# Source: kuberhealthy/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kuberhealthy
  namespace: jx
  labels:
    app: kuberhealthy
    gitops.jenkins-x.io/pipeline: 'namespaces'
  annotations:
    meta.helm.sh/release-name: 'kuberhealthy'
    wave.pusher.com/update-on-config-change: 'true'
spec:
  replicas: 2
  selector:
    matchLabels:
      app: kuberhealthy
  strategy:
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: kuberhealthy
    spec:
      volumes:
        - name: config-volume
          configMap:
            # Provide the name of the ConfigMap containing the files you want
            # to add to the container
            name: kuberhealthy
      serviceAccountName: kuberhealthy
      automountServiceAccountToken: true
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              podAffinityTerm:
                labelSelector:
                  matchExpressions:
                    - key: app
                      operator: In
                      values:
                        - kuberhealthy
                topologyKey: "kubernetes.io/hostname"
      containers:
        - image: kuberhealthy/kuberhealthy:v2.4.1
          command: [/app/kuberhealthy]
          ports:
            - containerPort: 8080
              name: http
          securityContext:
            runAsNonRoot: true
            runAsUser: 999
            allowPrivilegeEscalation: false
          imagePullPolicy: IfNotPresent
          livenessProbe:
            failureThreshold: 3
            initialDelaySeconds: 2
            periodSeconds: 4
            successThreshold: 1
            tcpSocket:
              port: 8080
            timeoutSeconds: 1
          name: kuberhealthy
          volumeMounts:
            - name: config-volume
              mountPath: /etc/config/
          env:
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: CHECK_REAPER_RUN_INTERVAL
              value: 30s
          readinessProbe:
            failureThreshold: 3
            initialDelaySeconds: 2
            periodSeconds: 4
            successThreshold: 1
            tcpSocket:
              port: 8080
            timeoutSeconds: 1
          resources:
            requests:
              cpu: 400m
              memory: 300Mi
            limits:
              cpu: 2
              memory: 1Gi
      restartPolicy: Always
      terminationGracePeriodSeconds: 60
