Skip to content

Commit

Permalink
Fix workflow template in namespaced controller (#1580)
Browse files Browse the repository at this point in the history
* Add workflow template permissions to namespaced deployment manifests

* Use filtered shared informer factory for namespaced deployment
  • Loading branch information
dtaniwaki authored and sarabala1979 committed Sep 5, 2019
1 parent cd04ab8 commit 89e959e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
9 changes: 9 additions & 0 deletions manifests/namespace-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ rules:
- update
- patch
- delete
- apiGroups:
- argoproj.io
resources:
- workflowtemplates
- workflowtemplates/finalizers
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ rules:
- update
- patch
- delete
- apiGroups:
- argoproj.io
resources:
- workflowtemplates
- workflowtemplates/finalizers
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down
14 changes: 11 additions & 3 deletions workflow/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ func (wfc *WorkflowController) Run(ctx context.Context, wfWorkers, podWorkers in
}

wfc.wfInformer = util.NewWorkflowInformer(wfc.restConfig, wfc.Config.Namespace, workflowResyncPeriod, wfc.tweakWorkflowlist)

informerFactory := wfextv.NewSharedInformerFactory(wfc.wfclientset, workflowTemplateResyncPeriod)
wfc.wftmplInformer = informerFactory.Argoproj().V1alpha1().WorkflowTemplates()
wfc.wftmplInformer = wfc.newWorkflowTemplateInformer()

wfc.addWorkflowInformerHandler()
wfc.podInformer = wfc.newPodInformer()
Expand Down Expand Up @@ -508,6 +506,16 @@ func (wfc *WorkflowController) newPodInformer() cache.SharedIndexInformer {
return informer
}

func (wfc *WorkflowController) newWorkflowTemplateInformer() wfextvv1alpha1.WorkflowTemplateInformer {
var informerFactory wfextv.SharedInformerFactory
if wfc.Config.Namespace != "" {
informerFactory = wfextv.NewFilteredSharedInformerFactory(wfc.wfclientset, workflowTemplateResyncPeriod, wfc.Config.Namespace, func(opts *metav1.ListOptions) {})
} else {
informerFactory = wfextv.NewSharedInformerFactory(wfc.wfclientset, workflowTemplateResyncPeriod)
}
return informerFactory.Argoproj().V1alpha1().WorkflowTemplates()
}

func (wfc *WorkflowController) createPersistenceContext() (*sqldb.WorkflowDBContext, error) {

var wfDBCtx sqldb.WorkflowDBContext
Expand Down

0 comments on commit 89e959e

Please sign in to comment.