apiVersion: apps/v1
kind: Deployment
metadata:
  name: o11y-agent-control-server
  labels:
    app: o11y-agent-control-server
spec:
  replicas: 0
  selector:
    matchLabels:
      app: o11y-agent-control-server
  template:
    metadata:
      labels:
        app: o11y-agent-control-server
        azure.workload.identity/use: "true"
    spec:
      securityContext:
        fsGroup: 65532
      serviceAccountName: dedicated-regional-server-manager
      containers:
      - name: agent-control-server
        image: tidbclouddev.azurecr.io/tidbcloud/agent-control-server:4fbcba595763425b0e9880de8b2730a522cb7dfb
        args:
          - "--root-config=/etc/root-configs/config.yaml"
          - "--agent-config-templates-dir=/templates"
        volumeMounts:
          - name: root-config
            mountPath: /etc/root-configs
          - name: templates-dedicated-k8s
            mountPath: /templates/dedicated/k8s
          - name: templates-dedicated-k8s-jobs
            mountPath: /templates/dedicated/k8s/jobs
          - name: templates-dedicated-tidbcluster
            mountPath: /templates/dedicated/tidbcluster
        env:
          - name: CONCURRENT_RECONCILES
            value: "1"
          - name: O11Y_AUTH0_CLIENT_ID
            valueFrom:
              secretKeyRef:
                name: o11y-auth0-client
                key: Auth0ClientID
          - name: O11Y_AUTH0_CLIENT_SECRET
            valueFrom:
              secretKeyRef:
                name: o11y-auth0-client
                key: Auth0ClientSecret
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
          limits:
            cpu: 500m
            memory: 500Mi
      volumes:
        - name: root-config
          configMap:
            name: o11y-agent-control-server-root-config
        - name: templates-dedicated-k8s
          configMap:
            name: templates-dedicated-k8s
        - name: templates-dedicated-k8s-jobs
          configMap:
            name: templates-dedicated-k8s-jobs
        - name: templates-dedicated-tidbcluster
          configMap:
            name: templates-dedicated-tidbcluster
