Comments (22)
@jackzampolin my approach was incorrect.
I spoke with one of the Engineers working on Container Registry and here's the correction:
AUTH_TOKEN=$(echo "{\"username\":\"_token\",\"password\":\"$ACCESS_TOKEN\"}" | base64 --wrap=0)
Otherwise unchanged.
from draft-classic.
closing in favour of #152. The discussion in that ticket more clearly demonstrates the issue and proposed solution going forward.
from draft-classic.
So the current user story is that the user calls draft init
. At this state, the program checks ~/.docker/config.json
for credentials. It then branches based on information found:
- creds are noticed in
~/.docker/config.json
~/.docker/config.json
not found
For the former, draft will display the following information:
><> draft init
Reading Docker Client configuration...
It appears you are logged into at least one Docker Registry. Which would you like to use with Draft?
1) docker.io
2) https://index.docker.io/v1/
3) quay.io
4) None. I want to enter my own information.
Please enter a number:
If it's the latter (or the user chose option 4), then the following information is displayed to the user:
Reading Docker Client configuration...
It appears that you are not logged into a Docker Registry. Please login.
registry URL: docker.io
username: bacongobbler
password: ************
organization (optional, leave blank to use your username):
This prompt window can be bypassed by supplying --registry-url
, --username
, and --password
to draft init
.
Once the information is gathered from the client configuration, it will generate the auth token and inject it into the draft helm chart as a secret.
NOTE: short-lived token auth support will not be part of the initial rollout of this feature. For users running on Google Container Registry or Amazon EC2 Container Registry, the recommended way to log in would be to use the JSON key file via
><> draft init --registry-url "gcr.io" --username "_json_key" -password "$(cat keyfile.json)"
from draft-classic.
@bacongobbler @technosophos @michelleN
I'm having this problem. I've done everything I think I know how to get this running on ACR -- using the provided domains so not messing with any custom domains.
Here is the calls that I make to draft init
:
draft init --set registry.url=$acrname.azurecr.io,registry.org=$acrname,registry.authtoken=$authtoken,basedomain=azurecr.io
where
- $acrname is "draftacs"
- the $authtoken is generated by
password=$(az acr credential show -n $acrname --output tsv --query "passwords[0].value") authtoken=$(echo \{\"username\":\"$acrname\",\"password\":\"$password\",\"email\":\"[email protected]\"\} | base64)
Everything works fine but then I get:
c59fa6cbcbd9: Preparing
8d4d1ab5ff74: Preparing
ab0825ad21e8: Waiting
e7b0b4cd055a: Waiting
445ed6ee6867: Waiting
c59fa6cbcbd9: Waiting
8d4d1ab5ff74: Waiting
Error encountered streaming JSON response: no basic auth credentials
Error: there was an error running 'draft up': websocket: close 1001 (going away)
Any ideas?
from draft-classic.
It seems an auth issue with the registry. BTW, minikube seems to work perfectly, but the same workflow for minikube is:
8d4d1ab5ff74: Preparing
Error encountered streaming JSON response: no basic auth credentials
Error: there was an error running 'draft up': websocket: close 1001 (going away)
Uh, these will both work if someone knows how to identify what I'm doing wrong to auth to the registry..... :-) I will be happy to write a doc for azure/draft showing minikube if I get the registry auth working fine.
from draft-classic.
Again, I can log on directly to my registry with the SP that I had to create with the registry. I get, however, the same error when directly connecting using THOSE credentials as my username and password, too. Sigh. Writing up the doc, because I'm sure it's a simple thing and as soon as we figure it out, we can push both ACS/ACR doc and a minikube to azure/draft.
from draft-classic.
Again, I can log on directly to my registry with the SP that I had to create with the registry. I get, however, the same error when directly connecting using THOSE credentials as my username and password, too. Sigh. Writing up the doc, because I'm sure it's a simple thing and as soon as we figure it out, we can push both ACS/ACR doc and a minikube to azure/draft.
from draft-classic.
So you got to the point where draft
(or draftd
) is running in your cluster? That is, draft init succeeded, but it's draft up that is failing?
You might check kubectl get deployment -o yaml -n kube-system
and make sure that the args sent to the Draft pod have the right registry information
from draft-classic.
Ignore my issue. #UserError. :-) That said, the issue is a good one.
from draft-classic.
So I'm running into this too. How would you do it for GKE? Acording to the docs and this issue the following should (?) work but doesn't:
draft init --set
registry.url=gcr.io,
registry.org=influx-perf-testing,
registry.authtoken=$(echo '{"username":"_json_key","password":"$(cat ~/.draft/keyfile.json)"}' | base 64),
basedomain=my.tld```
from draft-classic.
@jackzampolin I was able to get this to work on GKE using Application Default Credentials:
gcloud auth application-default login
gcloud auth application-default print-access-token
The draft init command that works for me is then:
ACCESS_TOKEN=$(gcloud auth application-default print-access-token)
AUTH_TOKEN=$(echo "{\"registrytoken\":\"$ACCESS_TOKEN\"}" | base64 --wrap=0)
draft init \
--set \
registry.url=gcr.io,\
registry.org=${PROJECT},\
registry.authtoken=${AUTH_TOKEN},\
basedomain=${DOMAIN}
from draft-classic.
One other suggestion - After init has been called once, second time it should auto --upgrade without the flag?
If this is poor standardization, then I'd suggest disabling init and stating 'already initialized, don't forget to use --upgrade flag'. I was in a horrible loop for 1 hour because I was forgetting the upgrade flag when I needed to update my credentials yesterday.
from draft-classic.
I disagree that init should handle upgrades. In fact I would rather we limit the scope to literally initializing the cluster for the first time. After that the user can call draft up
on draft itself to upgrade. I'd like to see that as a more solid "Turing complete" upgrade workflow.
from draft-classic.
Agreed, what's your proposal for updating credentials / basedomain / etc. That's the key UX that needs to be solved as from what I found, the only way I could update my credentials was draft init {updated config} --upgrade.
I did not see any user stories around that on this thread, so would love to know what's the game plan there.
In short-term, would suggest updating https://github.com/Azure/draft/blob/master/docs/install.md - to share information on how to update your configuration. It would have saved me tons of time after a silly typo.
from draft-classic.
Subsequent calls to draft up
will update the application. You can either supply your custom registry information through draft.toml or though values.yaml. I use this during development when hacking on changes to draftd.
In short-term, would suggest updating https://github.com/Azure/draft/blob/master/docs/install.md - to share information on how to update your configuration. It would have saved me tons of time after a silly typo.
Right now the recommended way is to use draft init --update
as you mentioned. I intentionally avoided documenting it as that functionality is going to change sooner rather than later through a PR to close out this issue.
from draft-classic.
part one of the plan is to improve the minikube story, starting by contributing a registry addon to minikube. Once that's done, we can recommend users to use the following workflow:
$ minikube addons install ingress
$ minikube addons install registry
$ minikube start
$ helm init
$ draft init
Which at that point, draft will read the local kube config and notice that the current context name is called "minikube". It will then install draftd and point it towards the in-cluster registry.
As for Azure, we will do the same operation:
- draft will read the local kube config and notice the current context is pointing at an ACS cluster
- draft will read AZURE_RG_NAME and other envvars to search the ACS cluster's resource group for an ACR instance. If so, it will configure itself to automatically use that cluster. No authentication token will be required because ACS can talk to ACR clusters within the same resource group, as I understand it.
from draft-classic.
My chicken-scratch writing on a whiteboard:
The one problem I have right now is "how do we install an ingress controller onto ACS?" Right now there's no solid story other than helm install stable/nginx-ingress
. I'd like this to be one less step but I think it's suitable for the moment.
from draft-classic.
@bacongobbler, good line on minikube, azure. Will this approach work for all registries, generally? I'll follow up with the ACR/ACS access.....
from draft-classic.
Generally speaking, if someone were to write a Google Cloud bootstrap workflow for draft then yes. I'm limiting scope for v0.5.0 to just minikube and Azure for now as that happens to be the large majority of users trying out draft. All the other unrecognized providers will need to go through the manual approach we do today until someone can pick up the work for GKE, Amazon etc.
from draft-classic.
(that someone likely being myself)
from draft-classic.
gotcha: just wanna make sure we have a good path for everyone. checking on acr/acs access issues now to be certain about our assumptions.
from draft-classic.
checking on acr/acs access issues now to be certain about our assumptions.
My assumptions were wrong. Either way we can still automate this process to fetch the admin username/password and pass that to draftd.
from draft-classic.
Related Issues (20)
- Go Modules support HOT 3
- Old Kubernetes API extensions created in manifest file HOT 1
- Will the support for draft is going to get over? HOT 2
- Draft fails to create app if chart templates contain subdirectories
- `draft pack-repo update` fails with local pack repositories
- Support for client.authentication.k8s.io/v1beta1 HOT 3
- Use latest version of helm HOT 1
- Support for helm without Tiller HOT 1
- draft up with monorepo HOT 2
- No pod created after successful draft up HOT 1
- Draft is broken if your user path has spaces
- adduser: Only one or two names allowed. HOT 1
- Draft generates outdated helm chart for python pack HOT 1
- Support for newer k8s versions (e.g. 1.16) HOT 4
- This project is no longer being actively developed or maintained? HOT 6
- Draft up not working with helm3 HOT 3
- AppVeyor build fails HOT 1
- Does draft work w/ helm 3? HOT 1
- Allow customizing build dir HOT 1
- This repo is missing important files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from draft-classic.