Skip to content

Commit 201efdb

Browse files
authored
exclude internal generated operandrequest from Backup/Restore (#2273)
* stop BR internal generated operandrequest Signed-off-by: Allen Li <[email protected]> * removed duplicate check Signed-off-by: Allen Li <[email protected]> --------- Signed-off-by: Allen Li <[email protected]>
1 parent fc39a63 commit 201efdb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

velero/backup/common-service/label-common-service.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,17 @@ function label_ns_and_related() {
273273
operand_requests=$(${OC} get operandrequest -n "$namespace" -o custom-columns=NAME:.metadata.name --no-headers)
274274
# Loop through each OperandRequest name
275275
while IFS= read -r operand_request; do
276+
# Skip all the operandrequest with ownerreference
277+
ownerReferences=$(${OC} get operandrequest $operand_request -n "$namespace" -o jsonpath='{.metadata.ownerReferences}')
278+
if [[ $ownerReferences != "" ]]; then
279+
continue
280+
fi
281+
# Skip all the operandrequest generate by ODLM
282+
control_by_odlm=$(${OC} get operandrequest $operand_request -n "$namespace" --show-labels --no-headers | grep "operator.ibm.com/opreq-control=true" || echo "false")
283+
if [[ $control_by_odlm != "false" ]]; then
284+
continue
285+
fi
286+
276287
${OC} label operandrequests $operand_request foundationservices.cloudpak.ibm.com=operand -n "$namespace" --overwrite=true 2>/dev/null
277288
done <<< "$operand_requests"
278289

0 commit comments

Comments
 (0)