kube: add target:: convenience field to Service
Change-Id: If69116d93b6074136a36d98973e1aa997e2ebbef
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1802
Reviewed-by: q3k <q3k@hackerspace.pl>
diff --git a/kube/kube.libsonnet b/kube/kube.libsonnet
index a8fe444..ac96451 100644
--- a/kube/kube.libsonnet
+++ b/kube/kube.libsonnet
@@ -37,6 +37,13 @@
metadata+: { annotations: {} },
},
+ // Add `target` field
+ Service(name): kube.Service(name) {
+ // Deployment, Pod, DaemonSet, etc. that this Service is targeting.
+ target:: error "service target must be defined",
+ target_pod:: kube.podRef(self.target),
+ },
+
CephObjectStoreUser(name): kube._Object("ceph.rook.io/v1", "CephObjectStoreUser", name) {
local user = self,
spec: error "spec must be defined",