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

Don't include empty worker pools env var if not a worker #363

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strong-pears-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kubernetes-agent": patch
---

Don't include an empty WorkerPools env var if not a worker
2 changes: 2 additions & 0 deletions charts/kubernetes-agent/templates/tentacle-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ spec:
value: {{ .Values.agent.deploymentTarget.initial.tenantedDeploymentParticipation | quote }}
- name: "WorkerEnabled"
value: {{ .Values.agent.worker.enabled | quote }}
{{- if and .Values.agent.worker.initial.workerPools .Values.agent.worker.enabled }}
- name: "WorkerPools"
value: {{ join "," .Values.agent.worker.initial.workerPools | quote }}
{{- end }}
{{- if .Values.agent.deploymentTarget.enabled }}
{{include "kubernetes-agent.scriptPodEnvVars" .Values.scriptPods.deploymentTarget.image | nindent 12}}
{{- else if .Values.agent.worker.enabled }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ should match snapshot:
value: Untenanted
- name: WorkerEnabled
value: "false"
- name: WorkerPools
value: ""
- name: OCTOPUS__K8STENTACLE__NAMESPACE
value: NAMESPACE
- name: OCTOPUS__K8STENTACLE__PODSERVICEACCOUNTNAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,29 @@ tests:
path: spec.template.spec.containers[0].env[?(@.name == 'TargetRole')].value
value: "web,admin"

- it: "Sets worker pools"
- it: "Sets worker pools if worker enabled"
set:
agent:
worker:
enabled: true
initial:
workerPools: [WorkerPools-3, MyAwesomeWorkerPool]
asserts:
- equal:
path: spec.template.spec.containers[0].env[?(@.name == 'WorkerPools')].value
value: "WorkerPools-3,MyAwesomeWorkerPool"

- it: "Does not set worker pools if worker disabled"
set:
agent:
worker:
enabled: false
initial:
workerPools: [WorkerPools-3, MyAwesomeWorkerPool]
asserts:
- notExists:
path: spec.template.spec.containers[0].env[?(@.name == 'WorkerPools')].value

- it: "Sets machine policy if specified"
set:
agent:
Expand Down
Loading