Skip to content

Commit 323ec1f

Browse files
authored
MAJOR: haproxy: add support for deployment labels, raw container and service additional ports config (#303)
1 parent db10c6e commit 323ec1f

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

haproxy/templates/daemonset.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ spec:
121121
hostPort: {{ index $hostPorts $key }}
122122
{{- end }}
123123
{{- end }}
124+
{{- with .Values.rawContainerPorts }}
125+
{{- toYaml . | nindent 12 }}
126+
{{- end }}
124127
{{- with .Values.livenessProbe }}
125128
livenessProbe:
126129
{{- toYaml . | trim | nindent 12 }}

haproxy/templates/deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ metadata:
2222
namespace: {{ include "haproxy.namespace" . }}
2323
labels:
2424
{{- include "haproxy.labels" . | nindent 4 }}
25+
{{- if .Values.deploymentLabels }}
26+
{{ tpl (toYaml .Values.deploymentLabels) . | indent 4 }}
27+
{{- end }}
2528
annotations:
2629
{{- if .Values.deploymentAnnotations }}
2730
{{ tpl (toYaml .Values.deploymentAnnotations) . | indent 4 }}
@@ -123,6 +126,9 @@ spec:
123126
containerPort: {{ $value }}
124127
protocol: TCP
125128
{{- end }}
129+
{{- with .Values.rawContainerPorts }}
130+
{{- toYaml . | nindent 12 }}
131+
{{- end }}
126132
{{- with .Values.livenessProbe }}
127133
livenessProbe:
128134
{{- toYaml . | trim | nindent 12 }}

haproxy/templates/service.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ spec:
5252
externalIPs:
5353
{{- toYaml . | nindent 2 }}
5454
{{- end }}
55-
{{- if or .Values.containerPorts .Values.service.additionalPorts }}
55+
{{- if or .Values.containerPorts .Values.service.additionalPorts .Values.service.rawAdditionalPorts }}
5656
{{- $nodePorts := .Values.service.nodePorts }}
5757
{{- $servicePortType := .Values.service.type }}
5858
ports:
@@ -78,4 +78,7 @@ spec:
7878
{{- end }}
7979
{{- end }}
8080
{{- end }}
81+
{{- with .Values.service.rawAdditionalPorts }}
82+
{{- toYaml . | nindent 2 }}
83+
{{- end }}
8184
{{- end }}

haproxy/values.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ args:
101101
deploymentAnnotations: {}
102102
# key: value
103103

104+
deploymentLabels: {}
105+
# key: value
106+
104107
## Controller Container liveness/readiness probe configuration
105108
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
106109
livenessProbe:
@@ -174,6 +177,18 @@ containerPorts: # has to match hostPorts when useHostNetwork is true
174177
https: 443
175178
stat: 1024
176179

180+
## Raw container ports configuration (alternative to containerPorts for more control)
181+
## Allows specifying container ports in full Kubernetes format with custom protocols, names, etc.
182+
## ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#containerport-v1-core
183+
rawContainerPorts: []
184+
# Example:
185+
# - containerPort: 9090
186+
# name: metrics-port
187+
# protocol: TCP
188+
# - containerPort: 8080
189+
# name: custom-http
190+
# protocol: TCP
191+
177192
## Deployment strategy definition
178193
## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
179194
strategy: {}
@@ -500,6 +515,20 @@ service:
500515
additionalPorts: {}
501516
# prometheus: 9101
502517

518+
## Raw additional service ports configuration (alternative to additionalPorts for more control)
519+
## Allows specifying service ports in full Kubernetes format with custom protocols, names, etc.
520+
## ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.33/#serviceport-v1-core
521+
rawAdditionalPorts: []
522+
# Example:
523+
# - name: metrics-port
524+
# port: 9090
525+
# targetPort: 9090
526+
# protocol: TCP
527+
# - name: custom-service
528+
# port: 8080
529+
# targetPort: custom-http
530+
# protocol: TCP
531+
503532
## NodePort custom port
504533
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#nodeport-custom-port
505534
nodePorts: {}

0 commit comments

Comments
 (0)