apiVersion: apps/v1
kind: Deployment
metadata:
  name: pumba
spec:
  replicas: 1
  selector:
    matchLabels:
      name: pumba
  template:
    metadata:
      labels:
        name: pumba
        com.gaiaadm.pumba: "true" # prevent pumba from killing itself
    spec:
      affinity:
        podAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: name
                operator: In
                values:
                - percona-xtradb-cluster-operator
            topologyKey: "kubernetes.io/hostname"
      containers:
        - name: pumba
          image: gaiaadm/pumba:latest
          imagePullPolicy: IfNotPresent
          command: ["/pumba", "--dry-run", "--interval", "2h", "pause", "--duration", "1h", "percona-server-mongodb-operator" ]
          resources:
            requests:
              cpu: 10m
              memory: 5M
            limits:
              cpu: 100m
              memory: 20M
          volumeMounts:
            - name: dockersocket
              mountPath: /var/run/docker.sock
      volumes:
        - hostPath:
            path: /var/run/docker.sock
          name: dockersocket
