Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
kube-prometheus
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
prometheus-operator
kube-prometheus
Commits
8b3fb3e2
Commit
8b3fb3e2
authored
Nov 12, 2020
by
Blizter
Browse files
Options
Downloads
Patches
Plain Diff
removing ksonnet
parent
36536cfd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/ingress-one-to-many.jsonnet
+69
-40
69 additions, 40 deletions
examples/ingress-one-to-many.jsonnet
with
69 additions
and
40 deletions
examples/ingress-one-to-many.jsonnet
+
69
−
40
View file @
8b3fb3e2
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'
,
},
},
},
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment