apiVersion: apps/v1
kind: Deployment
metadata:
  name: billing2-api
spec:
  selector:
    matchLabels:
      app: billing2-api
      service: billing
  replicas: 3
  template:
    metadata:
      labels:
        app: billing2-api
        service: billing
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchLabels:
                app: billing2-api
            topologyKey: kubernetes.io/hostname
      topologySpreadConstraints:
      - maxSkew: 1
        topologyKey: topology.kubernetes.io/zone
        whenUnsatisfiable: ScheduleAnyway
        labelSelector:
          matchLabels:
            app: billing2-api
      serviceAccountName: central
      containers:
        - name: billing2-api
          image: 385595570414.dkr.ecr.us-west-2.amazonaws.com/dbaas/nightly/dbaas-billing2:bafacbe9ba0709d0a2cf26b33f4537afeba4e024
          command: [ "/usr/local/bin/server" ]
          resources:
            requests:
              cpu: "125m"
              memory: "256Mi"
            limits:
              cpu: "250m"
              memory: "256Mi"
          env:
            - name: GCP_WORKLOAD_IDENTITY_AUDIENCE
              value: //iam.googleapis.com/projects/27323915999/locations/global/workloadIdentityPools/dev-dbaas/providers/dev-dbaas-eks-oidc
            - name: GCP_IMPERSONATE_SA
              value: dev-nightly-central@pingcap-gardener.iam.gserviceaccount.com
            - name: CONTAINER_APP_NAME
              value: billing2-api
          envFrom:
            - secretRef:
                name: dev-billing-secrets
          volumeMounts:
            - name: dbaas-billing-config
              mountPath: "/etc/billing"
              readOnly: true
            - name: dbaas-billing-secrets
              mountPath: "/etc/billing_secrets"
              readOnly: true
      volumes:
        - name: dbaas-billing-config
          configMap:
            name: argo-dbaas-billing-config
        - name: dbaas-billing-secrets
          secret:
            secretName: dev-billing-secrets
