adamant-kite-43734
09/06/2024, 2:48 PMsquare-orange-60123
09/06/2024, 5:14 PMgifted-breakfast-73755
09/06/2024, 10:13 PMgifted-breakfast-73755
09/12/2024, 10:51 PMgifted-breakfast-73755
09/12/2024, 10:53 PMsquare-orange-60123
09/13/2024, 6:38 PMc-
is the v3 cluster name. You can view these objects in your local cluster by going to local -> more resources -> rancher -> mgmt clusters where the ID will match the name you see in the v3 call. These APIs aren't designed for users to directly use, hence the lack of documentation and support around v1 api.
more on 'why is status.ClusterName' not there in the response when you set the clusterName on your v1 object
Status is its own object of the cluster. meaning that when you update the name of the cluster, status doesn't get that update until after the create/update command is sent. So after you create your v1 cluster, you should then get it from rancher once its created.
But you can run into race conditions, because rancher is actually updating those resources like its status behind the scenes after you 'create' the cluster, then rancher will update the schema of the cluster, if that makes sense.
tldr:
so to put that together, you'd have to create the v1 cluster, then poll the new object in rancher until Status.ClusterName is populated. If you're wanting the kubeConfig, you should also poll until the status of the cluster is active so that you'll have a valid kubeConfig when downloaded. Use status.clusterName as the ID in v1/management.cattle.io.clusters/c-m-numbers?action=generateKubeconfig
and you should be able to download it.gifted-breakfast-73755
09/13/2024, 7:15 PMGET /v1/provisioning.cattle.io.clusters/{clusterId}
until metadata.state.transitioning
was not true
and then I check metadata.state.name
to make sure it's active
. Once it's active I grab status.clusterName
like you said and at that point it is set so I'll go with that.
A couple followup questions for you:
1. I assumed the v3 API was newer than the v1 API but since RKE1 cluster creation uses v3 and RKE2 cluster creation uses v1, does that mean v1 is newer despite the name?
2. To confirm, there is no way to control the value of status.clusterName
and that will always be generated?
3. status.clusterName
is the only key that can be used to download the kubeconfig, correct?square-orange-60123
09/13/2024, 7:17 PMgifted-breakfast-73755
09/13/2024, 7:17 PMsquare-orange-60123
09/13/2024, 7:20 PMgifted-breakfast-73755
09/13/2024, 7:25 PMsquare-orange-60123
09/13/2024, 7:27 PMgifted-breakfast-73755
09/13/2024, 7:27 PMkubectl
commands using the downloaded kubeconfig file wouldn't work and we found that it was a timing issues where even though the cluster was active the nodes were not ready so we also added in polling of GET /v3/clusters/{clusterId}/nodes
and waited until all nodes had an active state which worked well for RKE1 and the v3 API but I don't know what the equivalent would be for the v1 API...gifted-breakfast-73755
09/13/2024, 7:28 PMsquare-orange-60123
09/13/2024, 7:29 PMview in api
option in the UI is great for finding the new resource in v1 coming from v3.
for nodes, its v1/cluster.x-k8s.io.machines/fleet-default/your_node_name
gifted-breakfast-73755
09/13/2024, 7:35 PM/v1/cluster.x-k8s.io.machines/fleet-default/{machinePoolName}
so is that would I would need to check or would I need to drill down to individual nodes/machines within the machine pool in case the size of the pool is greater than 1?square-orange-60123
09/13/2024, 7:38 PMmachines
at this level.square-orange-60123
09/13/2024, 7:38 PM<pool_name>-<generated_name>
gifted-breakfast-73755
09/13/2024, 7:44 PM/v1/cluster.x-k8s.io.machines/fleet-default/{nodeName}
to view an individual node and it wasn't found. I can view the machine pool at /v1/cluster.x-k8s.io.machines/fleet-default/{machinePoolName}
.... I think I just found it by drilling down in the Rancher UI. Looks like it's /k8s/clusters/{status.clusterName}/v1/nodes/{nodeName}
?gifted-breakfast-73755
09/13/2024, 7:44 PMsquare-orange-60123
09/13/2024, 7:45 PMgifted-breakfast-73755
09/13/2024, 7:45 PMtest-cluster-control-1b46842a-l5pbb
square-orange-60123
09/13/2024, 7:45 PMgifted-breakfast-73755
09/13/2024, 7:46 PMtest-cluster-control-777f8b57c6xs9gsh-s849g
gifted-breakfast-73755
09/13/2024, 7:50 PM/k8s/clusters/{status.clusterName}/v1/nodes
and checking metadata.state.name
of each node
in the data
array to make sure it's active
. Thanks!square-orange-60123
09/13/2024, 7:52 PMgifted-breakfast-73755
09/13/2024, 8:21 PM/k8s
a third API?square-orange-60123
09/13/2024, 8:22 PMgifted-breakfast-73755
09/13/2024, 8:31 PMsquare-orange-60123
09/13/2024, 8:33 PMgifted-breakfast-73755
09/13/2024, 8:35 PMsquare-orange-60123
09/13/2024, 8:37 PMgifted-breakfast-73755
09/13/2024, 8:48 PMsquare-orange-60123
09/13/2024, 8:55 PMgifted-breakfast-73755
09/13/2024, 9:08 PMgifted-breakfast-73755
09/19/2024, 9:42 PM/v1/rke-machine-config.cattle.io.tritonconfigs/fleet-default
to create a RKE2 cluster from my script it seems that changing metadata.generateName
does not have any impact. For example, when I viewed the request that Rancher UI sent it included the cluster name so I removed that from metadata.generateName
but the node names still end up prefixed by the cluster name. Any ideas?gifted-breakfast-73755
09/19/2024, 9:44 PMsquare-orange-60123
09/20/2024, 8:05 PMgifted-breakfast-73755
09/21/2024, 3:15 AM