grafana / tanka

Flexible, reusable and concise configuration for Kubernetes
https://tanka.dev
Apache License 2.0
2.41k stars 166 forks source link

feat(env list): allow specifying a jsonnet implementation #1208

Closed julienduchesne closed 1 month ago

julienduchesne commented 1 month ago

This will allow us to run this with jrsonnet, making it way faster

fsgh42 commented 1 month ago

@julienduchesne nice job, I was waiting for this!

Sadly, currently this seems incompatible with tanka.helm:

$ tk eval --jsonnet-implementation 'binary:/usr/bin/jrsonnet' environments/prod/main.jsonnet 
Error: evaluating jsonnet: error running file redacted/tanka/environments/prod/main.jsonnet: exit status 1
only functions can be called, got null
    vendor/github.com/grafana/jsonnet-libs/tanka-util/helm.libsonnet:48:21-31:   variable <chartData> access
    vendor/github.com/grafana/jsonnet-libs/tanka-util/k8s.libsonnet:43:7-14:     variable <object> access
    vendor/github.com/grafana/jsonnet-libs/tanka-util/k8s.libsonnet:13:21-28:    variable <object> access
    argument <v> evaluation
    vendor/github.com/grafana/jsonnet-libs/tanka-util/k8s.libsonnet:13:8-29:     function <builtin_is_object> call
    vendor/github.com/grafana/jsonnet-libs/tanka-util/k8s.libsonnet:13:16-13:17: if condition
    vendor/github.com/grafana/jsonnet-libs/tanka-util/k8s.libsonnet:42:6-42:7:   function <patchKubernetesObjects> call
    vendor/github.com/grafana/jsonnet-libs/tanka-util/helm.libsonnet:48:5-52:    function <patchLabels> call
    lib/redacted/argocd.libsonnet:75:6-75:7:                                         function <template> call
    field <argocd> manifestification

I cannot get this to render by passing just ./vendor and ./lib folders to the native jsonnet binary either. Since tk eval works perfectly fine on the same code I suspect there might be additional magic hidden somewhere in tanka one might need to pass to external binary invocation as well.

julienduchesne commented 1 month ago

Yup, no native functions. Hide any attribute that isn't a Tanka env