You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* label length
Signed-off-by: Allen Li <liyuchen223@gmail.com>
* 1
Signed-off-by: Allen Li <liyuchen223@gmail.com>
---------
Signed-off-by: Allen Li <liyuchen223@gmail.com>
Copy file name to clipboardExpand all lines: cp3pt0-deployment/common/utils.sh
+30-10Lines changed: 30 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -279,8 +279,10 @@ function wait_for_certificate() {
279
279
functionwait_for_csv() {
280
280
local namespace=$1
281
281
local package_name=$2
282
-
local condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${package_name}.${namespace}='' -n ${namespace} -o yaml -o jsonpath='{.items[*].status.installedCSV}'"
283
-
local debug_condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${package_name}.${namespace}='' -n ${namespace} -o jsonpath='{.items[*].status.conditions}'"
282
+
local key="${package_name}.${namespace}"
283
+
local length_limited_key=$(echo ${key:0:63})
284
+
local condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${length_limited_key}='' -n ${namespace} -o yaml -o jsonpath='{.items[*].status.installedCSV}'"
285
+
local debug_condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${length_limited_key}='' -n ${namespace} -o jsonpath='{.items[*].status.conditions}'"
284
286
285
287
local retries=180
286
288
local sleep_time=10
@@ -337,8 +339,10 @@ function wait_for_operand_request() {
337
339
functionwait_for_nss_patch() {
338
340
local namespace=$1
339
341
local package_name=$2
342
+
local key="${package_name}.${namespace}"
343
+
local length_limited_key=$(echo ${key:0:63})
340
344
341
-
local sub_name=$(${OC} get subscription.operators.coreos.com -n ${namespace} -l operators.coreos.com/${package_name}.${namespace}='' --no-headers | awk '{print $1}')
345
+
local sub_name=$(${OC} get subscription.operators.coreos.com -n ${namespace} -l operators.coreos.com/${length_limited_key}='' --no-headers | awk '{print $1}')
342
346
local csv_name=$(${OC} get subscription.operators.coreos.com ${sub_name} -n ${namespace} --ignore-not-found -o jsonpath={.status.installedCSV})
343
347
344
348
local condition="${OC} -n ${namespace} get csv ${csv_name} -o jsonpath='{.spec.install.spec.deployments[0].spec.template.spec.containers[0].env[?(@.name==\"WATCH_NAMESPACE\")].valueFrom.configMapKeyRef.name}'| grep 'namespace-scope'"
@@ -507,8 +511,11 @@ function wait_for_operator_upgrade() {
507
511
local package_name=$2
508
512
local channel=$3
509
513
local install_mode=$4
510
-
local condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${package_name}.${namespace}='' -n ${namespace} -o yaml -o jsonpath='{.items[*].status.installedCSV}' | grep -w $channel"
511
-
local debug_condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${package_name}.${namespace}='' -n ${namespace} -o jsonpath='{.items[*].status.conditions}'"
514
+
local key="${package_name}.${namespace}"
515
+
# k8s label name length limit to 64 characters
516
+
local length_limited_key=$(echo ${key:0:63})
517
+
local condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${length_limited_key}='' -n ${namespace} -o yaml -o jsonpath='{.items[*].status.installedCSV}' | grep -w $channel"
518
+
local debug_condition="${OC} get subscription.operators.coreos.com -l operators.coreos.com/${length_limited_key}='' -n ${namespace} -o jsonpath='{.items[*].status.conditions}'"
512
519
513
520
local retries=120
514
521
local sleep_time=20
@@ -1272,8 +1279,10 @@ function update_operator() {
1272
1279
local remove_opreq_label=${7:-}
1273
1280
local retries=5 # Number of retries
1274
1281
local delay=5 # Delay between retries in seconds
1275
-
1276
-
local sub_name=$(${OC} get subscription.operators.coreos.com -n ${ns} -l operators.coreos.com/${package_name}.${ns}='' --no-headers | awk '{print $1}')
1282
+
local key="${package_name}.${ns}"
1283
+
# k8s label name length limit to 64 characters
1284
+
local length_limited_key=$(echo ${key:0:63})
1285
+
local sub_name=$(${OC} get subscription.operators.coreos.com -n ${ns} -l operators.coreos.com/${length_limited_key}='' --no-headers | awk '{print $1}')
1277
1286
if [ -z"$sub_name" ];then
1278
1287
warning "Not found subscription ${package_name} in ${ns}"
1279
1288
return 0
@@ -1407,9 +1416,18 @@ function scale_down() {
1407
1416
local services_ns=$2
1408
1417
local channel=$3
1409
1418
local source=$4
1410
-
local cs_sub=$(${OC} get subscription.operators.coreos.com -n ${operator_ns} -l operators.coreos.com/ibm-common-service-operator.${operator_ns}='' --no-headers | awk '{print $1}')
1419
+
local cs_package="ibm-common-service-operator"
1420
+
local cs_key="${cs_package}.${operator_ns}"
1421
+
# k8s label name length limit to 64 characters
1422
+
local length_limited_cs_key=$(echo ${cs_key:0:63})
1423
+
local cs_sub=$(${OC} get subscription.operators.coreos.com -n ${operator_ns} -l operators.coreos.com/${length_limited_cs_key}='' --no-headers | awk '{print $1}')
1411
1424
local cs_CSV=$(${OC} get subscription.operators.coreos.com ${cs_sub} -n ${operator_ns} --ignore-not-found -o jsonpath={.status.installedCSV})
1412
-
local odlm_sub=$(${OC} get subscription.operators.coreos.com -n ${services_ns} -l operators.coreos.com/ibm-odlm.${services_ns}='' --no-headers | awk '{print $1}')
1425
+
1426
+
local odlm_package="ibm-odlm"
1427
+
local odlm_key="${odlm_package}.${services_ns}"
1428
+
# k8s label name length limit to 64 characters
1429
+
local length_limited_odlm_key=$(echo ${odlm_key:0:63})
1430
+
local odlm_sub=$(${OC} get subscription.operators.coreos.com -n ${services_ns} -l operators.coreos.com/${length_limited_odlm_key}='' --no-headers | awk '{print $1}')
1413
1431
local odlm_CSV=$(${OC} get subscription.operators.coreos.com ${odlm_sub} -n ${services_ns} --ignore-not-found -o jsonpath={.status.installedCSV})
1414
1432
1415
1433
${OC} get subscription.operators.coreos.com ${cs_sub} -n ${operator_ns} -o yaml > /tmp/sub.yaml
@@ -1496,7 +1514,9 @@ function scale_up() {
1496
1514
local services_ns=$2
1497
1515
local package_name=$3
1498
1516
local deployment=$4
1499
-
local sub=$(${OC} get subscription.operators.coreos.com -n ${operator_ns} -l operators.coreos.com/${package_name}.${operator_ns}='' --no-headers | awk '{print $1}')
1517
+
local key="${package_name}.${operator_ns}"
1518
+
local length_limited_key=$(echo ${key:0:63})
1519
+
local sub=$(${OC} get subscription.operators.coreos.com -n ${operator_ns} -l operators.coreos.com/${length_limited_key}='' --no-headers | awk '{print $1}')
1500
1520
local csv=$(${OC} get subscription.operators.coreos.com ${sub} -n ${operator_ns} --ignore-not-found -o jsonpath={.status.installedCSV})
1501
1521
1502
1522
if [[ "$deployment"=="operand-deployment-lifecycle-manager" ]];then
0 commit comments