@@ -11,6 +11,7 @@ function printUsage() {
1111 echo " ./${SCRIPT_NAME} -i|--image <image url>"
1212 echo " Options: "
1313 echo " -i|--image Specify the plugin image to deploy. (default is ${DEFAULT_IMAGE} )"
14+ echo " -c|--certManagerNamespace give the namespace cert manager is installed in, will search for it in the Subscriptions otherwise"
1415 echo " -h|--help Print this message."
1516}
1617
@@ -25,6 +26,11 @@ while [[ $# -gt 0 ]]; do
2526 shift
2627 shift
2728 ;;
29+ -c|--certManagerNamespace)
30+ certManagerNamespace=" $2 "
31+ shift
32+ shift
33+ ;;
2834 -* |--* )
2935 echo " Unknown option $1 "
3036 printUsage
@@ -35,17 +41,21 @@ while [[ $# -gt 0 ]]; do
3541 esac
3642done
3743
38- # find the cert-manager operator namespace, if this can't be retrived there's no
39- # possibility to proceed
40- certManagerNamespace=$( oc get Subscriptions --all-namespaces -ojson | jq -r ' .items[] | select(.spec.name == "cert-manager") | .metadata.namespace' )
44+ # if the user has overridden the certManagerNamespace don't try to search for it
4145if test -z " $certManagerNamespace "
42- then
43- certManagerNamespace=$( oc get Subscriptions --all-namespaces -ojson | jq -r ' .items[] | select(.spec.name == "openshift-cert-manager-operator") | .metadata.namespace' )
46+ then
47+ # find the cert-manager operator namespace, if this can't be retrived there's no
48+ # possibility to proceed
49+ certManagerNamespace=$( oc get Subscriptions --all-namespaces -ojson | jq -r ' .items[] | select(.spec.name == "cert-manager") | .metadata.namespace' )
4450 if test -z " $certManagerNamespace "
4551 then
46- echo " cert-manager's namespace can't be determined, check that it is installed"
47- oc get Subscriptions --all-namespaces
48- exit 1
52+ certManagerNamespace=$( oc get Subscriptions --all-namespaces -ojson | jq -r ' .items[] | select(.spec.name == "openshift-cert-manager-operator") | .metadata.namespace' )
53+ if test -z " $certManagerNamespace "
54+ then
55+ echo " Error: cert-manager's namespace can't be determined"
56+ oc get Subscriptions --all-namespaces
57+ exit 1
58+ fi
4959 fi
5060fi
5161echo " cert-manager's namespace: $certManagerNamespace "
0 commit comments