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
k8saas: better kubeconfig support #372
Conversation
b0a5195
to
1200693
Compare
if err := writeOrAddToKubeconfig(kubeconfig); err != nil { | ||
warn(fmt.Sprintf("couldn't write cluster credentials: %v", err)) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you return an error and print it here instead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i could, but it'd be redundant. also because this isn't a reason to fail the whole operation and not print the cluster that was just created, it would confuse users into thinking their cluster wasn't created
failCount = 0 // API responded, reset it's error counter | ||
} | ||
if cluster.Status == nil { | ||
time.Sleep(1 * time.Second) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
||
// waitForClusterRunning waits for a cluster to be running. | ||
func waitForClusterRunning(kube do.KubernetesService, clusterID string) error { | ||
failCount := 0 |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
50b29dd
to
5c81229
Compare
887f7b7
to
c28d2c1
Compare
AddStringFlag(cmdKubeClusterCreate, doctl.ArgSizeSlug, "", defaultNodeSize, "size of the nodes in the default node pool (incompatible with --"+doctl.ArgClusterNodePool+")") | ||
AddStringFlag(cmdKubeClusterCreate, doctl.ArgNodePoolCount, "", strconv.Itoa(defaultNodeCount), "size of the nodes in the default node pool (incompatible with --"+doctl.ArgClusterNodePool+")") | ||
AddStringSliceFlag(cmdKubeClusterCreate, doctl.ArgClusterNodePool, "", nil, `cluster node pools in the form "name=your-name;size=droplet_size;count=5;tag=tag1;tag=tag2"`, requiredOpt()) | ||
AddBoolFlag(cmdKubeClusterCreate, doctl.ArgClusterUpdateKubeconfig, "", true, "whether to add the created cluster to your kubeconfig") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This default also changes the current context to the new cluster cluster, should this maybe be a separate value that defaults to false? I've had a few occasions where this happened and I forgot about it, and got very confused why my kubectl seemed to not be doing what I wanted it to the cluster that was previously my active context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm reproducing the minikube
and kubeadm
behavior here, but this could be a flag yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way you could make the node-pool flag more usable or show how to print the various "slug" sizes in the help text?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'll try to make this better in a next iteration.
a1ffcc1
to
4e1a573
Compare
Looks (and feels) ready to me. |
I know minikube does this, but is there a flag to preserve context? When creating clusters with eksctl for example I'm not forced to get a context-switch. |
@alexellis I'll add one, and change the default behavior to not change the context. It seems that enough people find this jarring to suggest it's probably not a good default behavior. |
actually I'll just remove that changing the context thing, it's already easily done with |
running
on acreate
call.