diff --git a/core/deployment/pom.xml b/core/deployment/pom.xml index 5e5ab8b0..5639b50c 100644 --- a/core/deployment/pom.xml +++ b/core/deployment/pom.xml @@ -42,6 +42,10 @@ io.quarkus quarkus-smallrye-health-deployment + + io.quarkus + quarkus-info-deployment-spi + io.fabric8 crd-generator-api-v2 diff --git a/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/OperatorSDKProcessor.java b/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/OperatorSDKProcessor.java index faa3e38d..cead32ba 100644 --- a/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/OperatorSDKProcessor.java +++ b/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/OperatorSDKProcessor.java @@ -5,6 +5,7 @@ import java.lang.annotation.Annotation; import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.function.Function; @@ -42,6 +43,7 @@ import io.quarkus.gizmo.MethodCreator; import io.quarkus.gizmo.MethodDescriptor; import io.quarkus.gizmo.ResultHandle; +import io.quarkus.info.deployment.spi.InfoBuildTimeValuesBuildItem; import io.quarkus.runtime.QuarkusApplication; import io.quarkus.runtime.metrics.MetricsFactory; @@ -97,6 +99,15 @@ void setup(BuildProducer indexDependency, new AdditionalIndexedClassesBuildItem(QuarkusControllerConfiguration.DefaultRateLimiter.class.getName())); } + @BuildStep + void addInfo(VersionBuildItem versionBuildItem, BuildProducer infoContributor) { + final var version = versionBuildItem.getVersion(); + infoContributor.produce(new InfoBuildTimeValuesBuildItem("Quarkus Operator SDK", Map.of( + "Java Operator SDK version", version.getSdkCompleteVersion(), + "Quarkus Operator SDK version", version.getExtensionCompleteVersion(), + "Fabric8 effective version", version.getRuntimeFabric8Version()))); + } + @BuildStep(onlyIf = IsDevelopment.class) void addConsoleCommands(VersionBuildItem versionBuildItem, BuildProducer commands) { // register dev console commands diff --git a/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/VersionAlignmentCheckingStep.java b/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/VersionAlignmentCheckingStep.java index d9aebc65..49c81c8b 100644 --- a/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/VersionAlignmentCheckingStep.java +++ b/core/deployment/src/main/java/io/quarkiverse/operatorsdk/deployment/VersionAlignmentCheckingStep.java @@ -21,7 +21,7 @@ VersionBuildItem checkVersionsAlignment(BuildTimeOperatorConfiguration buildTime log.info("QOSDK: " + version.getExtensionCompleteVersion()); log.info("JOSDK: " + version.getSdkCompleteVersion()); - final var runtimeFabric8Version = io.fabric8.kubernetes.client.Version.clientVersion(); + final var runtimeFabric8Version = version.getRuntimeFabric8Version(); log.info("Fabric8 (effective): " + runtimeFabric8Version); final var runtimeQuarkusVersion = io.quarkus.builder.Version.getVersion(); diff --git a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/Version.java b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/Version.java index 6020dd71..d2010e8c 100644 --- a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/Version.java +++ b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/Version.java @@ -19,15 +19,17 @@ public class Version extends io.javaoperatorsdk.operator.api.config.Version { private final String extensionVersion; private final String extensionBranch; private final String extensionCommit; + private final String runtimeFabric8Version; private final Date extensionBuildTime; @RecordableConstructor // constructor needs to be recordable for the class to be passed around by Quarkus public Version(String commit, Date builtTime, String extensionVersion, String extensionCommit, - String extensionBranch, Date extensionBuildTime) { + String extensionBranch, String runtimeFabric8Version, Date extensionBuildTime) { super(commit, builtTime); this.extensionVersion = extensionVersion; this.extensionBranch = extensionBranch; this.extensionCommit = extensionCommit; + this.runtimeFabric8Version = runtimeFabric8Version; this.extensionBuildTime = extensionBuildTime; } @@ -66,6 +68,10 @@ public String getQuarkusVersion() { return Versions.QUARKUS; } + public String getRuntimeFabric8Version() { + return runtimeFabric8Version; + } + public static Version loadFromProperties() { final var sdkVersion = Utils.VERSION; InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("extension-version.properties"); @@ -97,6 +103,7 @@ public static Version loadFromProperties() { properties.getProperty("git.build.version", UNKNOWN), properties.getProperty("git.commit.id.abbrev", UNKNOWN), properties.getProperty("git.branch", UNKNOWN), + io.fabric8.kubernetes.client.Version.clientVersion(), builtTime); } }