Skip to content

Conversation

runcom
Copy link
Member

@runcom runcom commented Jul 20, 2017

Signed-off-by: Antonio Murdaca runcom@redhat.com

@runcom
Copy link
Member Author

runcom commented Jul 20, 2017

I need feedback from tests/CI and still need to add integration tests, do not merge (but review appreciated)

@runcom runcom force-pushed the additional-registries branch 3 times, most recently from 9c42a7c to 54aa085 Compare July 20, 2017 08:29
@runcom
Copy link
Member Author

runcom commented Jul 20, 2017

@mrunalp @rhatdan PTAL

@runcom runcom force-pushed the additional-registries branch from 54aa085 to 4e164e8 Compare July 20, 2017 09:44
@rh-atomic-bot
Copy link

87/87 passed on RHEL - Passed.
121/121 k8s node-e2e passed on RHEL - Passed.

87/87 passed on Fedora - Passed.
121/121 k8s node-e2e passed on Fedora - Passed.

87/87 passed on CentOS - Passed.
0/0 k8s node-e2e passed on CentOS - Failed.

Log - https://aos-ci.s3.amazonaws.com/kubernetes-incubator/cri-o/crio-integration-tests-prs/777/fullresults.txt

@rh-atomic-bot
Copy link

0/0 passed on RHEL - Passed.
0/0 k8s node-e2e passed on RHEL - Failed.

0/0 passed on Fedora - Passed.
0/0 k8s node-e2e passed on Fedora - Failed.

0/0 passed on CentOS - Passed.
0/0 k8s node-e2e passed on CentOS - Failed.

Log - https://aos-ci.s3.amazonaws.com/kubernetes-incubator/cri-o/crio-integration-tests-prs/778/fullresults.txt

@runcom runcom force-pushed the additional-registries branch from 4e164e8 to b32e73a Compare July 20, 2017 11:06

if len(additionalRegistries) == 0 {
// TODO(runcom): make docker.io a CONST
additionalRegistries = []string{"docker.io"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a default registry to replace docker.io and put this in the config file. Then add additional registries, that way we don't hard code docker.io into the tool?
I think we should use Trust/signing to block registries, so there is no reason to add that functionality here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, I will change the config file to have "docker.io" in it by default so that we don't hardcode docker.io

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the flag should just be registries, and we allow users to add a list of registries, with docker.io as the default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good :)

@@ -0,0 +1,123 @@
package storage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be in storage or pkg/registries?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's about image naming, irrespective of registries I guess

options := &copy.Options{
SourceCtx: &types.SystemContext{},
}
// a not empty username should be sufficient to decide whether to send auth
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Specifiying a username indicates the user intends to send authentication to the registry.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@runcom Can you change the comment above to match my previous comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep!

@rh-atomic-bot
Copy link

87/87 passed on RHEL - Passed.
121/121 k8s node-e2e passed on RHEL - Passed.

87/87 passed on Fedora - Passed.
121/121 k8s node-e2e passed on Fedora - Passed.

87/87 passed on CentOS - Passed.
0/0 k8s node-e2e passed on CentOS - Failed.

Log - https://aos-ci.s3.amazonaws.com/kubernetes-incubator/cri-o/crio-integration-tests-prs/779/fullresults.txt

separatorRegexp = match(`(?:[._]|__|[-]*)`)

// nameComponentRegexp restricts registry path component names to start
// with at least one letter or number, with following parts able to be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: For these more complicated regexp's, it would be nice to have an example of what a valid object would look like in the comments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also have you written tests for these? It would be nice to have a test fail is someone later edits one of these and messes it up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to write a huge comment at the beginning of this as this is a forked version from Docker/distribution. Nobody should never edit this, as for test coverage, this should stay as is.

@runcom runcom force-pushed the additional-registries branch from b32e73a to 35b1a26 Compare July 31, 2017 16:08
@runcom
Copy link
Member Author

runcom commented Jul 31, 2017

Updated not-to hardcode docker.io in go files, now we just generate the config with "docker.io" just to maintain compatibility but hopefully we can get rid of that and indeed distros can generate config w/o docker at all. I'll add tests and changes to man pages now.

@runcom runcom force-pushed the additional-registries branch from 35b1a26 to 877a641 Compare July 31, 2017 17:49
@runcom
Copy link
Member Author

runcom commented Jul 31, 2017

Added changes to man pages. Just need to add tests (which I'm working on). @mrunalp @rhatdan PTAL (hopefully, we can tag beta after this :))

# image (e.g. fedora:rawhide). "docker.io" is left here as a default registry.
# Users can remove it and use whatever default registry they need.
registries = [
"docker.io",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this will work, since config reads the host config and will append docker.io onto a list even if docker.io is already on the list. Might be better off leaving this to the distribution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker.io should go at the end not the beginning.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, Docker.io is still a default since w/o this string the config isn't a working config. One can do "crio config" and get a broken config since no registries are configured. How do we deal with that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will still default to docker.io in containers/image? My problem with this is if I wanted to specify no registies, config will still show docker.io. And if I have docker.io in my config, this code will show
docker.io docker.io

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if it still defaults to docker.io in containers/image we need to have a way to still have a default for docker.io when pulling unqualified images because that's just what people expect (and what we do in RHEL right now, unless people actually block docker.io).
I'm fine leaving this to distro but bear in mind crio is going to error out if nobody add a registry here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhatdan could you provide an example of using this PR and having the double "docker.io" entry there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhatdan the double "docker.io" issue is not an issue (the last command totally overrides the docker.io entry also):

$ cat test.config| grep docker.io
  "docker.io",

$ sudo ./crio --config test.config --debug --registry docker.io --registry test.redhat.com
DEBU[2017-08-01 10:28:44.630508363+02:00] runcom [docker.io test.redhat.com]

$ sudo ./crio --configtest.config --debug --registry test.rhel.com
DEBU[2017-08-01 10:29:49.679527671+02:00] runcom [test.rhel.com]

You can see docker.io isn't added twice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a ;piece of code to remove duplicates though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does
$ sudo ./crio --config test.config --registry test.rhel.com | grep docker.io
Show?
What does the list of registries show? It should show docker.io and test.rhel.com from my understanding of the code. But if I remove docker.io from test.config and run the same test does it show just test.rhel.com and NO docker.io? That is the problem, but it is probably not a big deal since the config command is probably only run in rpm.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does
$ sudo ./crio --config test.config --registry test.rhel.com | grep docker.io
Show?
What does the list of registries show? It should show docker.io and test.rhel.com from my understanding of the code

@rhatdan this shows just test.rhel.com - is that ok? CLI flags overrides config.

But if I remove docker.io from test.config and run the same test does it show just test.rhel.com and NO docker.io? That is the problem

it will still shows NO docker.io

{{ range $opt := .InsecureRegistries }}{{ printf "\t%q,\n" $opt }}{{ end }}]
# registries is used to specify registries to be used when pulling an unqualified
# image (e.g. fedora:rawhide). "docker.io" is left here as a default registry.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment about docker.io.

cmd/crio/main.go Outdated
},
cli.StringSliceFlag{
Name: "registry",
Usage: "list of registies used when pulling unqualified images",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list of registries to prepend when pulling unqualified images.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registry to be prepended when pulling unqualified images, can be specified multiple times.

cmd/crio/main.go Outdated
}

if len(config.Registries) == 0 {
logrus.Fatal("no registries configured. Please add registries with the --registry flag")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually an error, or does it just force users to use fully qualified images

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm torn between leaving this error or do as you said, force people to use fully qualify images. However, I think we should go with the latter (error out) so we don't risk to break kubernetes at all (since many users still use unqualified images in prod)

docs/crio.8.md Outdated
Print usage statement

**--insecure-registry=**
List of registries to enable insecure communication with
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

       --insecure-registry=[]
         Enable insecure registry  communication,  i.e.,  enable  un-encrypted
       and/or untrusted communication.

       List  of  insecure registries can contain an element with CIDR notation
       to specify a whole  subnet.  Insecure  registries  accept  HTTP  and/or
       accept HTTPS with certificates from unknown CAs.

       Enabling  --insecure-registry  is useful when running a local registry.
       However, because its use creates  security  vulnerabilities  it  should
       ONLY  be  enabled  for testing purposes.  For increased security, users
       should add their CA to their system's list of trusted  CAs  instead  of
       using --insecure-registry.

docs/crio.8.md Outdated
CRIO root dir (default: "/var/lib/containers/storage")

**--registry**=""
List of registries to be used when pulling an unqualified image
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a list or something that can be specified multiple times?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same as insecure registries flag, so it's a flag which can be specified multiple times.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the comment should say
Registry host which will be prepended to unqualified images, can be specified multiple times.


**insecure_registries**=""
List of registries to enable insecure communication with

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

       --insecure-registry=[]
         Enable insecure registry  communication,  i.e.,  enable  un-encrypted
       and/or untrusted communication.

       List  of  insecure registries can contain an element with CIDR notation
       to specify a whole  subnet.  Insecure  registries  accept  HTTP  and/or
       accept HTTPS with certificates from unknown CAs.

       Enabling  --insecure-registry  is useful when running a local registry.
       However, because its use creates  security  vulnerabilities  it  should
       ONLY  be  enabled  for testing purposes.  For increased security, users
       should add their CA to their system's list of trusted  CAs  instead  of
       using --insecure-registry.

Image which contains the pause executable (default: "kubernetes/pause")

**registries**=""
List of registries to be used when pulling an unqualified image
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is a list how do I specify it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add "comma separated list of registeies"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good.

@rh-atomic-bot
Copy link

81/81 passed on RHEL - Passed.
121/121 k8s node-e2e passed on RHEL - Passed.

81/81 passed on Fedora - Passed.
121/121 k8s node-e2e passed on Fedora - Passed.

81/81 passed on CentOS - Passed.
0/0 k8s node-e2e passed on CentOS - Failed.

Log - https://aos-ci.s3.amazonaws.com/kubernetes-incubator/cri-o/crio-integration-tests-prs/890/fullresults.txt

@runcom runcom force-pushed the additional-registries branch 2 times, most recently from 76c6274 to 3a6a62b Compare August 1, 2017 08:43
}

if len(cleanRegistries) == 0 {
return nil, errors.New("no registries configured. Please add registries with the --registry flag")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why am I required to have a registry defined? Can't a user say that he always requires fully qualified names?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with that - @mrunalp wdyt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 to allowing fully qualified names always.

options := &copy.Options{
SourceCtx: &types.SystemContext{},
}
// a not empty username should be sufficient to decide whether to send auth
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@runcom Can you change the comment above to match my previous comment.

server/server.go Outdated
}

imageService, err := storage.GetImageService(store, config.DefaultTransport, config.InsecureRegistries)
imageService, err := storage.GetImageService(store, config.DefaultTransport, config.InsecureRegistries, config.Registries)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: shouldn't registries come before insecureregistries.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm they are unrelated, I guess it's personal taste, if you want I'll have Registries comes first

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so, thats why it was a nit.

// normalize the unqualified image to be domain/repo/image...
images := []string{}
for _, r := range svc.registries {
if r == dockerRegistry {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really necessary? Won't containers/image treat docker.io://imageName correctly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but I guess it's cleaner to pass down the unqualified image (as I do here) instead of passing down "docker.io/imageName"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather remove the reference to docker.io and allow containers/image to do its thing. You are building in assumptions about containers/image that could change in the future. I think we should treat them all the same.

@runcom
Copy link
Member Author

runcom commented Aug 1, 2017

@baude brought up that we should use the global /etc/containers/registries.conf instead of having cri-o's config specify its own additional registries. @mrunalp @rhatdan wdyt? I'm super fine with this. Other tools can read that.

@rh-atomic-bot
Copy link

81/81 passed on RHEL - Passed.
121/121 k8s node-e2e passed on RHEL - Passed.

81/81 passed on Fedora - Passed.
121/121 k8s node-e2e passed on Fedora - Passed.

81/81 passed on CentOS - Passed.
0/0 k8s node-e2e passed on CentOS - Failed.

Log - https://aos-ci.s3.amazonaws.com/kubernetes-incubator/cri-o/crio-integration-tests-prs/899/fullresults.txt

@rhatdan
Copy link
Contributor

rhatdan commented Aug 1, 2017

My pull request is doing the same thing, in that we are defaulting storage to /etc/containers/storage.conf and then allowing crio.conf to override it, but by default content comes out of registries.

I agree with @baude but I think /etc/containers/registry.conf, (We should use it for buildah as well.)
It should become part of skopeo-containers, not atomic though. Since we don't want to force atomic on everyone. Perhaps the definition should be stored in containers/image.

@runcom
Copy link
Member Author

runcom commented Aug 1, 2017

Discussed with @rhatdan @baude, we won't hold this PR for now. We finish this, ship beta, meanwhile we build up a library to parse the registries.conf file and provides primitives to cri-o to gather additional registries.

@runcom runcom changed the title [WIP] *: implement additional pull registries *: implement additional pull registries Aug 1, 2017
@rhatdan
Copy link
Contributor

rhatdan commented Aug 1, 2017

LGTM

@runcom runcom force-pushed the additional-registries branch from 3a6a62b to 7787d67 Compare August 1, 2017 18:36
@runcom
Copy link
Member Author

runcom commented Aug 1, 2017

Just push-forced with latest changes - @mrunalp PTAL

@mrunalp
Copy link
Member

mrunalp commented Aug 1, 2017

This looks fine. Let us wait for the tests to return.

@mrunalp
Copy link
Member

mrunalp commented Aug 1, 2017

Test failure: pulling image failed: rpc error: code = 2 desc = no registries configured while trying to pull an unqualified image

@runcom
Copy link
Member Author

runcom commented Aug 1, 2017

Yeah, got that, I'm fixing it (and writing the blog post simultaneously)

@rh-atomic-bot
Copy link

6/7 passed on RHEL - Failed.
0/1 k8s node-e2e passed on RHEL - Failed.

6/7 passed on Fedora - Failed.
0/1 k8s node-e2e passed on Fedora - Failed.

30/54 passed on CentOS - Failed.
0/0 k8s node-e2e passed on CentOS - Failed.

Log - https://aos-ci.s3.amazonaws.com/kubernetes-incubator/cri-o/crio-integration-tests-prs/909/fullresults.txt

@runcom runcom force-pushed the additional-registries branch 2 times, most recently from 7a65d8d to d173e1f Compare August 2, 2017 09:45
@rh-atomic-bot
Copy link

30/31 passed on RHEL - Failed.
0/1 k8s node-e2e passed on RHEL - Failed.

30/31 passed on Fedora - Failed.
0/1 k8s node-e2e passed on Fedora - Failed.

30/31 passed on CentOS - Failed.
0/0 k8s node-e2e passed on CentOS - Failed.

Log - https://aos-ci.s3.amazonaws.com/kubernetes-incubator/cri-o/crio-integration-tests-prs/913/fullresults.txt

@runcom runcom force-pushed the additional-registries branch 2 times, most recently from 6a37548 to ec450e6 Compare August 2, 2017 12:17
@rh-atomic-bot
Copy link

38/43 passed on RHEL - Failed.
121/121 k8s node-e2e passed on RHEL - Passed.

38/43 passed on Fedora - Failed.
121/121 k8s node-e2e passed on Fedora - Passed.

38/43 passed on CentOS - Failed.
0/0 k8s node-e2e passed on CentOS - Failed.

Log - https://aos-ci.s3.amazonaws.com/kubernetes-incubator/cri-o/crio-integration-tests-prs/914/fullresults.txt

@runcom runcom force-pushed the additional-registries branch from ec450e6 to b4cf00f Compare August 2, 2017 13:00
@runcom
Copy link
Member Author

runcom commented Aug 2, 2017

let's wait for CI now that Travis's green here

@mrunalp
Copy link
Member

mrunalp commented Aug 2, 2017

Needs rebase :/

@runcom
Copy link
Member Author

runcom commented Aug 2, 2017

rebasing..........

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
@runcom runcom force-pushed the additional-registries branch from b4cf00f to a35727c Compare August 2, 2017 14:38
@rh-atomic-bot
Copy link

38/40 passed on RHEL - Failed.
2/24 k8s node-e2e passed on RHEL - Failed.

38/40 passed on Fedora - Failed.
2/21 k8s node-e2e passed on Fedora - Failed.

38/40 passed on CentOS - Failed.
0/0 k8s node-e2e passed on CentOS - Failed.

Log - https://aos-ci.s3.amazonaws.com/kubernetes-incubator/cri-o/crio-integration-tests-prs/915/fullresults.txt

@runcom
Copy link
Member Author

runcom commented Aug 2, 2017

mmmm looking at tests failures. in CI (weird actually)

@runcom
Copy link
Member Author

runcom commented Aug 2, 2017

can't see how CI failed and Travis did not, maybe it was an old run of this PR

@mrunalp
Copy link
Member

mrunalp commented Aug 2, 2017

yeah, could have been an old run. Can you check if a new run is scheduled?

@runcom
Copy link
Member Author

runcom commented Aug 2, 2017

there are 6+ builds in the queue and can't check parameters of those 😕

@rh-atomic-bot
Copy link

81/81 passed on RHEL - Passed.
121/121 k8s node-e2e passed on RHEL - Passed.

81/81 passed on Fedora - Passed.
121/121 k8s node-e2e passed on Fedora - Passed.

81/81 passed on CentOS - Passed.
0/0 k8s node-e2e passed on CentOS - Failed.

Log - https://aos-ci.s3.amazonaws.com/kubernetes-incubator/cri-o/crio-integration-tests-prs/919/fullresults.txt

@runcom
Copy link
Member Author

runcom commented Aug 2, 2017

Alright CI finally came back @mrunalp

@mrunalp
Copy link
Member

mrunalp commented Aug 3, 2017

LGTM

@mrunalp mrunalp merged commit 66d96e7 into cri-o:master Aug 3, 2017
@runcom runcom deleted the additional-registries branch August 3, 2017 07:48
@runcom
Copy link
Member Author

runcom commented Aug 3, 2017

...adding some integration tests also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants