Files
feedc0de 5acc3b0154
Publish PHP Apache image / Build, test and push (push) Successful in 1m10s
Add Apache status monitoring to Helm chart
2026-09-10 20:49:26 +02:00

132 lines
4.5 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "php-homepage.fullname" . }}
labels:
{{- include "php-homepage.labels" . | nindent 4 }}
{{- with .Values.deploymentAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
minReadySeconds: 5
revisionHistoryLimit: 3
strategy:
{{- toYaml .Values.strategy | nindent 4 }}
selector:
matchLabels:
{{- include "php-homepage.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "php-homepage.labels" . | nindent 8 }}
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
automountServiceAccountToken: false
terminationGracePeriodSeconds: 30
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ include "php-homepage.fullname" . }}
image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: APACHE_SERVER_ADMIN
value: {{ .Values.apache.serverAdmin | quote }}
- name: APACHE_STATUS_PORT
value: {{ .Values.apache.statusPort | quote }}
ports:
- name: http
containerPort: 80
protocol: TCP
- name: apache-status
containerPort: {{ .Values.apache.statusPort }}
protocol: TCP
{{- if .Values.probes.startup.enabled }}
startupProbe:
tcpSocket:
port: http
periodSeconds: {{ .Values.probes.startup.periodSeconds }}
timeoutSeconds: {{ .Values.probes.startup.timeoutSeconds }}
failureThreshold: {{ .Values.probes.startup.failureThreshold }}
{{- end }}
{{- if .Values.probes.readiness.enabled }}
readinessProbe:
tcpSocket:
port: http
periodSeconds: {{ .Values.probes.readiness.periodSeconds }}
timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }}
failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
{{- end }}
{{- if .Values.probes.liveness.enabled }}
livenessProbe:
tcpSocket:
port: http
periodSeconds: {{ .Values.probes.liveness.periodSeconds }}
timeoutSeconds: {{ .Values.probes.liveness.timeoutSeconds }}
failureThreshold: {{ .Values.probes.liveness.failureThreshold }}
{{- end }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeMounts:
- name: webroot
mountPath: {{ .Values.persistence.mountPath }}
{{- end }}
{{- if .Values.metrics.enabled }}
- name: apache-exporter
image: "{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}"
imagePullPolicy: {{ .Values.metrics.image.pullPolicy }}
args:
- "--scrape_uri=http://127.0.0.1:{{ .Values.apache.statusPort }}/server-status?auto"
- "--web.listen-address=:{{ .Values.metrics.port }}"
ports:
- name: metrics
containerPort: {{ .Values.metrics.port }}
protocol: TCP
readinessProbe:
httpGet:
path: /metrics
port: metrics
periodSeconds: 10
timeoutSeconds: 2
failureThreshold: 3
livenessProbe:
httpGet:
path: /metrics
port: metrics
periodSeconds: 30
timeoutSeconds: 2
failureThreshold: 3
{{- with .Values.metrics.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumes:
- name: webroot
persistentVolumeClaim:
claimName: {{ default (include "php-homepage.fullname" .) .Values.persistence.existingClaim }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}