helm-charts
helm-charts copied to clipboard
podTemplate helper does not allow setting command: "" in container spec
Describe the bug
Setting the following in values.yaml
...
additionalAgents:
newagent:
podName: newagent
sideContainerName: jnlp
command: ""
args: ""
Results in the following under

As you can see, Command to run
is being set to sleep
, when it should be empty.
Version of Helm and Kubernetes:
Helm Version: v3.6.1
Kubernetes Version: v1.19.9
Which version of the chart: 3.5.9
What happened: The jnlp
container in the pod template has Command to run
set to sleep
.
What you expected to happen: The jnlp
container in the pod template should have Command to run
set to no value/empty string.
How to reproduce it (as minimally and precisely as possible):
- Add the following to your
values.yaml
:additionalAgents: newagent: podName: newagent sideContainerName: jnlp command: "" args: ""
-
helm install
- Check
jenkins-jenkins-jcasc-config
ConfigMap value. Verify thatcommand
is NOT set to an empty string (e.g.command:
- Go https://
/configureClouds/ - Expand Pod Template Details for the "newagent" pod template
- Verify that
Command to run
is set tosleep
Anything else we need to know:
I think the issue is that the jenkins.casc.podTemplate
helper method is not wrapping {{ .Values.agent.command }}
with double quotes (e.g. "{{ .Values.agent.command }}"
). I assume this is why setting command: ""
in values.yaml
results in command:
in the jenkins-jenkins-jcasc-config
ConfigMap. Additionally, if no value is provided to command
, the Kubernetes plugin for Jenkins will default it to sleep
.
This issue most notably impacts Windows versions of the jenkins/inbound-agent
Docker image. The agent process does not properly launch as the default command is set to sleep
.
I think the issue is that the jenkins.casc.podTemplate helper method is not wrapping {{ .Values.agent.command }} with double quotes (e.g. "{{ .Values.agent.command }}"). I assume this is why setting command: "" in values.yaml results in command: in the jenkins-jenkins-jcasc-config ConfigMap. Additionally, if no value is provided to command, the Kubernetes plugin for Jenkins will default it to sleep.
@bartsqueezy Could you try quoting the command and check if that works? I suspect that we can't change it as empty would result in the default of the Kubernetes plugin being used.
Sure, let me give it a test and get back to you.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.
I think the issue is that the jenkins.casc.podTemplate helper method is not wrapping {{ .Values.agent.command }} with double quotes (e.g. "{{ .Values.agent.command }}"). I assume this is why setting command: "" in values.yaml results in command: in the jenkins-jenkins-jcasc-config ConfigMap. Additionally, if no value is provided to command, the Kubernetes plugin for Jenkins will default it to sleep.
@bartsqueezy Could you try quoting the command and check if that works? I suspect that we can't change it as empty would result in the default of the Kubernetes plugin being used.
For what it's worth I also ran into this issue with the sleep command being added. Quoting it seems to work.
agent:
command: '""'