Skip to content

Commit 72984ec

Browse files
committed
chore: adopt kubernetes recommand label
1 parent 4133d1d commit 72984ec

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: prow.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -872,10 +872,17 @@ install_snapshot_controller() {
872872
cnt=0
873873
expected_running_pods=$(kubectl apply --dry-run=client -o "jsonpath={.spec.replicas}" -f "$SNAPSHOT_CONTROLLER_YAML")
874874
expected_namespace=$(kubectl apply --dry-run=client -o "jsonpath={.metadata.namespace}" -f "$SNAPSHOT_CONTROLLER_YAML")
875-
while [ "$(kubectl get pods -n "$expected_namespace" -l app=snapshot-controller | grep 'Running' -c)" -lt "$expected_running_pods" ]; do
875+
expect_key='app\.kubernetes\.io/name'
876+
expected_label=$(kubectl apply --dry-run=client -o "jsonpath={.spec.template.metadata.labels['$expect_key']}" -f "$SNAPSHOT_CONTROLLER_YAML")
877+
if [ -z "${expected_label}" ]; then
878+
expect_key='app'
879+
expected_label=$(kubectl apply --dry-run=client -o "jsonpath={.spec.template.metadata.labels['$expect_key']}" -f "$SNAPSHOT_CONTROLLER_YAML")
880+
fi
881+
expect_key=${expect_key//\\/}
882+
while [ "$(kubectl get pods -n "$expected_namespace" -l "$expect_key"="$expected_label" | grep 'Running' -c)" -lt "$expected_running_pods" ]; do
876883
if [ $cnt -gt 30 ]; then
877884
echo "snapshot-controller pod status:"
878-
kubectl describe pods -n "$expected_namespace" -l app=snapshot-controller
885+
kubectl describe pods -n "$expected_namespace" -l "$expect_key"="$expected_label"
879886
echo >&2 "ERROR: snapshot controller not ready after over 5 min"
880887
exit 1
881888
fi

0 commit comments

Comments
 (0)