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
d480b41d
Commit
d480b41d
authored
Sep 28, 2018
by
Frederic Branczyk
Committed by
GitHub
Sep 28, 2018
Browse files
Options
Downloads
Plain Diff
Merge pull request #1935 from metalmatze/antiaffinity
contrib/kube-prometheus: Set antiAffinity for Prometheus & Alertmanager
parents
7d97b71a
916863e4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
jsonnet/kube-prometheus/kube-prometheus-anti-affinity.libsonnet
+39
-0
39 additions, 0 deletions
...t/kube-prometheus/kube-prometheus-anti-affinity.libsonnet
jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
+6
-4
6 additions, 4 deletions
jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
with
45 additions
and
4 deletions
jsonnet/kube-prometheus/kube-prometheus-anti-affinity.libsonnet
0 → 100644
+
39
−
0
View file @
d480b41d
local
k
=
import
'ksonnet/ksonnet.beta.3/k.libsonnet'
;
local
statefulSet
=
k
.
apps
.
v1beta2
.
statefulSet
;
local
affinity
=
statefulSet
.
mixin
.
spec
.
template
.
spec
.
affinity
.
podAntiAffinity
.
preferredDuringSchedulingIgnoredDuringExecutionType
;
local
matchExpression
=
affinity
.
mixin
.
podAffinityTerm
.
labelSelector
.
matchExpressionsType
;
{
local
antiaffinity
(
key
,
values
)
=
{
affinity
:
{
podAntiAffinity
:
{
preferredDuringSchedulingIgnoredDuringExecution
:
[
affinity
.
new
()
+
affinity
.
withWeight
(
100
)
+
affinity
.
mixin
.
podAffinityTerm
.
withNamespaces
(
$
.
_config
.
namespace
)
+
affinity
.
mixin
.
podAffinityTerm
.
withTopologyKey
(
'kubernetes.io/hostname'
)
+
affinity
.
mixin
.
podAffinityTerm
.
labelSelector
.
withMatchExpressions
([
matchExpression
.
new
()
+
matchExpression
.
withKey
(
key
)
+
matchExpression
.
withOperator
(
'In'
)
+
matchExpression
.
withValues
(
values
),
]),
],
},
},
},
alertmanager
+::
{
alertmanager
+:
{
spec
+:
antiaffinity
(
'alertmanager'
,
[
$
.
_config
.
alertmanager
.
name
]),
},
},
prometheus
+:
{
prometheus
+:
{
spec
+:
antiaffinity
(
'prometheus'
,
[
$
.
_config
.
prometheus
.
name
]),
},
},
}
This diff is collapsed.
Click to expand it.
jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
+
6
−
4
View file @
d480b41d
...
...
@@ -144,11 +144,13 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
local
roleList
=
k
.
rbac
.
v1
.
roleList
;
roleList
.
new
([
newSpecificRole
(
x
)
for
x
in
$
.
_config
.
prometheus
.
namespaces
]),
prometheus
:
local
container
=
k
.
core
.
v1
.
pod
.
mixin
.
spec
.
containersType
;
local
statefulSet
=
k
.
apps
.
v1beta2
.
statefulSet
;
local
container
=
statefulSet
.
mixin
.
spec
.
template
.
spec
.
containersType
;
local
resourceRequirements
=
container
.
mixin
.
resourcesType
;
local
selector
=
k
.
apps
.
v1beta2
.
deploymen
t
.
mixin
.
spec
.
selectorType
;
local
selector
=
statefulSe
t
.
mixin
.
spec
.
selectorType
;
local
resources
=
resourceRequirements
.
new
()
+
local
resources
=
resourceRequirements
.
new
()
+
resourceRequirements
.
withRequests
({
memory
:
'400Mi'
});
{
...
...
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