@@ -62,24 +62,24 @@ function print_help() {
62
62
function check_pod_status_ready() {
63
63
# Wait for the deployment rollout to complete before trying to list the pods
64
64
# to ensure that only pods corresponding to the new version is considered.
65
- ${KUBECTL} rollout status deploy -n ${NAMESPACE_PREFIX} system --timeout=5m
65
+ ${KUBECTL} rollout status deploy -n openshift-gitops-operator --timeout=5m
66
66
if [ $? -ne 0 ]; then
67
67
echo " [INFO] Deployments did not reach healthy state within 5m. Rolling back"
68
68
else
69
69
echo " [INFO] Deployments reached healthy state."
70
70
return 0
71
71
fi
72
72
73
- pod_name=$( ${KUBECTL} get pods --no-headers --field-selector=" status.phase!=Succeeded" -o custom-columns=" :metadata.name" -n ${NAMESPACE_PREFIX} system | grep " ${1} " ) ;
73
+ pod_name=$( ${KUBECTL} get pods --no-headers --field-selector=" status.phase!=Succeeded" -o custom-columns=" :metadata.name" -n openshift-gitops-operator | grep " ${1} " ) ;
74
74
if [ -z " $pod_name " ]; then
75
75
echo " [WARN] Ignoring empty pod name"
76
76
return 0
77
77
fi
78
78
echo " [DEBUG] Pod name : $pod_name " ;
79
- ${KUBECTL} wait pod --for=condition=Ready $pod_name -n ${NAMESPACE_PREFIX} system --timeout=150s;
79
+ ${KUBECTL} wait pod --for=condition=Ready $pod_name -n ${NAMESPACE} --timeout=150s;
80
80
if [ $? -ne 0 ]; then
81
81
echo " [INFO] Pod '$pod_name ' failed to become Ready in desired time. Logs from the pod:"
82
- ${KUBECTL} logs $pod_name -n ${NAMESPACE_PREFIX} system --all-containers;
82
+ ${KUBECTL} logs $pod_name -n ${NAMESPACE} --all-containers;
83
83
echo " [ERROR] Install/Upgrade failed. Performing rollback" ;
84
84
rollback
85
85
return 1
@@ -455,7 +455,7 @@ function migrate_olm_installation() {
455
455
fi
456
456
apply_kustomize_manifests
457
457
# Check pod status if it becomes ready
458
- check_pod_status_ready gitops-operator-controller-manager
458
+ check_pod_status_ready openshift- gitops-operator-controller-manager
459
459
460
460
if [ $? -eq 0 ]; then
461
461
# Non OLM installation is successful and its safe to remove the OLM specific
@@ -469,20 +469,20 @@ function migrate_olm_installation() {
469
469
# When migrating from OLM to non OLM installation, deployment created by the OLM operator
470
470
# must be scaled down to avoid 2 conflicting operators operating on the same CR.
471
471
function scale_down_olm_deploy() {
472
- ${KUBECTL} scale deploy/gitops-operator-controller-manager -n openshift-operators --replicas=0
472
+ ${KUBECTL} scale deploy/openshift- gitops-operator-controller-manager -n ${NAMESPACE} --replicas=0
473
473
}
474
474
475
475
# If migration to non OLM installation fails, revert to OLM based installation
476
476
# by scaling back the OLM created deployments from 0 to 1.
477
477
# Note: Rollback is possible only if the corresponding Subscription and ClusterServiceVersion objects are available.
478
478
function rollback_to_olm() {
479
- ${KUBECTL} scale deploy/gitops-operator-controller-manager -n openshift-operators --replicas=1
479
+ ${KUBECTL} scale deploy/openshift- gitops-operator-controller-manager -n ${NAMESPACE} --replicas=1
480
480
}
481
481
482
482
# Deletes the subscription for openshift-gitops-operator
483
483
function remove_subscription() {
484
484
# Delete the gitops subscription
485
- ${KUBECTL} delete subscription openshift-gitops-operator -n openshift-operators
485
+ ${KUBECTL} delete subscription openshift-gitops-operator -n ${NAMESPACE}
486
486
}
487
487
488
488
# Deletes the ClusterServiceVersion Object from the system
@@ -493,21 +493,21 @@ function remove_installed_csv() {
493
493
echo " [INFO] No installed CSV in Subscription"
494
494
return
495
495
fi
496
- ${KUBECTL} delete clusterserviceversion ${installedCSV} -n openshift-operators
496
+ ${KUBECTL} delete clusterserviceversion ${installedCSV} -n ${NAMESPACE}
497
497
}
498
498
499
499
# Waits till the OLM removal is successful.
500
500
function wait_for_olm_removal() {
501
501
# Wait till the operator deployment is completely removed.
502
- ${KUBECTL} wait --for=delete deploy/gitops-operator-controller-manager -n openshift-operators --timeout=60s
502
+ ${KUBECTL} wait --for=delete deploy/openshift- gitops-operator-controller-manager -n ${NAMESPACE} --timeout=60s
503
503
}
504
504
505
505
# Extract the custom configuration set in the Subscription and
506
506
# store the env settings in a file which can be sourced when running
507
507
# the non-OLM installation.
508
508
function extract_custom_env_in_subscription() {
509
509
# Get the GitOps subscription object as yaml
510
- ${KUBECTL} get subscription openshift-gitops-operator -n openshift-operators -o yaml > ${WORK_DIR} /subscription.yaml
510
+ ${KUBECTL} get subscription openshift-gitops-operator -n ${NAMESPACE} -o yaml > ${WORK_DIR} /subscription.yaml
511
511
# check if config.env element is present
512
512
element=$( ${YQ} ' .spec.config.env' ${WORK_DIR} /subscription.yaml)
513
513
if [ " ${element} " == " null" ]; then
0 commit comments