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

chore!: remove legacy patch pods fallback #13100

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d137e77
chore!: remove legacy `patch` `pods` fallback
agilgur5 Apr 24, 2024
ae066c7
fix: WIP test fixes.
Garett-MacGowan May 27, 2024
c1c3481
test: test fixes
Garett-MacGowan Jun 7, 2024
e1ec574
test: test fixes
Garett-MacGowan Jun 8, 2024
80fcc9a
test: test fixes
Garett-MacGowan Jun 8, 2024
fa9fc8e
test: test fixes
Garett-MacGowan Jun 8, 2024
f996a75
test: test fixes
Garett-MacGowan Jun 8, 2024
3b2d66e
test: test fixes
Garett-MacGowan Jun 8, 2024
2cf3d6c
test: test fixes
Garett-MacGowan Jun 8, 2024
eebacf7
test: test fixes
Garett-MacGowan Jun 8, 2024
dcd5503
test: test fixes
Garett-MacGowan Jun 9, 2024
3274435
test: test fixes
Garett-MacGowan Jun 9, 2024
23f781b
test: test fixes
Garett-MacGowan Jun 9, 2024
15c840c
test: test fixes
Garett-MacGowan Jun 9, 2024
c10ec1a
test: test fixes
Garett-MacGowan Jun 9, 2024
d36a085
test: test fixes
Garett-MacGowan Jun 9, 2024
5a075ca
test: test fixes
Garett-MacGowan Jun 9, 2024
2fb2bd4
test: test fixes
Garett-MacGowan Jun 9, 2024
378ae92
test: test fixes
Garett-MacGowan Jun 10, 2024
5432fbb
test: test fixes
Garett-MacGowan Jun 10, 2024
681b0be
test: test fixes.
Garett-MacGowan Jun 12, 2024
e04935d
test: test fixes.
Garett-MacGowan Jun 13, 2024
db334cb
test: test fixes.
Garett-MacGowan Jun 13, 2024
f592ea4
test: test fixes.
Garett-MacGowan Jun 13, 2024
1cb41da
test: test fixes.
Garett-MacGowan Jun 13, 2024
d59b972
test: test fixes.
Garett-MacGowan Jun 13, 2024
f881fc2
test: test fixes.
Garett-MacGowan Jun 13, 2024
05618df
test: test fixes.
Garett-MacGowan Jun 13, 2024
9c7e2f6
test: test fixes.
Garett-MacGowan Jun 14, 2024
49cb84b
docs: Add note to v3.6 upgrade docs regarding required RBAC.
Garett-MacGowan Jun 27, 2024
ac3d68f
fix: Add AnnotationKeyProgress to support N/M initial node progress. …
Garett-MacGowan Sep 9, 2024
c8b06b7
fix: Fix rebase regressions. fixes #13100
Garett-MacGowan Sep 9, 2024
b4b95a8
test: fix TestLoggedProgress. fixes #13100
Garett-MacGowan Sep 9, 2024
c92fe1e
Update workflow/controller/controller_test.go
Garett-MacGowan Sep 13, 2024
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
4 changes: 4 additions & 0 deletions docs/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Previously it was `--basehref` (no dash in between) and `ARGO_BASEHREF` (no unde
`ALLOWED_LINK_PROTOCOL` and `BASE_HREF` have been removed as redundant.
Use `ARGO_ALLOWED_LINK_PROTOCOL` and `ARGO_BASE_HREF` instead.

### Legacy insecure pod patch fallback removed. ([#13100](https://github.com/argoproj/argo-workflows/pull/13100))

For the Emissary executor to work properly, you must set up RBAC. See [workflow RBAC](workflow-rbac.md)

### Metrics changes

You can now retrieve metrics using the OpenTelemetry Protocol using the [OpenTelemetry collector](https://opentelemetry.io/docs/collector/), and this is the recommended mechanism.
Expand Down
2 changes: 0 additions & 2 deletions docs/workflow-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ kind: WorkflowTemplate
metadata:
name: hello-world-template-global-arg
spec:
serviceAccountName: argo
templates:
- name: hello-world
container:
Expand All @@ -151,7 +150,6 @@ kind: Workflow
metadata:
generateName: hello-world-wf-global-arg-
spec:
serviceAccountName: argo
entrypoint: print-message
arguments:
parameters:
Expand Down
1 change: 0 additions & 1 deletion examples/arguments-parameters-from-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ metadata:
workflows.argoproj.io/verify.py: |
assert status["phase"] == "Succeeded"
spec:
serviceAccountName: argo
entrypoint: print-message-from-configmap

templates:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ metadata:
This example demonstrates how a global parameter from a ConfigMap can be referenced as a template local variable.
Note that the "simple-parameters" ConfigMap (defined in `examples/configmaps/simple-parameters-configmap.yaml`) needs to be created first before submitting this workflow.
spec:
serviceAccountName: argo
entrypoint: print-message
arguments:
parameters:
Expand Down
1 change: 0 additions & 1 deletion examples/global-parameters-from-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ metadata:
This example demonstrates loading global parameter values from a ConfigMap.
Note that the "simple-parameters" ConfigMap (defined in `examples/configmaps/simple-parameters-configmap.yaml`) needs to be created first before submitting this workflow.
spec:
serviceAccountName: argo
entrypoint: print-message
# Parameters can also be passed via configmap reference.
arguments:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ roleRef:
kind: Role
name: argo-role
subjects:
- kind: ServiceAccount
name: argo
- kind: ServiceAccount
name: argo

11 changes: 0 additions & 11 deletions manifests/quick-start/base/workflow-default-rolebinding.yaml

This file was deleted.

1 change: 1 addition & 0 deletions test/e2e/manifests/minimal/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ resources:
- ../mixins/argo-workflows-agent-ca-certificates.yaml
- ../mixins/argo-server.service-account-token-secret.yaml
- ../mixins/argo.service-account-token-secret.yaml
- ../mixins/get-cm-rbac.yaml

patches:
- path: ../mixins/argo-server-deployment.yaml
Expand Down
49 changes: 49 additions & 0 deletions test/e2e/manifests/mixins/get-cm-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: get-cm
---
apiVersion: v1
kind: Secret
metadata:
name: get-cm.service-account-token
annotations:
kubernetes.io/service-account.name: get-cm
type: kubernetes.io/service-account-token
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: get-cm
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: get-cm-get-cm
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: get-cm
subjects:
- kind: ServiceAccount
name: get-cm
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: executor-get-cm
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: executor
subjects:
- kind: ServiceAccount
name: get-cm
6 changes: 0 additions & 6 deletions test/e2e/resource_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,9 @@ kind: Workflow
metadata:
generateName: k8s-resource-tmpl-with-pod-
spec:
serviceAccount: argo
entrypoint: main
templates:
- name: main
serviceAccountName: argo
resource:
action: create
setOwnerReference: true
Expand All @@ -80,7 +78,6 @@ spec:
metadata:
generateName: k8s-pod-resource-
spec:
serviceAccountName: argo
containers:
- name: argosay-container
image: argoproj/argosay:v2
Expand All @@ -104,11 +101,9 @@ kind: Workflow
metadata:
generateName: k8s-resource-tmpl-with-artifact-
spec:
serviceAccount: argo
entrypoint: main
templates:
- name: main
serviceAccountName: argo
inputs:
artifacts:
- name: manifest
Expand All @@ -120,7 +115,6 @@ spec:
metadata:
generateName: k8s-pod-resource-
spec:
serviceAccountName: argo
containers:
- name: argosay-container
image: argoproj/argosay:v2
Expand Down
1 change: 0 additions & 1 deletion test/e2e/workflow_configmap_substitution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ metadata:
label:
workflows.argoproj.io/test: "true"
spec:
serviceAccountName: argo
entrypoint: whalesay
arguments:
parameters:
Expand Down
4 changes: 0 additions & 4 deletions test/e2e/workflow_inputs_orverridable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ metadata:
label:
workflows.argoproj.io/test: "true"
spec:
serviceAccountName: argo
entrypoint: whalesay
arguments:
parameters:
Expand Down Expand Up @@ -73,7 +72,6 @@ metadata:
label:
workflows.argoproj.io/test: "true"
spec:
serviceAccountName: argo
entrypoint: whalesay
arguments:
parameters:
Expand Down Expand Up @@ -127,7 +125,6 @@ metadata:
label:
workflows.argoproj.io/test: "true"
spec:
serviceAccountName: argo
entrypoint: whalesay
arguments:
parameters:
Expand Down Expand Up @@ -164,7 +161,6 @@ metadata:
label:
workflows.argoproj.io/test: "true"
spec:
serviceAccountName: argo
entrypoint: whalesay
arguments:
parameters:
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
serviceAccountName: argo
automountServiceAccountToken: false
executor:
serviceAccountName: argo
serviceAccountName: get-cm
entrypoint: main
templates:
- name: main
Expand Down Expand Up @@ -67,7 +67,7 @@ spec:
serviceAccountName: argo
automountServiceAccountToken: false
executor:
serviceAccountName: argo
serviceAccountName: get-cm
entrypoint: main
templates:
- name: main
Expand Down
6 changes: 0 additions & 6 deletions workflow/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ const (
AnnotationKeyRBACRule = workflow.WorkflowFullName + "/rbac-rule"
AnnotationKeyRBACRulePrecedence = workflow.WorkflowFullName + "/rbac-rule-precedence"

// AnnotationKeyOutputs is the pod metadata annotation key containing the container outputs
AnnotationKeyOutputs = workflow.WorkflowFullName + "/outputs"
// AnnotationKeyCronWfScheduledTime is the workflow metadata annotation key containing the time when the workflow
// was scheduled to run by CronWorkflow.
AnnotationKeyCronWfScheduledTime = workflow.WorkflowFullName + "/scheduled-time"
Expand All @@ -51,10 +49,6 @@ const (
// AnnotationKeyProgress is N/M progress for the node
AnnotationKeyProgress = workflow.WorkflowFullName + "/progress"

// AnnotationKeyReportOutputsCompleted is an annotation on a workflow pod indicating outputs have completed.
// Only used as a backup in case LabelKeyReportOutputsCompleted can't be added to WorkflowTaskResult.
AnnotationKeyReportOutputsCompleted = workflow.WorkflowFullName + "/report-outputs-completed"

// AnnotationKeyArtifactGCStrategy is listed as an annotation on the Artifact GC Pod to identify
// the strategy whose artifacts are being deleted
AnnotationKeyArtifactGCStrategy = workflow.WorkflowFullName + "/artifact-gc-strategy"
Expand Down
47 changes: 33 additions & 14 deletions workflow/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (

"github.com/argoproj/argo-workflows/v3/config"
"github.com/argoproj/argo-workflows/v3/persist/sqldb"
"github.com/argoproj/argo-workflows/v3/pkg/apis/workflow"
wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
fakewfclientset "github.com/argoproj/argo-workflows/v3/pkg/client/clientset/versioned/fake"
"github.com/argoproj/argo-workflows/v3/pkg/client/clientset/versioned/scheme"
Expand Down Expand Up @@ -447,20 +448,42 @@ func listPods(woc *wfOperationCtx) (*apiv1.PodList, error) {
return woc.controller.kubeclientset.CoreV1().Pods(woc.wf.Namespace).List(context.Background(), metav1.ListOptions{})
}

type with func(pod *apiv1.Pod)
type with func(pod *apiv1.Pod, woc *wfOperationCtx)

func withOutputs(v interface{}) with {
switch x := v.(type) {
case string:
return withAnnotation(common.AnnotationKeyOutputs, x)
default:
return withOutputs(wfv1.MustMarshallJSON(x))
func withOutputs(outputs wfv1.Outputs) with {
return func(pod *apiv1.Pod, woc *wfOperationCtx) {
nodeId := woc.nodeID(pod)
taskResult := &wfv1.WorkflowTaskResult{
TypeMeta: metav1.TypeMeta{
APIVersion: workflow.APIVersion,
Kind: workflow.WorkflowTaskResultKind,
},
ObjectMeta: metav1.ObjectMeta{
Name: nodeId,
Labels: map[string]string{
common.LabelKeyWorkflow: woc.wf.Name,
common.LabelKeyReportOutputsCompleted: "true",
},
},
NodeResult: wfv1.NodeResult{
Phase: wfv1.NodeSucceeded,
Outputs: &outputs,
},
}
_, err := woc.controller.wfclientset.ArgoprojV1alpha1().WorkflowTaskResults(woc.wf.Namespace).
Create(
context.Background(),
taskResult,
metav1.CreateOptions{},
)
if err != nil {
panic(err)
}
}
}
func withProgress(v string) with { return withAnnotation(common.AnnotationKeyProgress, v) }
Copy link
Member

Choose a reason for hiding this comment

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

as in this line


func withExitCode(v int32) with {
return func(pod *apiv1.Pod) {
return func(pod *apiv1.Pod, _ *wfOperationCtx) {
for _, c := range pod.Spec.Containers {
pod.Status.ContainerStatuses = append(pod.Status.ContainerStatuses, apiv1.ContainerStatus{
Name: c.Name,
Expand All @@ -474,10 +497,6 @@ func withExitCode(v int32) with {
}
}

func withAnnotation(key, val string) with {
return func(pod *apiv1.Pod) { pod.Annotations[key] = val }
}

// createRunningPods creates the pods that are marked as running in a given test so that they can be accessed by the
// pod assessor
func createRunningPods(ctx context.Context, woc *wfOperationCtx) {
Expand Down Expand Up @@ -532,7 +551,7 @@ func makePodsPhase(ctx context.Context, woc *wfOperationCtx, phase apiv1.PodPhas
pod.Status.Message = "Pod failed"
}
for _, w := range with {
w(&pod)
w(&pod, woc)
}
updatedPod, err := podcs.Update(ctx, &pod, metav1.UpdateOptions{})
if err != nil {
Expand Down
5 changes: 2 additions & 3 deletions workflow/controller/exit_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/stretchr/testify/require"
apiv1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"

wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
)
Expand Down Expand Up @@ -357,7 +356,7 @@ func TestStepsTmplOnExit(t *testing.T) {
woc := newWorkflowOperationCtx(wf, controller)
woc.operate(ctx)
assert.Equal(t, wfv1.WorkflowRunning, woc.wf.Status.Phase)
makePodsPhase(ctx, woc, apiv1.PodSucceeded, withOutputs(wfv1.Outputs{Result: pointer.String("ok"), Parameters: []wfv1.Parameter{{}}}))
makePodsPhase(ctx, woc, apiv1.PodSucceeded)
woc1 := newWorkflowOperationCtx(woc.wf, controller)
woc1.operate(ctx)
assert.Equal(t, wfv1.WorkflowRunning, woc1.wf.Status.Phase)
Expand Down Expand Up @@ -462,7 +461,7 @@ func TestDAGOnExit(t *testing.T) {
woc := newWorkflowOperationCtx(wf, controller)
woc.operate(ctx)
assert.Equal(t, wfv1.WorkflowRunning, woc.wf.Status.Phase)
makePodsPhase(ctx, woc, apiv1.PodSucceeded, withOutputs(wfv1.Outputs{Parameters: []wfv1.Parameter{{}}}))
makePodsPhase(ctx, woc, apiv1.PodSucceeded)
woc1 := newWorkflowOperationCtx(woc.wf, controller)
woc1.operate(ctx)
assert.Equal(t, wfv1.WorkflowRunning, woc1.wf.Status.Phase)
Expand Down
29 changes: 0 additions & 29 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1427,35 +1427,6 @@ func (woc *wfOperationCtx) assessNodeStatus(ctx context.Context, pod *apiv1.Pod,
new.PodIP = pod.Status.PodIP
}

// If `AnnotationKeyReportOutputsCompleted` is set, it means RBAC prevented WorkflowTaskResult from being written.
if x, ok := pod.Annotations[common.AnnotationKeyReportOutputsCompleted]; ok {
woc.log.Warn("workflow uses legacy/insecure pod patch, see https://argo-workflows.readthedocs.io/en/latest/workflow-rbac/")
resultName := woc.nodeID(pod)
if x == "true" {
woc.wf.Status.MarkTaskResultComplete(resultName)
} else {
woc.wf.Status.MarkTaskResultIncomplete(resultName)
}

// Get node outputs from pod annotations instead if RBAC prevented WorkflowTaskResult from being written.
if x, ok = pod.Annotations[common.AnnotationKeyOutputs]; ok {
if new.Outputs == nil {
new.Outputs = &wfv1.Outputs{}
}
if err := json.Unmarshal([]byte(x), new.Outputs); err != nil {
new.Phase = wfv1.NodeError
new.Message = err.Error()
}
}

// Get node progress from pod annotations instead if RBAC prevented WorkflowTaskResult from being written.
if x, ok = pod.Annotations[common.AnnotationKeyProgress]; ok {
if p, ok := wfv1.ParseProgress(x); ok {
new.Progress = p
}
}
}

new.HostNodeName = pod.Spec.NodeName

if !new.Progress.IsValid() {
Expand Down
2 changes: 1 addition & 1 deletion workflow/controller/operator_concurrency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ spec:
assert.True(t, job1AcquiredLock)

// Make job-1's pod succeed
makePodsPhase(ctx, woc, apiv1.PodSucceeded, func(pod *apiv1.Pod) {
makePodsPhase(ctx, woc, apiv1.PodSucceeded, func(pod *apiv1.Pod, _ *wfOperationCtx) {
if pod.ObjectMeta.Name == "job-1" {
pod.Status.Phase = apiv1.PodSucceeded
}
Expand Down
Loading
Loading