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

Handle GetCluster 409 response during cluster creation #354

Merged

Conversation

akijakya
Copy link
Contributor

During cluster creation, when polling the cluster using the -w flag.

Q A
Bug fix? no
New feature? yes
API breaks? no
Deprecations? no
Related tickets -
License Apache 2.0

What's in this PR?

Log a "cluster is being created" info message instead of an error when there is a 409 Conflict response polling the cluster with the the -w / --wait flag in the first seconds during cluster creation.

Why?

For PKE (AWS) clusters the cluster creation immediately starts but the secret creation happens later and until the cluster secret is created, the cluster GET response is always going to run into error.

It was logged as a cluster creation failure error by the cli, which was a little bit deceiving.

Additional context

Related to this issue, which was already used for the following examples.

Logs before:

? Do you want to CREATE the cluster "clustername" now? Yes
INFO[0005] cluster is being created
ERRO[0005] failed to create cluster: 409 Conflict (err pipeline.GenericOpenAPIError, request=map[cloud:amazon location:eu-central-1 name:ajaky-test-pke-9 properties:map[pke:map[cri:map[runtime:containerd] kubernetes:map[rbac:map[enabled:true] version:1.19.10] nodepools:[map[autoscaling:false name:master provider:amazon providerConfig:map[autoScalingGroup:map[instanceType:c5.large launchConfigurationName:master name:master size:map[desired:1 max:1 min:1] zones:[eu-west-1]]] roles:[master]] map[autoscaling:true name:pool1 provider:amazon providerConfig:map[autoScalingGroup:map[instanceType:t2.small launchConfigurationName:pool1 name:pool1 size:map[desired:2 max:3 min:2] zones:[eu-west-1]]] roles:[worker]]]]] secretName:aws-scratch-eks], response={"code":409,"message":"Secret has not been created yet","error":"cluster is not ready"}
)
ERRO[0005] failed to create cluster: 409 Conflict (err pipeline.GenericOpenAPIError, request=map[cloud:amazon location:eu-central-1 name:ajaky-test-pke-9 properties:map[pke:map[cri:map[runtime:containerd] kubernetes:map[rbac:map[enabled:true] version:1.19.10] nodepools:[map[autoscaling:false name:master provider:amazon providerConfig:map[autoScalingGroup:map[instanceType:c5.large launchConfigurationName:master name:master size:map[desired:1 max:1 min:1] zones:[eu-west-1]]] roles:[master]] map[autoscaling:true name:pool1 provider:amazon providerConfig:map[autoScalingGroup:map[instanceType:t2.small launchConfigurationName:pool1 name:pool1 size:map[desired:2 max:3 min:2] zones:[eu-west-1]]] roles:[worker]]]]] secretName:aws-scratch-eks], response={"code":409,"message":"Secret has not been created yet","error":"cluster is not ready"}
)
Id  Name
11  clustername
Id  Name
11  clustername
...

Logs after:

? Do you want to CREATE the cluster "clustername" now? Yes
INFO[0003] cluster is being created
INFO[0003] cluster is being created
INFO[0003] cluster is being created
Id  Name
15  clustername
Id  Name
15  clustername
...

Checklist

  • Code meets the Developer Guide
  • [] User guide and development docs updated (if needed)
  • [] Related Helm chart(s) updated (if needed)

During cluster creation, when polling the cluster using the `-w` flag.
@akijakya akijakya added the enhancement New feature or request label Oct 22, 2021
@akijakya akijakya requested a review from pregnor October 22, 2021 08:55
@akijakya akijakya self-assigned this Oct 22, 2021
@akijakya akijakya merged commit 4a30d8c into master Oct 22, 2021
@akijakya akijakya deleted the handle-GetCluster-409-response-during-cluster-creation branch October 22, 2021 09:39
@pregnor pregnor mentioned this pull request Nov 23, 2021
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants