Skip to content
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

[CAMEL-21451] Migrate to JKube generated resources for all runtimes #16290

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

tdiesler
Copy link
Contributor

Copy link
Contributor

@gansheer gansheer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you remove the quarkus way of generating the manifests then this code should be removed as well :

public void applyRuntimeSpecificProperties(Traits traitConfig, TraitContext context, RuntimeType runtimeType) {
List<String> routeProperties = new ArrayList<>();
if (runtimeType == RuntimeType.quarkus) {
Route routeTrait = Optional.ofNullable(traitConfig.getRoute()).orElseGet(Route::new);
Container containerTrait = Optional.ofNullable(traitConfig.getContainer()).orElseGet(Container::new);
routeProperties.add("quarkus.openshift.route.expose=true");
if (routeTrait.getAnnotations() != null) {
routeTrait.getAnnotations().forEach((name, value) -> routeProperties
.add("quarkus.openshift.route.annotations.\"%s\"=%s".formatted(name, value)));
}
if (routeTrait.getHost() != null) {
routeProperties.add("quarkus.openshift.route.host=%s".formatted(routeTrait.getHost()));
}
routeProperties.add("quarkus.openshift.route.target-port=%s"
.formatted(Optional.ofNullable(containerTrait.getServicePortName()).orElse(DEFAULT_CONTAINER_PORT_NAME)));
if (routeTrait.getTlsTermination() != null) {
routeProperties
.add("quarkus.openshift.route.tls.termination=%s".formatted(routeTrait.getTlsTermination().getValue()));
}
if (routeTrait.getTlsCertificate() != null) {
routeProperties.add(
"quarkus.openshift.route.tls.certificate=%s"
.formatted(getContent(routeTrait.getTlsCertificate()).replaceAll("\n", "\\\\n")));
}
if (routeTrait.getTlsKey() != null) {
routeProperties.add("quarkus.openshift.route.tls.key=%s"
.formatted(getContent(routeTrait.getTlsKey()).replaceAll("\n", "\\\\n")));
}
if (routeTrait.getTlsCACertificate() != null) {
routeProperties
.add("quarkus.openshift.route.tls.ca-certificate=%s"
.formatted(getContent(routeTrait.getTlsCACertificate()).replaceAll("\n", "\\\\n")));
}
if (routeTrait.getTlsDestinationCACertificate() != null) {
routeProperties.add("quarkus.openshift.route.tls.destination-ca-certificate=%s"
.formatted(getContent(routeTrait.getTlsDestinationCACertificate()).replaceAll("\n", "\\\\n")));
}
if (routeTrait.getTlsInsecureEdgeTerminationPolicy() != null) {
routeProperties.add("quarkus.openshift.route.tls.insecure-edge-termination-policy=%s"
.formatted(routeTrait.getTlsInsecureEdgeTerminationPolicy()));
}
}
context.addOrAppendConfigurationResource("application.properties",
routeProperties.stream().collect(Collectors.joining(System.lineSeparator())));
}

It was used to generate the openshift CRD Route using the quarkus openshift plugin.

@tdiesler
Copy link
Contributor Author

please test this again

Copy link
Contributor

@gansheer gansheer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@gansheer gansheer merged commit affe175 into apache:main Nov 15, 2024
4 checks passed
@tdiesler tdiesler deleted the CAMEL-21451 branch November 15, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants