Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: instanceID support for argo server. Closes #2004 #2365

Merged
merged 14 commits into from
Mar 13, 2020

Conversation

whynowy
Copy link
Member

@whynowy whynowy commented Mar 5, 2020

Closes #2004

Make Argo server behaves the same as workflow controller:

  • Argo server only manages the workflows/CronWorkflows with the same instanceID (label xxxx/controller-instanceid), or wfs/cronWfs without instanceID, depends on if instanceID is configured in the ConfigMap.

  • argo cli without ARGO_SERVER ENV goes through kube api, argo list or argo cron list can see all the results. argo submit or argo cron create needs to give --instanceid=xxxx to create wf/cronWf targeting a specific controller.

  • argo cli with ARGO_SERVER ENV uses argo server, results of argo list and argo cron list might be different, depends on instanceID configuration in the ConfigMap. As a result, argo submit or argo cron create by default will include the instanceID in the labels if it's configured in the ConfigMap.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • I have written unit and/or e2e tests for my change. PRs without these are unlike to be merged.
  • Optional. I've added My organization is added to the README.
  • I've signed the CLA and required builds are green.

@whynowy whynowy changed the title feat: instanceID support for argo server. Closes #2004 feat: instanceID support for argo server. Closes #2004 [WIP] Mar 5, 2020
@codecov
Copy link

codecov bot commented Mar 5, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@1350882). Click here to learn what that means.
The diff coverage is 50.73%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2365   +/-   ##
=========================================
  Coverage          ?   13.26%           
=========================================
  Files             ?       71           
  Lines             ?    25230           
  Branches          ?        0           
=========================================
  Hits              ?     3346           
  Misses            ?    21450           
  Partials          ?      434
Impacted Files Coverage Δ
server/workflowarchive/archived_workflow_server.go 63.38% <ø> (ø)
workflow/controller/config_controller.go 14.72% <0%> (ø)
persist/sqldb/workflow_archive.go 0% <0%> (ø)
persist/sqldb/migrate.go 0% <0%> (ø)
server/cronworkflow/cron_workflow_server.go 54.28% <63.04%> (ø)
server/workflow/workflow_server.go 37.1% <64.51%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1350882...53a6cda. Read the comment docs.

server/workflow/workflow_server.go Outdated Show resolved Hide resolved
server/workflow/workflow_server.go Outdated Show resolved Hide resolved
server/workflow/workflow_server.go Outdated Show resolved Hide resolved
persist/sqldb/migrate.go Outdated Show resolved Hide resolved
@whynowy whynowy changed the title feat: instanceID support for argo server. Closes #2004 [WIP] feat: instanceID support for argo server. Closes #2004 Mar 6, 2020
@whynowy whynowy requested review from alexec and simster7 March 6, 2020 08:07
persist/sqldb/migrate.go Show resolved Hide resolved
server/workflow/workflow_server.go Outdated Show resolved Hide resolved
if err != nil {
return nil, err
}
return &cronworkflowpkg.CronWorkflowDeletedResponse{}, nil
}

func (c *cronWorkflowServiceServer) withInstanceID(opt metav1.ListOptions) metav1.ListOptions {
if c.mode == KubeClientMode {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should also work for kube client - should not need the guard condition

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed.

The expected behaviors for workflow list on GRPC server and kube-client are different.

  • On GRPC server, we expect it to list the workflows either no instanceID (instanceID == "") or instanceID is the same (intanceID != "").

  • When it's kube-client, we want argo list to list all the workflows without any instanceID related labelSelector, without this we can not achieve that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this. As much as possible, both clients should work in the same manner.

This would mean that the GRPC server should be the same as the kube-client.

Can you merge the labels together?

I think you're doing great work btw.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

argo server client works the same as GRPC server, but I don't think kube-client does.

A simple question, what is expected behavior for kube-client if there are multiple workflow controllers with different instanceid installed in one cluster? As a kube-client, you can not be the same as any of the argo servers, instead of being limited to a subset of the objects (intanceid lableselector), by default you should have the ability to see whatever you want to see.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think we want that. The kube-client is legacy code really, so we should not make extra effort to maintain any esoteric features. If you need to make a choice here, can you do whatever is simpler. I can even accept breaking changes to the kube-client.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the case, let's pick up the legacy client code, if later on we decide not to support it any more, we can easily dump it.

go.sum Outdated Show resolved Hide resolved
pkg/apiclient/argo-kube-cron-workflow-service-client.go Outdated Show resolved Hide resolved
@whynowy whynowy requested a review from alexec March 10, 2020 18:19
@whynowy
Copy link
Member Author

whynowy commented Mar 12, 2020

@alexec - could you review it again?

server/cronworkflow/cron_workflow_server.go Show resolved Hide resolved
server/cronworkflow/cron_workflow_server.go Show resolved Hide resolved
server/workflow/workflow_server.go Show resolved Hide resolved
server/workflow/workflow_server.go Outdated Show resolved Hide resolved
server/workflow/workflow_server_test.go Outdated Show resolved Hide resolved
persist/sqldb/migrate.go Outdated Show resolved Hide resolved
persist/sqldb/migrate.go Outdated Show resolved Hide resolved
persist/sqldb/migrate.go Outdated Show resolved Hide resolved
persist/sqldb/migrate.go Show resolved Hide resolved
Copy link
Contributor

@alexec alexec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff!

@whynowy whynowy merged commit e9a06dd into argoproj:master Mar 13, 2020
@whynowy whynowy deleted the instance_id branch March 13, 2020 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Argo server should support controller instance ids
3 participants