Comments (9)
Hi @StephanePaulus, first of all huge thank you for taking this initiative and POC!
library supports reading configmaps from mounted volumes.
Yeah, this is definitely smth we do not support yet, I'll fix the guideline, thanks for this and sorry for misleading you.
I would like to ask for advice and if there is a need for this besides my own. In my case I am not allowed to use the kubernetes API, so mounted volumes is the only way I can read configmaps or secrets.
That's good point and use case. Feel free to create PR and I can take it over if you like or I can provide you initial code review and you can finish the work yourselves.
Thanks again.
from micronaut-kubernetes.
Hi @pgressa, please let me know if you feel like the PR is not what you were expecting. Maybe we can come up with a better solution. If you are waiting for me to fully complete the PR, with all test passing please let me know.
from micronaut-kubernetes.
Hi @StephanePaulus, first of sorry for being quite for some time. Once again thanks for the PR. I'd like to get beck to this feature now.
To answer question #315:
For the secrets case I think we could either add the file path of the variables, so for the secret :
apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
username: YWRtaW4=
password: MWYyZDFlMmU2N2Rm
and configuration
kubernetes:
client:
enabled: false
watch: true
secrets:
enabled: true
paths:
- /etc/example-service/secrets
So the property source name would be then:
- file path
etc.example-servce.secrets.username
respetc.example-servce.secrets.password
Another option is to extend the configuration with the defined prefix:
kubernetes:
client:
enabled: false
watch: true
secrets:
enabled: true
items:
- path: /etc/example-service/secrets
namePrefix: foo.bar
What do you think?
Where to place it
Ideally this feature can find its way into https://github.com/micronaut-projects/micronaut-discovery-client in the future but at this moment let's keep it focused entirely on K8s use case.
I'll take over the PR and continue on it if you're not against it.
from micronaut-kubernetes.
@pgressa yes sure you can take over. I could share the new code I have in a private repository, that already fixes some bad file watching stuff. Let me know if I can be of any assistance.
I think the namePrefix option is the cleanest.
from micronaut-kubernetes.
I was thinking about deduplicating the code by providing more generic approach like:
kubernetes:
client:
external:
- name: <optional-name-of-the-property>, defaults to the "basename <path>"
path: <mandatory-path-to-file>
type: <mandatory-file-type> [file-per-property|structered-configuration], no default
watch: [true/false]
enabled: [true/false]
- This approach brings certain level of extensibility by providing the type file resolver.
also @StephanePaulus if you could share the new code I would be glad for it. Thanks.
from micronaut-kubernetes.
@pgressa here you can find the updated code that worked good enough for me. It is not perfect, but it did the job. code repo
Your approach looks very generic and will solve all issues I am trying to fix.
How kubernetes adds mounted files to the filesystem of a container is kind of tricky. When using the normal filewatcher you need to do special logic, because the files are just symbolic links. And the main folder is "..data"
from micronaut-kubernetes.
@pgressa Sorry to ask you, but do you have an idea when this feature/fix can be available?
from micronaut-kubernetes.
@StephanePaulus sorry for the delay, I have extracted the loading of config maps mounted as volumes into this PR #365. The hot reloading will be subject of some other PR in the future.
from micronaut-kubernetes.
@StephanePaulus I have removed the part "Add support to load configmaps when mounted as a volume. " from the title, since that's is already merged.
from micronaut-kubernetes.
Related Issues (20)
- Secrets with non-printable characters are corrupted on the app side
- Application fails to start on local when Kubernetes config is present in .kube directory HOT 10
- micronaut-kubernetes-informer prevents BeanCreatedEventListener<ApiClient> from firing HOT 1
- Move examples to guides HOT 5
- BOM contains invalid entry
- Kubernetes ConfigMap with single key value should not be parsed as a file reference
- DefaultNamespaceResolver runs in non k8s environments
- Dependency Dashboard
- ConfigMapLabelSupplier tries to initialize when eagerInitSingletons property is set to true HOT 4
- Consider supporting Java Operator SDK
- [Security vulnerability] Update dependency Kubernetes Java Client to v16 HOT 1
- Not possible to use namespaceSupplier without namespace on @Informer with DefaultInformerNamespaceResolver
- Broken Build in branch targeting Micronaut Framework 3.x HOT 1
- Migrate to new configuration ascidoc macro
- Consider simplifying CI
- path to be lazy initialized by injecting a provider to avoid this issue
- K8s Doc generation fails
- Informer library implementation influencing and limiting the naming of Custom Resource java classes HOT 3
- Controller for all namespaces can't get object from indexer using provided OperatorResourceLister
- Support watching K8s secrets to change properties without restart HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micronaut-kubernetes.