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

fix!: Only get executor plugins in workflow namespace. Fixes #12708 #12724

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions docs/executor_plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,7 @@ You'll see the workflow complete successfully.

### Discovery

When a workflow is run, plugins are loaded from:

* The workflow's namespace.
* The Argo installation namespace (typically `argo`).

If two plugins have the same name, only the one in the workflow's namespace is loaded.
When a workflow is run, plugins are only loaded from the workflow's namespace.

### Secrets

Expand Down
39 changes: 17 additions & 22 deletions workflow/controller/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,30 +271,25 @@ func (woc *wfOperationCtx) createAgentPod(ctx context.Context) (*apiv1.Pod, erro
func (woc *wfOperationCtx) getExecutorPlugins(ctx context.Context) ([]apiv1.Container, []apiv1.Volume, error) {
var sidecars []apiv1.Container
var volumes []apiv1.Volume
namespaces := map[string]bool{} // de-dupes executorPlugins when their namespaces are the same
namespaces[woc.controller.namespace] = true
namespaces[woc.wf.Namespace] = true
for namespace := range namespaces {
for _, plug := range woc.controller.executorPlugins[namespace] {
s := plug.Spec.Sidecar
c := s.Container.DeepCopy()
c.VolumeMounts = append(c.VolumeMounts, apiv1.VolumeMount{
Name: volumeMountVarArgo.Name,
MountPath: volumeMountVarArgo.MountPath,
ReadOnly: true,
// only mount the token for this plugin, not others
SubPath: c.Name,
})
if s.AutomountServiceAccountToken {
volume, volumeMount, err := woc.getServiceAccountTokenVolume(ctx, plug.Name+"-executor-plugin")
if err != nil {
return nil, nil, err
}
volumes = append(volumes, *volume)
c.VolumeMounts = append(c.VolumeMounts, *volumeMount)
for _, plug := range woc.controller.executorPlugins[woc.wf.Namespace] {
s := plug.Spec.Sidecar
c := s.Container.DeepCopy()
c.VolumeMounts = append(c.VolumeMounts, apiv1.VolumeMount{
Name: volumeMountVarArgo.Name,
MountPath: volumeMountVarArgo.MountPath,
ReadOnly: true,
// only mount the token for this plugin, not others
SubPath: c.Name,
})
if s.AutomountServiceAccountToken {
volume, volumeMount, err := woc.getServiceAccountTokenVolume(ctx, plug.Name+"-executor-plugin")
if err != nil {
return nil, nil, err
}
sidecars = append(sidecars, *c)
volumes = append(volumes, *volume)
c.VolumeMounts = append(c.VolumeMounts, *volumeMount)
}
sidecars = append(sidecars, *c)
}
return sidecars, volumes, nil
}
Expand Down
Loading