@@ -26,12 +26,14 @@ import (
2626)
2727
2828// Set K8S labels indicating role pods: Master or Replica
29- func (f * cFactory ) updatePodLabels (masterHost string ) error {
29+ func (f * cFactory ) updatePodLabels () error {
30+ masterHost := f .getMasterHost ()
31+
3032 for _ , ns := range f .cluster .Status .Nodes {
3133 pod , err := getPodForHostname (f .client , f .namespace , f .getLabels (map [string ]string {}), ns .Name )
3234 if err != nil {
3335 glog .Errorf ("Failed to update pod labels: %s" , err )
34- continue
36+ return err
3537 }
3638
3739 labels := pod .GetLabels ()
@@ -43,6 +45,7 @@ func (f *cFactory) updatePodLabels(masterHost string) error {
4345 desiredVal = "master"
4446 }
4547
48+ glog .Infof ("Inspecting pod: %s, label: %s, desired: %s" , pod .Name , val , desiredVal )
4649 if ! exists || val != desiredVal {
4750 labels ["role" ] = desiredVal
4851 glog .Infof ("Updating labels for Pod: %s" , pod .Name )
@@ -53,11 +56,13 @@ func (f *cFactory) updatePodLabels(masterHost string) error {
5356 OwnerReferences : pod .GetOwnerReferences (),
5457 Namespace : pod .GetNamespace (),
5558 }
56- kcore .CreateOrPatchPod (f .client , meta ,
59+ _ , act , err := kcore .CreateOrPatchPod (f .client , meta ,
5760 func (in * core.Pod ) * core.Pod {
5861 in .Labels = labels
5962 return in
6063 })
64+ glog .Infof ("Pod %s was %s" , pod .Name , getStatusFromKVerb (act ))
65+ return err
6166 }
6267 }
6368
0 commit comments