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

Fix samplesRegistry replacement in imageStreams when using paths #288

Merged

Conversation

aerdei
Copy link
Contributor

@aerdei aerdei commented Jun 5, 2020

Currently, when defining samplesRegistry in the CR with a value of newhost:1111/path, the resulting imageStream DockerImage values become newhost:1111/path/path/path instead of newhost:1111/path/oldpaths.
This PR makes it possible to have a path in samplesRegistry in the CR. This could be beneficial when using external registries with paths (e.g. Artifactory remote registries).

If oldreg has a registry found in oldies, replace the oldreg registry part with newreg and return it.
@gabemontero
Copy link
Contributor

Currently, when defining samplesRegistry in the CR with a value of newhost:1111/path, the resulting imageStream DockerImage values become newhost:1111/path/path/path instead of newhost:1111/path/oldpaths.
This PR makes it possible to have a path in samplesRegistry in the CR. This could be beneficial when using external registries with paths (e.g. Artifactory remote registries).

Interesting / thanks @aerdei !

Any chance you add a unit test that validates this change (it did pass the existing validations)?

The current validations are in https://github.com/openshift/cluster-samples-operator/blob/master/pkg/stub/handler_test.go#L294, admittedly a somewhat involved flow. If you want to take it on there, great. Otherwise, a new test method which validates your scenario and simply calls coreUpdateDockerPullSpec is fine with me as well.

@gabemontero gabemontero self-assigned this Jun 5, 2020
@gabemontero
Copy link
Contributor

/approve

I'll also note there is an RFE on the books for expanding the power of this aspect to override more than just the registry host:port, but it has not been prioritized as of yet.

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 5, 2020
Since .spec.dockerImageRepository is deprecated, add a new IS test file with a more detailed .spec.tags.from.name to extend test scenarios.
Add test cases where samplesRegistry is of the form host/path and host:port/path.
@aerdei
Copy link
Contributor Author

aerdei commented Jun 8, 2020

Hi @gabemontero ,
Thanks! I have updated the unit tests. I also took the liberty to add an additional test imageStream file that has a .spec.tags.from.name that more closely resembles current use cases (DockerImage names in openshift/library imageStreams). Let me know what you think!

@gabemontero
Copy link
Contributor

/lgtm

thanks again @aerdei

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aerdei, gabemontero

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

1 similar comment
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aerdei, gabemontero

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

@aerdei
Copy link
Contributor Author

aerdei commented Jun 9, 2020

/retest

@openshift-bot
Copy link
Contributor

/retest

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

3 similar comments
@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-bot
Copy link
Contributor

/retest

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

@openshift-merge-robot openshift-merge-robot merged commit 500c8ae into openshift:master Jun 10, 2020
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants