-
Notifications
You must be signed in to change notification settings - Fork 950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ctrd/daemon: support PlainHttp pull/push image #2810
Conversation
If the user sets the insecure registries, pouch will use PlainHTTP or HTTPs with unknown CA to pull or push image. For example, there are two registries 1. 172.17.0.7:5000 2. 172.17.0.2:5000 my.testingregistry.com We can use `pouchd --insecure-registries my.testingregistry.com:5000 --insecure-registries 172.17.0.7:5000` to start pouch daemon. Then we can pull or push any images from my.testingregistry.com:5000 or 172.17.0.7:5000 with PlainHTTP. But we cannot do it with 172.17.0.2:5000. Fix: #2663 Signed-off-by: Wei Fu <fuweid89@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #2810 +/- ##
==========================================
+ Coverage 69.34% 69.48% +0.13%
==========================================
Files 278 278
Lines 17397 17428 +31
==========================================
+ Hits 12064 12109 +45
+ Misses 3983 3976 -7
+ Partials 1350 1343 -7
|
func validateHostPort(s string) error { | ||
_, port, err := net.SplitHostPort(s) | ||
if err != nil { | ||
port = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not return err?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it is domain name without any port, such as 80
|
||
// InsecureRegistries sets insecure registries to allow to pull | ||
// insecure registries. | ||
InsecureRegistries []string `json:"insecure-registries,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add daemon test for this config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is hard to add this case right now because we need to download the registry and push the image in there. I am not sure how to make it easier to add it into repo.
LGTM |
// isInsecureDomain will return true if the domain of reference is in the | ||
// insecure registry. The insecure registry will accept HTTP or HTTPS with | ||
// certificates from unknown CAs. | ||
func (c *Client) isInsecureDomain(ref string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add unit test cases for this function?
} | ||
} | ||
|
||
func validateHostPort(s string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add unit test cases for this function?
Signed-off-by: Wei Fu fuweid89@gmail.com
Ⅰ. Describe what this PR did
If the user sets the insecure registries, pouch will use PlainHTTP or
HTTPs with unknown CA to pull or push image. For example, there are
two registries
We can use
pouchd --insecure-registries my.testingregistry.com:5000 --insecure-registries 172.17.0.7:5000
to start pouch daemon. Then wecan pull or push any images from my.testingregistry.com:5000 or
172.17.0.7:5000 with PlainHTTP. But we cannot do it with
172.17.0.2:5000.
Ⅱ. Does this pull request fix one issue?
Fix: #2663
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
added
Ⅳ. Describe how to verify it
CI
Ⅴ. Special notes for reviews