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/app/inventory/prod.jsonnet b/app/inventory/prod.jsonnet
index d8ecdf8..eb08009 100644
--- a/app/inventory/prod.jsonnet
+++ b/app/inventory/prod.jsonnet
@@ -84,7 +84,7 @@
},
service: top.ns.Contain(kube.Service(cfg.name)) {
- target_pod:: top.deployment.spec.template,
+ target:: top.deployment,
},
ingress: top.ns.Contain(kube.SimpleIngress(cfg.name)) {
diff --git a/app/mailman-web/kube/mailman.libsonnet b/app/mailman-web/kube/mailman.libsonnet
index f3748a9..c75e3b0 100644
--- a/app/mailman-web/kube/mailman.libsonnet
+++ b/app/mailman-web/kube/mailman.libsonnet
@@ -162,7 +162,7 @@
svcWeb: ns.Contain(kube.Service("web")) {
- target_pod: app.web.spec.template,
+ target:: app.web,
spec+: {
# hax
type: "LoadBalancer",
diff --git a/app/mastodon/kube/mastodon.libsonnet b/app/mastodon/kube/mastodon.libsonnet
index eac66fd..025eef8 100644
--- a/app/mastodon/kube/mastodon.libsonnet
+++ b/app/mastodon/kube/mastodon.libsonnet
@@ -276,11 +276,11 @@
},
svcWeb: ns.Contain(kube.Service("web")) {
- target_pod: app.web.spec.template,
+ target:: app.web,
},
svcStreaming: ns.Contain(kube.Service("streaming")) {
- target_pod: app.streaming.spec.template,
+ target:: app.streaming,
},
diff --git a/app/matrix/lib/appservice-irc.libsonnet b/app/matrix/lib/appservice-irc.libsonnet
index 92a1b21..f696970 100644
--- a/app/matrix/lib/appservice-irc.libsonnet
+++ b/app/matrix/lib/appservice-irc.libsonnet
@@ -116,7 +116,7 @@
svc: kube.Service("appservice-irc-%s" % [name]) {
metadata+: cfg.metadata,
- target_pod:: bridge.deployment.spec.template,
+ target:: bridge.deployment,
},
},
}
diff --git a/app/matrix/lib/appservice-telegram.libsonnet b/app/matrix/lib/appservice-telegram.libsonnet
index 5cfaf3a..209e855 100644
--- a/app/matrix/lib/appservice-telegram.libsonnet
+++ b/app/matrix/lib/appservice-telegram.libsonnet
@@ -147,7 +147,7 @@
svc: kube.Service("appservice-telegram-%s" % [name]) {
metadata+: cfg.metadata,
- target_pod:: bridge.deployment.spec.template,
+ target:: bridge.deployment,
},
},
}
diff --git a/app/matrix/lib/cas.libsonnet b/app/matrix/lib/cas.libsonnet
index 1a33aaa..f1de4fe 100644
--- a/app/matrix/lib/cas.libsonnet
+++ b/app/matrix/lib/cas.libsonnet
@@ -43,6 +43,6 @@
},
svc: app.ns.Contain(kube.Service("oauth2-cas-proxy")) {
- target_pod:: app.deployment.spec.template,
+ target:: app.deployment,
},
}
diff --git a/app/matrix/lib/coturn.libsonnet b/app/matrix/lib/coturn.libsonnet
index c27b196..e63a0bc 100644
--- a/app/matrix/lib/coturn.libsonnet
+++ b/app/matrix/lib/coturn.libsonnet
@@ -130,7 +130,7 @@
},
svcTCP: app.ns.Contain(kube.Service("coturn-tcp")) {
- target_pod:: app.deployment.spec.template,
+ target:: app.deployment,
metadata+: {
annotations+: {
"metallb.universe.tf/allow-shared-ip": "coturn",
@@ -150,7 +150,7 @@
},
svcUDP: app.ns.Contain(kube.Service("coturn-udp")) {
- target_pod:: app.deployment.spec.template,
+ target:: app.deployment,
metadata+: {
annotations+: {
"metallb.universe.tf/allow-shared-ip": "coturn",
diff --git a/app/matrix/lib/matrix.libsonnet b/app/matrix/lib/matrix.libsonnet
index b8a21f9..c72b060 100644
--- a/app/matrix/lib/matrix.libsonnet
+++ b/app/matrix/lib/matrix.libsonnet
@@ -161,7 +161,7 @@
casSvc: if cfg.cas.enable then kube.Service("oauth2-cas-proxy") {
metadata+: app.metadata("oauth2-cas-proxy"),
- target_pod:: app.casDeployment.spec.template,
+ target:: app.casDeployment,
},
synapseDeployment: kube.Deployment("synapse") {
@@ -219,7 +219,7 @@
synapseSvc: kube.Service("synapse") {
metadata+: app.metadata("synapse"),
- target_pod:: app.synapseDeployment.spec.template,
+ target:: app.synapseDeployment,
},
riotConfig:: {
@@ -344,7 +344,7 @@
riotSvc: kube.Service("riot-web") {
metadata+: app.metadata("riot-web"),
- target_pod:: app.riotDeployment.spec.template,
+ target:: app.riotDeployment,
},
wellKnown: if cfg.wellKnown then {
@@ -374,7 +374,7 @@
},
svc: kube.Service("wellknown") {
metadata+: app.metadata("wellknown"),
- target_pod:: app.wellKnown.deployment.spec.template,
+ target:: app.wellKnown.deployment,
},
} else {},
diff --git a/app/matrix/lib/media-repo.libsonnet b/app/matrix/lib/media-repo.libsonnet
index 7b7500f..4b079d8 100644
--- a/app/matrix/lib/media-repo.libsonnet
+++ b/app/matrix/lib/media-repo.libsonnet
@@ -115,7 +115,7 @@
// Run //app/matrix/media-repo-proxy, if needed. This rewrites Host headers
// from the homeserver's serving Host to the MXID hostname (which
// matrix-media-repo expects).
- //
+ //
// Currently we only are able to run one proxy for one homeserver config -
// but we don't expect to have multiple homeservers per matrix-media-repo
// any time soon.
@@ -158,10 +158,10 @@
} else {},
internalSvc: app.ns.Contain(kube.Service("media-repo-internal")) {
- target_pod:: app.deployment.spec.template,
+ target:: app.deployment,
},
svc: if std.length(needProxying) > 0 then app.ns.Contain(kube.Service("media-repo")) {
- target_pod:: app.proxies.deployment.spec.template,
+ target:: app.proxies.deployment,
} else app.internalSvc,
}
diff --git a/app/matrix/lib/riot.libsonnet b/app/matrix/lib/riot.libsonnet
index fc2f2e7..23273f9 100644
--- a/app/matrix/lib/riot.libsonnet
+++ b/app/matrix/lib/riot.libsonnet
@@ -90,6 +90,6 @@
},
svc: app.ns.Contain(kube.Service("riot-web")) {
- target_pod:: app.deployment.spec.template,
+ target:: app.deployment,
},
}
diff --git a/app/matrix/lib/synapse.libsonnet b/app/matrix/lib/synapse.libsonnet
index 324b2f2..925a715 100644
--- a/app/matrix/lib/synapse.libsonnet
+++ b/app/matrix/lib/synapse.libsonnet
@@ -230,10 +230,10 @@
},
},
svc: app.ns.Contain(kube.Service("synapse")) {
- target_pod:: app.main.deployment.spec.template,
+ target:: app.main.deployment,
},
replicationSvc: app.ns.Contain(kube.Service("synapse-replication-master")) {
- target_pod:: app.main.deployment.spec.template,
+ target:: app.main.deployment,
spec+: {
ports: [
{ port: 9093, name: 'replication', targetPort: 9093 },
@@ -262,7 +262,7 @@
},
},
svc: app.ns.Contain(kube.Service("synapse-generic")) {
- target_pod:: app.genericWorker.deployment.spec.template,
+ target:: app.genericWorker.deployment,
},
# Following paths can be handled by generic workers.
@@ -386,7 +386,7 @@
},
},
svc: app.ns.Contain(kube.Service("synapse-media")) {
- target_pod:: app.mediaWorker.deployment.spec.template,
+ target:: app.mediaWorker.deployment,
},
},
diff --git a/app/matrix/lib/wellknown.libsonnet b/app/matrix/lib/wellknown.libsonnet
index cdc5ceb..509b83c 100644
--- a/app/matrix/lib/wellknown.libsonnet
+++ b/app/matrix/lib/wellknown.libsonnet
@@ -36,6 +36,6 @@
},
},
svc: app.ns.Contain(kube.Service("wellknown")) {
- target_pod:: app.deployment.spec.template,
+ target:: app.deployment,
},
}
diff --git a/app/onlyoffice/prod.jsonnet b/app/onlyoffice/prod.jsonnet
index ecf61c7..6919b1a 100644
--- a/app/onlyoffice/prod.jsonnet
+++ b/app/onlyoffice/prod.jsonnet
@@ -66,7 +66,7 @@
},
svc: oo.ns.Contain(kube.Service("documentserver")) {
- target_pod:: oo.deploy.spec.template,
+ target:: oo.deploy,
},
ingress: oo.ns.Contain(kube.SimpleIngress("office")) {
diff --git a/app/radio/kube/radio.libsonnet b/app/radio/kube/radio.libsonnet
index d4c186c..8f94405 100644
--- a/app/radio/kube/radio.libsonnet
+++ b/app/radio/kube/radio.libsonnet
@@ -94,11 +94,11 @@
["admin-password", cfg.icecast.authentication.adminPassword],
],
["hostname", cfg.icecast.hostname],
- ["listen-socket",
+ ["listen-socket",
["port", std.toString(cfg.icecast.listenPort)],
],
["fileserve", "1"],
- ["paths",
+ ["paths",
["webroot", "/usr/share/icecast/web"],
["adminroot", "/usr/share/icecast/admin"],
],
@@ -172,7 +172,7 @@
},
svc: kube.Service(radio.makeName("icecast")) {
metadata+: radio.metadata,
- target_pod:: radio.deployment.spec.template,
+ target:: radio.deployment,
spec+: {
ports: [
{ name: "client", port: cfg.port, targetPort: cfg.icecast.listenPort, protocol: "TCP" },
diff --git a/app/walne/prod.jsonnet b/app/walne/prod.jsonnet
index da98b70..0a23d96 100644
--- a/app/walne/prod.jsonnet
+++ b/app/walne/prod.jsonnet
@@ -47,7 +47,7 @@
},
service: top.ns.Contain(kube.Service(cfg.name)) {
- target_pod:: top.deployment.spec.template,
+ target:: top.deployment,
},
ingress: top.ns.Contain(kube.SimpleIngress(cfg.name)) {
diff --git a/bgpwtf/cccampix/kube/ix.libsonnet b/bgpwtf/cccampix/kube/ix.libsonnet
index b04e865..f8ed067 100644
--- a/bgpwtf/cccampix/kube/ix.libsonnet
+++ b/bgpwtf/cccampix/kube/ix.libsonnet
@@ -114,7 +114,7 @@
},
svc: kube.Service(ix.name("octorpki")) {
metadata+: ix.metadata("octorpki"),
- target_pod:: ix.octorpki.deployment.spec.template,
+ target:: ix.octorpki.deployment,
spec+: {
ports: [
{ name: "client", port: 8080, targetPort: 8080, protocol: "TCP" },
@@ -150,7 +150,7 @@
},
svc: kube.Service(ix.name(name)) {
metadata+: ix.metadata(name),
- target_pod:: component.deployment.spec.template,
+ target:: component.deployment,
spec+: {
ports: [
{ name: "client", port: component.port, targetPort: component.port, protocol: "TCP" },
diff --git a/bgpwtf/internet/kube/prod.jsonnet b/bgpwtf/internet/kube/prod.jsonnet
index e905e67..e2fb6ca 100644
--- a/bgpwtf/internet/kube/prod.jsonnet
+++ b/bgpwtf/internet/kube/prod.jsonnet
@@ -56,7 +56,7 @@
svc: kube.Service("frontend") {
metadata+: internet.metadata("frontend"),
- target_pod:: internet.deployment.spec.template,
+ target:: internet.deployment,
},
ingress: kube.SimpleIngress("frontend") {
diff --git a/bgpwtf/speedtest/kube/prod.jsonnet b/bgpwtf/speedtest/kube/prod.jsonnet
index e9b1d59..6be5515 100644
--- a/bgpwtf/speedtest/kube/prod.jsonnet
+++ b/bgpwtf/speedtest/kube/prod.jsonnet
@@ -55,7 +55,7 @@
svc: kube.Service("public") {
metadata+: speedtest.metadata("public"),
- target_pod:: speedtest.deployment.spec.template,
+ target:: speedtest.deployment,
},
ingress: kube.SimpleIngress("public") {
diff --git a/cluster/kube/lib/admitomatic.libsonnet b/cluster/kube/lib/admitomatic.libsonnet
index 0432bca..70a24aa 100644
--- a/cluster/kube/lib/admitomatic.libsonnet
+++ b/cluster/kube/lib/admitomatic.libsonnet
@@ -88,7 +88,7 @@
},
svc: ns.Contain(kube.Service("admitomatic")) {
- target_pod:: env.daemonset.spec.template,
+ target:: env.daemonset,
},
webhook: kube.ValidatingWebhookConfiguration("admitomatic") {
diff --git a/cluster/kube/lib/cert-manager.libsonnet b/cluster/kube/lib/cert-manager.libsonnet
index bb8ccd2..56d9585 100644
--- a/cluster/kube/lib/cert-manager.libsonnet
+++ b/cluster/kube/lib/cert-manager.libsonnet
@@ -142,7 +142,7 @@
services: {
certmanager: kube.Service("cert-manager") {
metadata+: env.metadata,
- target_pod:: env.deployments.certmanager.spec.template,
+ target:: env.deployments.certmanager,
spec+: {
type: "ClusterIP",
ports: [
@@ -152,7 +152,7 @@
},
webhook: kube.Service("cert-manager-webhook") {
metadata+: env.metadata,
- target_pod:: env.deployments.webhook.spec.template,
+ target:: env.deployments.webhook,
spec+: {
type: "ClusterIP",
ports: [
diff --git a/cluster/kube/lib/cockroachdb.libsonnet b/cluster/kube/lib/cockroachdb.libsonnet
index ffad899..c80ee3f 100644
--- a/cluster/kube/lib/cockroachdb.libsonnet
+++ b/cluster/kube/lib/cockroachdb.libsonnet
@@ -26,11 +26,11 @@
# You are then ready to access the database via the public service from your application.
#
# PGCLIENTENCODING=utf8 psql -h q3kdb-public -p 26257 -U bialkov wykop
-# Password for user bialkov:
+# Password for user bialkov:
# psql (10.9 (Ubuntu 10.9-0ubuntu0.18.04.1), server 9.5.0)
# SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES128-GCM-SHA256, bits: 128, compression: off)
# Type "help" for help.
-#
+#
# wykop=>
@@ -206,7 +206,7 @@
"prometheus.io/port": std.toString(cluster.cfg.portHttp),
},
},
- target_pod:: server.deploy.spec.template,
+ target:: server.deploy,
spec+: {
ports: [
{ name: "grpc", port: cluster.cfg.portServe, targetPort: cluster.cfg.portServe },
@@ -300,7 +300,7 @@
command: [
"/cockroach/cockroach", "start",
"--certs-dir", "/cockroach/cockroach-certs",
- "--advertise-host", "%s.cluster.local" % server.service.host,
+ "--advertise-host", "%s.cluster.local" % server.service.host,
"--cache", "25%", "--max-sql-memory", "25%",
"--join", std.join(",", ["%s.cluster.local:%d" % [s.service.host, cluster.cfg.portServe] for s in cluster.servers if s.service.host != server.service.host]),
"--listen-addr=0.0.0.0:%d" % cluster.cfg.portServe,
diff --git a/cluster/kube/lib/coredns.libsonnet b/cluster/kube/lib/coredns.libsonnet
index 27720a9..e2331ca 100644
--- a/cluster/kube/lib/coredns.libsonnet
+++ b/cluster/kube/lib/coredns.libsonnet
@@ -189,7 +189,7 @@
metadata+: {
namespace: cfg.namespace,
},
- target_pod: env.deployment.spec.template,
+ target:: env.deployment,
spec+: {
ports: [ { name: p.name, port: p.containerPort, protocol: p.protocol } for p in svc.target_pod.spec.containers[0].ports ],
clusterIP: cfg.clusterIP,
diff --git a/cluster/kube/lib/metrics.libsonnet b/cluster/kube/lib/metrics.libsonnet
index fda3a59..f4d548a 100644
--- a/cluster/kube/lib/metrics.libsonnet
+++ b/cluster/kube/lib/metrics.libsonnet
@@ -124,7 +124,7 @@
metadata+: {
namespace: cfg.namespace,
},
- target_pod: env.deployment.spec.template,
+ target:: env.deployment,
},
api: kube._Object("apiregistration.k8s.io/v1beta1", "APIService", "v1beta1.metrics.k8s.io") {
spec+: {
diff --git a/cluster/kube/lib/nginx.libsonnet b/cluster/kube/lib/nginx.libsonnet
index 8e8673a..acb7b44 100644
--- a/cluster/kube/lib/nginx.libsonnet
+++ b/cluster/kube/lib/nginx.libsonnet
@@ -224,7 +224,7 @@
service: kube.Service("ingress-nginx") {
metadata+: env.metadata,
- target_pod:: env.deployment.spec.template,
+ target:: env.deployment,
spec+: {
type: "LoadBalancer",
ports: [
@@ -237,7 +237,7 @@
serviceGitea: kube.Service("ingress-nginx-gitea") {
metadata+: env.metadata,
- target_pod:: env.deployment.spec.template,
+ target:: env.deployment,
spec+: {
type: "LoadBalancer",
loadBalancerIP: "185.236.240.60",
diff --git a/cluster/kube/lib/prodvider.libsonnet b/cluster/kube/lib/prodvider.libsonnet
index 017d5cf..035637a 100644
--- a/cluster/kube/lib/prodvider.libsonnet
+++ b/cluster/kube/lib/prodvider.libsonnet
@@ -76,7 +76,7 @@
svc: kube.Service("prodvider") {
metadata+: env.metadata("prodvider"),
- target_pod:: env.deployment.spec.template,
+ target:: env.deployment,
spec+: {
type: "LoadBalancer",
ports: [
diff --git a/cluster/kube/lib/registry.libsonnet b/cluster/kube/lib/registry.libsonnet
index 37d8f36..f291607 100644
--- a/cluster/kube/lib/registry.libsonnet
+++ b/cluster/kube/lib/registry.libsonnet
@@ -217,7 +217,7 @@
},
authService: kube.Service("auth") {
metadata+: env.metadata("auth"),
- target_pod:: env.authDeployment.spec.template,
+ target:: env.authDeployment,
spec+: {
type: "ClusterIP",
ports: [
@@ -267,7 +267,7 @@
},
registryService: kube.Service("docker-registry") {
metadata+: env.metadata("docker-registry"),
- target_pod:: env.registryDeployment.spec.template,
+ target:: env.registryDeployment,
spec+: {
type: "ClusterIP",
ports: [
diff --git a/devtools/gerrit/kube/gerrit.libsonnet b/devtools/gerrit/kube/gerrit.libsonnet
index b292c31..2d10f32 100644
--- a/devtools/gerrit/kube/gerrit.libsonnet
+++ b/devtools/gerrit/kube/gerrit.libsonnet
@@ -210,7 +210,7 @@
svc: kube.Service(gerrit.name("gerrit")) {
metadata+: gerrit.metadata("service"),
- target_pod:: gerrit.deployment.spec.template,
+ target:: gerrit.deployment,
spec+: {
ports: [
{ name: "http", port: 80, targetPort: 8080, protocol: "TCP" },
diff --git a/devtools/issues/redmine.libsonnet b/devtools/issues/redmine.libsonnet
index e558d2b..6af03bd 100644
--- a/devtools/issues/redmine.libsonnet
+++ b/devtools/issues/redmine.libsonnet
@@ -127,7 +127,7 @@
},
svc: app.ns.Contain(kube.Service("redmine")) {
- target_pod:: app.deployment.spec.template,
+ target:: app.deployment,
},
ingress: app.ns.Contain(kube.SimpleIngress("redmine")) {
@@ -157,7 +157,7 @@
},
},
svc: app.ns.Contain(kube.Service("b")) {
- target_pod:: app.b.deployment.spec.template,
+ target:: app.b.deployment,
},
ingress: app.ns.Contain(kube.SimpleIngress("b")) {
hosts:: cfg.b.domains,
diff --git a/games/factorio/kube/factorio.libsonnet b/games/factorio/kube/factorio.libsonnet
index 3d9fc04..a02b69a 100644
--- a/games/factorio/kube/factorio.libsonnet
+++ b/games/factorio/kube/factorio.libsonnet
@@ -167,7 +167,7 @@
"app.kubernetes.io/name": cfg.appName,
},
},
- target_pod:: factorio.deployment.spec.template,
+ target:: factorio.deployment,
spec+: {
ports: [
{ name: "client", port: 34197, targetPort: 34197, protocol: "UDP" },
diff --git a/games/factorio/kube/proxy.libsonnet b/games/factorio/kube/proxy.libsonnet
index 9c116d0..a25ba7c 100644
--- a/games/factorio/kube/proxy.libsonnet
+++ b/games/factorio/kube/proxy.libsonnet
@@ -51,7 +51,7 @@
metadata+: {
namespace: "factorio",
},
- target_pod:: proxy.deploy.spec.template,
+ target:: proxy.deploy,
spec+: {
ports: [
{ name: "client", port: 4200, targetPort: 4200, protocol: "TCP" },
diff --git a/games/valheim/prod.jsonnet b/games/valheim/prod.jsonnet
index 05c5b3b..15f981a 100644
--- a/games/valheim/prod.jsonnet
+++ b/games/valheim/prod.jsonnet
@@ -33,7 +33,7 @@
},
},
svc: ns.Contain(kube.Service(named("external"))) {
- target_pod:: game.deployment.spec.template,
+ target:: game.deployment,
spec+: {
ports: kube.mapToNamedList({
zero: { port: cfg.port, targetPort: cfg.port, protocol: "UDP" },
diff --git a/hswaw/capacifier/prod.jsonnet b/hswaw/capacifier/prod.jsonnet
index fa508bb..16dc0fd 100644
--- a/hswaw/capacifier/prod.jsonnet
+++ b/hswaw/capacifier/prod.jsonnet
@@ -47,7 +47,7 @@
},
service: top.ns.Contain(kube.Service(cfg.name)) {
- target_pod:: top.deployment.spec.template,
+ target:: top.deployment,
},
ingress: top.ns.Contain(kube.SimpleIngress(cfg.name)) {
diff --git a/hswaw/cebulacamp/landing/kube/prod.jsonnet b/hswaw/cebulacamp/landing/kube/prod.jsonnet
index 50b8bcf..7f3ec5b 100644
--- a/hswaw/cebulacamp/landing/kube/prod.jsonnet
+++ b/hswaw/cebulacamp/landing/kube/prod.jsonnet
@@ -40,7 +40,7 @@
},
service: top.ns.Contain(kube.Service(cfg.name)) {
- target_pod:: top.deployment.spec.template,
+ target:: top.deployment,
},
ingress: top.ns.Contain(kube.SimpleIngress(cfg.name)) {
diff --git a/hswaw/ldapweb/prod.jsonnet b/hswaw/ldapweb/prod.jsonnet
index 72083c3..805f019 100644
--- a/hswaw/ldapweb/prod.jsonnet
+++ b/hswaw/ldapweb/prod.jsonnet
@@ -52,7 +52,7 @@
},
service: top.ns.Contain(kube.Service(cfg.name)) {
- target_pod:: top.deployment.spec.template,
+ target:: top.deployment,
},
ingress: top.ns.Contain(kube.SimpleIngress(cfg.name)) {
diff --git a/hswaw/oodviewer/prod.jsonnet b/hswaw/oodviewer/prod.jsonnet
index e7fab3d..fdd1515 100644
--- a/hswaw/oodviewer/prod.jsonnet
+++ b/hswaw/oodviewer/prod.jsonnet
@@ -57,7 +57,7 @@
},
service: top.ns.Contain(kube.Service("oodviewer")) {
- target_pod:: top.deploy.spec.template,
+ target:: top.deploy,
},
ingress: top.ns.Contain(kube.SimpleIngress("oodviewer")) {
diff --git a/hswaw/paperless/paperless.libsonnet b/hswaw/paperless/paperless.libsonnet
index 30f1a58..ca34d5c 100644
--- a/hswaw/paperless/paperless.libsonnet
+++ b/hswaw/paperless/paperless.libsonnet
@@ -162,7 +162,7 @@
},
service: app.ns.Contain(kube.Service("paperless")) {
- target_pod:: app.deploy.spec.template,
+ target:: app.deploy,
},
ingress: app.ns.Contain(kube.SimpleIngress("paperless")) {
diff --git a/hswaw/site/prod.jsonnet b/hswaw/site/prod.jsonnet
index 252187b..1dc2173 100644
--- a/hswaw/site/prod.jsonnet
+++ b/hswaw/site/prod.jsonnet
@@ -42,7 +42,7 @@
},
service: top.ns.Contain(kube.Service(cfg.name)) {
- target_pod:: top.deployment.spec.template,
+ target:: top.deployment,
},
ingress: top.ns.Contain(kube.SimpleIngress(cfg.name)) {
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",
diff --git a/kube/mirko.libsonnet b/kube/mirko.libsonnet
index 4f7d501..cca39ed 100644
--- a/kube/mirko.libsonnet
+++ b/kube/mirko.libsonnet
@@ -125,7 +125,7 @@
volumes:: {},
containers:: {
main: cfg.container,
- },
+ },
nodeSelector: null,
securityContext: {},
container:: error "container(s) must be set",
@@ -202,7 +202,7 @@
svc: kube.Service(component.makeName("")) { // No suffix, name part of DNS entry.
metadata+: component.metadata,
- target_pod:: component.deployment.spec.template,
+ target:: component.deployment,
spec+: {
ports: [
{
@@ -222,7 +222,7 @@
pki: {
cert: kube.Certificate(component.makeName("-cert")) {
metadata+: component.metadata,
-
+
spec: {
secretName: component.makeName("-cert"),
duration: "35040h0m0s", // 4 years
diff --git a/kube/postgres.libsonnet b/kube/postgres.libsonnet
index ac29f26..11393ab 100644
--- a/kube/postgres.libsonnet
+++ b/kube/postgres.libsonnet
@@ -171,7 +171,7 @@
svc: kube.Service(postgres.makeName("postgres")) {
metadata+: postgres.metadata,
- target_pod:: postgres.deployment.spec.template,
+ target:: postgres.deployment,
spec+: {
ports: [
{ name: "client", port: 5432, targetPort: 5432, protocol: "TCP" },
@@ -213,7 +213,7 @@
"app.kubernetes.io/component": "bouncer",
}
},
- target_pod:: postgres.bouncer.deployment.spec.template,
+ target:: postgres.bouncer.deployment,
spec+: {
ports: [
{ name: "client", port: 5432, targetPort: 5432, protocol: "TCP" },
diff --git a/kube/postgres_v.libsonnet b/kube/postgres_v.libsonnet
index ce8dc85..1c4357a 100644
--- a/kube/postgres_v.libsonnet
+++ b/kube/postgres_v.libsonnet
@@ -94,7 +94,7 @@
svc: kube.Service(postgres.makeName("postgres")) {
metadata+: postgres.metadata,
- target_pod:: postgres.deployment.spec.template,
+ target:: postgres.deployment,
spec+: {
ports: [
{ name: "client", port: 5432, targetPort: 5432, protocol: "TCP" },
@@ -136,7 +136,7 @@
"app.kubernetes.io/component": "bouncer",
}
},
- target_pod:: postgres.bouncer.deployment.spec.template,
+ target:: postgres.bouncer.deployment,
spec+: {
ports: [
{ name: "client", port: 5432, targetPort: 5432, protocol: "TCP" },
diff --git a/kube/redis.libsonnet b/kube/redis.libsonnet
index 9c21c49..f382d8b 100644
--- a/kube/redis.libsonnet
+++ b/kube/redis.libsonnet
@@ -87,7 +87,7 @@
},
svc: kube.Service(redis.makeName("redis")) {
metadata+: redis.metadata,
- target_pod:: redis.deployment.spec.template,
+ target:: redis.deployment,
spec+: {
ports: [
{ name: "client", port: 6379, targetPort: 6379, protocol: "TCP" },
diff --git a/ops/monitoring/lib/global.libsonnet b/ops/monitoring/lib/global.libsonnet
index ea89e9f..9eb2f26 100644
--- a/ops/monitoring/lib/global.libsonnet
+++ b/ops/monitoring/lib/global.libsonnet
@@ -118,7 +118,7 @@
},
serviceAPI: ns.Contain(kube.Service("victoria-api")) {
- target_pod: victoria.deploy.spec.template,
+ target:: victoria.deploy,
spec+: {
ports: [
{ name: "api", port: 8427, targetPort: 8427, protocol: "TCP" },
@@ -242,7 +242,7 @@
},
service: ns.Contain(kube.Service("grafana-public")) {
- target_pod: grafana.deploy.spec.template,
+ target:: grafana.deploy,
spec+: {
ports: [
{ name: "public", port: 3000, targetPort: 3000, protocol: "TCP" },
diff --git a/ops/sso/kube/sso.libsonnet b/ops/sso/kube/sso.libsonnet
index 58e3f8b..214c921 100644
--- a/ops/sso/kube/sso.libsonnet
+++ b/ops/sso/kube/sso.libsonnet
@@ -95,7 +95,7 @@
},
svc: app.ns.Contain(kube.Service("sso")) {
- target_pod:: app.deployment.spec.template,
+ target:: app.deployment,
spec+: {
ports: [
{ name: "http", port: 5000, targetPort: 5000, protocol: "TCP" },
diff --git a/personal/radex/demo-next/prod.jsonnet b/personal/radex/demo-next/prod.jsonnet
index 30a0feb..b0308d0 100644
--- a/personal/radex/demo-next/prod.jsonnet
+++ b/personal/radex/demo-next/prod.jsonnet
@@ -50,7 +50,7 @@
},
},
service: top.ns.Contain(kube.Service(cfg.name)) {
- target_pod:: top.deployment.spec.template,
+ target:: top.deployment,
},
ingress: top.ns.Contain(kube.SimpleIngress(cfg.name)) {
diff --git a/personal/radex/demo/prod.jsonnet b/personal/radex/demo/prod.jsonnet
index a5f7678..df8dd28 100644
--- a/personal/radex/demo/prod.jsonnet
+++ b/personal/radex/demo/prod.jsonnet
@@ -35,7 +35,7 @@
},
service: top.ns.Contain(kube.Service(cfg.name)) {
- target_pod:: top.deployment.spec.template,
+ target:: top.deployment,
},
ingress: top.ns.Contain(kube.SimpleIngress(cfg.name)) {
diff --git a/personal/radex/wordpress/prod.jsonnet b/personal/radex/wordpress/prod.jsonnet
index 7b01580..55f43be 100644
--- a/personal/radex/wordpress/prod.jsonnet
+++ b/personal/radex/wordpress/prod.jsonnet
@@ -51,7 +51,7 @@
},
service: top.ns.Contain(kube.Service(cfg.name)) {
- target_pod:: top.deployment.spec.template,
+ target:: top.deployment,
},
ingress: top.ns.Contain(kube.SimpleIngress(cfg.name)) {
@@ -101,7 +101,7 @@
},
service: top.ns.Contain(kube.Service("wordpress-mysql")) {
- target_pod:: mysql.deployment.spec.template,
+ target:: mysql.deployment,
},
},
}