File tree Expand file tree Collapse file tree 9 files changed +21
-20
lines changed
operator-framework-core/src/main/java/io/javaoperatorsdk/operator
operator-framework-quarkus-extension
deployment/src/main/java/io/javaoperatorsdk/quarkus/extension/deployment
runtime/src/main/java/io/javaoperatorsdk/quarkus/extension
java/io/javaoperatorsdk/quarkus/it
operator-framework/src/main/java/io/javaoperatorsdk/operator/config/runtime Expand file tree Collapse file tree 9 files changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ public <R extends CustomResource> void register(
101101
102102 // check that the custom resource is known by the cluster if configured that way
103103 final CustomResourceDefinition crd ;
104- if (configurationService .validateCustomResources ()) {
104+ if (configurationService .checkCRDAndValidateLocalModel ()) {
105105 final var crdName = configuration .getCRDName ();
106106 crd = k8sClient .apiextensions ().v1 ().customResourceDefinitions ().withName (crdName ).get ();
107107 if (crd == null ) {
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ default Config getClientConfiguration() {
5252 *
5353 * @return {@code true} if CRDs should be checked (default), {@code false} otherwise
5454 */
55- default boolean validateCustomResources () {
55+ default boolean checkCRDAndValidateLocalModel () {
5656 return true ;
5757 }
5858}
Original file line number Diff line number Diff line change 1212public class Utils {
1313
1414 private static final Logger log = LoggerFactory .getLogger (Utils .class );
15- public static final String VALIDATE_CR_ENV_KEY = "JAVA_OPERATOR_SDK_VALIDATE_CR " ;
15+ public static final String CHECK_CRD_ENV_KEY = "JAVA_OPERATOR_SDK_CHECK_CRD " ;
1616
1717 /**
1818 * Attempts to load version information from a properties file produced at build time, currently
@@ -51,11 +51,11 @@ public static Version loadFromProperties() {
5151 }
5252
5353 public static boolean isValidateCustomResourcesEnvVarSet () {
54- return System .getProperty (VALIDATE_CR_ENV_KEY ) != null ;
54+ return System .getProperty (CHECK_CRD_ENV_KEY ) != null ;
5555 }
5656
57- public static boolean shouldValidateCustomResources () {
58- final var value = System .getProperty (VALIDATE_CR_ENV_KEY );
57+ public static boolean shouldCheckCRDAndValidateLocalModel () {
58+ final var value = System .getProperty (CHECK_CRD_ENV_KEY );
5959 return value == null || Boolean .getBoolean (value );
6060 }
6161}
Original file line number Diff line number Diff line change @@ -83,8 +83,8 @@ void createConfigurationServiceAndOperator(
8383 final var version = Utils .loadFromProperties ();
8484 final var validateCustomResources =
8585 Utils .isValidateCustomResourcesEnvVarSet ()
86- ? Utils .shouldValidateCustomResources ()
87- : externalConfiguration .validateCustomResources .orElse (true );
86+ ? Utils .shouldCheckCRDAndValidateLocalModel ()
87+ : externalConfiguration .checkCRDAndValidateLocalModel .orElse (true );
8888
8989 final var supplier =
9090 recorder .configurationServiceSupplier (
Original file line number Diff line number Diff line change @@ -14,9 +14,10 @@ public class ExternalConfiguration {
1414 @ ConfigItem public Map <String , ExternalControllerConfiguration > controllers ;
1515
1616 /**
17- * Whether the operator should validate the {@link CustomResource} implementation before
18- * registering the associated controller.
17+ * Whether the operator should check that the CRD is properly deployed and that the associated
18+ * {@link CustomResource} implementation matches its information before registering the associated
19+ * controller.
1920 */
2021 @ ConfigItem (defaultValue = "true" )
21- public Optional <Boolean > validateCustomResources ;
22+ public Optional <Boolean > checkCRDAndValidateLocalModel ;
2223}
Original file line number Diff line number Diff line change 1313public class QuarkusConfigurationService extends AbstractConfigurationService {
1414 private static final ClientProxyUnwrapper unwrapper = new ClientProxyUnwrapper ();
1515 private final KubernetesClient client ;
16- private final boolean validateCustomResources ;
16+ private final boolean checkCRDAndValidateLocalModel ;
1717
1818 public QuarkusConfigurationService (
1919 Version version ,
2020 List <ControllerConfiguration > configurations ,
2121 KubernetesClient client ,
22- boolean validateCustomResources ) {
22+ boolean checkCRDAndValidateLocalModel ) {
2323 super (version );
2424 this .client = client ;
2525 if (configurations != null && !configurations .isEmpty ()) {
2626 configurations .forEach (this ::register );
2727 }
28- this .validateCustomResources = validateCustomResources ;
28+ this .checkCRDAndValidateLocalModel = checkCRDAndValidateLocalModel ;
2929 }
3030
3131 @ Override
@@ -41,8 +41,8 @@ public <R extends CustomResource> ControllerConfiguration<R> getConfigurationFor
4141 }
4242
4343 @ Override
44- public boolean validateCustomResources () {
45- return validateCustomResources ;
44+ public boolean checkCRDAndValidateLocalModel () {
45+ return checkCRDAndValidateLocalModel ;
4646 }
4747
4848 private static <R extends CustomResource > ResourceController <R > unwrap (
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public class TestOperatorApp {
2121 @ GET
2222 @ Path ("validateCR" )
2323 public boolean validateCR () {
24- return configurationService .validateCustomResources ();
24+ return configurationService .checkCRDAndValidateLocalModel ();
2525 }
2626
2727 @ GET
Original file line number Diff line number Diff line change 11quarkus.operator-sdk.controllers.annotation.finalizer =from-property/finalizer
22quarkus.operator-sdk.controllers.annotation.namespaces =bar
3- quarkus.operator-sdk.validate-custom-resources =false
3+ quarkus.operator-sdk.check-crd-and- validate-local-model =false
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public <R extends CustomResource> ControllerConfiguration<R> getConfigurationFor
3838 }
3939
4040 @ Override
41- public boolean validateCustomResources () {
42- return Utils .shouldValidateCustomResources ();
41+ public boolean checkCRDAndValidateLocalModel () {
42+ return Utils .shouldCheckCRDAndValidateLocalModel ();
4343 }
4444}
You can’t perform that action at this time.
0 commit comments