Skip to content

Commit

Permalink
ArtifactRepositoryRef ConfigMap is now taken from the workflow namespace
Browse files Browse the repository at this point in the history
Previously it was using the workflow controller's namespace.
  • Loading branch information
Ark-kun committed Jan 8, 2020
1 parent e4107bb commit 4cf6810
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions workflow/controller/config_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,16 @@ func ReadConfigMapValue(clientset kubernetes.Interface, namespace string, name s
return value, nil
}

func getArtifactRepositoryRef(wfc *WorkflowController, configMapName string, key string) (*config.ArtifactRepository, error) {
configStr, err := ReadConfigMapValue(wfc.kubeclientset, wfc.namespace, configMapName, key)
func getArtifactRepositoryRef(wfc *WorkflowController, configMapName string, key string, namespace string) (*config.ArtifactRepository, error) {
// Getting the ConfigMap from the workflow's namespace
configStr, err := ReadConfigMapValue(wfc.kubeclientset, namespace, configMapName, key)
if err != nil {
return nil, err
}
// Falling back to getting the ConfigMap from the controller's namespace
configStr, err = ReadConfigMapValue(wfc.kubeclientset, wfc.namespace, configMapName, key)
if err != nil {
return nil, err
}
}
var config config.ArtifactRepository
err = yaml.Unmarshal([]byte(configStr), &config)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (woc *wfOperationCtx) operate() {

if woc.wf.Spec.ArtifactRepositoryRef != nil {
repoReference := woc.wf.Spec.ArtifactRepositoryRef
repo, err := getArtifactRepositoryRef(woc.controller, repoReference.ConfigMap, repoReference.Key)
repo, err := getArtifactRepositoryRef(woc.controller, repoReference.ConfigMap, repoReference.Key, woc.wf.ObjectMeta.Namespace)
if err == nil {
woc.artifactRepository = repo
} else {
Expand Down

0 comments on commit 4cf6810

Please sign in to comment.