apiVersion: apps/v1
kind: Deployment
metadata:
  name: audit-log-scheduler
  labels:
    control-plane: audit-log-scheduler
spec:
  selector:
    matchLabels:
      control-plane: audit-log-scheduler
  replicas: 1    
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        control-plane: audit-log-scheduler
      annotations:
        prometheus.io/path: /metrics
        prometheus.io/port: "9090"
        prometheus.io/scrape: "true"
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: serverless.tidbcloud.com/node
                operator: In
                values:
                - general
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchLabels:
                control-plane: audit-log-scheduler
            topologyKey: kubernetes.io/hostname
      containers:
      - command:
        - /audit-log
        - scheduler
        args:
        - --component-name=audit-log-scheduler
        image: audit-log:latest
        imagePullPolicy: IfNotPresent
        name: audit-log-scheduler
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
          initialDelaySeconds: 10
          periodSeconds: 20
        readinessProbe:
          httpGet:
            path: /healthz
            port: 8080
          initialDelaySeconds: 10
          periodSeconds: 20
        resources:
          requests:
            cpu: 100m
            memory: 256Mi
          limits:
            cpu: 4000m
            memory: 8Gi
      tolerations:
      - key: serverless.tidbcloud.com/node
        operator: Equal
        value: general
        effect: NoSchedule
