You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Starting with Spring Cloud 2023.0.2/Spring Cloud Kubernetes 3.1.2, LeaderProperties.getNamespace(String default) is broken. As of commit 53fa5555, the method no longer falls back to the given defaultValue when namespace is not defined.
With 3.1.1, we return the defaultValue if the namespace is undefined (as expected):
publicStringgetNamespace(StringdefaultValue) {
if (!StringUtils.hasText(namespace)) {
returndefaultValue;
}
returnnamespace;
}
Applications that are not configuring spring.cloud.kubernetes.leader.namespace explicitly, relying on the auto-detected current namespace as the default will no longer work.
This is was accidentally introduced by the Fabric8 Leader refactoring made with #1648.
Impact
My application fails to start with this error:
io.fabric8.kubernetes.client.KubernetesClientException: namespace cannot be null
at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.inNamespace(BaseOperation.java:252)
at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.inNamespace(BaseOperation.java:97)
at org.springframework.cloud.kubernetes.fabric8.leader.Fabric8LeaderRecordWatcher.lambda$start$1(Fabric8LeaderRecordWatcher.java:63)
at org.springframework.cloud.kubernetes.commons.leader.LeaderUtils.guarded(LeaderUtils.java:51)
at org.springframework.cloud.kubernetes.fabric8.leader.Fabric8LeaderRecordWatcher.start(Fabric8LeaderRecordWatcher.java:59)
at org.springframework.cloud.kubernetes.commons.leader.LeaderInitiator.start(LeaderInitiator.java:62)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:288)
The text was updated successfully, but these errors were encountered:
kzander91
changed the title
Fabric8 LeaderProperties no longer auto-detect the current Kubernetes Namespace
Fabric8 LeaderProperties.getNamespace(defaultValue) no longer falls back to given default when namespace is undefined
May 31, 2024
Describe the bug
Starting with Spring Cloud 2023.0.2/Spring Cloud Kubernetes 3.1.2,
LeaderProperties.getNamespace(String default)
is broken. As of commit 53fa5555, the method no longer falls back to the givendefaultValue
whennamespace
is not defined.With 3.1.1, we return the
defaultValue
if thenamespace
is undefined (as expected):spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeaderProperties.java
Lines 121 to 127 in 2c9e4f0
With 3.1.2, we return the
namespace
if thedefaultValue
is defined (unexpected):spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeaderProperties.java
Lines 108 to 114 in 979bc62
This was likely the intention:
Applications that are not configuring
spring.cloud.kubernetes.leader.namespace
explicitly, relying on the auto-detected current namespace as the default will no longer work.This is was accidentally introduced by the Fabric8 Leader refactoring made with #1648.
Impact
My application fails to start with this error:
The text was updated successfully, but these errors were encountered: