Repository navigation
Allow getting images from registries over untrusted connection - #11690
Conversation
|
[test] |
miminar
left a comment
There was a problem hiding this comment.
I'd also welcome at least one test. Either an integration, e2e or extended one.
| BlobRepositoryCacheTTLEnvVar = "REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_BLOBREPOSITORYCACHETTL" | ||
|
|
||
| // PullthroughInsecureEnvVar is a boolean environment variable that allows to get image from the remote | ||
| // registry using HTTP protocol. This option requires that the pullthrough is enabled. |
There was a problem hiding this comment.
Insecure flag allows for pulling not only over HTTP protocol but also over HTTPS with self-signed certificate or with generally over untrusted connection.
I like a description of --insecure flag of image-import command:
allow importing from registries that have invalid HTTPS certificates or are hosted via HTTP.
| digestToStore: make(map[string]distribution.BlobStore), | ||
| repo: &repo, | ||
| digestToStore: make(map[string]distribution.BlobStore), | ||
| pullFromInsecureRegistries: pullthroughinsecure, |
| pullthroughinsecure, err := getBoolOption(PullthroughInsecureEnvVar, "pullthroughinsecure", false, options) | ||
| if err != nil { | ||
| context.GetLogger(ctx).Error(err) | ||
| } |
There was a problem hiding this comment.
This setting should really be per image stream. I'm fairly uncomfortable allowing MitM as a global setting. @liggitt your opinion.
There was a problem hiding this comment.
@smarterclayton @liggitt So, I will start to use InsecureRepositoryAnnotation per imagestream and I will remove pullFromInsecureRegistries. Ok ?
3e5ff94 to
ad9403f
Compare
@miminar We already have test for |
Yeah, but that doesn't really test whether the env var or config file option are recognized. I don't insist on another integration test though. |
|
@smarterclayton since this changes your original intention, can you approve the changes? |
ad9403f to
befde3e
Compare
|
@miminar @liggitt @smarterclayton please review again. |
|
is this a new feature, and is it required for 1.4? |
|
@liggitt This is a new feature. |
|
the change seems really contained, but this is really late. @smarterclayton, ruling? |
befde3e to
3a26f14
Compare
|
[test] |
|
This LGTM and is low risk and is technically a bug anyway. [merge] |
|
@Kargakis new race in configChange test trigger? --- FAIL: TestTriggers_configChange (4.99s) On Thu, Nov 3, 2016 at 1:53 PM, OpenShift Bot [email protected]
|
|
[test] On Thu, Nov 3, 2016 at 2:12 PM, Clayton Coleman [email protected] wrote:
|
|
PullthroughBlobServed failed |
Hm, we already retry conflicts for this test: The test seems to get the dc controller in a hotloop? Will have a look tomorrow. |
| } | ||
|
|
||
| func runRegistry() error { | ||
| config := `version: 0.1 |
There was a problem hiding this comment.
This is already duplicated several times. Can we import it from elsewhere or rather load it either from a new fixture file or images/dockerregistry/config.yml?
There was a problem hiding this comment.
This is already duplicated several times.
When you say "several times" do you mean twice ? :)
No, we can't use images/dockerregistry/config.yml because it is not suitable for testing. In fact, even these two tests (where config placed in the string) are different. In my testcase pullthrough: true is required.
I can place it in test/integration/testdata if you want.
There was a problem hiding this comment.
What about using go template? Take a look here: https://play.golang.org/p/SmtSYlmhj1
But instead of const string, we could use fixture file.
| ` | ||
| os.Setenv("DOCKER_REGISTRY_URL", "127.0.0.1:5000") | ||
|
|
||
| go dockerregistry.Execute(strings.NewReader(config)) |
There was a problem hiding this comment.
Is there no way to terminate the registry once the test is over?
There was a problem hiding this comment.
You're right. No way.
There was a problem hiding this comment.
That's why integration runs each test as its own process.
There was a problem hiding this comment.
That's why integration runs each test as its own process.
That's a relief.
| return distribution.Descriptor{}, err | ||
| } | ||
|
|
||
| r.pullFromInsecureRegistries = false |
There was a problem hiding this comment.
The pullFromInsecureRegistries should already have an appropriate value. It shouldn't be overridden here.
There was a problem hiding this comment.
An incorrect value can be set upon creation. That is why the TestPullthroughServeBlob failed.
There was a problem hiding this comment.
I also wanted to protect against possible changes that I made in a previous version of this PR.
There was a problem hiding this comment.
An incorrect value can be set upon creation.
I don't get it. Decision made on upper level shall be respected unless overridden by image stream annotation. If there's an incorrect value passed, it should be fixed in upper levels.
There was a problem hiding this comment.
I agree with @smarterclayton and @liggitt and I think that this setting should be per imagestream. In this case we should ignore global value to avoid side effects.
There was a problem hiding this comment.
I agree as well. I'm just saying that default value shouldn't be decided at such a low level.
By this change, r.pullFromInsecureRegistries is rendered totally useless. If it's no longer useful for pullthrough tests then please remove it and use local variable instead.
There was a problem hiding this comment.
If it's no longer useful for pullthrough tests then please remove it and use local variable instead.
Yes, change this variable is useless. I fixed the tests. I did not remove a single test. It works without using this global variable. Why do you consider this a problem?
There was a problem hiding this comment.
There's now a useless (*repository).pullFromInsecureRegistries attribute not being used anywhere but here. It makes people and compilers read useless lines. And if the compiler is not smart enough, it also wastes memory when run.
There was a problem hiding this comment.
Oh come on! The (*pullthroughBlobStore).pullFromInsecureRegistries is boolean. The imagestream is retrieved in the remoteStat, but is used in the proxyStat. I see no reason to pass local variable through remoteStat -> findCandidateRepository -> proxyStat. I think is more readable to use private parameter. And we already have it - (*pullthroughBlobStore).pullFromInsecureRegistries.
Since this option has never been used, I decided that it can be used to pass annotation.
There was a problem hiding this comment.
I don't agree but I won't argue. We've spent too much time already talking about this trifle.
| return nil | ||
| } | ||
|
|
||
| func TestPullThroughInSecure(t *testing.T) { |
Signed-off-by: Gladkov Alexey <[email protected]>
3a26f14 to
0b3b478
Compare
|
@smarterclayton PullthroughBlobServed fixed. |
|
Evaluated for origin test up to 0b3b478 |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/11118/) (Base Commit: 9c565ab) |
|
LGTM [merge] |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/11118/) (Image: devenv-rhel7_5327) |
|
[merge] |
|
Evaluated for origin merge up to 0b3b478 |
Fix https://bugzilla.redhat.com/show_bug.cgi?id=1385855
@miminar please review