i am trying to write some wrapper logic for deployments with Tanka/Jsonnet, but seem to be running into some issue, that is probably very simple to solve.
I am trying to create some wrapper-function for a statefulSet that adds e.g. some stdLabels
at multiple locations, but keep getting an error regarding Expected token OPERATOR but got "."
on the stateful.new.
It works without the local variable, but i have no clue as to why or how to solve this?
{
local k = import 'github.com/grafana/jsonnet-libs/ksonnet-util/kausal.libsonnet',
local container = k.core.v1.container,
local stateful = k.apps.v1.statefulSet,
fns: {
customStateful(name, config, c):: {
local stdLabels = {
realm: $._config.ingress.realm,
app: name,
'app.kubernetes.io/part-of': config.name,
},
stateful.new(
name=name,
replicas=null,
containers=[]
)
+ stateful.metadata.withLabels(stdLabels)
+ stateful.spec.template.metadata.withLabels(stdLabels)
}
},
$.aed.customStateful('test', cfg, container.new('test', alpine:latest)),
}