Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

5.9 KB
Raw Blame
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "pulse.fullname" . }}
  labels:
    {{- include "pulse.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.replicaCount }}
  strategy:
    type: {{ .Values.strategy.type | default "RollingUpdate" }}
  selector:
    matchLabels:
      {{- include "pulse.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "pulse.selectorLabels" . | nindent 8 }}
        {{- with .Values.server.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      {{- $podAnnotations := merge (dict) .Values.podAnnotations .Values.server.podAnnotations }}
      {{- if $podAnnotations }}
      annotations:
        {{- toYaml $podAnnotations | nindent 8 }}
      {{- end }}
    spec:
      serviceAccountName: {{ include "pulse.serviceAccountName" . }}
      {{- $defaultPodSecurityContext :=
        ternary
          (merge (dict) .Values.podSecurityContext .Values.server.podSecurityContext)
          .Values.server.podSecurityContext
          .Values.podSecurityContext.enabled }}
      {{- $podSecurityContext := ternary .Values.server.podSecurityContext $defaultPodSecurityContext .Values.openShift.enabled }}
      {{- if $podSecurityContext }}
      securityContext:
        {{- omit $podSecurityContext "enabled" | toYaml | nindent 8 }}
      {{- end }}
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      containers:
        - name: pulse
          image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: 7655
          {{- $defaultContainerSecurityContext :=
            ternary
              (merge (dict) .Values.containerSecurityContext .Values.server.securityContext)
              .Values.server.securityContext
              .Values.containerSecurityContext.enabled }}
          {{- $openShiftContainerSecurityContext := dict
            "allowPrivilegeEscalation" false
            "capabilities" (dict "drop" (list "ALL"))
            "runAsNonRoot" true }}
          {{- $openShiftContainerSecurityContext = mergeOverwrite $openShiftContainerSecurityContext .Values.server.securityContext }}
          {{- $openShiftContainerSecurityContext = omit $openShiftContainerSecurityContext "runAsUser" "runAsGroup" }}
          {{- $containerSecurityContext := ternary $openShiftContainerSecurityContext $defaultContainerSecurityContext .Values.openShift.enabled }}
          {{- if $containerSecurityContext }}
          securityContext:
            {{- omit $containerSecurityContext "enabled" | toYaml | nindent 12 }}
          {{- end }}
          {{- $envList := list }}
          {{- range .Values.server.env }}
          {{- $envList = append $envList . }}
          {{- end }}
          {{- range .Values.server.extraEnv }}
          {{- $envList = append $envList . }}
          {{- end }}
          {{- $secret := .Values.server.secretEnv }}
          {{- $secretKeys := list }}
          {{- if $secret.keys }}
          {{- $secretKeys = $secret.keys }}
          {{- else if $secret.data }}
          {{- $secretKeys = keys $secret.data }}
          {{- end }}
          {{- $root := . }}
          {{- range $key := $secretKeys }}
          {{- $envList = append $envList (dict "name" $key "valueFrom" (dict "secretKeyRef" (dict "name" (include "pulse.serverSecretName" $root) "key" $key))) }}
          {{- end }}
          {{- if $envList }}
          env:
            {{- toYaml $envList | nindent 12 }}
          {{- end }}
          {{- $envFrom := concat .Values.server.envFrom .Values.server.extraEnvFrom }}
          {{- if $envFrom }}
          envFrom:
            {{- range $envFrom }}
            {{- toYaml . | nindent 12 }}
            {{- end }}
          {{- end }}
          volumeMounts:
            - name: data
              mountPath: /data
            {{- with .Values.server.extraVolumeMounts }}
            {{- toYaml . | nindent 12 }}
            {{- end }}
          {{- with .Values.server.livenessProbe }}
          {{- if .enabled }}
          livenessProbe:
            httpGet:
              path: {{ .path }}
              port: http
            initialDelaySeconds: {{ .initialDelaySeconds }}
            periodSeconds: {{ .periodSeconds }}
            timeoutSeconds: {{ .timeoutSeconds }}
            failureThreshold: {{ .failureThreshold }}
          {{- end }}
          {{- end }}
          {{- with .Values.server.readinessProbe }}
          {{- if .enabled }}
          readinessProbe:
            httpGet:
              path: {{ .path }}
              port: http
            initialDelaySeconds: {{ .initialDelaySeconds }}
            periodSeconds: {{ .periodSeconds }}
            timeoutSeconds: {{ .timeoutSeconds }}
            failureThreshold: {{ .failureThreshold }}
          {{- end }}
          {{- end }}
          {{- with .Values.server.resources }}
          resources:
            {{- toYaml . | nindent 12 }}
          {{- end }}
      volumes:
        - name: data
          {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
          persistentVolumeClaim:
            claimName: {{ include "pulse.fullname" . }}
          {{- else if and .Values.persistence.enabled .Values.persistence.existingClaim }}
          persistentVolumeClaim:
            claimName: {{ .Values.persistence.existingClaim }}
          {{- else }}
          emptyDir: {}
          {{- end }}
        {{- with .Values.server.extraVolumes }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      {{- with .Values.server.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.server.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.server.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}