Skip to content

RFE: be able to specify multiple secrets for an image import #9758

Closed

Description

@soltysh

This was discovered during adding tests from #9730 (comment). We're trying to access internal docker registry, by default we generate secrets to access that registry for every project we create (you can't even remove them, they will be recreated). I'm creating additional secret using my user data, since it has access to both projects. Now I have two secrets, which will be considered appropriate for that registry. With current credentials implementation one will be picked randomly.

The proposed solution is:

  1. add retry mechanism for that cases
  2. allow users specify which secret to use at IS level

First is required, the latter would be a nice to have.

@smarterclayton fyi

Activity

  1. self-assigned this
    on Jul 8, 2016
  2. smarterclayton commented on Jul 8, 2016

    @smarterclayton
    Contributor

    On the node, we walk all applicable secrets until one works (Docker does
    this as well). Importer and registry pull through ultimately have to do
    the same. We may need a cache in pull through to identify likely candidate
    secret names (so we can prefer them).

    On Fri, Jul 8, 2016 at 5:42 PM, Maciej Szulik [email protected]
    wrote:

    This was discovered during adding tests from #9730 (comment)
    #9730 (comment).
    We're trying to access internal docker registry, by default we generate
    secrets to access that registry for every project we create (you can't even
    remove them, they will be recreated). I'm creating additional secret using
    my user data, since it has access to both projects. Now I have two secrets,
    which will be considered appropriate for that registry. With current
    credentials

    func basicCredentialsFromKeyring(keyring credentialprovider.DockerKeyring, target *url.URL) (string, string) {
    // TODO: compare this logic to Docker authConfig in v2 configuration
    value := target.Host + target.Path
    // Lookup(...) expects an image (not a URL path).
    // The keyring strips /v1/ and /v2/ version prefixes,
    // so we should also when selecting a valid auth for a URL.
    pathWithSlash := target.Path + "/"
    if strings.HasPrefix(pathWithSlash, "/v1/") || strings.HasPrefix(pathWithSlash, "/v2/") {
    value = target.Host + target.Path[3:]
    }
    configs, found := keyring.Lookup(value)
    if !found || len(configs) == 0 {
    // do a special case check for docker.io to match historical lookups when we respond to a challenge
    if value == "auth.docker.io/token" {
    glog.V(5).Infof("Being asked for %s, trying %s for legacy behavior", target, "index.docker.io/v1")
    return basicCredentialsFromKeyring(keyring, &url.URL{Host: "index.docker.io", Path: "/v1"})
    }
    // docker 1.9 saves 'docker.io' in config in f23, see https://bugzilla.redhat.com/show_bug.cgi?id=1309739
    if value == "index.docker.io" {
    glog.V(5).Infof("Being asked for %s, trying %s for legacy behavior", target, "docker.io")
    return basicCredentialsFromKeyring(keyring, &url.URL{Host: "docker.io"})
    }
    glog.V(5).Infof("Unable to find a secret to match %s (%s)", target, value)
    return "", ""
    }
    glog.V(5).Infof("Found secret to match %s (%s): %s", target, value, configs[0].ServerAddress)
    return configs[0].Username, configs[0].Password
    }

    implementation one will be picked randomly.

    The proposed solution is:

    1. add retry mechanism for that cases
    2. allow users specify which secret to use at IS level

    First is required, the latter would be a nice to have.

    @smarterclayton https://github.com/smarterclayton fyi

    —
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub
    #9758, or mute the thread
    https://github.com/notifications/unsubscribe/ABG_p37uRVH59xTq_8G-U0xbUefDPqH_ks5qTsQ_gaJpZM4JIa-K
    .

  3. assigned and unassigned on Aug 23, 2017
  4. mfojtik commented on Aug 23, 2017

    @mfojtik
    Contributor

    @bparees another trello card candidate, @soltysh can brief you in details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions