micronaut-projects / micronaut-kubernetes

This project includes integration between Micronaut and Kubernetes
https://micronaut-projects.github.io/micronaut-kubernetes/snapshot/guide
Apache License 2.0
44 stars 25 forks source link

KubernetesConfigurationClient respecting ConfigMap file name and environment #324

Open Ksnz opened 3 years ago

Ksnz commented 3 years ago

In current version of micronaut-kubernetes name of file in ConfigMap has no any effect on application. I think it would be better if it works like configs in application resources with same naming rules: application-<env> for example

apiVersion: v1
kind: ConfigMap
data:
  application-debug.yml: |+

would work only in debug environment Because in current version environment parameter in

public Publisher<PropertySource> getPropertySources(Environment environment)

of KubernetesConfigurationClient is not used at all.

I know it is breaking change, so it may be released with major version

pgressa commented 3 years ago

Hi @Ksnz ! Interesting idea though I wonder what would be the use case apart dynamically creating CM with the debug environment (if the application was started with debug env). The environments are deduced on the ApplicationContext startup and rest of the beans are configured based on property sources loaded from the configuration file. Also the configuration files are part of the application bundle, on the opposite the ConfigMap resource is provided externally so it's rather configuration discovery.

Truth is the AWS parameter store module follows the pattern you are suggesting.

At this moment I do not have strong opinion on this I'm curious what other users are thinking about this feature.