Problem
OperatorAutoConfiguration.getClientConfiguration() is not annotated with @ConditionalOnMissingBean, unlike the kubernetesClient() bean which is correctly guarded.
This means getClientConfiguration() is always executed, even when a custom KubernetesClient bean is already provided (e.g. in tests via a local K3s cluster).
The method calls Config.autoConfigure() or new ConfigBuilder() internally, both of which read ~/.kube/config and attempt to resolve all exec-credentials — including expired ones (e.g. expired gcloud tokens) — even if they are completely irrelevant for the current context.
Expected behavior
getClientConfiguration() should be annotated with @ConditionalOnMissingBean(Config.class) so that it can be skipped when a custom Config bean is provided, consistent with how kubernetesClient() is handled.
Suggested fix
@Bean
@ConditionalOnMissingBean(Config.class) // <-- add this
public Config getClientConfiguration(
@Autowired(required = false) KubernetesConfigCustomizer configCustomizer) {
...
}
Context
Version: 6.4.1
Module: operator-framework-spring-boot-starter
In test environments using e.g. K3sTestAutoConfiguration (which provides its own KubernetesClient bean via @ConditionalOnMissingBean), the getClientConfiguration() method still always fires and causes warnings/errors due to stale credentials in ~/.kube/config, even though the resulting Config bean is never actually used.
Problem
OperatorAutoConfiguration.getClientConfiguration()is not annotated with@ConditionalOnMissingBean, unlike thekubernetesClient()bean which is correctly guarded.This means
getClientConfiguration()is always executed, even when a customKubernetesClientbean is already provided (e.g. in tests via a local K3s cluster).The method calls
Config.autoConfigure()ornew ConfigBuilder()internally, both of which read~/.kube/configand attempt to resolve all exec-credentials — including expired ones (e.g. expired gcloud tokens) — even if they are completely irrelevant for the current context.Expected behavior
getClientConfiguration()should be annotated with@ConditionalOnMissingBean(Config.class)so that it can be skipped when a customConfigbean is provided, consistent with howkubernetesClient()is handled.Suggested fix
Context
Version: 6.4.1
Module: operator-framework-spring-boot-starter
In test environments using e.g. K3sTestAutoConfiguration (which provides its own KubernetesClient bean via @ConditionalOnMissingBean), the getClientConfiguration() method still always fires and causes warnings/errors due to stale credentials in ~/.kube/config, even though the resulting Config bean is never actually used.