Skip to content
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

Bug 1816812: Allow test images to be in a single mirror #291

Merged

Conversation

smarterclayton
Copy link

@smarterclayton smarterclayton commented Jul 22, 2020

In downstream contexts, it's extremely useful to be able to combine all the "testable" images in Kubernetes into a single repo so that a user could mirror these offline in one chunk, and audit the set of images for changes. For instance, within OpenShift we would like to have a single place we can place all the images used by all the tests with a single authentication scheme. While some images are not "real" and can't be mirrored (for instance, the images that point to an auth protected registry), that is not the majority.

This code makes it possible to specify an environment variable KUBE_TEST_REPO that maps the static strings of the registry to a single repository by placing the uniqueness in a tag. For instance:

KUBE_TEST_REPO=quay.io/openshift/community-e2e-images

would translate k8s.gcr.io/prometheus-to-sd:v0.5.0 to quay.io/openshift/community-e2e-images:e2e-30-k8s-gcr-io-prometheus-to-sd-v0-5-0-6JI59Yih4oaj3oQOjRfhyQ.

The tag is a safe form of the name, plus the index (the constant within manifest.go), plus a hash of the full input. The length of the tag is constrained to the minimum of hash + index + the safe name.

The public method is changed to return two maps - index to original name and index to test repo name. These maps would be the same if the env var is not set.

In order to enable offline test execution we need to be able to collect all images used by Kube e2e into a single repo and then
mirror them. This structure may be useful upstream in the future, but some assessment of the particular pattern in use will be
necessary to determine the best outcome.

The presence of the env var switches all pullable images to use a single repository (which has been prepared by openshift-tests)
except for those images that are explicitly not intended to be pulled (those tests can't run offline anyway). The original map
is returned so the mirror can identify the mapping in use between hardcoded value and external value.

See openshift/origin#24887 for more details.

Upstream PR kubernetes#93510.

@openshift-ci-robot
Copy link

@smarterclayton: This pull request references Bugzilla bug 1816812, which is valid. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1816812: Allow test images to be in a single mirror

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.

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Jul 22, 2020
@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 22, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 28, 2020
@openshift-ci-robot
Copy link

@smarterclayton: This pull request references Bugzilla bug 1816812, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.6.0) matches configured target release for branch (4.6.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1816812: Allow test images to be in a single mirror

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.

@smarterclayton
Copy link
Author

/retest

@smarterclayton
Copy link
Author

@sttts david did a pass and had me get the upstream created and update the comments. I would appreciate review and ack that you understand why we will carry this (the upstream may take a while to merge / get consensus, but the change here is a very scoped carry in order to support customers who want offline tests).

@smarterclayton
Copy link
Author

/retest

2 similar comments
@smarterclayton
Copy link
Author

/retest

@smarterclayton
Copy link
Author

/retest

@smarterclayton
Copy link
Author

@sttts now that we've branched, can you review and raise any concerns so we can merge the offline images change?

@sttts
Copy link

sttts commented Oct 12, 2020

/assign @marun

@openshift-ci-robot
Copy link

@smarterclayton: This pull request references Bugzilla bug 1816812, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1816812: Allow test images to be in a single mirror

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.

}

// GetOriginalImageConfigs returns the configuration before any mapping rules.
func GetOriginalImageConfigs() map[int]Config {
Copy link

Choose a reason for hiding this comment

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

why public?

Copy link
Author

Choose a reason for hiding this comment

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

Must be used by the mirroring code in order to get the original state and by tests that have to do dynamic lookups (you have to know where Kube thinks the images are in order to translate some access)


// GetMappedImageConfigs returns the images if they were mapped to the provided
// image repository.
func GetMappedImageConfigs(originalImageConfigs map[int]Config, repo string) map[int]Config {
Copy link

Choose a reason for hiding this comment

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

why public?

Copy link

@sttts sttts Oct 12, 2020

Choose a reason for hiding this comment

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

mapConfigsToRepo

Copy link
Author

Choose a reason for hiding this comment

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

Same as above

Copy link
Author

Choose a reason for hiding this comment

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

I kept the public repo names consistent with the package style (i agree that is a better name, but everything in this package is Get* and I didn't want to drift too much)

test/utils/image/manifest.go Outdated Show resolved Hide resolved
test/utils/image/manifest.go Outdated Show resolved Hide resolved
@sttts
Copy link

sttts commented Oct 12, 2020

some nits. Looks reasonable otherwise.

/retest

@openshift-ci-robot
Copy link

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

Test name Commit Details Rerun command
ci/prow/kubernetes-e2e 4f6d059b7270362fb025763c3a332134d02eda3e link /test kubernetes-e2e
ci/prow/gcp-e2e-kubernetes 4f6d059b7270362fb025763c3a332134d02eda3e link /test gcp-e2e-kubernetes
ci/prow/e2e-azure-upgrade 4f6d059b7270362fb025763c3a332134d02eda3e link /test e2e-azure-upgrade

Full PR test history. Your PR dashboard.

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.

@marun
Copy link

marun commented Oct 15, 2020

/retest

@smarterclayton
Copy link
Author

Updated with review comments

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 5, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: smarterclayton, sttts

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link

/retest

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

7 similar comments
@openshift-bot
Copy link

/retest

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

@openshift-bot
Copy link

/retest

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

@openshift-bot
Copy link

/retest

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

@openshift-bot
Copy link

/retest

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

@openshift-bot
Copy link

/retest

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

@openshift-bot
Copy link

/retest

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

@openshift-bot
Copy link

/retest

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

@smarterclayton
Copy link
Author

/retest

@smarterclayton
Copy link
Author

/override ci/prow/e2e-cmd

@openshift-ci-robot
Copy link

@smarterclayton: Overrode contexts on behalf of smarterclayton: ci/prow/e2e-cmd

In response to this:

/override ci/prow/e2e-cmd

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.

@openshift-bot
Copy link

/retest

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

4 similar comments
@openshift-bot
Copy link

/retest

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

@openshift-bot
Copy link

/retest

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

@openshift-bot
Copy link

/retest

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

@openshift-bot
Copy link

/retest

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

@openshift-merge-robot
Copy link

openshift-merge-robot commented Nov 6, 2020

@smarterclayton: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/e2e-cmd f07333c link /test e2e-cmd

Full PR test history. Your PR dashboard.

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.

@openshift-bot
Copy link

/retest

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

1 similar comment
@openshift-bot
Copy link

/retest

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

@openshift-merge-robot openshift-merge-robot merged commit 38dcd0e into openshift:master Nov 6, 2020
@openshift-ci-robot
Copy link

@smarterclayton: Some pull requests linked via external trackers have merged:

The following pull requests linked via external trackers have not merged:

These pull request must merge or be unlinked from the Bugzilla bug in order for it to move to the next state.

Bugzilla bug 1816812 has not been moved to the MODIFIED state.

In response to this:

Bug 1816812: Allow test images to be in a single mirror

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.

@smarterclayton
Copy link
Author

/cherry-pick release-4.6

@smarterclayton
Copy link
Author

/cherrypick release-4.6

@openshift-cherrypick-robot

@smarterclayton: new pull request created: #536

In response to this:

/cherry-pick release-4.6

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.

@openshift-cherrypick-robot

@smarterclayton: new pull request could not be created: failed to create pull request against openshift/kubernetes#openshift-cherrypick-robot:cherry-pick-291-to-release-4.6 from release-4.6: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for openshift-cherrypick-robot:cherry-pick-291-to-release-4.6."}],"documentation_url":"https://docs.github.com/rest/reference/pulls#create-a-pull-request"}

In response to this:

/cherrypick release-4.6

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.

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. bugzilla/severity-high Referenced Bugzilla bug's severity is high for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants