kube/kube.libsonnet: add Contain to Namespace
This allow for the following:
ns: kube.Namespace("foo"),
service: self.ns.Contain(kube.Service("bar")) {
spec+: {
// ...
},
},
No more `metadata+: { namespace: ... }` !
Change-Id: Iff21654e18919afbe60c574e560356c6bd6d9b89
diff --git a/kube/kube.libsonnet b/kube/kube.libsonnet
index 5a1ad02..10b042c 100644
--- a/kube/kube.libsonnet
+++ b/kube/kube.libsonnet
@@ -17,6 +17,16 @@
secret: { secretName: certificate.spec.secretName },
},
+ # Add .Contain method to Namespaces, allowing for easy marking of particular
+ # kube objects as contained in that namespace.
+ Namespace(name): kube.Namespace(name) {
+ Contain(o):: o {
+ metadata+: {
+ namespace: name,
+ },
+ },
+ },
+
CephObjectStoreUser(name): kube._Object("ceph.rook.io/v1", "CephObjectStoreUser", name) {
local user = self,
spec: error "spec must be defined",