Skip to content
Snippets Groups Projects
Commit 8b3fb3e2 authored by Blizter's avatar Blizter
Browse files

removing ksonnet

parent 36536cfd
Branches
Tags
No related merge requests found
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet'; local ingress(name, namespace, rules) = {
local secret = k.core.v1.secret; apiVersion: 'networking.k8s.io/v1',
local ingress = k.extensions.v1beta1.ingress; kind: 'Ingress',
local ingressTls = ingress.mixin.spec.tlsType; metadata: {
local ingressRule = ingress.mixin.spec.rulesType; name: name,
local httpIngressPath = ingressRule.mixin.http.pathsType; namespace: namespace,
annotations: {
'nginx.ingress.kubernetes.io/auth-type': 'basic',
'nginx.ingress.kubernetes.io/auth-secret': 'basic-auth',
'nginx.ingress.kubernetes.io/auth-realm': 'Authentication Required',
},
},
spec: { rules: rules },
};
local kp = local kp =
(import 'kube-prometheus/kube-prometheus.libsonnet') + (import 'kube-prometheus/kube-prometheus.libsonnet') +
...@@ -37,43 +45,64 @@ local kp = ...@@ -37,43 +45,64 @@ local kp =
}, },
// Create one ingress object that routes to each individual application // Create one ingress object that routes to each individual application
ingress+:: { ingress+:: {
'kube-prometheus': 'kube-prometheus': ingress(
ingress.new() + 'kube-prometheus',
ingress.mixin.metadata.withName('prometheus-k8s') + $._config.namespace,
ingress.mixin.metadata.withNamespace($._config.namespace) + [{
ingress.mixin.metadata.withAnnotations({ host: 'alertmanager.example.com',
'nginx.ingress.kubernetes.io/auth-type': 'basic', http: {
'nginx.ingress.kubernetes.io/auth-secret': 'basic-auth', paths: [{
'nginx.ingress.kubernetes.io/auth-realm': 'Authentication Required', backend: {
}) + service: {
ingress.mixin.spec.withRules([ name: 'alertmanager-main',
ingressRule.new() + port: 'web',
ingressRule.withHost('prometheus.dev.kepler-ops.io') + },
ingressRule.mixin.http.withPaths( },
httpIngressPath.new() + }],
httpIngressPath.mixin.backend.withServiceName('prometheus-k8s') + },
httpIngressPath.mixin.backend.withServicePort('web') },
) , {
ingressRule.withHost('alertmanager.example.com') + host: 'grafana.example.com',
ingressRule.mixin.http.withPaths( http: {
httpIngressPath.new() + paths: [{
httpIngressPath.mixin.backend.withServiceName('alertmanager-main') + backend: {
httpIngressPath.mixin.backend.withServicePort('web') service: {
), name: 'grafana',
ingressRule.withHost('grafana.example.com') + port: 'http',
ingressRule.mixin.http.withPaths( },
httpIngressPath.new() + },
httpIngressPath.mixin.backend.withServiceName('grafana') + }],
httpIngressPath.mixin.backend.withServicePort('http') },
)] },
{
host: 'alertmanager.example.com',
http: {
paths: [{
backend: {
service: {
name: 'prometheus-k8s',
port: 'web',
},
},
}],
},
},]
), ),
}, },
} + { } + {
// Create basic auth secret - replace 'auth' file with your own // Create basic auth secret - replace 'auth' file with your own
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',
},
}, },
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment