From 31203244f7dc30da00e5e599184776bfce146d8f Mon Sep 17 00:00:00 2001 From: Chris Laprun Date: Thu, 7 Nov 2024 15:47:14 +0100 Subject: [PATCH] refactor: move external CRD configuration to main CRD configuration Signed-off-by: Chris Laprun --- .../bundle/deployment/BundleProcessor.java | 4 ++-- .../operatorsdk/bundle/ExternalCRDsTest.java | 2 +- .../runtime/BundleGenerationConfiguration.java | 14 -------------- .../operatorsdk/runtime/CRDConfiguration.java | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/BundleProcessor.java b/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/BundleProcessor.java index 46a280f0a..152205356 100644 --- a/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/BundleProcessor.java +++ b/bundle-generator/deployment/src/main/java/io/quarkiverse/operatorsdk/bundle/deployment/BundleProcessor.java @@ -115,9 +115,9 @@ private static String getBundleName(AnnotationInstance csvMetadata, String defau } @BuildStep(onlyIf = IsGenerationEnabled.class) - UnownedCRDInfoBuildItem unownedCRDInfo(BundleGenerationConfiguration bundleConfiguration, + UnownedCRDInfoBuildItem unownedCRDInfo(BuildTimeOperatorConfiguration operatorConfiguration, CurateOutcomeBuildItem appInfoBuildItem) { - final Optional> maybeExternalCRDs = bundleConfiguration.externalCRDLocations(); + final Optional> maybeExternalCRDs = operatorConfiguration.crd().externalCRDLocations(); final var crds = new CRDInfos(); if (maybeExternalCRDs.isPresent()) { final var moduleRoot = appInfoBuildItem.getApplicationModel().getApplicationModule().getModuleDir().toPath(); diff --git a/bundle-generator/deployment/src/test/java/io/quarkiverse/operatorsdk/bundle/ExternalCRDsTest.java b/bundle-generator/deployment/src/test/java/io/quarkiverse/operatorsdk/bundle/ExternalCRDsTest.java index 5e2cef044..753508b61 100644 --- a/bundle-generator/deployment/src/test/java/io/quarkiverse/operatorsdk/bundle/ExternalCRDsTest.java +++ b/bundle-generator/deployment/src/test/java/io/quarkiverse/operatorsdk/bundle/ExternalCRDsTest.java @@ -32,7 +32,7 @@ public class ExternalCRDsTest { .withApplicationRoot((jar) -> jar .addClasses(First.class, External.class, ExternalDependentResource.class, ReconcilerWithExternalCR.class)) - .overrideConfigKey("quarkus.operator-sdk.bundle.external-crd-locations", + .overrideConfigKey("quarkus.operator-sdk.crd.external-crd-locations", "src/test/external-crds/v1beta1spec.crd.yml, src/test/external-crds/external.crd.yml"); @ProdBuildResults diff --git a/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/BundleGenerationConfiguration.java b/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/BundleGenerationConfiguration.java index 5af0157c1..f7334b682 100644 --- a/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/BundleGenerationConfiguration.java +++ b/bundle-generator/runtime/src/main/java/io/quarkiverse/operatorsdk/bundle/runtime/BundleGenerationConfiguration.java @@ -58,18 +58,4 @@ public interface BundleGenerationConfiguration { * @since 6.8.0 */ Map bundles(); - - /** - * A comma-separated list of paths where external CRDs that need to be referenced for non-generated custom resources. - * Typical use cases where this might be needed include when custom resource implementations are located in a different - * module than the controller implementation or when the CRDs are not generated at all (e.g. in integration cases where your - * operator needs to deal with 3rd party custom resources). - * - *

- * Paths can be either absolute or relative, in which case they will be resolved from the current module root directory. - *

- * - * @since 6.8.4 - */ - Optional> externalCRDLocations(); } diff --git a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/CRDConfiguration.java b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/CRDConfiguration.java index 90faee8df..bd0ca5e9c 100644 --- a/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/CRDConfiguration.java +++ b/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/CRDConfiguration.java @@ -64,4 +64,18 @@ public interface CRDConfiguration { * process. */ Optional> excludeResources(); + + /** + * A comma-separated list of paths where external CRDs that need to be referenced for non-generated custom resources. + * Typical use cases where this might be needed include when custom resource implementations are located in a different + * module than the controller implementation or when the CRDs are not generated at all (e.g. in integration cases where your + * operator needs to deal with 3rd party custom resources). + * + *

+ * Paths can be either absolute or relative, in which case they will be resolved from the current module root directory. + *

+ * + * @since 6.8.4 + */ + Optional> externalCRDLocations(); }