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: 4 additions & 0 deletions helm/kagent-tools/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ metadata:
namespace: {{ include "kagent-tools.namespace" . }}
labels:
{{- include "kagent-tools.labels" . | nindent 4 }}
{{- with .Values.deploymentAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
Expand Down
29 changes: 29 additions & 0 deletions helm/kagent-tools/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "kagent-tools.fullname" . }}
namespace: {{ include "kagent-tools.namespace" . }}
labels:
{{- include "kagent-tools.labels" . | nindent 4 }}
{{- with .Values.podDisruptionBudget.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.podDisruptionBudget.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.unhealthyPodEvictionPolicy }}
unhealthyPodEvictionPolicy: {{ .Values.podDisruptionBudget.unhealthyPodEvictionPolicy }}
{{- end }}
selector:
matchLabels:
{{- include "kagent-tools.selectorLabels" . | nindent 6 }}
{{- end }}
21 changes: 21 additions & 0 deletions helm/kagent-tools/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,24 @@ tests:
value:
app.kubernetes.io/name: RELEASE-NAME
app.kubernetes.io/instance: RELEASE-NAME

- it: should not have deployment annotations by default
template: deployment.yaml
asserts:
- isNull:
path: metadata.annotations

- it: should render custom deployment annotations
template: deployment.yaml
set:
deploymentAnnotations:
keel.sh/policy: "force"
example.com/annotation: "test-value"
asserts:
- equal:
path: metadata.annotations["keel.sh/policy"]
value: "force"
- equal:
path: metadata.annotations["example.com/annotation"]
value: "test-value"

59 changes: 59 additions & 0 deletions helm/kagent-tools/tests/pdb_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
suite: test pod disruption budget
templates:
- pdb.yaml
tests:
- it: should not render pdb by default
template: pdb.yaml
asserts:
- hasDocuments:
count: 0

- it: should render pdb when enabled with minAvailable
template: pdb.yaml
set:
podDisruptionBudget:
enabled: true
minAvailable: 1
asserts:
- isKind:
of: PodDisruptionBudget
- equal:
path: metadata.name
value: RELEASE-NAME
- equal:
path: spec.minAvailable
value: 1
- isNull:
path: spec.maxUnavailable
- equal:
path: spec.selector.matchLabels
value:
app.kubernetes.io/name: RELEASE-NAME
app.kubernetes.io/instance: RELEASE-NAME

- it: should render pdb with maxUnavailable and annotations/labels
template: pdb.yaml
set:
podDisruptionBudget:
enabled: true
maxUnavailable: "50%"
unhealthyPodEvictionPolicy: IfHealthyBudget
labels:
custom-label: pdb-label
annotations:
custom-annotation: pdb-annotation
asserts:
- isKind:
of: PodDisruptionBudget
- equal:
path: spec.maxUnavailable
value: "50%"
- equal:
path: spec.unhealthyPodEvictionPolicy
value: IfHealthyBudget
- equal:
path: metadata.labels["custom-label"]
value: pdb-label
- equal:
path: metadata.annotations["custom-annotation"]
value: pdb-annotation
12 changes: 12 additions & 0 deletions helm/kagent-tools/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

# Annotations to add to the deployment
deploymentAnnotations: {}

podAnnotations: {}

podSecurityContext: {}
Expand All @@ -76,6 +79,15 @@ securityContext: {}
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

# PodDisruptionBudget configuration
podDisruptionBudget:
enabled: false
# minAvailable: 1
# maxUnavailable: 1
# labels: {}
# annotations: {}
# unhealthyPodEvictionPolicy: IfHealthyBudget

# Node taints which will be tolerated for Pod.
tolerations: []
Expand Down