File tree 9 files changed +21
-20
lines changed
operator-framework/src/main/java/io/javaoperatorsdk/operator/config/runtime
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
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(
101
101
102
102
// check that the custom resource is known by the cluster if configured that way
103
103
final CustomResourceDefinition crd ;
104
- if (configurationService .validateCustomResources ()) {
104
+ if (configurationService .checkCRDAndValidateLocalModel ()) {
105
105
final var crdName = configuration .getCRDName ();
106
106
crd = k8sClient .apiextensions ().v1 ().customResourceDefinitions ().withName (crdName ).get ();
107
107
if (crd == null ) {
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ default Config getClientConfiguration() {
52
52
*
53
53
* @return {@code true} if CRDs should be checked (default), {@code false} otherwise
54
54
*/
55
- default boolean validateCustomResources () {
55
+ default boolean checkCRDAndValidateLocalModel () {
56
56
return true ;
57
57
}
58
58
}
Original file line number Diff line number Diff line change 12
12
public class Utils {
13
13
14
14
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 " ;
16
16
17
17
/**
18
18
* Attempts to load version information from a properties file produced at build time, currently
@@ -51,11 +51,11 @@ public static Version loadFromProperties() {
51
51
}
52
52
53
53
public static boolean isValidateCustomResourcesEnvVarSet () {
54
- return System .getProperty (VALIDATE_CR_ENV_KEY ) != null ;
54
+ return System .getProperty (CHECK_CRD_ENV_KEY ) != null ;
55
55
}
56
56
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 );
59
59
return value == null || Boolean .getBoolean (value );
60
60
}
61
61
}
Original file line number Diff line number Diff line change @@ -83,8 +83,8 @@ void createConfigurationServiceAndOperator(
83
83
final var version = Utils .loadFromProperties ();
84
84
final var validateCustomResources =
85
85
Utils .isValidateCustomResourcesEnvVarSet ()
86
- ? Utils .shouldValidateCustomResources ()
87
- : externalConfiguration .validateCustomResources .orElse (true );
86
+ ? Utils .shouldCheckCRDAndValidateLocalModel ()
87
+ : externalConfiguration .checkCRDAndValidateLocalModel .orElse (true );
88
88
89
89
final var supplier =
90
90
recorder .configurationServiceSupplier (
Original file line number Diff line number Diff line change @@ -14,9 +14,10 @@ public class ExternalConfiguration {
14
14
@ ConfigItem public Map <String , ExternalControllerConfiguration > controllers ;
15
15
16
16
/**
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.
19
20
*/
20
21
@ ConfigItem (defaultValue = "true" )
21
- public Optional <Boolean > validateCustomResources ;
22
+ public Optional <Boolean > checkCRDAndValidateLocalModel ;
22
23
}
Original file line number Diff line number Diff line change 13
13
public class QuarkusConfigurationService extends AbstractConfigurationService {
14
14
private static final ClientProxyUnwrapper unwrapper = new ClientProxyUnwrapper ();
15
15
private final KubernetesClient client ;
16
- private final boolean validateCustomResources ;
16
+ private final boolean checkCRDAndValidateLocalModel ;
17
17
18
18
public QuarkusConfigurationService (
19
19
Version version ,
20
20
List <ControllerConfiguration > configurations ,
21
21
KubernetesClient client ,
22
- boolean validateCustomResources ) {
22
+ boolean checkCRDAndValidateLocalModel ) {
23
23
super (version );
24
24
this .client = client ;
25
25
if (configurations != null && !configurations .isEmpty ()) {
26
26
configurations .forEach (this ::register );
27
27
}
28
- this .validateCustomResources = validateCustomResources ;
28
+ this .checkCRDAndValidateLocalModel = checkCRDAndValidateLocalModel ;
29
29
}
30
30
31
31
@ Override
@@ -41,8 +41,8 @@ public <R extends CustomResource> ControllerConfiguration<R> getConfigurationFor
41
41
}
42
42
43
43
@ Override
44
- public boolean validateCustomResources () {
45
- return validateCustomResources ;
44
+ public boolean checkCRDAndValidateLocalModel () {
45
+ return checkCRDAndValidateLocalModel ;
46
46
}
47
47
48
48
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 {
21
21
@ GET
22
22
@ Path ("validateCR" )
23
23
public boolean validateCR () {
24
- return configurationService .validateCustomResources ();
24
+ return configurationService .checkCRDAndValidateLocalModel ();
25
25
}
26
26
27
27
@ GET
Original file line number Diff line number Diff line change 1
1
quarkus.operator-sdk.controllers.annotation.finalizer =from-property/finalizer
2
2
quarkus.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
38
38
}
39
39
40
40
@ Override
41
- public boolean validateCustomResources () {
42
- return Utils .shouldValidateCustomResources ();
41
+ public boolean checkCRDAndValidateLocalModel () {
42
+ return Utils .shouldCheckCRDAndValidateLocalModel ();
43
43
}
44
44
}
You can’t perform that action at this time.
0 commit comments