Skip to content

Commit

Permalink
fix: Auto update workflow controller configmap (#10218)
Browse files Browse the repository at this point in the history
Signed-off-by: Saravanan Balasubramanian <[email protected]>
  • Loading branch information
sarabala1979 authored Dec 12, 2022
1 parent 7b34cb1 commit b0f0c58
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions config/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

type Controller interface {
Get(context.Context) (*Config, error)
GetName() string
}

type controller struct {
Expand Down Expand Up @@ -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
}
13 changes: 12 additions & 1 deletion workflow/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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()).
Expand All @@ -1083,6 +1093,7 @@ func (wfc *WorkflowController) newConfigMapInformer() cache.SharedIndexInformer
},
},
})

}
return indexInformer
}
Expand Down

0 comments on commit b0f0c58

Please sign in to comment.