diff --git a/config/controller.go b/config/controller.go index 66b916e55c73..7e0e07302697 100644 --- a/config/controller.go +++ b/config/controller.go @@ -13,6 +13,7 @@ import ( type Controller interface { Get(context.Context) (*Config, error) + GetName() string } type controller struct { @@ -60,3 +61,7 @@ func (cc *controller) Get(ctx context.Context) (*Config, error) { } return config, parseConfigMap(cm, config) } + +func (cc *controller) GetName() string { + return cc.configMap +} diff --git a/workflow/controller/controller.go b/workflow/controller/controller.go index 0158b5751bfb..f24d99eec51f 100644 --- a/workflow/controller/controller.go +++ b/workflow/controller/controller.go @@ -402,8 +402,17 @@ func (wfc *WorkflowController) runConfigMapWatcher(stopCh <-chan struct{}) { continue } log.Debugf("received config map %s/%s update", cm.Namespace, cm.Name) + if cm.GetName() == wfc.configController.GetName() && wfc.namespace == cm.GetNamespace() { + log.Infof("Received Workflow Controller config map %s/%s update", cm.Namespace, cm.Name) + err := wfc.updateConfig() + if err != nil { + log.Errorf("Failed update the Workflow Controller config map. error: %v", err) + continue + } + log.Infof("Successfully Workflow Controller config map %s/%s updated", cm.Namespace, cm.Name) + continue + } wfc.notifySemaphoreConfigUpdate(cm) - case <-stopCh: return } @@ -1070,6 +1079,7 @@ func (wfc *WorkflowController) newConfigMapInformer() cache.SharedIndexInformer Error("failed to convert configmap to plugin") return } + wfc.executorPlugins[cm.GetNamespace()][cm.GetName()] = p log.WithField("namespace", cm.GetNamespace()). WithField("name", cm.GetName()). @@ -1083,6 +1093,7 @@ func (wfc *WorkflowController) newConfigMapInformer() cache.SharedIndexInformer }, }, }) + } return indexInformer }