Giter VIP home page Giter VIP logo

Comments (10)

josledp avatar josledp commented on May 19, 2024 2

I'll work on this if you don't mind

from gomplate.

hairyhenderson avatar hairyhenderson commented on May 19, 2024 1

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.

rhuss avatar rhuss commented on May 19, 2024

The would make sense for Secrets probably, too.

from gomplate.

hairyhenderson avatar hairyhenderson commented on May 19, 2024

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.

rhuss avatar rhuss commented on May 19, 2024

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.

2color avatar 2color commented on May 19, 2024

That'd be great!

from gomplate.

josdotso avatar josdotso commented on May 19, 2024

Love this idea!

from gomplate.

hairyhenderson avatar hairyhenderson commented on May 19, 2024

@josledp thank you! That would be fantastic!

from gomplate.

kevin1991acosta avatar kevin1991acosta commented on May 19, 2024

Good man

from gomplate.

hairyhenderson avatar hairyhenderson commented on May 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.