apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    sidecar.jaegertracing.io/inject: jaeger
  name: dbaas-core-svc-server
spec:
  replicas: 2
  selector:
    matchLabels:
      app: dbaas-core-svc-server
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: dbaas-core-svc-server
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - podAffinityTerm:
                labelSelector:
                  matchExpressions:
                    - key: app
                      operator: In
                      values:
                        - dbaas-core-svc-server
                topologyKey: topology.kubernetes.io/zone
              weight: 100
      containers:
        - name: core-svc-server
          command:
            - /core-svc
            - serve
            - --config-path=/etc/core-svc/core-svc-config.yaml
          env:
            - name: CORE_SVC_ROLE
              value: API_SERVICE
            - 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: ENABLE_TRACING
              value: "true"
          image: 385595570414.dkr.ecr.us-west-2.amazonaws.com/dbaas/nightly/core-svc:8a0276306d7022c16b79656ca45db9121e04fb47
          imagePullPolicy: IfNotPresent
          readinessProbe:
            failureThreshold: 10
            initialDelaySeconds: 5
            periodSeconds: 5
            successThreshold: 1
            tcpSocket:
              port: 8888
            timeoutSeconds: 1
          resources:
            limits:
              cpu: 100m
              memory: 500Mi
            requests:
              cpu: 100m
              memory: 500Mi
          volumeMounts:
            - mountPath: /etc/core-svc
              name: core-svc-config
              readOnly: true
            - mountPath: /kube
              name: infra-kubeconfig
      serviceAccountName: central
      volumes:
        - configMap:
            name: dbaas-core-svc
          name: core-svc-config
        - secret:
            secretName: core-svc-infra-kubeconfig
          name: infra-kubeconfig
