...

Text file src/edge-infra.dev/config/pallets/sds/fim/base/patch-job.yaml

Documentation: edge-infra.dev/config/pallets/sds/fim/base

     1apiVersion: batch/v1
     2kind: Job
     3metadata:
     4  name: fim-persistence-container-patch
     5  namespace: fim
     6spec:
     7  completions: 1
     8  template:
     9    metadata:
    10      labels:
    11        platform.edge.ncr.com/component: fim-persistence-container-patch
    12      annotations:
    13        config.linkerd.io/proxy-await: "enabled"
    14    spec:
    15      restartPolicy: Never
    16      serviceAccountName: fim-container-patcher
    17      containers:
    18      - name: fim-persistence-container-patch
    19        image: bzl://cmd/sds/fim/patcher:fim-patcher-container-push
    20        command:
    21        - /bin/sh
    22        - -c
    23        args:
    24        - |
    25          readonly SAMHAIN_PERSISTENCE_NAME="samhain"
    26          readonly FIM_NAMESPACE="fim"
    27          ALPINE_FIM_INDEX=$(kubectl get persistence samhain -n fim -ojson | jq '[.spec.statefulSet.spec.template.spec.containers[].name] | index("alpine-fim")')
    28
    29          if [ "$ALPINE_FIM_INDEX" = "null" ]; then
    30              echo "no alpine-fim container found, exiting"
    31              curl -X POST http://localhost:4191/shutdown
    32              exit 0
    33          fi
    34
    35          echo "found container name alpine-fim at $ALPINE_FIM_INDEX, removing via patch"
    36          kubectl patch persistence "$SAMHAIN_PERSISTENCE_NAME" -n "$FIM_NAMESPACE" --type='json' -p="[{\"op\": \"remove\", \"path\": \"/spec/statefulSet/spec/template/spec/containers/$ALPINE_FIM_INDEX\"}]"
    37          PATCH_EXIT=$?
    38
    39          echo "attempting to shutdown linkerd"
    40
    41          curl -X POST http://localhost:4191/shutdown
    42
    43          exit $PATCH_EXIT
    44        imagePullPolicy: IfNotPresent
    45      imagePullSecrets:
    46      - name: edge-docker-pull-secret

View as plain text