hasura / gitkube

Build and deploy docker images to Kubernetes using git push
Apache License 2.0
3.81k stars 208 forks source link

Support for secret type .dockerconfigjson #38

Closed sdileep closed 6 years ago

sdileep commented 6 years ago

First push of gitkube-example on to my local cluster went through fine so I thought of pushing an update and realised that I need to setup the registry to get it working. So, I created a kube secret, with name regsecret, for docker following the instructions on the link in the README of gitkube-example and updated the registry of the example remote to be:

  registry:
    url: "docker.io/sdileep"
    credentials:
      secretKeyRef:
        name: regsecret
        key: .dockercfg

Now when I try to push to the example remote, I get the following error:

remote: WARNING: Error loading config file:/home/default-example/.dockercfg - Invalid Auth config file

So, I updated the registry to be:

  registry:
    url: "docker.io/sdileep"
    credentials:
      secretKeyRef:
        name: regsecret
        key: .dockerconfigjson

.dockerconfigjson field of the secret is the base64 representation of docker credentials - I presumed this is what goes in here.

Now when I try to push to the example remote, I get a timeout. Not sure what the correct config here should be, could you please help? Thanks.

tirumaraiselvan commented 6 years ago

I think you hit the recent change in kubectl (v1.9) of docker-secret type. This creates a secret of type .dockerconfigjson as opposed to .dockercfg. Unfortunately, these types are not compatible with each other. So replacing the key will not work. For some reason, this breaking change was actually approved https://github.com/kubernetes/kubernetes/pull/53916

For gitkube, we will have to create a fix which works with both types of secret. For now, you can try using a kubectl prior to v1.9 (say 1.8.8) to create the secret. Will update this issue once we support both.

tirumaraiselvan commented 6 years ago

Fixed in https://github.com/hasura/gitkube/pull/45