Skip to content
Open
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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ The command removes all the Kubernetes objects associated with the chart and del
| agent.maxRunTime | string | `"5h"` | |
| agent.name | string | `""` | A (preferably) unique name assigned to this particular container-agent instance. This name will appear in your runners inventory page in the CircleCI UI. If left unspecified, the name will default to the name of the deployment. |
| agent.nodeSelector | object | `{}` | Node labels for agent pod assignment Ref: https://kubernetes.io/docs/user-guide/node-selection/ |
| agent.pdb | object | `{"create":false,"maxUnavailable":1,"minAvailable":1}` | Pod disruption budget settings |
| agent.pdb.create | string | `false` | Create a pod disruption budget |
| agent.pdb.minAvailable | string | `1` | Minimum available pods set in PodDisruptionBudget. Define either 'minAvailable' or 'maxUnavailable', never both. |
| agent.pdb.maxUnavailable | string | `null` | Maximum unavailable pods set in PodDisruptionBudget. If set, 'minAvailable' is ignored. |
| agent.podAnnotations | object | `{}` | Annotations to be added to agent pods |
| agent.podSecurityContext | object | `{}` | Security Context policies for agent pods |
| agent.pullSecrets | list | `[]` | |
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

# Edge

[#84](https://github.com/CircleCI-Public/container-runner-helm-chart/pull/84)
Fix the Pod Disruption Budget template so that it does not set both `minAvailable` and `maxUnavailable`

[#71](https://github.com/CircleCI-Public/container-runner-helm-chart/pull/71) Added an option to configure the image name for the orchestrator container, enabling hosting in a private registry or an air-gapped environment on CircleCI server. See the [runner-init repository](https://github.com/circleci/runner-init) for more information.

[#68](https://github.com/CircleCI-Public/container-runner-helm-chart/pull/68) Refactor: Move `logging` container-related resources to their own component subdirectory. This is to work towards a more organized Chart.
Expand Down
7 changes: 3 additions & 4 deletions templates/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ kind: PodDisruptionBudget
metadata:
name: {{ template "container-agent.fullname" . }}
spec:
{{- if .Values.agent.pdb.minAvailable }}
{{- if and .Values.agent.pdb.minAvailable (not (hasKey .Values.agent.pdb "maxUnavailable")) }}
minAvailable: {{ .Values.agent.pdb.minAvailable }}
{{- end }}
{{- if .Values.agent.pdb.maxUnavailable }}
{{- else if .Values.agent.pdb.maxUnavailable }}
maxUnavailable: {{ .Values.agent.pdb.maxUnavailable }}
{{- end }}
{{- end }}
selector:
matchLabels:
{{- toYaml .Values.agent.matchLabels | nindent 6 }}
Expand Down
69 changes: 69 additions & 0 deletions tests/pdb_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
suite: test pod disruption budget
templates:
- pdb.yaml
tests:
- it: should not create a pod disruption budget by default
asserts:
- notExists:
kind: PodDisruptionBudget

- it: should create a pod disruption budget when enabled
set:
agent:
pdb:
create: true
asserts:
- exists:
kind: PodDisruptionBudget
- equal:
path: spec.minAvailable
value: 1
- equal:
path: spec.selector.matchLabels.app
value: container-agent

- it: should set minAvailable when specified
set:
agent:
pdb:
create: true
minAvailable: 3
asserts:
- exists:
kind: PodDisruptionBudget
- equal:
path: spec.minAvailable
value: 3
- notExists:
path: spec.maxUnavailable

- it: should set maxUnavailable when specified
set:
agent:
pdb:
create: true
maxUnavailable: 2
asserts:
- exists:
kind: PodDisruptionBudget
- equal:
path: spec.maxUnavailable
value: 2
- notExists:
path: spec.minAvailable

- it: should prefer maxUnavailable if both minAvailable and maxUnavailable are set
set:
agent:
pdb:
create: true
minAvailable: 2
maxUnavailable: 3
asserts:
- exists:
kind: PodDisruptionBudget
- equal:
path: spec.maxUnavailable
value: 3
- notExists:
path: spec.minAvailable
6 changes: 5 additions & 1 deletion values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,14 @@ agent:
# topologyKey: "kubernetes.io/hostname"

# -- Pod disruption budget settings
# Ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
pdb:
create: false
# -- Minimum available pods set in PodDisruptionBudget.
# Define either 'minAvailable' or 'maxUnavailable', never both.
minAvailable: 1
maxUnavailable: 1
# -- Maximum unavailable pods set in PodDisruptionBudget. If set, 'minAvailable' is ignored.
# maxUnavailable: 1

# -- CircleCI Runner API URL
runnerAPI: "https://runner.circleci.com"
Expand Down