apiVersion: apps/v1
kind: Deployment
metadata:
  name: dataplane-controller
  labels:
    app.kubernetes.io/name: dataplane-controller
    app.kubernetes.io/component: dataplane-controller
    app.kubernetes.io/managed-by: kustomize
    cloud.pingcap.com/bizType: dedicated
spec:
  selector:
    matchLabels:
      app: dataplane-controller
  replicas: 1
  template:
    metadata:
      labels:
        app: dataplane-controller
        cloud.pingcap.com/bizType: dedicated
    spec:
      securityContext:
        runAsNonRoot: true
        seccompProfile:
          type: RuntimeDefault
      containers:
      - args:
        - --log-level=debug
        - --client-mode=true
        - --leader-elect=true
        - --root-config=/etc/configs/root-config.yaml
        - --addon-template-config=/etc/configs/k8s-addon-templates.yaml
        - --infra-template-config=/etc/configs/k8s-infra-templates.yaml
        - --dedicated-template-config=/etc/configs/k8s-dedicated-templates.yaml
        - --dp-template-config=/etc/configs/k8s-dp-templates.yaml
        - --enabled-components=controller
        image: IMAGE_REGISTRY/tidbcloud/dedicated-regional-server:8a354ede66b0527fd75f69b8b2be37438aad7c7c
        name: controller
        ports:
        - containerPort: 8082
          name: metrics
          protocol: TCP
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - "ALL"
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8081
          initialDelaySeconds: 15
          periodSeconds: 20
        readinessProbe:
          httpGet:
            path: /readyz
            port: 8081
          initialDelaySeconds: 5
          periodSeconds: 10
        imagePullPolicy: Always
        volumeMounts:
          - name: root-config
            mountPath: /etc/configs/root-config.yaml
            subPath: root-config.yaml
          - name: addon-template-config
            mountPath: /etc/configs/k8s-addon-templates.yaml
            subPath: k8s-addon-templates.yaml
          - name: infra-template-config
            mountPath: /etc/configs/k8s-infra-templates.yaml
            subPath: k8s-infra-templates.yaml
          - name: dedicated-template-config
            mountPath: /etc/configs/k8s-dedicated-templates.yaml
            subPath: k8s-dedicated-templates.yaml
          - name: dp-template-config
            mountPath: /etc/configs/k8s-dp-templates.yaml
            subPath: k8s-dp-templates.yaml
          - name: account-list
            mountPath: /etc/configs/account-list.yaml
            subPath: account-list.yaml
        resources:
          limits:
            cpu: 1000m
            memory: 4096Mi
          requests:
            cpu: 100m
            memory: 256Mi
      volumes:
        - name: root-config
          configMap:
            name: regional-server-root-config
        - name: addon-template-config
          configMap:
            name: regional-server-addon-template-config
        - name: infra-template-config
          configMap:
            name: regional-server-infra-template-config
        - name: dedicated-template-config
          configMap:
            name: regional-server-dedicated-template-config
        - name: dp-template-config
          configMap:
            name: regional-server-dp-template-config
        - name: account-list
          configMap:
            name: account-list
            items:
              - key: account-list.yaml
                path: account-list.yaml
      serviceAccountName: dataplane-manager
      terminationGracePeriodSeconds: 10
