Skip to content

Commit

Permalink
Update non-olm-install script to setup conversion webhook
Browse files Browse the repository at this point in the history
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
  • Loading branch information
svghadi committed Sep 14, 2023
1 parent e4390f6 commit 753ea9c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions hack/non-olm-install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ The following environment variables can be set to configure various options for
| **DISABLE_DEFAULT_ARGOCD_INSTANCE** | When set to `true`, this will disable the default 'ready-to-use' installation of Argo CD in the `openshift-gitops` namespace. |false |
| **SERVER_CLUSTER_ROLE** |This environment variable enables administrators to configure a common cluster role to use across all of the managed namespaces in the role bindings the operator creates for the Argo CD server. | None |
| **WATCH_NAMESPACE** | namespaces in which Argo applications can be created | None |
| **ENABLE_CONVERSION_WEBHOOK** | This environment variable enables conversion webhook to convert v1alpha1 ArgoCD resources to v1beta1 | true |
### Running the script

#### Usage
Expand Down
16 changes: 12 additions & 4 deletions hack/non-olm-install/install-gitops-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ CONTROLLER_CLUSTER_ROLE=${CONTROLLER_CLUSTER_ROLE:-""}
DISABLE_DEFAULT_ARGOCD_INSTANCE=${DISABLE_DEFAULT_ARGOCD_INSTANCE:-"false"}
SERVER_CLUSTER_ROLE=${SERVER_CLUSTER_ROLE:-""}
WATCH_NAMESPACE=${WATCH_NAMESPACE:-""}
ENABLE_CONVERSION_WEBHOOK=${ENABLE_CONVERSION_WEBHOOK:-"true"}

# Print help message
function print_help() {
Expand Down Expand Up @@ -102,7 +103,7 @@ function rollback_to_previous_image() {
if [ ! -z "${PREV_OPERATOR_IMG}" ]; then
export OPERATOR_IMG=${PREV_OPERATOR_IMG}
prepare_kustomize_files
${KUSTOMIZE} build ${WORK_DIR} | ${KUBECTL} apply -f -
${KUSTOMIZE} build ${WORK_DIR} | ${KUBECTL} apply --server-side=true -f -
echo "[INFO] Operator update operation was unsuccessful!!";
else
echo "[INFO] Installing image for the first time. Nothing to rollback. Quitting..";
Expand Down Expand Up @@ -177,8 +178,10 @@ resources:
- https://github.com/redhat-developer/gitops-operator/config/crd?ref=$GIT_REVISION&timeout=90s
- https://github.com/redhat-developer/gitops-operator/config/rbac?ref=$GIT_REVISION&timeout=90s
- https://github.com/redhat-developer/gitops-operator/config/manager?ref=$GIT_REVISION&timeout=90s
- https://github.com/redhat-developer/gitops-operator/config/webhook?ref=$GIT_REVISION&timeout=90s
patches:
- path: https://raw.githubusercontent.com/redhat-developer/gitops-operator/master/config/default/manager_auth_proxy_patch.yaml
- path: https://raw.githubusercontent.com/redhat-developer/gitops-operator/master/config/default/manager_auth_proxy_patch.yaml
- path: https://raw.githubusercontent.com/redhat-developer/gitops-operator/master/config/default/manager_webhook_patch.yaml
- path: env-overrides.yaml
- path: security-context.yaml" > ${WORK_DIR}/kustomization.yaml
}
Expand Down Expand Up @@ -227,7 +230,9 @@ spec:
- name: SERVER_CLUSTER_ROLE
value: \"${SERVER_CLUSTER_ROLE}\"
- name: WATCH_NAMESPACE
value: \"${WATCH_NAMESPACE}\"" > ${WORK_DIR}/env-overrides.yaml
value: \"${WATCH_NAMESPACE}\"
- name: ENABLE_CONVERSION_WEBHOOK
value: \"${ENABLE_CONVERSION_WEBHOOK}\"" > ${WORK_DIR}/env-overrides.yaml
}

# Create a security context for the containers that are present in the deployment.
Expand Down Expand Up @@ -379,7 +384,7 @@ function apply_kustomize_manifests() {
echo "[INFO] (Attempt ${attempt}) Executing kustomize build command"
${KUSTOMIZE} build ${WORK_DIR} > ${WORK_DIR}/kustomize-build-output.yaml || continue
echo "[INFO] (Attempt ${attempt}) Creating k8s resources from kustomize manifests"
${KUBECTL} apply -f ${WORK_DIR}/kustomize-build-output.yaml && break
${KUBECTL} apply --server-side=true -f ${WORK_DIR}/kustomize-build-output.yaml && break
done
}

Expand Down Expand Up @@ -441,6 +446,9 @@ function print_info() {
if [ ! -z "${WATCH_NAMESPACE}" ]; then
echo "WATCH_NAMESPACE: ${WATCH_NAMESPACE}"
fi
if [ ! -z "${ENABLE_CONVERSION_WEBHOOK}" ]; then
echo "ENABLE_CONVERSION_WEBHOOK: ${ENABLE_CONVERSION_WEBHOOK}"
fi
echo "==========================================="
}

Expand Down

0 comments on commit 753ea9c

Please sign in to comment.