Skip to content

Commit

Permalink
Ensure that k8s client created from quarkus-kubernetes-config
Browse files Browse the repository at this point in the history
Relates to: quarkusio#18973
  • Loading branch information
geoand committed Mar 21, 2023
1 parent 187ca4b commit a990743
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ class KubernetesConfigSourceProvider implements ConfigSourceProvider {
private final ConfigMapConfigSourceUtil configMapConfigSourceUtil;
private final SecretConfigSourceUtil secretConfigSourceUtil;

/**
* @param config Quarkus runtime Configuration of the extension
* @param buildTimeConfig Quarkus build-time Configuration of the extension
* @param client A Kubernetes Client that is specific to this extension - it must not be shared with any other parts of the
* application
*/
public KubernetesConfigSourceProvider(KubernetesConfigSourceConfig config, KubernetesConfigBuildTimeConfig buildTimeConfig,
KubernetesClient client) {
this.config = config;
Expand All @@ -47,6 +53,7 @@ public Iterable<ConfigSource> getConfigSources(ClassLoader forClassLoader) {
if (buildTimeConfig.secretsEnabled && config.secrets.isPresent()) {
result.addAll(getSecretConfigSources(config.secrets.get()));
}
client.close(); // we no longer need the client, so we must close it to avoid resource leaks
return result;
}

Expand Down

0 comments on commit a990743

Please sign in to comment.