kube: standardize on a `local top = self` convention
A convention is introduced to specify `local top = self` declaration at the top of an app/service/component's jsonnet, representing the top-level object. Reasoning is as following:
- `top` is more universal/unambiguous than `app`
- `top` is usually shorter than $NAME
- a conventional `top` instead of $NAME (coupled with other conventions introduced) makes app jsonnets wonderfully copy-paste'able, aiding in learning and quickly building
Change-Id: I7ece83ce7e97021ad98a6abb3500fb9839936811
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1805
Reviewed-by: q3k <q3k@hackerspace.pl>
diff --git a/app/onlyoffice/prod.jsonnet b/app/onlyoffice/prod.jsonnet
index eafde30..9d9b410 100644
--- a/app/onlyoffice/prod.jsonnet
+++ b/app/onlyoffice/prod.jsonnet
@@ -7,8 +7,8 @@
{
onlyoffice:: {
- local oo = self,
- local cfg = oo.cfg,
+ local top = self,
+ local cfg = top.cfg,
cfg:: {
namespace: error "cfg.namespace must be set",
image: "onlyoffice/documentserver:7.0.0.132",
@@ -58,7 +58,7 @@
},
},
volumes_: {
- data: kube.PersistentVolumeClaimVolume(oo.pvc),
+ data: kube.PersistentVolumeClaimVolume(top.pvc),
},
},
},
@@ -66,12 +66,12 @@
},
svc: ns.Contain(kube.Service("documentserver")) {
- target:: oo.deploy,
+ target:: top.deploy,
},
ingress: ns.Contain(kube.SimpleIngress("office")) {
hosts:: [cfg.domain],
- target_service:: oo.svc,
+ target_service:: top.svc,
},
// Needed because the documentserver runs its own supervisor, and: