# Boskos cleaner is needed to allow resources created out of dynamic resource lifecycle to
# be deleted.
# It is responsible for checking if resources that were created based on
# dynamic resource lifecycles have child resources defined in their userdata and if yes,
# mark those as to be deleted as well.
# Afterwards the resources are put into tombstone state which makes boskos delete them
# the next time it syncs its config.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: boskos-cleaner
  labels:
    app: prow
    component: boskos-cleaner
  namespace: ci
spec:
  replicas: 1
  selector:
    matchLabels:
      component: boskos-cleaner
  template:
    metadata:
      labels:
        app: prow
        component: boskos-cleaner
    spec:
      serviceAccountName: boskos
      terminationGracePeriodSeconds: 300
      containers:
      - name: boskos-cleaner
        image: gcr.io/k8s-prow/boskos/cleaner:v20200414-0c2810cf0
        args:
        - --boskos-url=http://boskos
        - --use-v2-implementation=true
        - --namespace=$(namespace)
        - --log-level=debug
        env:
        - name: namespace
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
