Questions tagged [jsonnet]

Jsonnet is a data templating language which compiles to JSON.

Jsonnet is a domain specific configuration language that helps you define JSON data. Jsonnet lets you compute fragments of JSON within the structure, bringing the same benefit to structured data that templating languages bring to plain text.

Project info

116 questions
3
votes
2 answers

How to parse String to Boolen value in Jsonnet

I have a jsonnet function that accepts boolean values as parameters. Suppose I have a jsonnet file called deploy.jsonnet: function (image='', isReady) { local config = self, deploy: if isReady then [ do deployment ] else [don't do deployment] I…
Anoop Philip
  • 971
  • 2
  • 11
  • 19
2
votes
1 answer

How to install jsonnet on conda

I am installing allennlp and it has quite a lot of dependencies. Everything is installing fine but the installalation of Jsonnet is failing. I tried installing jsonnet using pip install jsonnet manually but that isn't working either.
Arion Love
  • 23
  • 4
2
votes
0 answers

How is a root reference (`$`) resolved in Jsonnet imports?

I feel like I don't understand how Jsonnet imports work. There are numerous references to importing being akin to copy-and-pasting. For example Jsonnet tutorial says "The import construct is like copy/pasting Jsonnet code" and Tanka's tutorial has a…
Nikolai Prokoschenko
  • 8,465
  • 11
  • 58
  • 97
2
votes
0 answers

Why does VSCode's Jsonnet Language Server think this line is wrong?

The following line has existed in my jsonnet code for a long time. The code executes as expected. I just started using VSCode and installed the Jsonnet Language Server but now the server seems to think the line is problematic. Why? the code local…
user3877654
  • 1,045
  • 1
  • 16
  • 40
2
votes
1 answer

Big cluster config managment: Kustomize or Jsonnet?

Currently I'm working with Kubeflow. It is a quite large set up with about 30 different deployments. The default manifests of the Kubeflow team is using the standard Kustomize tool to provide patches for different environments like on-prem, cloud,…
Nolan Edric
  • 406
  • 4
  • 13
2
votes
1 answer

Can I use current date as a Jsonnet variable?

I want to use current date of system (like 2021-03-01) as a variable in jsonnet.
akizminet
  • 33
  • 5
2
votes
0 answers

Is there a way to generate json-schema from jsonnet?

Jsonnet seems like a great tool for config management, and I was wondering if there's a way to generate json-schema using jsonnet? I'm particularly interested in this because tools like react-jsonschema-form and json-editor requires json-schema as…
rrlamichhane
  • 1,435
  • 2
  • 18
  • 34
2
votes
1 answer

How to set a hostname in a jsonnet file?

I am trying to get the hang of jsonnet files. So far all I have is hard-coded values but what if I wanted to get the hostname for a Java application. For example in Java I would just do: String hostName = System.getenv("HOSTNAME"); But obviously I…
Cameron
  • 23
  • 1
  • 3
2
votes
1 answer

how to replace one element of array in jsonnet with mixin way?

we have array imported from libsonnet { "volumes": [ { "emptyDir": {}, "name": "grafana-storage" }, { "configMap": { "name": "grafana-dashboard-apiserver" }, "name": " grafana-dashboard-apiserver" …
Roger Song
  • 43
  • 4
2
votes
1 answer

jsonnet: How to serialize array into string

How to convert this ["a", "b", "c", "d"] into "a", "b", "c", "d" in JSONNET (https://jsonnet.org/ref/stdlib.html)
2
votes
1 answer

Complex validation in Jsonnet library

What I'm trying to do is create a libsonnet library with some complex validation on the inputs, but I'm not sure how to implement this in the libsonnet file without getting null back. I'm trying to generate API calls for Hosted Graphite's Alerts API…
Scott Crooks
  • 1,523
  • 4
  • 24
  • 39
2
votes
1 answer

How can I do nested for loop in jsonnet and access the variables?

How can I access t, which is the thing I get from the outer loop? { ['applications-' + name + t]: kp.applications[name][t] for name in [t for t in std.objectFields(kp.applications)] } My array looks something like this: applications : …
jonaz
  • 3,764
  • 2
  • 20
  • 20
2
votes
1 answer

How to convert a json into base64 string in jsonnet

I have a json file. I want to encode into base64 string and add it in my main json using jsonnet. datasources.json: { "datasources": [{ "id": 1, "orgId": 1, "name": "prometheus" }] } grafana.jsonnet: local getDataSources() = { …
Alok Kumar Singh
  • 2,331
  • 3
  • 18
  • 37
2
votes
3 answers

Overwrite a nested list element using jsonnet

I have the following json { "namespace": "monitoring", "name": "alok", "spec": { "replicas": 1, "template": { "metadata": "aaa", "spec": { "containers": [ { …
Alok Kumar Singh
  • 2,331
  • 3
  • 18
  • 37
2
votes
1 answer

VSCode extension - getting started with ksonnet

I would really like to try out ksonnet with the VSCode extension but can't seem to get things setup properly and I've read the setup instructions. I have done the following: brew install ks brew install jsonnet ks init traefik git clone…
kross
  • 3,627
  • 2
  • 32
  • 60