diff --git a/charts/vela-core/templates/defwithtemplate/init-container.yaml b/charts/vela-core/templates/defwithtemplate/init-container.yaml index cf5c7df29..d39197814 100644 --- a/charts/vela-core/templates/defwithtemplate/init-container.yaml +++ b/charts/vela-core/templates/defwithtemplate/init-container.yaml @@ -35,6 +35,9 @@ spec: if parameter.args != _|_ { args: parameter.args } + if parameter["env"] != _|_ { + env: parameter.env + } // +patchKey=name volumeMounts: [{ @@ -61,6 +64,31 @@ spec: // +usage=Specify the args run in the init container args?: [...string] + // +usage=Specify the env run in the init container + env?: [...{ + // +usage=Environment variable name + name: string + // +usage=The value of the environment variable + value?: string + // +usage=Specifies a source the value of this var should come from + valueFrom?: { + // +usage=Selects a key of a secret in the pod's namespace + secretKeyRef?: { + // +usage=The name of the secret in the pod's namespace to select from + name: string + // +usage=The key of the secret to select from. Must be a valid secret key + key: string + } + // +usage=Selects a key of a config map in the pod's namespace + configMapKeyRef?: { + // +usage=The name of the config map in the pod's namespace to select from + name: string + // +usage=The key of the config map to select from. Must be a valid secret key + key: string + } + } + }] + // +usage=Specify the mount name of shared volume mountName: *"workdir" | string diff --git a/charts/vela-core/templates/defwithtemplate/sidecar.yaml b/charts/vela-core/templates/defwithtemplate/sidecar.yaml index 6e6c8c082..47fec98a0 100644 --- a/charts/vela-core/templates/defwithtemplate/sidecar.yaml +++ b/charts/vela-core/templates/defwithtemplate/sidecar.yaml @@ -27,6 +27,9 @@ spec: if parameter.args != _|_ { args: parameter.args } + if parameter["env"] != _|_ { + env: parameter.env + } if parameter["volumes"] != _|_ { volumeMounts: [ for v in parameter.volumes { { @@ -57,6 +60,31 @@ spec: // +usage=Specify the args in the sidecar args?: [...string] + // +usage=Specify the env in the sidecar + env?: [...{ + // +usage=Environment variable name + name: string + // +usage=The value of the environment variable + value?: string + // +usage=Specifies a source the value of this var should come from + valueFrom?: { + // +usage=Selects a key of a secret in the pod's namespace + secretKeyRef?: { + // +usage=The name of the secret in the pod's namespace to select from + name: string + // +usage=The key of the secret to select from. Must be a valid secret key + key: string + } + // +usage=Selects a key of a config map in the pod's namespace + configMapKeyRef?: { + // +usage=The name of the config map in the pod's namespace to select from + name: string + // +usage=The key of the config map to select from. Must be a valid secret key + key: string + } + } + }] + // +usage=Specify the shared volume path volumes?: [...{ name: string diff --git a/charts/vela-minimal/templates/defwithtemplate/init-container.yaml b/charts/vela-minimal/templates/defwithtemplate/init-container.yaml index cf5c7df29..d39197814 100644 --- a/charts/vela-minimal/templates/defwithtemplate/init-container.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/init-container.yaml @@ -35,6 +35,9 @@ spec: if parameter.args != _|_ { args: parameter.args } + if parameter["env"] != _|_ { + env: parameter.env + } // +patchKey=name volumeMounts: [{ @@ -61,6 +64,31 @@ spec: // +usage=Specify the args run in the init container args?: [...string] + // +usage=Specify the env run in the init container + env?: [...{ + // +usage=Environment variable name + name: string + // +usage=The value of the environment variable + value?: string + // +usage=Specifies a source the value of this var should come from + valueFrom?: { + // +usage=Selects a key of a secret in the pod's namespace + secretKeyRef?: { + // +usage=The name of the secret in the pod's namespace to select from + name: string + // +usage=The key of the secret to select from. Must be a valid secret key + key: string + } + // +usage=Selects a key of a config map in the pod's namespace + configMapKeyRef?: { + // +usage=The name of the config map in the pod's namespace to select from + name: string + // +usage=The key of the config map to select from. Must be a valid secret key + key: string + } + } + }] + // +usage=Specify the mount name of shared volume mountName: *"workdir" | string diff --git a/charts/vela-minimal/templates/defwithtemplate/sidecar.yaml b/charts/vela-minimal/templates/defwithtemplate/sidecar.yaml index 6e6c8c082..47fec98a0 100644 --- a/charts/vela-minimal/templates/defwithtemplate/sidecar.yaml +++ b/charts/vela-minimal/templates/defwithtemplate/sidecar.yaml @@ -27,6 +27,9 @@ spec: if parameter.args != _|_ { args: parameter.args } + if parameter["env"] != _|_ { + env: parameter.env + } if parameter["volumes"] != _|_ { volumeMounts: [ for v in parameter.volumes { { @@ -57,6 +60,31 @@ spec: // +usage=Specify the args in the sidecar args?: [...string] + // +usage=Specify the env in the sidecar + env?: [...{ + // +usage=Environment variable name + name: string + // +usage=The value of the environment variable + value?: string + // +usage=Specifies a source the value of this var should come from + valueFrom?: { + // +usage=Selects a key of a secret in the pod's namespace + secretKeyRef?: { + // +usage=The name of the secret in the pod's namespace to select from + name: string + // +usage=The key of the secret to select from. Must be a valid secret key + key: string + } + // +usage=Selects a key of a config map in the pod's namespace + configMapKeyRef?: { + // +usage=The name of the config map in the pod's namespace to select from + name: string + // +usage=The key of the config map to select from. Must be a valid secret key + key: string + } + } + }] + // +usage=Specify the shared volume path volumes?: [...{ name: string diff --git a/vela-templates/definitions/internal/trait/init-container.cue b/vela-templates/definitions/internal/trait/init-container.cue index 3b7caeeb5..8827ba873 100644 --- a/vela-templates/definitions/internal/trait/init-container.cue +++ b/vela-templates/definitions/internal/trait/init-container.cue @@ -30,6 +30,9 @@ template: { if parameter.args != _|_ { args: parameter.args } + if parameter["env"] != _|_ { + env: parameter.env + } // +patchKey=name volumeMounts: [{ @@ -56,6 +59,31 @@ template: { // +usage=Specify the args run in the init container args?: [...string] + // +usage=Specify the env run in the init container + env?: [...{ + // +usage=Environment variable name + name: string + // +usage=The value of the environment variable + value?: string + // +usage=Specifies a source the value of this var should come from + valueFrom?: { + // +usage=Selects a key of a secret in the pod's namespace + secretKeyRef?: { + // +usage=The name of the secret in the pod's namespace to select from + name: string + // +usage=The key of the secret to select from. Must be a valid secret key + key: string + } + // +usage=Selects a key of a config map in the pod's namespace + configMapKeyRef?: { + // +usage=The name of the config map in the pod's namespace to select from + name: string + // +usage=The key of the config map to select from. Must be a valid secret key + key: string + } + } + }] + // +usage=Specify the mount name of shared volume mountName: *"workdir" | string diff --git a/vela-templates/definitions/internal/trait/sidecar.cue b/vela-templates/definitions/internal/trait/sidecar.cue index 85e84c29f..64e261873 100644 --- a/vela-templates/definitions/internal/trait/sidecar.cue +++ b/vela-templates/definitions/internal/trait/sidecar.cue @@ -22,6 +22,9 @@ template: { if parameter.args != _|_ { args: parameter.args } + if parameter["env"] != _|_ { + env: parameter.env + } if parameter["volumes"] != _|_ { volumeMounts: [ for v in parameter.volumes { { @@ -52,6 +55,31 @@ template: { // +usage=Specify the args in the sidecar args?: [...string] + // +usage=Specify the env in the sidecar + env?: [...{ + // +usage=Environment variable name + name: string + // +usage=The value of the environment variable + value?: string + // +usage=Specifies a source the value of this var should come from + valueFrom?: { + // +usage=Selects a key of a secret in the pod's namespace + secretKeyRef?: { + // +usage=The name of the secret in the pod's namespace to select from + name: string + // +usage=The key of the secret to select from. Must be a valid secret key + key: string + } + // +usage=Selects a key of a config map in the pod's namespace + configMapKeyRef?: { + // +usage=The name of the config map in the pod's namespace to select from + name: string + // +usage=The key of the config map to select from. Must be a valid secret key + key: string + } + } + }] + // +usage=Specify the shared volume path volumes?: [...{ name: string