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(controller): Use different container runtime executors for each workflow. Close #4254 #4998

Merged
merged 8 commits into from Feb 19, 2021

Conversation

alexec
Copy link
Contributor

@alexec alexec commented Feb 2, 2021

Adds containerRuntimeExecutors to workflow-controller-configmap so you can select the executor you want to use.

This is controlled by the operation - users cannot change this setting.

The operator can allow 1 or more executors.

Typically I'd expect this to be used for:

  • Trying out k8sapi or emissary executors.
  • Trying out any executor prior to switching the default.
  • Running some workflows more or less securely.
  containerRuntimeExecutor: docker
  containerRuntimeExecutors: |
    - name: k8sapi
      selector:
        matchLabels:
          workflows.argoproj.io/container-runtime-executor: k8sapi

…workflow.

Signed-off-by: Alex Collins <alex_collins@intuit.com>
Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

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

This is great to have. We were thinking about something similar along the line as well but distributing based on percentage of the total number of workflows.

config/config.go Outdated
func (c Config) GetContainerRuntimeExecutor(labels labels.Labels) (string, error) {
name, err := c.ContainerRuntimeExecutors.Select(labels)
if name != "" {
return name, err
Copy link
Member

Choose a reason for hiding this comment

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

Looks like err is always nil in this case so return name, nil would be more readable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know it is odd looking, but I think it is correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is because it can return "", nil - i.e. it did not find a CRE, but there was not an error

@alexec alexec marked this pull request as ready for review February 2, 2021 20:26
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
@alexec alexec linked an issue Feb 3, 2021 that may be closed by this pull request
@alexec alexec changed the title feat(controller): Use different container runtime executors for each workflow feat(controller): Use different container runtime executors for each workflow. Close #4254 Feb 3, 2021
@alexec
Copy link
Contributor Author

alexec commented Feb 11, 2021

@sarabala1979 can I request your review as I think @jessesuen is busy

@alexec alexec closed this Feb 12, 2021
@alexec alexec deleted the choose-executor branch February 12, 2021 22:56
@alexec alexec restored the choose-executor branch February 17, 2021 00:42
@alexec alexec reopened this Feb 17, 2021
@alexec
Copy link
Contributor Author

alexec commented Feb 17, 2021

@sarabala1979 I accidentally closed this. Can you please review/approve?

@@ -99,6 +101,14 @@ type Config struct {
InitialDelay metav1.Duration `json:"initialDelay,omitempty"`
}

func (c Config) GetContainerRuntimeExecutor(labels labels.Labels) (string, error) {
name, err := c.ContainerRuntimeExecutors.Select(labels)
if name != "" {
Copy link
Member

Choose a reason for hiding this comment

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

can we log the error if it is not nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to re-write this confusing code to make it clearer and less "clever"

}

type ContainerRuntimeExecutor struct {
Name string `json:"name"`
Copy link
Member

Choose a reason for hiding this comment

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

the Name is kind of confusing. It should be executor or executorName or executorType

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that "type" and "name" are synonymous. I.e. there is only one executor of type "pns", it is the "pns" executor.

I'm not sure about the correct term here, but I'd like to leave this called "name" unless you feel strongly?

@sarabala1979
Copy link
Member

I think in the future we can have defaultExecuter under ContainerRuntimeExecutors and deprecate ContainerRuntimeExecutor

@alexec
Copy link
Contributor Author

alexec commented Feb 19, 2021

I think in the future we can have defaultExecuter under ContainerRuntimeExecutors and deprecate ContainerRuntimeExecutor

I don't think I should make this change. I'd have to write additional code and deal with what happens when they're both defined, but this does not add any new capabilities but does force migration on our users at some point.

Copy link
Member

@sarabala1979 sarabala1979 left a comment

Choose a reason for hiding this comment

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

Above comments minor

Signed-off-by: Alex Collins <alex_collins@intuit.com>
…workflow.

Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: Alex Collins <alex_collins@intuit.com>
@@ -0,0 +1,35 @@
apiVersion: argoproj.io/v1alpha1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sarabala1979 @simster7 this is a fully-filled out example with a test, description, and version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

…workflow.

Signed-off-by: Alex Collins <alex_collins@intuit.com>
…workflow.

Signed-off-by: Alex Collins <alex_collins@intuit.com>
@alexec alexec merged commit 687479f into argoproj:master Feb 19, 2021
@alexec alexec deleted the choose-executor branch February 19, 2021 18:48
@simster7 simster7 mentioned this pull request Feb 23, 2021
34 tasks
@simster7 simster7 mentioned this pull request Mar 8, 2021
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.

Per workflow container runtime executor setting
4 participants