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/matrix/lib/cas.libsonnet b/app/matrix/lib/cas.libsonnet
index 4c70b45..8c7ed40 100644
--- a/app/matrix/lib/cas.libsonnet
+++ b/app/matrix/lib/cas.libsonnet
@@ -1,8 +1,8 @@
local kube = import "../../../kube/kube.libsonnet";
{
- local app = self,
- local cfg = app.cfg,
+ local top = self,
+ local cfg = top.cfg,
cfg:: {
image: error "cfg.image must be set",
@@ -13,7 +13,7 @@
},
ns:: error "ns needs to be a kube.Namespace object",
- local ns = app.ns,
+ local ns = top.ns,
deployment: ns.Contain(kube.Deployment("oauth2-cas-proxy")) {
spec+: {
@@ -44,6 +44,6 @@
},
svc: ns.Contain(kube.Service("oauth2-cas-proxy")) {
- target:: app.deployment,
+ target:: top.deployment,
},
}