Skip to content

Commit

Permalink
chech operq-control label (#2155)
Browse files Browse the repository at this point in the history
* chech operq label exist or not

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

* update grep

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

---------

Signed-off-by: Allen Li <[email protected]>
  • Loading branch information
qpdpQ authored Aug 22, 2024
1 parent 3ac63e5 commit 4c2206f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cp3pt0-deployment/common/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,10 @@ function update_operator() {
# something (either Open Shift or OLM), so need to use patch
# "~1" is the escape sequence for "/" character
if [ ! -z "$remove_opreq_label" ]; then
${OC} patch subscription.operators.coreos.com ${sub_name} -n ${ns} --type='json' -p='[{"op": "remove", "path": "/metadata/labels/operator.ibm.com~1opreq-control"}]' || warning "Could not patch Subscription ${sub_name} in ${ns} to remove label"
label_exist=$(${OC} get subscription.operators.coreos.com ${sub_name} -n ${ns} -o=jsonpath='{.metadata.labels}' | grep operator.ibm.com/opreq-control || echo false)
if [[ $label_exist != "false" ]]; then
${OC} patch subscription.operators.coreos.com ${sub_name} -n ${ns} --type='json' -p='[{"op": "remove", "path": "/metadata/labels/operator.ibm.com~1opreq-control"}]' || warning "Could not patch Subscription ${sub_name} in ${ns} to remove label"
fi
fi

while [ $retries -gt 0 ]; do
Expand Down

0 comments on commit 4c2206f

Please sign in to comment.