Do I really need a name for every resource? #502
-
Hi, I am new to Tanka so forgive me if I am just unable to get it right. Do I really need the name local tanka = import "github.com/grafana/jsonnet-libs/tanka-util/main.libsonnet";
local helm = tanka.helm.new(std.thisFile);
{
lokinamespace: {
apiVersion: "v1",
kind: "Namespace",
metadata: {
name: "loki"
}
},
loki: helm.template("loki-stack", "../../charts/loki-stack", {
namespace: "loki",
values: {
config: {
table_manager: {
retention_deletes_enabled: true,
retention_period: "720h",
},
},
persistence: {
enabled: true,
size: "30Gi",
},
ingress: {
enabled: true,
annotations: {
"kubernetes.io/ingress.class": "internal",
},
hosts: [{
host: "loki-k8s.FOOBAR.COM",
paths: ["/"],
}
],
tls: [],
}
}
})
} What I would like to do is something more anonymous like:
Why do I want to achieve this? I think it's very annoying to constantly come up with fantasy resource names if it's really not needed. I just want to create a namespace for loki before installing the loki-stack helm chart. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That's just how Jsonnet works. It renders to JSON. Tanka then scans the resultant JSON for objects that have an However, using lists in Jsonnet makes life harder later on when we decide we want to adjust something after the fact. Having a JSON name means we can refer to the object easily, which makes a big difference. |
Beta Was this translation helpful? Give feedback.
That's just how Jsonnet works. It renders to JSON. Tanka then scans the resultant JSON for objects that have an
apiVersion
and akind
. So we somehow need to reference the object in the JSON - this could either be within a map (i.e. it needs a name) or in a list, in which case it doesn't.However, using lists in Jsonnet makes life harder later on when we decide we want to adjust something after the fact. Having a JSON name means we can refer to the object easily, which makes a big difference.