diff --git a/CHANGELOG.md b/CHANGELOG.md index d370df5f85..70da98eecd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ Usage: * Ported PR fabric8io/fabric8-maven-plugin#1792, NullCheck in FileDataSecretEnricher * Fix #53: Renamed plugins to openshift/kubernetes-maven-plugin keeping acronym (oc/k8s) for goal * Fix #97: Port of fabric8io/fabric8-maven-plugin#1794 to fix ImageChange triggers not being set in DeploymentConfig when resource fragments are used +* Ported PR fabric8io/fabric8-maven-plugin#1802, Labels are missing for some objects ### 0.2.0 (05-03-2020) * Fix #71: script to extract changelog information for notifications diff --git a/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/AbstractDockerMojo.java b/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/AbstractDockerMojo.java index 650ee1d7cb..4ea00f6b63 100644 --- a/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/AbstractDockerMojo.java +++ b/kubernetes-maven-plugin/plugin/src/main/java/org/eclipse/jkube/maven/plugin/mojo/build/AbstractDockerMojo.java @@ -61,11 +61,15 @@ import org.eclipse.jkube.kit.config.image.build.OpenShiftBuildStrategy; import org.eclipse.jkube.kit.config.image.build.RegistryAuthConfiguration; import org.eclipse.jkube.kit.config.resource.BuildRecreateMode; +import org.eclipse.jkube.kit.config.resource.PlatformMode; import org.eclipse.jkube.kit.config.resource.ProcessorConfig; import org.eclipse.jkube.kit.config.resource.ResourceConfig; import org.eclipse.jkube.kit.config.resource.RuntimeMode; import org.eclipse.jkube.kit.config.service.JKubeServiceHub; import org.eclipse.jkube.kit.profile.ProfileUtil; +import org.eclipse.jkube.maven.enricher.api.EnricherContext; +import org.eclipse.jkube.maven.enricher.api.JKubeEnricherContext; +import org.eclipse.jkube.maven.plugin.enricher.EnricherManager; import org.eclipse.jkube.maven.plugin.generator.GeneratorManager; import org.apache.maven.archiver.MavenArchiveConfiguration; @@ -731,6 +735,11 @@ protected org.eclipse.jkube.kit.config.service.BuildService.BuildServiceConfig g projectHelper.attachArtifact(project, "yml", classifier, destFile); } }) + .enricherTask(builder -> { + EnricherManager enricherManager = new EnricherManager(resources, getEnricherContext(), MavenUtil.getCompileClasspathElementsIfRequested(project, useProjectClasspath)); + enricherManager.enrich(PlatformMode.kubernetes, builder); + enricherManager.enrich(PlatformMode.openshift, builder); + }) .build(); } @@ -762,6 +771,17 @@ protected String getLogPrefix() { // ================================================================================================== + // Get enricher context + public EnricherContext getEnricherContext() throws DependencyResolutionRequiredException { + return new JKubeEnricherContext.Builder() + .project(MavenUtil.convertMavenProjectToJKubeProject(project, session)) + .config(extractEnricherConfig()) + .images(getResolvedImages()) + .resources(resources) + .log(log) + .build(); + } + // Get generator context protected GeneratorContext getGeneratorContext() throws DependencyResolutionRequiredException { return new GeneratorContext.Builder()