question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

kubernetes.client.namespace not honored when using ConfigMap PropertySource and DefaultKubernetesClient

See original GitHub issue

Given 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:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
HJK181commented, Apr 8, 2020

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.

0reactions
spring-projects-issuescommented, Apr 8, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found