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 12 commits into
base: main
Choose a base branch
from

Conversation

shuangkun
Copy link
Member

@shuangkun shuangkun commented Nov 14, 2024

Fixes #5506 Reference: #11446

Unsolved issues:

Hide secret value in argo template, log, UI

Motivation

Modifications

Verification

Loccal Test and UT

@shuangkun shuangkun force-pushed the parameter/secret branch 2 times, most recently from c9383cb to 5d65f3c Compare November 14, 2024 13:47
@shuangkun shuangkun added the area/spec Changes to the workflow specification. label Nov 20, 2024
@shuangkun shuangkun added the type/security Security related label Dec 19, 2024
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.

Can you paste some example outputs and screenshots?

@shuangkun shuangkun requested a review from Joibel as a code owner January 5, 2025 04:23
shuangkun and others added 10 commits January 5, 2025 13:06
Signed-off-by: shuangkun <[email protected]>
Signed-off-by: shuangkun <[email protected]>
Co-authored-by: shuangkun <[email protected]>
Co-authored-by: Jinsu Park <[email protected]>
Signed-off-by: shuangkun <[email protected]>
Signed-off-by: shuangkun <[email protected]>
Signed-off-by: shuangkun <[email protected]>
Signed-off-by: shuangkun <[email protected]>
Signed-off-by: shuangkun <[email protected]>
Signed-off-by: shuangkun <[email protected]>
@shuangkun shuangkun force-pushed the parameter/secret branch 2 times, most recently from 2496146 to 95d1338 Compare January 5, 2025 05:28
Signed-off-by: shuangkun <[email protected]>
Signed-off-by: shuangkun <[email protected]>
@shuangkun
Copy link
Member Author

Can you paste some example outputs and screenshots?

Sure.

  1. deploy a secret
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"
opensource % echo "aGVsbG8gd29ybGQK" | base64 -d
hello world
  1. Then we can submit a workflow to reference this secret use new cli.
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}}"]
tianshuangkun@U-4YKHFNR6-2229 opensource % /Users/tianshuangkun/go/src/github.com/argoproj/argo-workflows/dist/argo submit test.yaml
Name:                global-parameter-values-from-secret-68jb8
Namespace:           argo
ServiceAccount:      unset (will run with the default ServiceAccount)
Status:              Pending
Created:             Sun Jan 05 12:31:10 +0800 (now)
Progress:
Parameters:
  1. View the results and successfully reference the secret
tianshuangkun@U-4YKHFNR6-2229 opensource % /Users/tianshuangkun/go/src/github.com/argoproj/argo-workflows/dist/argo get @latest
Name:                global-parameter-values-from-secret-rtfml
Namespace:           argo
ServiceAccount:      unset (will run with the default ServiceAccount)
Status:              Succeeded
Conditions:
 PodRunning          False
 Completed           True
Created:             Sun Jan 05 12:33:22 +0800 (26 seconds ago)
Started:             Sun Jan 05 12:33:22 +0800 (26 seconds ago)
Finished:            Sun Jan 05 12:33:30 +0800 (18 seconds ago)
Duration:            8 seconds
Progress:            1/1
ResourcesDuration:   2s*(100Mi memory),0s*(1 cpu)
Parameters:

STEP                                          TEMPLATE       PODNAME                                    DURATION  MESSAGE
 ✔ global-parameter-values-from-secret-rtfml  print-message  global-parameter-values-from-secret-rtfml  5s
tianshuangkun@U-4YKHFNR6-2229 opensource % /Users/tianshuangkun/go/src/github.com/argoproj/argo-workflows/dist/argo logs @latest
global-parameter-values-from-secret-rtfml: time="2025-01-05T04:33:26.162Z" level=info msg="capturing logs" argo=true
global-parameter-values-from-secret-rtfml: time="2025-01-05T04:33:26.163Z" level=debug msg="ignore signal child exited" argo=true
global-parameter-values-from-secret-rtfml: hello world
global-parameter-values-from-secret-rtfml:
global-parameter-values-from-secret-rtfml: time="2025-01-05T04:33:26.171Z" level=debug msg="ignore signal child exited" argo=true
global-parameter-values-from-secret-rtfml: time="2025-01-05T04:33:27.164Z" level=info msg="sub-process exited" argo=true error="<nil>"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/spec Changes to the workflow specification. type/security Security related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing k8s secret to a workflow as input
2 participants