@@ -33,7 +33,7 @@ func (f *cFactory) updatePodLabels() error {
3333 pod , err := getPodForHostname (f .client , f .namespace , f .getLabels (map [string ]string {}), ns .Name )
3434 if err != nil {
3535 glog .Errorf ("Failed to update pod labels: %s" , err )
36- return err
36+ continue
3737 }
3838
3939 labels := pod .GetLabels ()
@@ -48,7 +48,6 @@ func (f *cFactory) updatePodLabels() error {
4848 glog .V (2 ).Infof ("Inspecting pod: %s, label: %s, desired: %s" , pod .Name , val , desiredVal )
4949
5050 if ! exists || val != desiredVal {
51- labels ["role" ] = desiredVal
5251 glog .Infof ("Updating labels for Pod: %s" , pod .Name )
5352
5453 meta := metav1.ObjectMeta {
@@ -57,13 +56,19 @@ func (f *cFactory) updatePodLabels() error {
5756 OwnerReferences : pod .GetOwnerReferences (),
5857 Namespace : pod .GetNamespace (),
5958 }
59+
6060 _ , act , err := kcore .CreateOrPatchPod (f .client , meta ,
6161 func (in * core.Pod ) * core.Pod {
62- in .Labels = labels
62+ in .Labels [ "role" ] = desiredVal
6363 return in
6464 })
65+
66+ if err != nil {
67+ glog .Errorf ("Error while updating pod label: %s" , err )
68+ }
69+
6570 glog .Infof ("Pod %s was %s" , pod .Name , getStatusFromKVerb (act ))
66- return err
71+
6772 }
6873 }
6974
0 commit comments