Skip to content

Commit 88ee3cf

Browse files
committed
feat(helm): support more pod fields
1 parent 1c4ac53 commit 88ee3cf

6 files changed

Lines changed: 137 additions & 2 deletions

File tree

charts/acontext/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: A Helm chart for Acontext deployment on Kubernetes
44

55
type: application
66

7-
version: 0.0.3
7+
version: 0.0.4
88
appVersion: "0.0.1"
99

1010
dependencies:

charts/acontext/templates/api-deployment.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ spec:
3636
securityContext:
3737
{{- toYaml . | nindent 8 }}
3838
{{- end }}
39+
{{- with .Values.api.terminationGracePeriodSeconds }}
40+
terminationGracePeriodSeconds: {{ . }}
41+
{{- end }}
3942
containers:
4043
- name: api
4144
{{- with .Values.api.securityContext }}
@@ -141,6 +144,10 @@ spec:
141144
resources:
142145
{{- toYaml . | nindent 12 }}
143146
{{- end }}
147+
{{- with .Values.api.lifecycle }}
148+
lifecycle:
149+
{{- toYaml . | nindent 12 }}
150+
{{- end }}
144151
{{- with .Values.api.nodeSelector }}
145152
nodeSelector:
146153
{{- toYaml . | nindent 8 }}
@@ -153,5 +160,9 @@ spec:
153160
tolerations:
154161
{{- toYaml . | nindent 8 }}
155162
{{- end }}
163+
{{- with .Values.api.topologySpreadConstraints }}
164+
topologySpreadConstraints:
165+
{{- toYaml . | nindent 8 }}
166+
{{- end }}
156167
{{- end }}
157168

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{{- if and .Values.api.enabled .Values.api.podDisruptionBudget.enabled }}
2+
apiVersion: policy/v1
3+
kind: PodDisruptionBudget
4+
metadata:
5+
name: {{ include "aconext.api.name" . }}
6+
labels:
7+
{{- include "aconext.labels" . | nindent 4 }}
8+
app.kubernetes.io/component: api
9+
spec:
10+
selector:
11+
matchLabels:
12+
{{- include "aconext.api.selectorLabels" . | nindent 6 }}
13+
{{- if .Values.api.podDisruptionBudget.minAvailable }}
14+
minAvailable: {{ .Values.api.podDisruptionBudget.minAvailable }}
15+
{{- end }}
16+
{{- if .Values.api.podDisruptionBudget.maxUnavailable }}
17+
maxUnavailable: {{ .Values.api.podDisruptionBudget.maxUnavailable }}
18+
{{- end }}
19+
{{- if .Values.api.podDisruptionBudget.unhealthyPodEvictionPolicy }}
20+
unhealthyPodEvictionPolicy: {{ .Values.api.podDisruptionBudget.unhealthyPodEvictionPolicy }}
21+
{{- end }}
22+
{{- end }}
23+

charts/acontext/templates/core-deployment.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ spec:
3636
securityContext:
3737
{{- toYaml . | nindent 8 }}
3838
{{- end }}
39+
{{- with .Values.core.terminationGracePeriodSeconds }}
40+
terminationGracePeriodSeconds: {{ . }}
41+
{{- end }}
3942
{{- if and .Values.postgresql.enabled .Values.postgresql.auth.postgresPassword }}
4043
initContainers:
4144
- name: init-vector-extension
@@ -126,6 +129,10 @@ spec:
126129
resources:
127130
{{- toYaml . | nindent 12 }}
128131
{{- end }}
132+
{{- with .Values.core.lifecycle }}
133+
lifecycle:
134+
{{- toYaml . | nindent 12 }}
135+
{{- end }}
129136
{{- with .Values.core.nodeSelector }}
130137
nodeSelector:
131138
{{- toYaml . | nindent 8 }}
@@ -138,5 +145,9 @@ spec:
138145
tolerations:
139146
{{- toYaml . | nindent 8 }}
140147
{{- end }}
148+
{{- with .Values.core.topologySpreadConstraints }}
149+
topologySpreadConstraints:
150+
{{- toYaml . | nindent 8 }}
151+
{{- end }}
141152
{{- end }}
142153

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{{- if and .Values.core.enabled .Values.core.podDisruptionBudget.enabled }}
2+
apiVersion: policy/v1
3+
kind: PodDisruptionBudget
4+
metadata:
5+
name: {{ include "aconext.core.name" . }}
6+
labels:
7+
{{- include "aconext.labels" . | nindent 4 }}
8+
app.kubernetes.io/component: core
9+
spec:
10+
selector:
11+
matchLabels:
12+
{{- include "aconext.core.selectorLabels" . | nindent 6 }}
13+
{{- if .Values.core.podDisruptionBudget.minAvailable }}
14+
minAvailable: {{ .Values.core.podDisruptionBudget.minAvailable }}
15+
{{- end }}
16+
{{- if .Values.core.podDisruptionBudget.maxUnavailable }}
17+
maxUnavailable: {{ .Values.core.podDisruptionBudget.maxUnavailable }}
18+
{{- end }}
19+
{{- if .Values.core.podDisruptionBudget.unhealthyPodEvictionPolicy }}
20+
unhealthyPodEvictionPolicy: {{ .Values.core.podDisruptionBudget.unhealthyPodEvictionPolicy }}
21+
{{- end }}
22+
{{- end }}
23+

charts/acontext/values.yaml

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,40 @@ core:
7575
nodeSelector: {}
7676
tolerations: []
7777
affinity: {}
78+
79+
# Topology spread constraints
80+
topologySpreadConstraints: []
81+
# - maxSkew: 1
82+
# topologyKey: topology.kubernetes.io/zone
83+
# whenUnsatisfiable: DoNotSchedule
84+
# labelSelector:
85+
# matchLabels:
86+
# app.kubernetes.io/component: core
87+
# - maxSkew: 1
88+
# topologyKey: kubernetes.io/hostname
89+
# whenUnsatisfiable: ScheduleAnyway
90+
# labelSelector:
91+
# matchLabels:
92+
# app.kubernetes.io/component: core
93+
94+
# Termination grace period
95+
terminationGracePeriodSeconds: 30
96+
97+
# Lifecycle hooks
98+
lifecycle: {}
99+
# preStop:
100+
# exec:
101+
# command: ["/bin/sh", "-c", "sleep 15"]
102+
# postStart:
103+
# exec:
104+
# command: ["/bin/sh", "-c", "echo Hello from the postStart handler"]
105+
106+
# Pod Disruption Budget
107+
podDisruptionBudget:
108+
enabled: false
109+
minAvailable: 1 # Can be an integer or percentage (e.g., "50%")
110+
# maxUnavailable: 1 # Alternative to minAvailable
111+
# unhealthyPodEvictionPolicy: IfHealthyBudget # Available in Kubernetes 1.26+
78112

79113
# API service configuration
80114
api:
@@ -144,6 +178,40 @@ api:
144178
nodeSelector: {}
145179
tolerations: []
146180
affinity: {}
181+
182+
# Topology spread constraints
183+
topologySpreadConstraints: []
184+
# - maxSkew: 1
185+
# topologyKey: topology.kubernetes.io/zone
186+
# whenUnsatisfiable: DoNotSchedule
187+
# labelSelector:
188+
# matchLabels:
189+
# app.kubernetes.io/component: api
190+
# - maxSkew: 1
191+
# topologyKey: kubernetes.io/hostname
192+
# whenUnsatisfiable: ScheduleAnyway
193+
# labelSelector:
194+
# matchLabels:
195+
# app.kubernetes.io/component: api
196+
197+
# Termination grace period
198+
terminationGracePeriodSeconds: 30
199+
200+
# Lifecycle hooks
201+
lifecycle: {}
202+
# preStop:
203+
# exec:
204+
# command: ["/bin/sh", "-c", "sleep 15"]
205+
# postStart:
206+
# exec:
207+
# command: ["/bin/sh", "-c", "echo Hello from the postStart handler"]
208+
209+
# Pod Disruption Budget
210+
podDisruptionBudget:
211+
enabled: false
212+
minAvailable: 1 # Can be an integer or percentage (e.g., "50%")
213+
# maxUnavailable: 1 # Alternative to minAvailable
214+
# unhealthyPodEvictionPolicy: IfHealthyBudget # Available in Kubernetes 1.26+
147215

148216
# PostgreSQL configuration (Bitnami chart)
149217
# Set enabled: false to use external PostgreSQL
@@ -257,7 +325,6 @@ secrets:
257325
secretKey: "" # AWS S3 secret key
258326

259327

260-
# TOOD: opentelemetry collector
261328

262329
# HTTPRoute configuration (Gateway API)
263330
# HTTPRoute is used to define routing rules for the Gateway API

0 commit comments

Comments
 (0)