Register downstream clusters script uses cluster id
@@ -44,11 +44,16 @@ EOF
echo -e "4\n" | rancher login "https://$url" --token "$token" --skip-verify
rancher clusters create second --import
+until rancher cluster ls --format json | jq -r 'select(.Name=="second") | .ID' | grep -Eq "c-[a-z0-9]" ; do sleep 1; done
+id=$( rancher cluster ls --format json | jq -r 'select(.Name=="second") | .ID' )
kubectl config use-context "$cluster_downstream"
-rancher cluster import second
-rancher cluster import second | grep curl | sh
+rancher cluster import "$id"
+rancher cluster import "$id" | grep curl | sh
-until rancher cluster list | grep second | grep -q active; do echo waiting for cluster registration; sleep 5; done
+until rancher cluster ls --format json | jq -r 'select(.Name=="second") | .Cluster.state' | grep -q active; do
+ echo waiting for cluster registration
+ sleep 5
+done
kubectl config use-context "$ctx"
