@@ -27,13 +27,6 @@ In order to use this a secret needs to be created containing the name of the `ht
|
|||||||
Also, the applications provide external links to themselves in alerts and various places. When an ingress is used in front of the applications these links need to be based on the external URL's. This can be configured for each application in jsonnet.
|
Also, the applications provide external links to themselves in alerts and various places. When an ingress is used in front of the applications these links need to be based on the external URL's. This can be configured for each application in jsonnet.
|
||||||
|
|
||||||
```jsonnet
|
```jsonnet
|
||||||
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|
||||||
local secret = k.core.v1.secret;
|
|
||||||
local ingress = k.extensions.v1beta1.ingress;
|
|
||||||
local ingressTls = ingress.mixin.spec.tlsType;
|
|
||||||
local ingressRule = ingress.mixin.spec.rulesType;
|
|
||||||
local httpIngressPath = ingressRule.mixin.http.pathsType;
|
|
||||||
|
|
||||||
local kp =
|
local kp =
|
||||||
(import 'kube-prometheus/kube-prometheus.libsonnet') +
|
(import 'kube-prometheus/kube-prometheus.libsonnet') +
|
||||||
{
|
{
|
||||||
@@ -48,30 +41,44 @@ local kp =
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
ingress+:: {
|
ingress+:: {
|
||||||
'prometheus-k8s':
|
'prometheus-k8s': {
|
||||||
ingress.new() +
|
apiVersion: 'extensions/v1beta1',
|
||||||
ingress.mixin.metadata.withName($.prometheus.prometheus.metadata.name) +
|
kind: 'Ingress',
|
||||||
ingress.mixin.metadata.withNamespace($.prometheus.prometheus.metadata.namespace) +
|
metadata: {
|
||||||
ingress.mixin.metadata.withAnnotations({
|
name: $.prometheus.prometheus.metadata.name,
|
||||||
'nginx.ingress.kubernetes.io/auth-type': 'basic',
|
namespace: $.prometheus.prometheus.metadata.namespace,
|
||||||
'nginx.ingress.kubernetes.io/auth-secret': 'basic-auth',
|
annotations: {
|
||||||
'nginx.ingress.kubernetes.io/auth-realm': 'Authentication Required',
|
'nginx.ingress.kubernetes.io/auth-type': 'basic',
|
||||||
}) +
|
'nginx.ingress.kubernetes.io/auth-secret': 'basic-auth',
|
||||||
ingress.mixin.spec.withRules(
|
'nginx.ingress.kubernetes.io/auth-realm': 'Authentication Required',
|
||||||
ingressRule.new() +
|
},
|
||||||
ingressRule.withHost('prometheus.example.com') +
|
},
|
||||||
ingressRule.mixin.http.withPaths(
|
spec: {
|
||||||
httpIngressPath.new() +
|
rules: [{
|
||||||
httpIngressPath.mixin.backend.withServiceName($.prometheus.service.metadata.name) +
|
host: 'prometheus.example.com',
|
||||||
httpIngressPath.mixin.backend.withServicePort('web')
|
http: {
|
||||||
),
|
paths: [{
|
||||||
),
|
backend: {
|
||||||
|
serviceName: $.prometheus.service.metadata.name,
|
||||||
|
servicePort: 'web',
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} + {
|
} + {
|
||||||
ingress+:: {
|
ingress+:: {
|
||||||
'basic-auth-secret':
|
'basic-auth-secret': {
|
||||||
secret.new('basic-auth', { auth: std.base64(importstr 'auth') }) +
|
apiVersion: 'v1',
|
||||||
secret.mixin.metadata.withNamespace($._config.namespace),
|
kind: 'Secret',
|
||||||
|
metadata: {
|
||||||
|
name: 'basic-auth',
|
||||||
|
namespace: $._config.namespace,
|
||||||
|
},
|
||||||
|
data: { auth: std.base64(importstr 'auth') },
|
||||||
|
type: 'Opaque',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user