Coder Social home page Coder Social logo

Comments (9)

tinyzimmer avatar tinyzimmer commented on June 3, 2024 1

I have a new feature on the latest tag (when this run is done) for you to at least start playing with if you want. But I make no guarantees to its stability. I tried to mimic the tanka example as close as possible (with a few omissions that are not available directly in the helm Go API without some hacking).

Simplest example is here:

local utils = import 'internal://utils.libsonnet';

{
    chart: utils.helmTemplate('example', './chart', {
        values: { replicaCount: 2 },
    })
}

You can see the schema for the final opts argument here. One important note is I skipped the calledFrom construct for now. It's there in the options, but ignored. The path you give is assumed relative to where you are executing the jsonnet for now. In the controller that's the path you define in the CR.


To make testing a little easier I added to the konfig CLI. There was already the build command which did a server-side dry-run of a Konfiguration. I added a simple (rather dumb for now, but can be expanded) show command that behaves similarly to kubecfg and regular jsonnet. Just pass it a jsonnet file or path and it will run it through the same interpreter the controller uses.

It doesn't get released without a tag, so you'd have to build manually for now to get that command. If you have go installed you can run make build-konfig in this repository and it will be installed to ~/go/bin/konfig.


Any feedback is appreciated if you are able to give it a try 😄

from jsonnet-controller.

tinyzimmer avatar tinyzimmer commented on June 3, 2024

I guess my first question is do both those functions rely on any external CLI utilities. If they don't then I absolutely will include them, or something similar.

To your first question, I was trying to think of interesting ways a user could define additional functions at runtime. In my head at the time it didn't seem like it'd be worth the effort since the writer of the jsonnet can easily define the functions they need. That being said, having the ability to declare functions globally via another CRD or something could be interesting.

from jsonnet-controller.

derrickburns avatar derrickburns commented on June 3, 2024

I looked at the code. The helm native func does make CLI calls.

from jsonnet-controller.

derrickburns avatar derrickburns commented on June 3, 2024

And so does the kustomize native func. :(

from jsonnet-controller.

derrickburns avatar derrickburns commented on June 3, 2024

However, I wonder if those are necessary. I believe that there is a Helm Go API.

from jsonnet-controller.

tinyzimmer avatar tinyzimmer commented on June 3, 2024

Yea I have other projects where I've (at least with helm) invoked the needfuls via the Go API. But ya, we'd have to implement them into the controller. I'm trying to avoid embedding binaries - currently leaning on controller-runtime server-side apply for syncing state instead of using kubectl.

from jsonnet-controller.

tinyzimmer avatar tinyzimmer commented on June 3, 2024

I may take a stab at, at least, helm functionality later today or tomorrow

from jsonnet-controller.

derrickburns avatar derrickburns commented on June 3, 2024

from jsonnet-controller.

derrickburns avatar derrickburns commented on June 3, 2024

Very nice!

from jsonnet-controller.

Related Issues (3)

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.