kubernetes.client.namespace not honored when using ConfigMap PropertySource and DefaultKubernetesClient
See original GitHub issueGiven a Service A1
in namespace A
and a POD B1
running in namespace B
with the following ConfigMap for Pod B1:
apiVersion: v1
kind: ConfigMap
metadata:
name: B1
data:
application.yml: |-
server:
port: 8092
spring:
profiles: kubernetes
cloud:
kubernetes:
client:
namespace: A
discovery:
enabled: true
A1:
ribbon:
NIWSServerListClassName: org.springframework.cloud.kubernetes.ribbon.KubernetesServerList
KubernetesNamespace: A
PortName: https
The DefaultKubernetesClient
uses the namespace where POD B1’s ConfigMap is applied instead of the value from kubernetes.client.namespace
when asked to get all services from KubernetesDiscoveryClient#getInstances
. The problem is that ConfigMapConfigProperties#determineSources
set’s the namespace for the client to the namespace the ConfigMap is deployed to.
Using the same configuration above with spring-cloud-configuration
where the application.yml
is served from a GIT repo work perfectly fine.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Cannot read configmap with name: [xx] in namespace ['default ...
is /etc/config default value for configmaps? i've created configmap, i can use in spring cloud kubernetes via consuming api. but when i want...
Read more >Spring Cloud Kubernetes
config.namespace had not been set, the ConfigMap named c1 would be looked up in the namespace that the application runs. See Namespace resolution ......
Read more >Kubernetes Client - Quarkus
Usage. Quarkus configures a Bean of type KubernetesClient which can be injected into application code using the well known CDI methods. This client...
Read more >fabric8io - Bountysource
KubernetesClientException: Operation: [get] for kind: [ConfigMap] with name: [Scripts Engine] in namespace: [null] failed. at io.fabric8.kubernetes.client.
Read more >DefaultKubernetesClient (Fabric8 :: Kubernetes - javadoc.io
Class for Default Kubernetes Client implementing KubernetesClient interface. ... API entrypoint for kubernetes resources with APIGroup apps/v1.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m not willing to invest more time in this issue. I already invested a lot of time and effort to debug the issue and give you a description with the class and method name where things go wrong.
If you are not interested in fixing it, feel free to close the issue.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.