Skip to content

Commit

Permalink
Merge pull request quarkusio#38428 from iocanel/local-streams-38018
Browse files Browse the repository at this point in the history
Add resolve names annotation to OpenShift Deploymnets
  • Loading branch information
gsmet authored Jan 27, 2024
2 parents c748f21 + 2986643 commit c0faacf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.quarkus.kubernetes.deployment;

import io.dekorate.kubernetes.decorator.NamedResourceDecorator;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.api.model.PodTemplateSpecFluent;

public class ApplyResolveNamesImagePolicyDecorator extends NamedResourceDecorator<PodTemplateSpecFluent<?>> {

@Override
public void andThenVisit(PodTemplateSpecFluent<?> podTemplate, ObjectMeta meta) {
podTemplate.editOrNewMetadata().addToAnnotations("alpha.image.policy.openshift.io/resolve-names", "*").endMetadata();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ public List<DecoratorBuildItem> createDecorators(ApplicationInfoBuildItem applic
result.add(new DecoratorBuildItem(new RemoveOptionalFromConfigMapKeySelectorDecorator()));
}

result.add(new DecoratorBuildItem(new ApplyResolveNamesImagePolicyDecorator()));

DeploymentResourceKind deploymentKind = config.getDeploymentResourceKind(capabilities);
switch (deploymentKind) {
case Deployment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public void assertGeneratedResources() throws IOException {

assertThat(d.getSpec()).satisfies(deploymentSpec -> {
assertThat(deploymentSpec.getTemplate()).satisfies(t -> {
assertThat(t.getMetadata()).satisfies(metadata -> assertThat(metadata.getAnnotations()).contains(
entry("alpha.image.policy.openshift.io/resolve-names", "*")));

assertThat(t.getMetadata()).satisfies(metadata -> assertThat(metadata.getLabels()).containsAnyOf(
entry("app.kubernetes.io/name", NAME),
entry("app.kubernetes.io/version", "0.1-SNAPSHOT")));
Expand Down

0 comments on commit c0faacf

Please sign in to comment.