apiVersion: batch/v1
kind: Job
metadata:
  name: "rootfs-patcher-{{ .Values.global.rootfs_version }}"
spec:
  template:
    spec:
      initContainers:
      - name: bits-waiter
        image: eirini/bits-waiter:{{ .Values.opi.image_tag }}
        imagePullPolicy: IfNotPresent
        command:
        - /bits-waiter
        - --namespace=scf
        - --timeout={{ .Values.opi.rootfs_patcher_timeout }}
      containers:
      - name: patch
        command:
        - /rootfs-patcher
        - --namespace={{ .Values.opi.namespace }}
        - --rootfs-version={{ .Values.global.rootfs_version }}
        image: eirini/rootfs-patcher:{{ .Values.opi.image_tag }}
        imagePullPolicy: IfNotPresent
      restartPolicy: OnFailure
      serviceAccount: opi
      serviceAccountName: opi
