# services/monitoring/availability-legacy-cleanup-job.yaml
apiVersion: batch/v1
kind: Job
metadata:
  name: atlas-availability-legacy-series-cleanup-v1
  namespace: monitoring
spec:
  activeDeadlineSeconds: 300
  backoffLimit: 2
  template:
    metadata:
      labels:
        app: atlas-availability-legacy-series-cleanup
    spec:
      restartPolicy: Never
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: kubernetes.io/hostname
                    operator: NotIn
                    values:
                      - titan-22
                      - titan-24
      containers:
        - name: cleanup
          image: python:3.12-alpine
          command: ["python", "/scripts/availability_cleanup.py"]
          env:
            - name: VM_URL
              value: http://victoria-metrics-single-server:8428
          resources:
            requests:
              cpu: 25m
              memory: 32Mi
            limits:
              cpu: 250m
              memory: 128Mi
          volumeMounts:
            - name: script
              mountPath: /scripts
              readOnly: true
      volumes:
        - name: script
          configMap:
            name: atlas-availability-cleanup-script
