apiVersion: batch/v1 kind: Job metadata: name: fim-persistence-container-patch namespace: fim spec: completions: 1 template: metadata: labels: platform.edge.ncr.com/component: fim-persistence-container-patch annotations: config.linkerd.io/proxy-await: "enabled" spec: restartPolicy: Never serviceAccountName: fim-container-patcher containers: - name: fim-persistence-container-patch image: bzl://cmd/sds/fim/patcher:fim-patcher-container-push command: - /bin/sh - -c args: - | readonly SAMHAIN_PERSISTENCE_NAME="samhain" readonly FIM_NAMESPACE="fim" ALPINE_FIM_INDEX=$(kubectl get persistence samhain -n fim -ojson | jq '[.spec.statefulSet.spec.template.spec.containers[].name] | index("alpine-fim")') if [ "$ALPINE_FIM_INDEX" = "null" ]; then echo "no alpine-fim container found, exiting" curl -X POST http://localhost:4191/shutdown exit 0 fi echo "found container name alpine-fim at $ALPINE_FIM_INDEX, removing via patch" kubectl patch persistence "$SAMHAIN_PERSISTENCE_NAME" -n "$FIM_NAMESPACE" --type='json' -p="[{\"op\": \"remove\", \"path\": \"/spec/statefulSet/spec/template/spec/containers/$ALPINE_FIM_INDEX\"}]" PATCH_EXIT=$? echo "attempting to shutdown linkerd" curl -X POST http://localhost:4191/shutdown exit $PATCH_EXIT imagePullPolicy: IfNotPresent imagePullSecrets: - name: edge-docker-pull-secret