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: Support loading parameter values from secrets. Fixes: #5506 #13899

Open
wants to merge 10 commits 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
4 changes: 4 additions & 0 deletions api/jsonschema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions api/openapi-spec/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/executor_swagger.md
Original file line number Diff line number Diff line change
Expand Up @@ -4049,6 +4049,7 @@ intent and helps make sure that UIDs and names do not get conflated.
| jsonPath | string| `string` | | | JSONPath of a resource to retrieve an output parameter value from in resource templates | |
| parameter | string| `string` | | | Parameter reference to a step or dag task in which to retrieve an output parameter value from</br>(e.g. '{{steps.mystep.outputs.myparam}}') | |
| path | string| `string` | | | Path in the container to retrieve an output parameter value from in container templates | |
| secretKeyRef | [SecretKeySelector](#secret-key-selector)| `SecretKeySelector` | | | | |
| supplied | [SuppliedValueFrom](#supplied-value-from)| `SuppliedValueFrom` | | | | |


Expand Down
69 changes: 69 additions & 0 deletions docs/fields.md

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions examples/arguments-parameters-from-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: arguments-parameters-from-secret-
labels:
workflows.argoproj.io/test: "true"
annotations:
workflows.argoproj.io/description: |
This example demonstrates loading parameter values from a Secret.
Note that the "simple-parameters" Secret (defined in `examples/secrets/simple-parameters-secret.yaml`) needs to be created first before submitting this workflow.
workflows.argoproj.io/verify.py: |
assert status["phase"] == "Succeeded"
spec:
entrypoint: print-message-from-secret

templates:
- name: print-message-from-secret
inputs:
parameters:
# Parameters can also be passed via secret reference.
- name: message
valueFrom:
secretKeyRef:
name: simple-parameters
key: msg
container:
image: busybox
command: ["echo"]
args: ["{{inputs.parameters.message}}"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: global-parameter-from-secret-referenced-as-local-variable-
labels:
workflows.argoproj.io/test: "true"
annotations:
workflows.argoproj.io/description: |
This example demonstrates how a global parameter from a Secret can be referenced as a template local variable.
Note that the "simple-parameters" Secret (defined in `examples/secrets/simple-parameters-secret.yaml`) needs to be created first before submitting this workflow.
spec:
entrypoint: print-message
arguments:
parameters:
- name: message
valueFrom:
secretKeyRef:
name: simple-parameters
key: msg
templates:
- name: print-message
inputs:
parameters:
- name: message
container:
image: busybox
command: ["echo"]
args: ["{{inputs.parameters.message}}"]
27 changes: 27 additions & 0 deletions examples/global-parameters-from-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: global-parameter-values-from-secret-
labels:
workflows.argoproj.io/test: "true"
annotations:
workflows.argoproj.io/description: |
This example demonstrates loading global parameter values from a Secret.
Note that the "simple-parameters" Secret (defined in `examples/secrets/simple-parameters-secret.yaml`) needs to be created first before submitting this workflow.
spec:
entrypoint: print-message
# Parameters can also be passed via secret reference.
arguments:
parameters:
- name: message
valueFrom:
secretKeyRef:
name: simple-parameters
key: msg

templates:
- name: print-message
container:
image: busybox
command: ["echo"]
args: ["{{workflow.parameters.message}}"]
10 changes: 10 additions & 0 deletions examples/secrets/simple-parameters-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
name: simple-parameters
labels:
# Note that this label is required for the informer to detect this Secret.
workflows.argoproj.io/secret-type: Parameter
data:
msg: "aGVsbG8gd29ybGQK"

2 changes: 1 addition & 1 deletion examples/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func TestValidateExamples(t *testing.T) {
failures, err := ValidateArgoYamlRecursively(".", []string{"testvolume.yaml", "simple-parameters-configmap.yaml", "memoize-simple.yaml"})
failures, err := ValidateArgoYamlRecursively(".", []string{"testvolume.yaml", "simple-parameters-configmap.yaml", "memoize-simple.yaml", "simple-parameters-secret.yaml"})
if err != nil {
t.Errorf("There was an error: %s", err)
}
Expand Down
2 changes: 2 additions & 0 deletions hack/test-examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ set -eu -o pipefail

# Load the configmaps that contains the parameter values used for certain examples.
kubectl apply -f examples/configmaps/simple-parameters-configmap.yaml
# Load the secrets that contains the parameter values used for certain examples.
kubectl apply -f examples/secrets/simple-parameters-secret.yaml

echo "Checking for banned images..."
grep -lR 'workflows.argoproj.io/test' examples/* | while read f ; do
Expand Down
130 changes: 130 additions & 0 deletions manifests/base/crds/full/argoproj.io_clusterworkflowtemplates.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading