Merge pull request #261 from s-urbaniak/prometheus-anti-affinity

jsonnet/kube-prometheus/kube-promehtues-anti-affinity: fix construction
This commit is contained in:
Frederic Branczyk
2019-10-08 17:52:06 +02:00
committed by GitHub

View File

@@ -4,13 +4,13 @@ local affinity = statefulSet.mixin.spec.template.spec.affinity.podAntiAffinity.p
local matchExpression = affinity.mixin.podAffinityTerm.labelSelector.matchExpressionsType; local matchExpression = affinity.mixin.podAffinityTerm.labelSelector.matchExpressionsType;
{ {
local antiaffinity(key, values) = { local antiaffinity(key, values, namespace) = {
affinity: { affinity: {
podAntiAffinity: { podAntiAffinity: {
preferredDuringSchedulingIgnoredDuringExecution: [ preferredDuringSchedulingIgnoredDuringExecution: [
affinity.new() + affinity.new() +
affinity.withWeight(100) + affinity.withWeight(100) +
affinity.mixin.podAffinityTerm.withNamespaces($._config.namespace) + affinity.mixin.podAffinityTerm.withNamespaces(namespace) +
affinity.mixin.podAffinityTerm.withTopologyKey('kubernetes.io/hostname') + affinity.mixin.podAffinityTerm.withTopologyKey('kubernetes.io/hostname') +
affinity.mixin.podAffinityTerm.labelSelector.withMatchExpressions([ affinity.mixin.podAffinityTerm.labelSelector.withMatchExpressions([
matchExpression.new() + matchExpression.new() +
@@ -26,14 +26,16 @@ local matchExpression = affinity.mixin.podAffinityTerm.labelSelector.matchExpres
alertmanager+:: { alertmanager+:: {
alertmanager+: { alertmanager+: {
spec+: spec+:
antiaffinity('alertmanager', [$._config.alertmanager.name]), antiaffinity('alertmanager', [$._config.alertmanager.name], $._config.namespace),
}, },
}, },
prometheus+: { prometheus+: {
local p = self,
prometheus+: { prometheus+: {
spec+: spec+:
antiaffinity('prometheus', [$._config.prometheus.name]), antiaffinity('prometheus', [p.name], p.namespace),
}, },
}, },
} }