@@ -313,9 +313,9 @@ function label_ns_and_related() {
313313
314314 # Label the Zen Service
315315 if [[ $NO_OLM == " false" ]]; then
316- ${OC} label customresourcedefinition zenservices.zen.cpd.ibm.com foundationservices.cloudpak.ibm.com=zen --overwrite=true 2> /dev/null
316+ ${OC} label customresourcedefinition zenservices.zen.cpd.ibm.com zenextensions.zen.cpd.ibm.com foundationservices.cloudpak.ibm.com=zen --overwrite=true 2> /dev/null
317317 else
318- ${OC} label customresourcedefinition zenservices.zen.cpd.ibm.com foundationservices.cloudpak.ibm.com=zen-chart --overwrite=true 2> /dev/null
318+ ${OC} label customresourcedefinition zenservices.zen.cpd.ibm.com zenextensions.zen.cpd.ibm.com foundationservices.cloudpak.ibm.com=zen-cluster --overwrite=true 2> /dev/null
319319 fi
320320 zen_services=$( ${OC} get zenservice -n " $namespace " -o custom-columns=NAME:.metadata.name --no-headers)
321321 while IFS= read -r zen_service; do
@@ -414,14 +414,22 @@ function label_nss(){
414414 ${OC} label subscriptions.operators.coreos.com $nss_pm foundationservices.cloudpak.ibm.com=subscription -n $OPERATOR_NS --overwrite=true 2> /dev/null
415415 ${OC} label customresourcedefinition namespacescopes.operator.ibm.com foundationservices.cloudpak.ibm.com=crd --overwrite=true 2> /dev/null
416416 else
417- # TODO label the cluster scoped resources, label them denoting cluster scoped somehow
418- # clusterrolebinding
419- # clusterrole
420- # crd
417+ # cluster scoped resources
418+ ${OC} label clusterrole ibm-namespace-scope-operator foundationservices.cloudpak.ibm.com=nss-cluster --overwrite=true 2> /dev/null
419+ ${OC} label clusterrolebinding ibm-namespace-scope-operator foundationservices.cloudpak.ibm.com=nss-cluster --overwrite=true 2> /dev/null
421420 ${OC} label customresourcedefinition namespacescopes.operator.ibm.com foundationservices.cloudpak.ibm.com=nss-cluster --overwrite=true 2> /dev/null
422- # TODO get and label helm secret
423- # Label deployment
421+ nss_cluster_release_name=$( ${OC} get crd namespacescopes.operator.ibm.com -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-name}' --ignore-not-found)
422+ nss_cluster_release_namespace=$( ${OC} get crd namespacescopes.operator.ibm.com -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-namespace}' --ignore-not-found)
423+ ${OC} label secret sh.helm.release.v1.$nss_cluster_release_name .v1 -n $nss_cluster_release_namespace foundationservices.cloudpak.ibm.com=nss-cluster --overwrite=true 2> /dev/null
424+ # namespace scoped resources
425+ ${OC} label deployment ibm-namespace-scope-operator foundationservices.cloudpak.ibm.com=nss -n $OPERATOR_NS --overwrite=true 2> /dev/null
426+ nss_release_name=$( ${OC} get deploy ibm-namespace-scope-operator -n $OPERATOR_NS -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-name}' --ignore-not-found)
427+ nss_release_namespace=$( ${OC} get deploy ibm-namespace-scope-operator -n $OPERATOR_NS -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-namespace}' --ignore-not-found)
428+ ${OC} label secret sh.helm.release.v1.$nss_release_name .v1 -n $nss_release_namespace foundationservices.cloudpak.ibm.com=nss --overwrite=true 2> /dev/null
429+ ${OC} label role ibm-namespace-scope-operator -n $OPERATOR_NS foundationservices.cloudpak.ibm.com=nss --overwrite=true 2> /dev/null
430+ ${OC} label rolebinding ibm-namespace-scope-operator -n $OPERATOR_NS foundationservices.cloudpak.ibm.com=nss --overwrite=true 2> /dev/null
424431 fi
432+
425433 # The following resources are labeled with 'nss' are bundled together for backup
426434 ${OC} label namespacescopes.operator.ibm.com common-service foundationservices.cloudpak.ibm.com=nss -n $OPERATOR_NS --overwrite=true 2> /dev/null
427435 ${OC} label serviceaccount ibm-namespace-scope-operator foundationservices.cloudpak.ibm.com=nss -n $OPERATOR_NS --overwrite=true 2> /dev/null
@@ -450,16 +458,15 @@ function label_helm_cluster_scope(){
450458 title " Begin labeling cluster scoped resources installed via helm..."
451459 # TODO get name of helm secret for each chart
452460 # odlm cluster resources (crds)
453- ${OC} label crd operandbindinfos.operator.ibm.com operandconfigs.operator.ibm.com operandregistries.operator.ibm.com foundationservices.cloudpak.ibm.com=odlm-cluster --overwrite=true 2> /dev/null
461+ ${OC} label crd operandbindinfos.operator.ibm.com operandconfigs.operator.ibm.com operandregistries.operator.ibm.com operandrequests.operator.ibm.com operatorconfigs.operator.ibm.com foundationservices.cloudpak.ibm.com=odlm-cluster --overwrite=true 2> /dev/null
454462 # helm secret
455463 odlm_release_name=$( ${OC} get crd operandbindinfos.operator.ibm.com -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-name}' --ignore-not-found)
456464 odlm_release_namespace=$( ${OC} get crd operandbindinfos.operator.ibm.com -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-namespace}' --ignore-not-found)
457465 ${OC} label secret sh.helm.release.v1.$odlm_release_name .v1 -n $odlm_release_namespace foundationservices.cloudpak.ibm.com=odlm-cluster --overwrite=true 2> /dev/null
458466
459- # cs operator cluster resources (crds, clusterrole, clusterrolebinding)
460- ${OC} label crd commonservices.operator.ibm.com foundationservices.cloudpak.ibm.com=cs-op-cluster --overwrite=true 2> /dev/null
461- ${OC} label clusterrole ibm-common-service-operator foundationservices.cloudpak.ibm.com=cs-op-cluster --overwrite=true 2> /dev/null
462- ${OC} label clusterrolebinding ibm-common-service-operator foundationservices.cloudpak.ibm.com=cs-op-cluster --overwrite=true 2> /dev/null
467+ # cs operator cluster resources (crds, clusterrole, clusterrolebinding), crd covered elsewhere in script
468+ ${OC} label clusterrole ibm-common-service-operator foundationservices.cloudpak.ibm.com=cs-cluster --overwrite=true 2> /dev/null
469+ ${OC} label clusterrolebinding ibm-common-service-operator foundationservices.cloudpak.ibm.com=cs-cluster --overwrite=true 2> /dev/null
463470 cs_release_name=$( ${OC} get crd commonservices.operator.ibm.com -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-name}' --ignore-not-found)
464471 cs_release_namespace=$( ${OC} get crd commonservices.operator.ibm.com -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-namespace}' --ignore-not-found)
465472 ${OC} label secret sh.helm.release.v1.$cs_release_name .v1 -n $cs_release_namespace foundationservices.cloudpak.ibm.com=cs-cluster --overwrite=true 2> /dev/null
@@ -504,9 +511,7 @@ function label_helm_cluster_scope(){
504511
505512function label_helm_namespace_scope(){
506513 title " Begin labeling namespace scoped resources installed via helm..."
507- # probably best to label going through the namespaces from the start
508514 # label rbac and resources in operator and services namespace first
509- # TODO get name of helm secret for each chart
510515 # odlm
511516 ${OC} label deploy operand-deployment-lifecycle-manager foundationservices.cloudpak.ibm.com=odlm-chart -n $OPERATOR_NS --overwrite=true 2> /dev/null
512517 ${OC} label serviceaccount operand-deployment-lifecycle-manager foundationservices.cloudpak.ibm.com=odlm-chart -n $OPERATOR_NS --overwrite=true 2> /dev/null
@@ -555,23 +560,25 @@ function label_helm_namespace_scope(){
555560 # edb
556561 deploy=$( ${OC} get deploy -n $OPERATOR_NS | grep postgresql-operator-controller-manager | awk ' {print $1}' )
557562 ${OC} label deployment $deploy foundationservices.cloudpak.ibm.com=edb-chart -n $OPERATOR_NS --overwrite=true 2> /dev/null
563+ ${OC} label configmap cloud-native-postgresql-image-list postgresql-operator-default-monitoring foundationservices.cloudpak.ibm.com=edb-chart -n $OPERATOR_NS --overwrite=true 2> /dev/null
564+ ${OC} label service postgresql-operator-webhook-service foundationservices.cloudpak.ibm.com=edb-chart -n $OPERATOR_NS --overwrite=true 2> /dev/null
558565 ${OC} label serviceaccount postgresql-operator-manager foundationservices.cloudpak.ibm.com=edb-chart -n $OPERATOR_NS --overwrite=true 2> /dev/null
559566 ${OC} label role postgresql-operator-controller-manager foundationservices.cloudpak.ibm.com=edb-chart -n $OPERATOR_NS --overwrite=true 2> /dev/null
560567 ${OC} label rolebinding postgresql-operator-controller-manager foundationservices.cloudpak.ibm.com=edb-chart -n $OPERATOR_NS --overwrite=true 2> /dev/null
561568 ${OC} label role postgresql-operator-controller-manager foundationservices.cloudpak.ibm.com=edb-chart -n $SERVICES_NS --overwrite=true 2> /dev/null
562569 ${OC} label rolebinding postgresql-operator-controller-manager foundationservices.cloudpak.ibm.com=edb-chart -n $SERVICES_NS --overwrite=true 2> /dev/null
563- edb_release_name=$( ${OC} get deploy postgresql-operator-controller-manager -n $OPERATOR_NS -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-name}' --ignore-not-found)
564- edb_release_namespace=$( ${OC} get deploy postgresql-operator-controller-manager -n $OPERATOR_NS -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-namespace}' --ignore-not-found)
570+ edb_release_name=$( ${OC} get deploy $deploy -n $OPERATOR_NS -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-name}' --ignore-not-found)
571+ edb_release_namespace=$( ${OC} get deploy $deploy -n $OPERATOR_NS -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-namespace}' --ignore-not-found)
565572 ${OC} label secret sh.helm.release.v1.$edb_release_name .v1 -n $edb_release_namespace foundationservices.cloudpak.ibm.com=edb-chart --overwrite=true 2> /dev/null
566573
567574 # zen
568575 ${OC} label deploy ibm-zen-operator foundationservices.cloudpak.ibm.com=zen-chart -n $OPERATOR_NS --overwrite=true 2> /dev/null
569576 # zenservice covered in label_ns_and_related function
570577 ${OC} label role ibm-zen-operator-role foundationservices.cloudpak.ibm.com=zen-chart -n $OPERATOR_NS --overwrite=true 2> /dev/null
571- ${OC} label role ibm-zen-operator-rolebinding foundationservices.cloudpak.ibm.com=zen-chart -n $OPERATOR_NS --overwrite=true 2> /dev/null
578+ ${OC} label rolebinding ibm-zen-operator-rolebinding foundationservices.cloudpak.ibm.com=zen-chart -n $OPERATOR_NS --overwrite=true 2> /dev/null
572579 ${OC} label serviceaccount ibm-zen-operator-serviceaccount foundationservices.cloudpak.ibm.com=zen-chart -n $OPERATOR_NS --overwrite=true 2> /dev/null
573580 ${OC} label role ibm-zen-operator-role foundationservices.cloudpak.ibm.com=zen-chart -n $SERVICES_NS --overwrite=true 2> /dev/null
574- ${OC} label role ibm-zen-operator-rolebinding foundationservices.cloudpak.ibm.com=zen-chart -n $SERVICES_NS --overwrite=true 2> /dev/null
581+ ${OC} label rolebinding ibm-zen-operator-rolebinding foundationservices.cloudpak.ibm.com=zen-chart -n $SERVICES_NS --overwrite=true 2> /dev/null
575582 zen_release_name=$( ${OC} get deploy ibm-zen-operator -n $OPERATOR_NS -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-name}' --ignore-not-found)
576583 zen_release_namespace=$( ${OC} get deploy ibm-zen-operator -n $OPERATOR_NS -o jsonpath=' {.metadata.annotations.meta\.helm\.sh/release-namespace}' --ignore-not-found)
577584 ${OC} label secret sh.helm.release.v1.$zen_release_name .v1 -n $zen_release_namespace foundationservices.cloudpak.ibm.com=zen-chart --overwrite=true 2> /dev/null
@@ -595,14 +602,18 @@ function label_helm_namespace_scope(){
595602 # ui
596603 ${OC} label role ibm-commonui-operator foundationservices.cloudpak.ibm.com=ui-chart -n $namespace --overwrite=true 2> /dev/null
597604 ${OC} label rolebinding ibm-commonui-operator foundationservices.cloudpak.ibm.com=ui-chart -n $namespace --overwrite=true 2> /dev/null
598-
599605
606+ # edb
607+ ${OC} label role postgresql-operator-controller-manager foundationservices.cloudpak.ibm.com=edb-chart -n $namespace --overwrite=true 2> /dev/null
608+ ${OC} label rolebinding postgresql-operator-controller-manager foundationservices.cloudpak.ibm.com=edb-chart -n $namespace --overwrite=true 2> /dev/null
609+
600610 # zen
601611 ${OC} label role ibm-zen-operator-role foundationservices.cloudpak.ibm.com=zen-chart -n $namespace --overwrite=true 2> /dev/null
602612 ${OC} label rolebinding ibm-zen-operator-rolebinding foundationservices.cloudpak.ibm.com=zen-chart -n $namespace --overwrite=true 2> /dev/null
603613 done
604614 fi
605615
616+ success " Namespace scoped charts labeled."
606617}
607618
608619# ---------- Info functions ----------#
0 commit comments