{{- if .Values.statuspage.enabled }} {{- $name := printf "%s-statuspage" (include "uptimesebi.fullname" .) }} apiVersion: apps/v1 kind: Deployment metadata: name: {{ $name }} labels: {{- include "uptimesebi.labels" . | nindent 4 }} app.kubernetes.io/component: statuspage spec: replicas: {{ .Values.statuspage.replicas }} selector: matchLabels: {{- include "uptimesebi.selector" (list . "statuspage") | nindent 6 }} template: metadata: labels: {{- include "uptimesebi.selector" (list . "statuspage") | nindent 8 }} annotations: checksum/secret: {{ include "uptimesebi.secretData" . | sha256sum }} {{- with .Values.statuspage.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} spec: automountServiceAccountToken: false {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: statuspage image: {{ include "uptimesebi.image" (list . "-statuspage") }} imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: UPTIME_API_URL value: {{ .Values.statuspage.apiURL | default (include "uptimesebi.apiURL" .) | quote }} {{- if not (or .Values.statuspage.token .Values.statuspage.existingSecret) }} {{- fail "statuspage.enabled needs statuspage.token or statuspage.existingSecret (see values.yaml)" }} {{- end }} {{- include "uptimesebi.secretEnv" (list (include "uptimesebi.secretName" .) "UPTIME_AGENT_TOKEN" .Values.statuspage.existingSecret .Values.statuspage.existingSecretKey "statuspage-token") | nindent 12 }} - name: UPTIME_STATUSPAGE_HOSTS value: {{ required "statuspage.hosts needs at least one host name" .Values.statuspage.hosts | join "," | quote }} - name: UPTIME_STATUSPAGE_CACHE_DIR value: /var/lib/uptimesebi - name: UPTIME_TRUSTED_PROXIES value: {{ join "," .Values.trustedProxies | quote }} - name: UPTIME_LOG_LEVEL value: {{ .Values.logLevel | quote }} {{- with .Values.extraEnv }} {{- toYaml . | nindent 12 }} {{- end }} ports: - name: http containerPort: 8082 livenessProbe: httpGet: {path: /healthz, port: http} periodSeconds: 10 readinessProbe: httpGet: {path: /readyz, port: http} periodSeconds: 5 securityContext: {{- toYaml .Values.securityContext | nindent 12 }} resources: {{- toYaml .Values.statuspage.resources | nindent 12 }} volumeMounts: - name: tmp mountPath: /tmp # Snapshots keep pages up while the API is away; rebuilt on start. - name: cache mountPath: /var/lib/uptimesebi volumes: {{- include "uptimesebi.tmpVolume" . | nindent 8 }} - name: cache emptyDir: sizeLimit: 256Mi {{- with .Values.statuspage.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.statuspage.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.statuspage.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} --- apiVersion: v1 kind: Service metadata: name: {{ $name }} labels: {{- include "uptimesebi.labels" . | nindent 4 }} app.kubernetes.io/component: statuspage spec: type: {{ .Values.statuspage.service.type }} selector: {{- include "uptimesebi.selector" (list . "statuspage") | nindent 4 }} ports: - name: http port: {{ .Values.statuspage.service.port }} targetPort: http {{- if and .Values.statuspage.podDisruptionBudget.enabled (gt (int .Values.statuspage.replicas) 1) }} --- apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: {{ $name }} labels: {{- include "uptimesebi.labels" . | nindent 4 }} spec: minAvailable: {{ .Values.statuspage.podDisruptionBudget.minAvailable }} selector: matchLabels: {{- include "uptimesebi.selector" (list . "statuspage") | nindent 6 }} {{- end }} {{- if .Values.statuspage.ingress.enabled }} --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: {{ $name }} labels: {{- include "uptimesebi.labels" . | nindent 4 }} {{- with .Values.statuspage.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: {{- with .Values.statuspage.ingress.className }} ingressClassName: {{ . }} {{- end }} {{- if .Values.statuspage.ingress.tls.enabled }} tls: - hosts: {{- toYaml .Values.statuspage.hosts | nindent 8 }} secretName: {{ .Values.statuspage.ingress.tls.secretName | default (printf "%s-tls" $name) }} {{- end }} rules: {{- range .Values.statuspage.hosts }} - host: {{ . | quote }} http: paths: - path: / pathType: Prefix backend: service: name: {{ $name }} port: name: http {{- end }} {{- end }} {{- end }}