mgr: skip updating service if there is no selector

When the mgr services are updated by the operator to set the
active mgr properly, skip services that do not currently
have a selector set.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
(cherry picked from commit b8dac76d18)
This commit is contained in:
Travis Nielsen authored and Mergify committed 2022-07-13 13:45:08 +00:00
1 parent 8743cb3ee9
commit 8aef0b770e
1 file changed
+3
+3
View File
@@ -307,6 +307,9 @@ func (c *Cluster) updateServiceSelectors(activeDaemon string) error {
return errors.Wrap(err, "failed to query mgr services to update")
}
for i, service := range services.Items {
if service.Spec.Selector == nil {
service.Spec.Selector = map[string]string{}
}
// Update the selector on the service to point to the active mgr
if service.Spec.Selector[controller.DaemonIDLabel] == activeDaemon {
logger.Infof("no need to update service %q", service.Name)