Raj
Raj

Reputation: 389

Escape & in Yaml

I've been trying several options to escape & in a kubernetes deployment manifest ( "command": ["sh","-c","nohup /bin/ecr-token-refresh \&;sleep 10; exit 0"] with no luck yet.

  pod.beta.kubernetes.io/init-containers: '[
       {
        "name": "token-refresh-prestart",
        "image": "{{ .Values.images.ecrrefresh }}",
        "command": ["sh","-c","nohup /bin/ecr-refresh-token \&;sleep10; exit 0"] ,
        "volumeMounts": [
                    {
                        "name": "prod-b-spin-refresh-config",
                        "mountPath": "/opt/config/ecr-token-refresh",
                        "readOnly": false
                    },
                    {
                        "name": "password-volume",
                        "mountPath": "/opt/passwords",
                        "readOnly": false
                    }
                ]
       }
    ]'

Upvotes: 0

Views: 1830

Answers (2)

Raj
Raj

Reputation: 389

The equivalent is

nohup /bin/ecr-refresh-token \\\u0026 

But the problem is that there is no way to run the process in the background as part of the manifest. You can do that if you manually kc exec into the pod

Upvotes: 0

sfgroups
sfgroups

Reputation: 19109

you can add command like this.

command:
  - "sh"
  - "-c"
  - >
    nohup /bin/ecr-refresh-token &
    sleep 10
    exit 0

Is there a reason why your putting this in the background?

Upvotes: 2

Related Questions