--- {{- if .Values.matomo.tracker.enabled }} apiVersion: apps/v1 kind: Deployment metadata: name: matomo-tracker namespace: {{.Values.namespace}} labels: app: matomo-tracker {{- if .Values.matomo.extralabels }} {{ toYaml .Values.matomo.extralabels | indent 4 }} {{- end }} spec: replicas: {{.Values.matomo.tracker.replicas}} selector: matchLabels: app: matomo-tracker template: metadata: labels: app: matomo-tracker {{- if .Values.matomo.extralabels }} {{ toYaml .Values.matomo.extralabels | indent 8 }} {{- end }} annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap-matomo.yaml") . | sha256sum }} spec: {{ include "matomo.init" . | nindent 6 }} containers: - name: fpm-metrics securityContext: runAsUser: {{.Values.matomo.runAsUser}} privileged: false allowPrivilegeEscalation: false image: hipages/php-fpm_exporter:2.2.0 imagePullPolicy: Always resources: limits: cpu: 40m memory: 32Mi requests: cpu: 40m memory: 32Mi - name: nginx image: {{.Values.nginx.image}} {{- if .Values.matomo.tracker.nginx.resources }} resources: {{ toYaml .Values.matomo.tracker.nginx.resources | indent 10 }} {{- end }} # readinessProbe: # httpGet: # scheme: HTTP # path: /matomo.js # port: 8080 # initialDelaySeconds: 10 # periodSeconds: 5 livenessProbe: exec: command: - /bin/sh - -c - "[ -f /tmp/nginx.pid ] && ps -A | grep nginx" initialDelaySeconds: 10 periodSeconds: 5 securityContext: runAsUser: {{.Values.nginx.runAsUser}} privileged: false allowPrivilegeEscalation: false volumeMounts: - name: nginx-conf mountPath: /etc/nginx/nginx.conf subPath: nginx.conf readOnly: true - name: fastcgi-params mountPath: /etc/nginx/fastcgi_params subPath: fastcgi_params readOnly: true - name: mime-types mountPath: /etc/nginx/mime.types subPath: mime.types readOnly: true - name: static-data mountPath: /var/www/html readOnly: true ports: - containerPort: 8080 - name: matomo image: {{.Values.matomo.image}} {{- if .Values.matomo.tracker.resources }} resources: {{ toYaml .Values.matomo.tracker.resources | indent 10 }} {{- end }} securityContext: runAsUser: {{.Values.matomo.runAsUser}} privileged: false allowPrivilegeEscalation: false imagePullPolicy: Always env: - name: MATOMO_DB_PASSWORD valueFrom: secretKeyRef: name: {{ .Values.db.password.secretKeyRef.name }} key: {{ .Values.db.password.secretKeyRef.key }} command: [ 'sh' , '-c' , 'supervisord -n' ] volumeMounts: - name: static-data mountPath: /var/www/html - name: matomo-supervisor-tracker mountPath: /etc/supervisor.d readOnly: true - name: matomo-phpfpm-tracker mountPath: /usr/local/etc/php-fpm.d/zz-global.conf subPath: zz-global.conf {{- if .Values.matomo.livenessProbe }} livenessProbe: {{- if .Values.matomo.livenessProbe.exec }} exec: command: - sh - -c - {{ .Values.matomo.livenessProbe.exec.command }} initialDelaySeconds: {{ .Values.matomo.livenessProbe.initialDelaySeconds | default 10 }} periodSeconds: {{ .Values.matomo.livenessProbe.periodSeconds | default 20 }} timeoutSeconds: {{ .Values.matomo.livenessProbe.timeoutSeconds | default 10 }} {{- end }} {{- end }} {{- if .Values.matomo.readinessProbe }} readinessProbe: httpGet: path: {{ .Values.matomo.readinessProbe.httpGet.path }} port: {{ .Values.matomo.readinessProbe.httpGet.port | default 80 }} initialDelaySeconds: {{ .Values.matomo.livenessProbe.initialDelaySeconds | default 5 }} periodSeconds: {{ .Values.matomo.livenessProbe.periodSeconds | default 5 }} {{- end }} {{ include "matomo.images.pullSecrets" ( dict "images" (list .Values.matomo) "global" .Values.global) | nindent 6 }} volumes: - name: nginx-conf configMap: name: nginx-matomo-tracker items: - key: nginx.conf path: nginx.conf - name: fastcgi-params configMap: name: nginx-matomo-tracker items: - key: fastcgi_params path: fastcgi_params - name: mime-types configMap: name: nginx-matomo-tracker items: - key: mime.types path: mime.types - name: matomo-configuration configMap: name: matomo-configuration - name: static-data emptyDir: {} - name: matomo-supervisor-tracker configMap: name: matomo-supervisor-tracker - name: matomo-phpfpm-tracker configMap: name: matomo-phpfpm-tracker --- apiVersion: v1 kind: Service metadata: name: matomo-tracker labels: app: matomo-tracker spec: ports: - port: 8080 protocol: TCP selector: app: matomo-tracker {{- end -}}