mirror of
https://github.com/carlosedp/cluster-monitoring.git
synced 2024-12-22 19:09:30 +01:00
Generate ingress manifests exactly matching the manual changes
This solution isn't perfect, but it works.
This commit is contained in:
parent
3643fdedad
commit
5397440673
@ -1,4 +1,4 @@
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: alertmanager-main
|
||||
@ -9,9 +9,12 @@ spec:
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: alertmanager-main
|
||||
servicePort: web
|
||||
service:
|
||||
name: alertmanager-main
|
||||
port:
|
||||
name: web
|
||||
path: /
|
||||
pathType: Prefix
|
||||
tls:
|
||||
- hosts:
|
||||
- alertmanager.192.168.1.15.nip.io
|
||||
|
@ -1,4 +1,4 @@
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: grafana
|
||||
@ -9,9 +9,12 @@ spec:
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: grafana
|
||||
servicePort: http
|
||||
service:
|
||||
name: grafana
|
||||
port:
|
||||
name: http
|
||||
path: /
|
||||
pathType: Prefix
|
||||
tls:
|
||||
- hosts:
|
||||
- grafana.192.168.1.15.nip.io
|
||||
|
@ -1,4 +1,4 @@
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: prometheus-k8s
|
||||
@ -9,9 +9,12 @@ spec:
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: prometheus-k8s
|
||||
servicePort: web
|
||||
service:
|
||||
name: prometheus-k8s
|
||||
port:
|
||||
name: web
|
||||
path: /
|
||||
pathType: Prefix
|
||||
tls:
|
||||
- hosts:
|
||||
- prometheus.192.168.1.15.nip.io
|
||||
|
@ -92,24 +92,37 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
|
||||
|
||||
// Creates ingress objects
|
||||
newIngress(name, namespace, host, path, serviceName, servicePort):: (
|
||||
local ingress = k.networking.v1beta1.ingress;
|
||||
local ingressTls = ingress.mixin.spec.tlsType;
|
||||
local ingressRule = ingress.mixin.spec.rulesType;
|
||||
local httpIngressPath = ingressRule.mixin.http.pathsType;
|
||||
|
||||
ingress.new()
|
||||
+ ingress.mixin.metadata.withName(name)
|
||||
+ ingress.mixin.metadata.withNamespace(namespace)
|
||||
+ ingress.mixin.spec.withRules(
|
||||
ingressRule.new()
|
||||
+ ingressRule.withHost(host)
|
||||
+ ingressRule.mixin.http.withPaths(
|
||||
httpIngressPath.new()
|
||||
+ httpIngressPath.withPath(path)
|
||||
+ httpIngressPath.mixin.backend.withServiceName(serviceName)
|
||||
+ httpIngressPath.mixin.backend.withServicePort(servicePort)
|
||||
),
|
||||
)
|
||||
{
|
||||
apiVersion: 'networking.k8s.io/v1',
|
||||
kind: 'Ingress',
|
||||
metadata: {
|
||||
name: name,
|
||||
namespace: namespace,
|
||||
},
|
||||
spec: {
|
||||
rules: [
|
||||
{
|
||||
host: host,
|
||||
http: {
|
||||
paths: [
|
||||
{
|
||||
backend: {
|
||||
service: {
|
||||
name: serviceName,
|
||||
port: {
|
||||
name: servicePort,
|
||||
},
|
||||
},
|
||||
},
|
||||
path: path,
|
||||
pathType: 'Prefix',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
),
|
||||
|
||||
// Add TLS to Ingress resource with secret containing the certificates if exists
|
||||
|
Loading…
Reference in New Issue
Block a user