Skip to content

Commit

Permalink
helm: improve deployment and service manifest
Browse files Browse the repository at this point in the history
Add support for custom resource definition and extend customisation of
service specific settings.

Signed-off-by: Antoine C <syslog-ng@acolombier.dev>
  • Loading branch information
Antoine Colombier committed Dec 13, 2023
1 parent 50bdf85 commit b946b3f
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 6 deletions.
2 changes: 1 addition & 1 deletion contrib/syslog-ng-helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: syslog-ng
description: Syslog-ng
version: 0.2
version: 0.3
appVersion: 3.27.1
maintainers:
- name: zakkg3
Expand Down
19 changes: 18 additions & 1 deletion contrib/syslog-ng-helm-chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,25 @@ spec:
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}

containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.extraArgs }}
args:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: tcp-port
containerPort: 601
Expand All @@ -47,6 +59,9 @@ spec:
- mountPath: /var/log
name: logs
{{- end }}
{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
volumes:
- name: config
configMap:
Expand All @@ -56,7 +71,9 @@ spec:
persistentVolumeClaim:
claimName: {{ include "syslog-ng.fullname" . }}-pvc
{{- end }}

{{- with .Values.extraVolumes }}
{{ toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
21 changes: 18 additions & 3 deletions contrib/syslog-ng-helm-chart/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,32 @@ kind: Service
metadata:
name: {{ include "syslog-ng.fullname" . }}
labels:
{{- include "syslog-ng.labels" . | nindent 4 }}
{{- include "syslog-ng.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if eq .Values.service.type "externalip" }}

{{- if eq .Values.service.type "externalip" }}
{{- with .Values.service.externalIPs }}
externalIPs:
{{- toYaml . | nindent 3 }}
{{- end }}
{{- else}}
type: {{ .Values.service.type }}
{{- end }}
{{- if .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges: {{ toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
{{- if .Values.service.loadBalancerClass }}
loadBalancerClass: {{ .Values.service.loadBalancerClass }}
{{- end }}
{{- if .Values.service.sessionAffinity }}
sessionAffinity: {{ .Values.service.sessionAffinity }}
{{- end }}
{{- if .Values.service.externalTrafficPolicy }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
{{- end }}
ports:
- name: udp-port
port: 514
Expand Down
9 changes: 8 additions & 1 deletion contrib/syslog-ng-helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,21 @@ securityContext: {}
# runAsNonRoot: true
# runAsUser: 1000

# syslog-ng have fixed ports tcp 601 and udp 514
# syslog-ng have fixed ports tcp 601 and udp 514
service:
type: ClusterIP
# use externalip for a pre routede exter al ip.
# TO-DO: LoadBalancer
# type: externalip
# externalIPs:
# - 10.205.212.12
annotations: {}
# external-dns.alpha.kubernetes.io/hostname: "syslog.example.com"
loadBalancerSourceRanges: []
# - 10.2.3.0/24
loadBalancerClass: ~
sessionAffinity: ~
externalTrafficPolicy: Cluster


resources: {}
Expand Down
4 changes: 4 additions & 0 deletions news/other-4752.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
helm: improve deployment and service manifest

Add support for custom resource definition and extend customisation of
service specific settings.

0 comments on commit b946b3f

Please sign in to comment.