Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubernetes ConfigMap with single key value should not be parsed as a file reference #456

Open
zoltan-toth-mw opened this issue Mar 17, 2022 · 0 comments
Assignees
Labels
type: bug Something isn't working

Comments

@zoltan-toth-mw
Copy link

Expected Behavior

I created a config map with a single key value: "datasources.default.url=jdbc:postgresql://...."

18:20:58.743 [OkHttp https://100.64.0.1/...] TRACE i.m.kubernetes.util.KubernetesUtils - Processing PropertySources for ConfigMap: class V1ConfigMap {
    apiVersion: null
    binaryData: null
    data: {datasources.default.url=jdbc:postgresql://REDACTED}
    immutable: null
    ...

I'd expect that "datasources.default.url" property will be available in the application, but it is not.

Actual Behaviour

KubernetesUtils decides that this is not a map of key values but a "single file???"

 if (data.size() > 1 || !getExtension(entry.getKey()).isPresent()) {
      if (LOG.isTraceEnabled()) {
           LOG.trace("Considering this ConfigMap as containing multiple literal key/values");
      }
      ...
    } else {
            if (LOG.isTraceEnabled()) {
                LOG.trace("Considering this ConfigMap as containing values from a single file");
            }
            ...
    }

data.size() > 1 will be false and getExtension will return with "url" for the key "datasources.default.url" which means the second condition will be false too.

This logic should be at least documented as it is hidden now but I think getExtension should return something only for well known configuration extensions like yaml or properties.

Steps To Reproduce

Call KubernetesUtils.getExtension("datasources.default.url") and it will return url OR
call KubernetesUtils.configMapAsPropertySource with a single key value config map where the key contains a dot.

Environment Information

No response

Example Application

No response

Version

3.2.7

@pgressa pgressa added the type: bug Something isn't working label Mar 17, 2022
@dradosevic dradosevic self-assigned this Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants