From 08a4f8f53ef9ea57ecdb70965d977646aed5cc6e Mon Sep 17 00:00:00 2001 From: HubbeKing Date: Sun, 12 Sep 2021 23:55:37 +0300 Subject: [PATCH] Update ingress manifest to networking.k8s.io/v1 API This means k8s.jsonnet only works with kubernetes versions >= 1.19.0, but means it works with kubernetes versions >= 1.22.0 as well, which removed the old networking.k8s.io/v1beta API. --- k8s.jsonnet | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/k8s.jsonnet b/k8s.jsonnet index 28f20d1..b2865ab 100644 --- a/k8s.jsonnet +++ b/k8s.jsonnet @@ -62,6 +62,9 @@ // Set to true to let the ingress handle TLS ingress_tls: true, + // Ingress class for ingress + ingress_class_name: "nginx", + // Uncomment and give a secretName for ingress, if required for ingress TLS //ingress_secret_name: "wubloader-tls", @@ -308,12 +311,13 @@ // Ingress to direct requests to the correct services. { kind: "Ingress", - apiVersion: "networking.k8s.io/v1beta1", + apiVersion: "networking.k8s.io/v1", metadata: { name: "wubloader", labels: {app: "wubloader"} + $.config.ingress_labels, }, spec: { + ingressClassName: $.config.ingress_class_name, rules: [ { host: $.config.ingress_host, @@ -323,8 +327,12 @@ path: path, pathType: type, backend: { - serviceName: "wubloader-%s" % std.strReplace(name, "_", "-"), - servicePort: 80, + service: { + name: "wubloader-%s" % std.strReplace(name, "_", "-"), + port: { + number: 80 + }, + }, }, }, local metric_rule(name) = rule(name, "/metrics/%s" % name, "Exact"),