apiVersion: apps/v1
kind: Deployment
metadata:
  name: kotsadm-api-node
spec:
  selector:
    matchLabels:
      app: kotsadm-api-node
  template:
    metadata:
      labels:
        app: kotsadm-api-node
    spec:
      securityContext:
        runAsUser: 1001
      affinity:
        podAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - ship-www
              topologyKey: "kubernetes.io/hostname"
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 2
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - kotsadm-api-node
              topologyKey: "kubernetes.io/hostname"
      restartPolicy: Always
      containers:
        - name: kotsadm-api-node
          image: kotsadm-api-node
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 3000
            - name: debug
              containerPort: 9229
          env:
            - name: AUTO_CREATE_CLUSTER
              value: "0"
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          readinessProbe:
            httpGet:
              path: /healthz
              port: 3000
            initialDelaySeconds: 2
            periodSeconds: 2
