Skip to content

update an environment variable inside a kubernetes manifest #1949

Answered by olblak
till asked this question in Q&A
Discussion options

You must be logged in to vote

@till Another approach would be to use the yaml plugin with the yamlpath engine.

sources:
  default:
    kind: shell
    spec:
      command: echo "r.example.com/app:v2.0.0"

targets:
  solution-1:
    name: 'bump ANOTHER_VARIABLE to {{ source "default" }}'
    kind: yaml
    spec:
      engine: yamlpath
      file: /tmp/deployment.yaml
      key: "$.spec.template.spec.containers[*].env[?(@.name == 'ANOTHER_VARIABLE')].value"
    transformers:
      - addprefix: '"'
      - addsuffix: '"'

  solution-2:
    name: 'bump ANOTHER_VARIABLE to {{ source "default" }}'
    kind: yaml
    disablesourceinput: true
    spec:
      engine: yamlpath
      file: /tmp/deployment.yaml
      key: "$.spec…

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
2 replies
@till
Comment options

@till
Comment options

Comment options

You must be logged in to vote
2 replies
@till
Comment options

@till
Comment options

Answer selected by till
Comment options

You must be logged in to vote
4 replies
@till
Comment options

@olblak
Comment options

@till
Comment options

@olblak
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants