Skip to content

Commit e75f70d

Browse files
authored
fix: refactor argoKubeClient to start argo server when creating workflowServiceClient (#14401)
Signed-off-by: Jakub Buczak <[email protected]>
1 parent 9b73126 commit e75f70d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/apiclient/argo-kube-client.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type argoKubeClient struct {
5858
cwfTmplStore types.ClusterWorkflowTemplateStore
5959
wfLister store.WorkflowLister
6060
wfStore store.WorkflowStore
61+
namespace string
6162
}
6263

6364
var _ Client = &argoKubeClient{}
@@ -108,18 +109,19 @@ func newArgoKubeClient(ctx context.Context, opts ArgoKubeOpts, clientConfig clie
108109
opts: opts,
109110
instanceIDService: instanceIDService,
110111
wfClient: wfClient,
112+
namespace: namespace,
111113
}
112-
err = client.startStores(restConfig, namespace)
114+
err = client.startStores(restConfig)
113115
if err != nil {
114116
return nil, nil, err
115117
}
116118

117119
return ctx, client, nil
118120
}
119121

120-
func (a *argoKubeClient) startStores(restConfig *restclient.Config, namespace string) error {
122+
func (a *argoKubeClient) startStores(restConfig *restclient.Config) error {
121123
if a.opts.UseCaching {
122-
wftmplInformer, err := workflowtemplateserver.NewInformer(restConfig, namespace)
124+
wftmplInformer, err := workflowtemplateserver.NewInformer(restConfig, a.namespace)
123125
if err != nil {
124126
return err
125127
}
@@ -147,7 +149,9 @@ func (a *argoKubeClient) startStores(restConfig *restclient.Config, namespace st
147149

148150
func (a *argoKubeClient) NewWorkflowServiceClient() workflowpkg.WorkflowServiceClient {
149151
wfArchive := sqldb.NullWorkflowArchive
150-
return &errorTranslatingWorkflowServiceClient{&argoKubeWorkflowServiceClient{workflowserver.NewWorkflowServer(a.instanceIDService, argoKubeOffloadNodeStatusRepo, wfArchive, a.wfClient, a.wfLister, a.wfStore, a.wfTmplStore, a.cwfTmplStore, nil, nil)}}
152+
wfServer := workflowserver.NewWorkflowServer(a.instanceIDService, argoKubeOffloadNodeStatusRepo, wfArchive, a.wfClient, a.wfLister, a.wfStore, a.wfTmplStore, a.cwfTmplStore, nil, &a.namespace)
153+
go wfServer.Run(a.opts.CachingCloseCh)
154+
return &errorTranslatingWorkflowServiceClient{&argoKubeWorkflowServiceClient{wfServer}}
151155
}
152156

153157
func (a *argoKubeClient) NewCronWorkflowServiceClient() (cronworkflow.CronWorkflowServiceClient, error) {

0 commit comments

Comments
 (0)