diff --git a/scripts/rancher/cluster-actions.sh b/scripts/rancher/cluster-actions.sh index abd866e..d3fdca6 100644 --- a/scripts/rancher/cluster-actions.sh +++ b/scripts/rancher/cluster-actions.sh @@ -3,18 +3,10 @@ ####################################### # List clusters managed by Rancher -# Arguments: -# Rancher URL -# token -# Examples: -# rancher_list_clusters rancher.random_string.geek xxxxx ####################################### rancher_list_clusters() { - local rancherUrl=$1 - local token=$2 - echo "Listing clusters registered in Rancher..." - curl -s -k "$rancherUrl/v3/clusters" -H "Authorization: Bearer $token" | jq . + kubectl get clusters.provisioning.cattle.io --all-namespaces -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' } ####################################### @@ -22,106 +14,73 @@ rancher_list_clusters() { # Globals: # CLUSTER_ID # Arguments: -# Rancher URL -# token # name # version (Kubernetes) # Examples: -# rancher_create_customcluster rancher.random_string.geek xxxxx demo 'v1.27.16+rke2r1' +# rancher_create_customcluster demo 'v1.27.16+rke2r1' ####################################### rancher_create_customcluster() { - local rancherUrl=$1 - local token=$2 - local name=$3 - local version=$4 + local name=$1 + local version=$2 echo "Creating downstream cluster in Rancher..." - CLUSTER_CONFIG=$(cat <