Skip to content

Image pruner: Determine protocol just once - #14914

Merged
openshift-merge-robot merged 2 commits into
openshift:masterfrom
miminar:secure-image-prune
Aug 17, 2017
Merged

openshift-merge-robot merged 2 commits into
openshift:masterfrom
miminar:secure-image-prune

Conversation

@miminar

@miminar miminar commented Jun 27, 2017 •

Copy link
Copy Markdown

Determine the registry protocol once. Do not change to other protocol during the run. This will produce nicer output without unrelated protocol fallback errors.

A follow-up for #14114 and #14405
Resolves #15291

@miminar miminar changed the title imagesprune: Determina protocol just once Image pruner: Determine protocol just once Jun 27, 2017
@miminar
miminar force-pushed the secure-image-prune branch from c3d693f to d9af60d Compare June 27, 2017 15:58
@miminar

miminar commented Jun 27, 2017

Copy link
Copy Markdown
Author

[test][testextended][extended:core(registry|imageapi|ImagePrune|ImageQuota)]

@soltysh soltysh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks good, some nits.

Comment thread pkg/image/prune/prune.go Outdated
healthCheck := func(proto, registry string) error {
func (drp *defaultRegistryPinger) ping(registry string) (string, error) {
registryURL, err := tryProtocolsWithRegistryURL(registry, drp.insecure, func(u url.URL) error {
// TODO: `/healthz` route is deprecated by `/`; remove it in future versions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can't we check / and fallback to /healthz only if the former fail? This way we'll support both.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We can. Resolved.

Comment thread pkg/image/prune/prune.go Outdated
protos = []string{"https"}
}
registry = url.Host
glog.V(4).Infof("url: %#+v", url)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like a development debug, can you make it more friendly?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

You're right. Ditched.

Comment thread pkg/image/prune/prune.go Outdated
glog.V(4).Infof("Trying protocol %s for the registry url %s", proto, registry)
default:
glog.V(4).Infof("Falling back to protocol %s for the registry url %s", proto, registry)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is bad, just log the fact, you'll figure out when looking at logs, that this is a retry. There's no point in hardcoding this switch.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

As you wish. I liked it better this way though.

Comment thread pkg/image/prune/prune.go Outdated
}

if err != nil {
// TODO: remove the first

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Leftover?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yep. Removed.

Comment thread pkg/image/prune/prune.go Outdated
// tryProtocolsWithRegistryURL runs given callback with different protocols until no error is returned. The
// https protocol is the first attempt. If it fails and allowInsecure is true, http will be the next. Obtained
// errors will be concatenated and returned.
func tryProtocolsWithRegistryURL(registry string, allowInsecure bool, callback func(registryURL url.URL) error) (*url.URL, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

callback here suggests an actual callback method, but it's not. It's the heart of this method, an action performed by this function. I'd suggest renaming the variable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

action maybe?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good suggesion. Changed.

@soltysh

soltysh commented Jun 28, 2017

Copy link
Copy Markdown
Contributor

Although it looks like your changes are failing tests, so you need to address that one.

@miminar
miminar force-pushed the secure-image-prune branch from d9af60d to 178a139 Compare June 29, 2017 10:50
@miminar

miminar commented Jun 29, 2017

Copy link
Copy Markdown
Author

Tests should be passing now.

@miminar
miminar force-pushed the secure-image-prune branch 3 times, most recently from 30b4a6c to 093d03b Compare June 29, 2017 11:11
@soltysh

soltysh commented Jun 29, 2017

Copy link
Copy Markdown
Contributor

LGTM!

@miminar
miminar force-pushed the secure-image-prune branch from 093d03b to 7f24389 Compare June 29, 2017 13:32
@miminar

miminar commented Jun 29, 2017

Copy link
Copy Markdown
Author

One last unit test fix.

@miminar

miminar commented Jul 3, 2017

Copy link
Copy Markdown
Author

Flake #14129 re-[test]

@miminar

miminar commented Jul 3, 2017 •

Copy link
Copy Markdown
Author

@mfojtik merge please. Waiting for code unfreeze.

@miminar
miminar force-pushed the secure-image-prune branch 2 times, most recently from 704189d to 58876ea Compare July 3, 2017 15:15
@miminar

miminar commented Jul 3, 2017

Copy link
Copy Markdown
Author

I reformatted logging messages again and made a small change to defaulting to insecure connection.

Since now internal docker registry URL may be a DNS, let's not default to insecure connection if --registry-url override is empty. As long as a local IP is used as internal URL, insecure fall-back will be allowed.

@openshift openshift deleted a comment from openshift-bot Jul 3, 2017
@miminar
miminar force-pushed the secure-image-prune branch 5 times, most recently from 7de7ae1 to c3bfb0b Compare July 4, 2017 16:00
@miminar
miminar force-pushed the secure-image-prune branch from c3bfb0b to 2a03fe4 Compare July 24, 2017 12:17
@miminar

miminar commented Jul 24, 2017

Copy link
Copy Markdown
Author

Fixed broken formatting of help message.

@miminar
miminar force-pushed the secure-image-prune branch from a14089d to 5cc9d12 Compare July 24, 2017 13:10
@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin testextended up to 5cc9d12

@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/testextended FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin_extended/906/) (Base Commit: 74121fa) (PR Branch Commit: 5cc9d12) (Extended Tests: core(registry|imageapi|ImagePrune|ImageQuota))

@fabianofranz

Copy link
Copy Markdown
Contributor

/test extended_templates

@miminar

miminar commented Aug 8, 2017

Copy link
Copy Markdown
Author

Yum flakes #8571 and #10162. Flake #15432

@miminar

miminar commented Aug 8, 2017

Copy link
Copy Markdown
Author

/retest

@fabianofranz

Copy link
Copy Markdown
Contributor

/approve

@openshift-merge-robot openshift-merge-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 8, 2017
@miminar

miminar commented Aug 14, 2017

Copy link
Copy Markdown
Author

Jenkins job not found.
/retest

@miminar

miminar commented Aug 14, 2017

Copy link
Copy Markdown
Author

/test extended_image_registry

@miminar

miminar commented Aug 14, 2017

Copy link
Copy Markdown
Author

Flakes #15432 and #15763

@miminar

miminar commented Aug 14, 2017

Copy link
Copy Markdown
Author

/retest

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

3 similar comments
@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot

Copy link
Copy Markdown
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@miminar

miminar commented Aug 15, 2017

Copy link
Copy Markdown
Author

Flake #15432 again.
/retest

@openshift-ci-robot

openshift-ci-robot commented Aug 15, 2017 •

Copy link
Copy Markdown

@miminar: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/openshift-jenkins/check 47551a8 link /test check
ci/openshift-jenkins/extended_image_registry 90e575c link /test extended_image_registry

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@miminar

miminar commented Aug 15, 2017

Copy link
Copy Markdown
Author

/test extended_conformance_gce
/test check

Michal Minář added 2 commits August 15, 2017 16:56
Determine the registry protocol once. Do not change to other protocol
during the run. This will produce nicer output without unrelated
protocol fallback errors.

Do not default to insecure connection when the --registry-url is empty.

Move registry client initialization just before the start of the pruner
- so we can precisely determine whether to allow for insecure fall-back
based on collected images and image streams.

Move ping() outside of pruner. Instead, determine the registry URL
before the pruner starts and assume it won't change during the run.

Signed-off-by: Michal Minář <[email protected]>
@miminar
miminar force-pushed the secure-image-prune branch from 90e575c to 7fd22bb Compare August 15, 2017 14:56
@openshift-merge-robot openshift-merge-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 15, 2017
@miminar

miminar commented Aug 16, 2017

Copy link
Copy Markdown
Author

Rebased. @soltysh may I have your lgtm one more time?

@soltysh

soltysh commented Aug 16, 2017

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 16, 2017
@openshift-merge-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabianofranz, miminar, soltysh

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-merge-robot

Copy link
Copy Markdown
Contributor

/test all [submit-queue is verifying that this PR is safe to merge]

@openshift-merge-robot

Copy link
Copy Markdown
Contributor

Automatic merge from submit-queue

@openshift-merge-robot
openshift-merge-robot merged commit 86abb1f into openshift:master Aug 17, 2017
openshift-merge-robot added a commit that referenced this pull request Sep 14, 2017
@miminar
miminar deleted the secure-image-prune branch October 10, 2017 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants