---
# Source: piraeus/templates/ha-controller-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: piraeus-op-ha-controller
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: piraeus-op-ha-controller
  template:
    metadata:
      labels:
        app.kubernetes.io/name: piraeus-op-ha-controller
    spec:
      serviceAccountName: ha-controller
      containers:
        - name: controller
          image: quay.io/piraeusdatastore/piraeus-ha-controller:v0.1.3
          imagePullPolicy: "IfNotPresent"
          args:
            - --leader-election=true
            - --leader-election-lease-name=$(NAME)
            - --leader-election-namespace=$(NAMESPACE)
            - --v=5
          env:
            - name: LS_CONTROLLERS
              value: http://piraeus-op-cs.default.svc:3370
            - name: NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          livenessProbe:
            httpGet:
              port: 8080
              path: /healthz
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - topologyKey: kubernetes.io/hostname
              labelSelector:
                matchLabels:
                  app.kubernetes.io/name: piraeus-op-ha-controller
      securityContext:
        runAsUser: 1000
        runAsGroup: 1000
        fsGroup: 1000
