Skip to content

Commit

Permalink
Review changes from scripts-dev to scripts-adopter (#1384)
Browse files Browse the repository at this point in the history
* add channel to subscription changes (#1371)

Signed-off-by: Ben Luzarraga <[email protected]>

* init checker_tool (#1386)

Signed-off-by: Henry Li <[email protected]>

---------

Signed-off-by: Ben Luzarraga <[email protected]>
Signed-off-by: Henry Li <[email protected]>
Co-authored-by: Ben Luzarraga <[email protected]>
Co-authored-by: Henry Li <[email protected]>
  • Loading branch information
3 people authored Jul 26, 2023
1 parent 2d567c7 commit 3e93941
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
15 changes: 15 additions & 0 deletions checker_tool/check_cpfs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# Licensed Materials - Property of IBM
# Copyright IBM Corporation 2023. All Rights Reserved
# US Government Users Restricted Rights -
# Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
# This is an internal component, bundled with an official IBM product.
# Please refer to that particular license for additional information.

function main() {
echo "This is the main function"
}

main "$@"
9 changes: 5 additions & 4 deletions convert_to_multi_instance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function collect_data() {
cs_operator_channel=$(${OC} get sub ibm-common-service-operator -n ${master_ns} -o yaml | yq ".spec.channel")
info "channel:${cs_operator_channel}"
catalog_source=$(${OC} get sub ibm-common-service-operator -n ${master_ns} -o yaml | yq ".spec.source")
info "catalog_source:${catalog_source}"
info "catalog_source:${catalog_source}"
#this command gets all of the ns listed in requested from namesapce fields
requested_ns=$("${OC}" get configmap -n kube-public -o yaml ${cm_name} | yq '.data[]' | yq '.namespaceMapping[].requested-from-namespace' | awk '{print $2}' | tr '\n' ' ')
Expand Down Expand Up @@ -381,9 +381,10 @@ function cleanupCSOperators(){
local sub=$(${OC} get sub -n ${namespace} | grep ibm-common-service-operator | awk '{print $1}')
${OC} get sub ${sub} -n ${namespace} -o yaml > tmp.yaml
${YQ} -i '.spec.source = "'${catalog_source}'"' tmp.yaml || error "Could not replace catalog source for CS operator in namespace ${namespace}"
${OC} delete sub ${sub} -n ${namespace}
${OC} apply -f tmp.yaml
info "Common Service Operator Subscription in namespace ${namespace} updated to use catalog source ${catalog_source}"
${YQ} -i '.spec.channel = "'${cs_operator_channel}'"' tmp.yaml || error "Could not replace channel for CS operator in namespace ${namespace}"
${YQ} -i 'del(.metadata.creationTimestamp) | del(.metadata.managedFields) | del(.metadata.resourceVersion) | del(.metadata.uid) | del(.status)' tmp.yaml || error "Failed to remove metadata fields from temp cs operator yaml for namespace ${namespace}."
${OC} apply -f tmp.yaml || error "Failed to apply catalogsource and channel changes to cs operator subscription in namespace ${namespace}."
info "Common Service Operator Subscription in namespace ${namespace} updated to use catalog source ${catalog_source} and channel ${cs_operator_channel}."
else
info "No Common Service Operator in namespace ${namespace}. Moving on..."
fi
Expand Down

0 comments on commit 3e93941

Please sign in to comment.