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

Generate broker container names more sensibly #16289

Merged
merged 1 commit into from
Mar 10, 2020

Conversation

amisevsk
Copy link
Contributor

@amisevsk amisevsk commented Mar 9, 2020

What does this PR do?

Fixes an issue where container names for brokers could be longer than 63 characters:

  • If a broker image is referenced by tag, trim the digest to 10 chars and use that instead of the full thing
  • If the generated name is longer than 63 chars for whatever reason, trim it to allow the workspace to start.

What issues does this PR fix or reference?

Fixes #16288

Fixes an issue where container names for brokers could be longer than 63
characters:

- If a broker image is referenced by tag, trim the digest to 10 chars and
use that instead of the full thing
- If the generated name is longer than 63 chars for whatever reason,
trim it to allow the workspace to start.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
@amisevsk amisevsk added the kind/bug Outline of a bug - must adhere to the bug report template. label Mar 9, 2020
@che-bot che-bot added the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Mar 9, 2020
@@ -247,7 +247,25 @@ private String generateUniqueName(String suffix) {
*/
@VisibleForTesting
protected String generateContainerNameFromImageRef(String image) {
return image.toLowerCase().replaceAll("[^/]*/", "").replaceAll("[^\\d\\w-]", "-");
String containerName;
Copy link
Contributor

Choose a reason for hiding this comment

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

While this is certainly improving the situation, it is still not taking care of the possible clashes. What do you think can be done there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A container name can be up to 30 chars, if you want to use an image with a really long tag there's not much we can do that's intelligent. Apart from that we could choose a completely different tack for naming these containers, but that's potentially more risky and I would prefer that be a separate issue + PR to minimize risk in 7.9.x.

Are there any big cases I've missed in the PR? I admit I wrote it hastily.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One solution would be to just name the containers "metadata-broker" and "artifacts-broker", though that obscures the version being used in the default use case (where it's currently something like che-plugin-metadata-broker-v3-1-0.

@che-bot
Copy link
Contributor

che-bot commented Mar 9, 2020

❌ E2E Happy path tests failed ❗

See Details

Tested with Eclipse Che Multiuser User on K8S (minikube v1.1.1)

⚠️ https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

ℹ️ Use comment "crw-ci-test" to rerun happy path E2E test.

@amisevsk
Copy link
Contributor Author

crw-ci-test

@amisevsk
Copy link
Contributor Author

ci-test

@che-bot
Copy link
Contributor

che-bot commented Mar 10, 2020

❌ E2E Happy path tests failed ❗

See Details

Tested with Eclipse Che Multiuser User on K8S (minikube v1.1.1)

⚠️ https://github.com/orgs/eclipse/teams/eclipse-che-qa please check this report.

ℹ️ Use comment "crw-ci-test" to rerun happy path E2E test.

@amisevsk amisevsk merged commit 78ee3bf into eclipse-che:master Mar 10, 2020
@che-bot che-bot removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Mar 10, 2020
@che-bot che-bot added this to the 7.10.0 milestone Mar 10, 2020
@amisevsk amisevsk deleted the handle-broker-digests branch March 10, 2020 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Outline of a bug - must adhere to the bug report template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Container name for brokers can be created longer than 63 chars
5 participants