apiVersion: apps/v1
kind: Deployment
metadata:
  name: tiworkload-agent
  namespace: tiworkload
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      tiworkload/app: tiworkload-agent
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        tiworkload/app: tiworkload-agent
    spec:
      serviceAccountName: tiworkload-agent-sa
      containers:
        - args:
            - --config=/etc/config/tiworkload-agent-config.yaml
          command:
            - /apps/tiworkload-agent
          image: tidbclouddev.azurecr.io/tiworkload/agent:latest
          imagePullPolicy: Always
          livenessProbe:
            failureThreshold: 10
            httpGet:
              path: /ping
              port: 81
              scheme: HTTP
            initialDelaySeconds: 1
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 10
          name: main
          ports:
            - containerPort: 81
              protocol: TCP
          readinessProbe:
            failureThreshold: 10
            httpGet:
              path: /ping
              port: 81
              scheme: HTTP
            initialDelaySeconds: 1
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - mountPath: /etc/config
              name: agent-conf
              readOnly: true
            - mountPath: /apps/workload-exec
              name: agent-workspace
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
        - configMap:
            defaultMode: 420
            name: tiworkload-agent-config
          name: agent-conf
        - name: agent-workspace
          persistentVolumeClaim:
            claimName: tiworkload-agent-pvc
