Comments (10)
I'll work on this if you don't mind
from gomplate.
Ok thanks for the tips -- looks like https://github.com/kubernetes/client-go is what I want. I'll dabble with this when I get some time.
from gomplate.
The would make sense for Secrets probably, too.
from gomplate.
Thanks @rhuss - I'm not very familiar with Kubernetes, but looking at the API, this could be fairly easy to implement using an HTTP(S) datasource
(see https://kubernetes.io/docs/api-reference/v1.5/#read-199 for example).
One thing I'm not sure about is authentication, though #115 went in recently which allows arbitrary headers to be sent (mostly for auth purposes).
I think a good start would be to try to see if something like this works:
(in.tmpl)
{{ (datasource "myconfigmap").data | toJSON }}
$ gomplate --datasource myconfigmap=http://my.kube.api.address/api/v1/namespaces/{namespace}/configmaps/myconfigmap -f in.tmpl
It'd probably be nicer to have simplified support, but hopefully this is a start! Can you try this out and let me know if it works? Or let me know if I'm way off and this makes no sense 😉
from gomplate.
Kubernetes comes with a full client API which you can use directly without going over HTTP. As this datasource is probably supposed to be used within a Kubernetes cluster, the API server can be easily used with a so called ServiceAccount
, so there is not to worry much about authentication.
The use case I have in mind is agnostic of the API server's address as it is running from within the cluster (not from outside where it doesn't make much sense imo).
As seen also in the SO answer all connection parameters can be directly fetched from files which are installed by Kubernetes at fixed file locations within the container (so gomplate could simply pick them up there). The namespace can also be picked up directly (would have to check how, though). The only parameters left is then configmap name.
It''s not urgent, just wanted to open the issue more as reminder for a cool, unique feature ;-)
from gomplate.
That'd be great!
from gomplate.
Love this idea!
from gomplate.
@josledp thank you! That would be fantastic!
from gomplate.
Good man
from gomplate.
More than a year since there's been any activity, I'm going to close this issue for now.
While it would be interesting for gomplate to support ConfigMaps and Secrets directly, the usual pattern that I've seen is to mount the ConfigMap as a file inside the pod, and gomplate can read these files with no issue. I've seen gomplate used like this in a few cases.
If there is renewed interest, feel free to re-open the issue! Mostly I'm trying to clean up stale issues and PRs 😉
from gomplate.
Related Issues (20)
- Documentation: Mark features/functions that are coming in V4? HOT 3
- iterate over plugin's output
- Documentation: broken link to the Nested Templates section HOT 1
- Documentation: broken link to the Nested Templates section HOT 1
- gomplate produces no result and no error HOT 2
- Suggestion: if there is a yaml parsing error, print which file produces the error HOT 3
- feat: `htpasswd` function HOT 1
- Addressing Security Vulnerability CVE-2023-39533, CVE-2023-29403 by upgrading Go HOT 4
- Gomplate v3.11.x Go 1.21 panic: go4.org/unsafe/assume-no-moving-gc HOT 8
- [Feature] something like `{{-` and `-}}` but that trims newlines only HOT 4
- datasource "ami" failed to render template when using aws config with profile using "sso_session" parameter. HOT 14
- Feature Request: Exclude from processing but still copy file to target folder
- Ignore not provided parametrs HOT 2
- [Feature]: integrate expr-lang HOT 4
- [Feature] Handle with not existing keys HOT 4
- Question / Feature request - `coll.Omit` and lists/slices HOT 2
- N/A
- Provide a "cli command" datasource to allow custom integration with any external data source HOT 3
- security: CVE-2023-49569 - go-git/v5 HOT 2
- Gomplate not preserving AWS-specific custom YAML tags on merge HOT 2
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 gomplate.