Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doctl k8s cluster get <clustername> not working for cluster with long name #461

praveenvp07 opened this issue Jun 4, 2019 · 1 comment


Copy link

@praveenvp07 praveenvp07 commented Jun 4, 2019

when I am creating a cluster with a long name "doctl k8s cluster get $CLUSTER" not working, but in list command it is showing the cluster

doctl k8s cluster get $CLUSTER

Error: GET 404 cluster not found

doctl k8s cluster list

ID Name Region Version Status Node Pools
c4fbbc63-9ebf-4b0e-8ec2-4df84549e3d4 f8291060b73f4fa7b60586fe51a1d862 blr1 1.14.1-do.3 running f8291060b73f4fa7b60586fe51a1d862-default-pool

@andrewsomething andrewsomething added the bug label Jun 6, 2019

This comment has been minimized.

Copy link

@andrewsomething andrewsomething commented Jun 6, 2019

Hi @praveenvp07 Thanks for the report.

We allow up to 64 characters in the name for a Kubernetes cluster, and doctl k8s cluster get does work with a name that long:

$ doctl k8s cluster get thisisakubernetesclusterwithaverrylongnameaslongasweallowittobe
ID                                      Name                                                               Region    Version        Auto Upgrade    Status          Endpoint    IPv4    Cluster Subnet    Service Subnet    Tags                                            Created At                       Updated At                       Node Pools
21464f77-42fc-4a32-9aa4-a101843e94c0    thisisakubernetesclusterwithaverrylongnameaslongasweallowittobe    nyc1      1.14.1-do.3    false           provisioning                   k8s,k8s:21464f77-42fc-4a32-9aa4-a101843e94c0    2019-06-06 19:28:09 +0000 UTC    2019-06-06 19:28:19 +0000 UTC    pool-v5ju1cmsh

The issue here seem to be that we use uuid.Parse to determine if the user supplied a name or an ID as the argument:


Lines 1515 to 1517 in 2573fa6

func looksLikeUUID(str string) bool {
return uuid.Parse(str) != nil

This is incorrectly determining that your cluster's name is actually its ID. Here's a test case demonstrating the issue:

func TestClusterByIDorName(t *testing.T) {
	tests := []struct {
		name string
		want bool
			name: "21464f77-42fc-4a32-9aa4-a101843e94c0",
			want: true,
			name: "my-cluster",
			want: false,
			name: "f8291060b73f4fa7b60586fe51a1d862",
			want: false,

	for _, tt := range tests {
		t.Run(, func(t *testing.T) {
			assert.EqualValues(t, tt.want, looksLikeUUID(


--- FAIL: TestClusterByIDorName (0.00s)
    --- FAIL: TestClusterByIDorName/f8291060b73f4fa7b60586fe51a1d862 (0.00s)
            	Error Trace:	kubernetes_test.go:876
            	Error:      	Not equal: 
            	            	expected: false
            	            	actual  : true
            	Test:       	TestClusterByIDorName/f8291060b73f4fa7b60586fe51a1d862
@bentranter bentranter closed this in 5b808ab Nov 7, 2019
bentranter added a commit that referenced this issue Nov 7, 2019
Updated looksLikeUUID to only match hyphenated UUIDs (Fixes #461)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.