diff --git a/Dockerfile b/Dockerfile index d43476fd75..7604a4474a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,9 +24,10 @@ COPY --from=builder workspace/provider-api /usr/local/bin/provider-api COPY --from=builder workspace/onboarding-validation-keys-gen /usr/local/bin/onboarding-validation-keys-gen COPY --from=builder workspace/metrics/deploy/*rules*.yaml /ocs-prometheus-rules/ COPY --from=builder workspace/ux-backend-server /usr/local/bin/ux-backend-server +COPY --from=builder workspace/hack/entrypoint.sh /usr/local/bin/entrypoint -RUN chmod +x /usr/local/bin/ocs-operator /usr/local/bin/provider-api +RUN chmod +x /usr/local/bin/ocs-operator /usr/local/bin/provider-api /usr/local/bin/entrypoint USER operator -ENTRYPOINT ["/usr/local/bin/ocs-operator"] +ENTRYPOINT ["/usr/local/bin/entrypoint"] diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 63babb6d03..0e945344f9 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -23,7 +23,7 @@ spec: serviceAccountName: ocs-operator containers: - command: - - ocs-operator + - entrypoint args: - --enable-leader-election - "--health-probe-bind-address=:8081" diff --git a/deploy/csv-templates/ocs-operator.csv.yaml.in b/deploy/csv-templates/ocs-operator.csv.yaml.in index f4ed25398a..a230eb4102 100644 --- a/deploy/csv-templates/ocs-operator.csv.yaml.in +++ b/deploy/csv-templates/ocs-operator.csv.yaml.in @@ -537,7 +537,7 @@ spec: - --enable-leader-election - --health-probe-bind-address=:8081 command: - - ocs-operator + - entrypoint env: - name: WATCH_NAMESPACE valueFrom: diff --git a/deploy/ocs-operator/manifests/ocs-operator.clusterserviceversion.yaml b/deploy/ocs-operator/manifests/ocs-operator.clusterserviceversion.yaml index 33d9798c30..ecb465f9b9 100644 --- a/deploy/ocs-operator/manifests/ocs-operator.clusterserviceversion.yaml +++ b/deploy/ocs-operator/manifests/ocs-operator.clusterserviceversion.yaml @@ -546,7 +546,7 @@ spec: - --enable-leader-election - --health-probe-bind-address=:8081 command: - - ocs-operator + - entrypoint env: - name: WATCH_NAMESPACE valueFrom: diff --git a/hack/entrypoint.sh b/hack/entrypoint.sh new file mode 100755 index 0000000000..bc58ad148c --- /dev/null +++ b/hack/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +RESTART_EXIT_CODE=42 + +while true; do + ./usr/local/bin/ocs-operator $@ + EXIT_CODE=$? + if [ $EXIT_CODE -ne $RESTART_EXIT_CODE ]; then + exit $EXIT_CODE + fi +done