Skip to content

Commit

Permalink
Disable Kubernetes Config when in AppCDs generation
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Jan 4, 2024
1 parent 119e7fa commit 1a4bbdc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
@Recorder
public class AppCDSRecorder {

public static final String QUARKUS_APPCDS_GENERATE_PROP = "quarkus.appcds.generate";

public void controlGenerationAndExit() {
if (Boolean.parseBoolean(System.getProperty("quarkus.appcds.generate", "false"))) {
if (Boolean.parseBoolean(System.getProperty(QUARKUS_APPCDS_GENERATE_PROP, "false"))) {
InitializationTaskRecorder.preventFurtherRecorderSteps(5,
"Unable to properly shutdown Quarkus application when creating AppCDS",
PreventFurtherStepsException::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

import static io.smallrye.config.Converters.getImplicitConverter;

import java.util.Collections;

import org.eclipse.microprofile.config.spi.ConfigSource;

import io.fabric8.kubernetes.client.KubernetesClient;
import io.quarkus.arc.runtime.appcds.AppCDSRecorder;
import io.quarkus.kubernetes.client.runtime.KubernetesClientBuildConfig;
import io.quarkus.kubernetes.client.runtime.KubernetesClientUtils;
import io.quarkus.runtime.TlsConfig;
Expand All @@ -23,6 +26,12 @@ static class KubernetesConfigFactory implements ConfigurableConfigSourceFactory<
@Override
public Iterable<ConfigSource> getConfigSources(final ConfigSourceContext context,
final KubernetesClientBuildConfig config) {
boolean inAppCDsGeneration = Boolean
.parseBoolean(System.getProperty(AppCDSRecorder.QUARKUS_APPCDS_GENERATE_PROP, "false"));
if (inAppCDsGeneration) {
return Collections.emptyList();
}

// TODO - TlsConfig is used in a lot of place. This is to avoid having it to migrate to ConfigMapping.
boolean trustAll = getImplicitConverter(Boolean.class)
.convert(context.getValue("quarkus.tls.trust-all").getValue());
Expand Down

0 comments on commit 1a4bbdc

Please sign in to comment.