Skip to content

Commit 29a5c76

Browse files
authored
Merge pull request #228 from mowangdk/chore/adopt_kubernetes_recommand_labels
chore: adopt kubernetes recommand label
2 parents 1df23db + 72984ec commit 29a5c76

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
@@ -875,10 +875,17 @@ install_snapshot_controller() {
875875
cnt=0
876876
expected_running_pods=$(kubectl apply --dry-run=client -o "jsonpath={.spec.replicas}" -f "$SNAPSHOT_CONTROLLER_YAML")
877877
expected_namespace=$(kubectl apply --dry-run=client -o "jsonpath={.metadata.namespace}" -f "$SNAPSHOT_CONTROLLER_YAML")
878-
while [ "$(kubectl get pods -n "$expected_namespace" -l app=snapshot-controller | grep 'Running' -c)" -lt "$expected_running_pods" ]; do
878+
expect_key='app\.kubernetes\.io/name'
879+
expected_label=$(kubectl apply --dry-run=client -o "jsonpath={.spec.template.metadata.labels['$expect_key']}" -f "$SNAPSHOT_CONTROLLER_YAML")
880+
if [ -z "${expected_label}" ]; then
881+
expect_key='app'
882+
expected_label=$(kubectl apply --dry-run=client -o "jsonpath={.spec.template.metadata.labels['$expect_key']}" -f "$SNAPSHOT_CONTROLLER_YAML")
883+
fi
884+
expect_key=${expect_key//\\/}
885+
while [ "$(kubectl get pods -n "$expected_namespace" -l "$expect_key"="$expected_label" | grep 'Running' -c)" -lt "$expected_running_pods" ]; do
879886
if [ $cnt -gt 30 ]; then
880887
echo "snapshot-controller pod status:"
881-
kubectl describe pods -n "$expected_namespace" -l app=snapshot-controller
888+
kubectl describe pods -n "$expected_namespace" -l "$expect_key"="$expected_label"
882889
echo >&2 "ERROR: snapshot controller not ready after over 5 min"
883890
exit 1
884891
fi

0 commit comments

Comments
 (0)