Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Make draft init foolproof #152

Closed
sgoings opened this issue Jun 14, 2017 · 3 comments · Fixed by #154
Closed

Make draft init foolproof #152

sgoings opened this issue Jun 14, 2017 · 3 comments · Fixed by #154
Assignees
Milestone

Comments

@sgoings
Copy link
Member

sgoings commented Jun 14, 2017

Requiring users to copy/paste/change this line:

draft init --set registry.url=changeme,registry.org=changeme,registry.authtoken=changeme,basedomain=changeme

has caused some false starts and pain for first timers.

What could be done to make draft init be able to successfully install draft on a kubernetes cluster without any intense documentation parsing?

@sgoings
Copy link
Member Author

sgoings commented Jun 14, 2017

One idea I had was to make draft init an interactive prompt. If the user hasn't specified all of the required options (from the commandline, from a config file, from environment variables)... could the draft client start asking questions of the user? Such as:

What registry would you like to use? [dockerhub]
<enter>

What registry would you like to use? [1]
1) Dockerhub
2) Quay.io
3) Google Container Registry
4) Azure Container Registry
...
<enter>

What's your registry username? [default to $USER]
sgoings<enter>

What's your registry password?
*****<enter>
...

and so on.

@bacongobbler
Copy link
Contributor

bacongobbler commented Jun 14, 2017

If the user hasn't specified all of the required options (from the commandline, from a config file, from environment variables)... could the draft client start asking questions of the user? Such as:

Bingo. This is exactly how I want to solve it. However, I want to make the prompt a little smarter by also reading from the local kube config.

For example, if the current context is found to be a minikube cluster (easily identifiable as the config's name would be "minikube"), then we can make the following assumptions:

$ draft init
It looks like you are using a Kubernetes cluster deployed on Minikube. Is this correct? (Y/n) y
Awesome!
Checking to see if plugin "registry" is installed... (GOOD)
Checking to see if plugin "ingress" is installed... (GOOD)
Checking to see if tiller is installed... (GOOD)
Draftd (the Draft server side component) has been installed into your Kubernetes Cluster.
Happy Sailing!

So then the user workflow for installing draft looks like this:

$ minikube addons install ingress
$ minikube addons install registry
$ minikube start
$ helm init
$ draft init

And for Azure (envvars present), we can perform lookups using az client libraries:

$ draft init
It looks like you are using a Kubernetes cluster deployed on Azure Container Services. Is this correct? (Y/n) y
Awesome!
Checking to see if an Azure Container Registry exists in the Resource Group... (GOOD)
It looks like there are multiple Azure Container Registries available. Which one would you like to use?

1) bacodraft
2) draftonacs
3) None. I want Draft to create a new one for me.

Make a selection: 3
Creating Azure Container Registry draft0123456789... (GOOD)
Checking to see if ingress-nginx is installed... (GOOD)
Checking to see if tiller is installed... (GOOD)
Draftd (the Draft server side component) has been installed into your Kubernetes Cluster.
Happy Sailing!

If the user answers "no" to the original question, then we go through the prompt you mention.

A lot of chicken-scratch discussion is talked about in #49 but this ticket seems to be a much clearer discussion on how we want to tackle this problem, so I'll make this the official "draft init overhaul discussion" ticket.

@bacongobbler
Copy link
Contributor

This was referenced Jun 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants