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

Allow overriding of app.openshift.io/runtime label #26285

Merged
merged 1 commit into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,10 @@ public List<DecoratorBuildItem> createDecorators(ApplicationInfoBuildItem applic
});

result.add(new DecoratorBuildItem(OPENSHIFT, new ApplyImagePullPolicyDecorator(name, config.getImagePullPolicy())));
result.add(new DecoratorBuildItem(OPENSHIFT, new AddLabelDecorator(name, OPENSHIFT_APP_RUNTIME, QUARKUS)));

if (labels.stream().noneMatch(l -> l.getKey().equals(OPENSHIFT_APP_RUNTIME))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I really like it.
Ideally we should apply the same logic to all labels, annotations we add.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed! I'll try and go through the rest later on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#26543 should take care of the rest of the labels

result.add(new DecoratorBuildItem(OPENSHIFT, new AddLabelDecorator(name, OPENSHIFT_APP_RUNTIME, QUARKUS)));
}

Stream.concat(config.convertToBuildItems().stream(),
envs.stream().filter(e -> e.getTarget() == null || OPENSHIFT.equals(e.getTarget()))).forEach(e -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void assertGeneratedResources() throws IOException {
assertThat(openshiftList).filteredOn(h -> "DeploymentConfig".equals(h.getKind())).singleElement().satisfies(h -> {
assertThat(h.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo("openshift-v4");
assertThat(m.getLabels().get("app.openshift.io/runtime")).isEqualTo("quarkus");
assertThat(m.getLabels().get("app.openshift.io/runtime")).isEqualTo("test");
assertThat(m.getLabels().get("app.kubernetes.io/name")).isEqualTo("openshift-v4");
assertThat(m.getLabels().get("app")).isNull();
assertThat(m.getNamespace()).isNull();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
quarkus.kubernetes.deployment-target=openshift
quarkus.openshift.flavor=v4
quarkus.openshift.flavor=v4
quarkus.openshift.labels."app.openshift.io/runtime"=test