
apiVersion: apps/v1
kind: Deployment
metadata:
  name: install-scripts
spec:
  selector:
    matchLabels:
      app: install-scripts
  template:
    metadata:
      labels:
        app: install-scripts
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 2
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - install-scripts
              topologyKey: "kubernetes.io/hostname"
      containers:
        - name: install-scripts
          image: replicated/install-scripts
          imagePullPolicy: IfNotPresent
          ports:
            - name: install-scripts
              containerPort: 5000
          # the liveness probe checks if the python service is running
          livenessProbe:
            failureThreshold: 10
            httpGet:
              path: /healthz
              port: install-scripts
              scheme: HTTP
            initialDelaySeconds: 15
            periodSeconds: 5
            successThreshold: 1
            timeoutSeconds: 1
          # the readiness probe checks if the container can connect to the database
          readinessProbe:
            failureThreshold: 1
            httpGet:
              path: /dbz
              port: install-scripts
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 10
            successThreshold: 2
            timeoutSeconds: 5
