Skip to content

Make CustomResource implementations validation configurable for Spring Boot #381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ common mistakes. Advanced users or production deployments might want to skip thi
by setting
the `CHECK_CRD_ENV_KEY` environment variable to `false`. Quarkus users can also add
`quarkus.operator-sdk.check-crd-and-validate-local-model=false` to their `application.properties` for the
same purpose.
same purpose. Spring Boot users can set the property `javaoperatorsdk.check-crd-and-validate-local-model`
to `false`.

#### Automatic generation of CRDs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public Config getClientConfiguration() {
return config.build();
}

@Override
public boolean checkCRDAndValidateLocalModel() {
return configuration.getCheckCrdAndValidateLocalModel();
}

@Bean
@ConditionalOnMissingBean(Operator.class)
public Operator operator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class OperatorConfigurationProperties {

private KubernetesClientProperties client = new KubernetesClientProperties();
private Map<String, ControllerProperties> controllers = Collections.emptyMap();
private boolean checkCrdAndValidateLocalModel = true;

public KubernetesClientProperties getClient() {
return client;
Expand All @@ -25,4 +26,12 @@ public Map<String, ControllerProperties> getControllers() {
public void setControllers(Map<String, ControllerProperties> controllers) {
this.controllers = controllers;
}

public boolean getCheckCrdAndValidateLocalModel() {
return checkCrdAndValidateLocalModel;
}

public void setCheckCrdAndValidateLocalModel(boolean checkCrdAndValidateLocalModel) {
this.checkCrdAndValidateLocalModel = checkCrdAndValidateLocalModel;
}
}