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

Support watching K8s secrets to change properties without restart #680

Open
mhartmann-jaconi opened this issue Feb 21, 2024 · 3 comments
Open

Comments

@mhartmann-jaconi
Copy link

Feature description

Feature Request
Support of watch mechanism for K8s secrets, read via K8s-api, so that secret content is stored as property source in application context without a server restart.

Current State
From this documentation I get the impression (and my tests seem to prove that), that only ConfigMaps can be watched to dynamically (without restart) provide configuration as property source in the application context.

My Usecase
I have an application, which does oauth-secured calls to other backend services in context of a "tenant" (a keycloak realm), where we have multiple ones of. To achieve that, we need a client-id/-secret per tenant in the application context.
From time to time, there are new keycloak realms added and new client-credentials get generated and reflected as K8s secrets automatically (initiated by a different team).
As a service owner I don't want to take manual action (restart service), when a new K8s secret appears, I just want the application to handle that by itself (eg. via K8s-api 'watch').

@alvarosanchez
Copy link
Member

Secrets are supported too: https://github.com/micronaut-projects/micronaut-kubernetes/blob/master/src/main/docs/guide/config-client.adoc#secrets

Note that you need to explicitly enable it (and give your deployment secret read permissions).

Please give it a try.

@alvarosanchez alvarosanchez closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2024
@mhartmann-jaconi
Copy link
Author

I already tried the same approach, as for configmaps:

micronaut:
  config-client:
    enabled: true

kubernetes:
  client:
    secrets:
      enabled: true
      watch: true
      labels:
        - app: keycloak

But unfortunately this doesn't seem to work. I need to restart the service to make it aware of new secrets.

@alvarosanchez
Copy link
Member

alvarosanchez commented Feb 21, 2024

My apologies, secrets watching is indeed not supported, but is a legitimate ask. Reopening this

@alvarosanchez alvarosanchez reopened this Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants