From 8d8c45c4dd600ea95e218c879301b074e7b4f710 Mon Sep 17 00:00:00 2001 From: Kemal Akkoyun <kakkoyun@gmail.com> Date: Mon, 16 Nov 2020 09:12:00 +0100 Subject: [PATCH] Remove ksonnet from kube-prometheus Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com> --- .../kube-prometheus-all-namespaces.libsonnet | 29 +++++++------------ .../kube-prometheus-anti-affinity.libsonnet | 29 +++++++++---------- 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/jsonnet/kube-prometheus/kube-prometheus-all-namespaces.libsonnet b/jsonnet/kube-prometheus/kube-prometheus-all-namespaces.libsonnet index e6ab5548..843c1769 100644 --- a/jsonnet/kube-prometheus/kube-prometheus-all-namespaces.libsonnet +++ b/jsonnet/kube-prometheus/kube-prometheus-all-namespaces.libsonnet @@ -1,20 +1,11 @@ -local k = import 'github.com/ksonnet/ksonnet-lib/ksonnet.beta.4/k.libsonnet'; - { - prometheus+:: { - clusterRole+: { - rules+: - local role = k.rbac.v1.role; - local policyRule = role.rulesType; - local rule = policyRule.new() + - policyRule.withApiGroups(['']) + - policyRule.withResources([ - 'services', - 'endpoints', - 'pods', - ]) + - policyRule.withVerbs(['get', 'list', 'watch']); - [rule] - }, - } -} \ No newline at end of file + prometheus+:: { + clusterRole+: { + rules+: [{ + apiGroups: [''], + resources: ['services', 'endpoints', 'pods'], + verbs: ['get', 'list', 'watch'], + }], + }, + }, +} diff --git a/jsonnet/kube-prometheus/kube-prometheus-anti-affinity.libsonnet b/jsonnet/kube-prometheus/kube-prometheus-anti-affinity.libsonnet index 59014d55..9fd0eb78 100644 --- a/jsonnet/kube-prometheus/kube-prometheus-anti-affinity.libsonnet +++ b/jsonnet/kube-prometheus/kube-prometheus-anti-affinity.libsonnet @@ -1,23 +1,22 @@ -local k = import 'github.com/ksonnet/ksonnet-lib/ksonnet.beta.4/k.libsonnet'; -local statefulSet = k.apps.v1.statefulSet; -local affinity = statefulSet.mixin.spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecutionType; -local matchExpression = affinity.mixin.podAffinityTerm.labelSelector.matchExpressionsType; - { local antiaffinity(key, values, namespace) = { affinity: { podAntiAffinity: { preferredDuringSchedulingIgnoredDuringExecution: [ - affinity.new() + - affinity.withWeight(100) + - affinity.mixin.podAffinityTerm.withNamespaces(namespace) + - affinity.mixin.podAffinityTerm.withTopologyKey('kubernetes.io/hostname') + - affinity.mixin.podAffinityTerm.labelSelector.withMatchExpressions([ - matchExpression.new() + - matchExpression.withKey(key) + - matchExpression.withOperator('In') + - matchExpression.withValues(values), - ]), + { + podAffinityTerm: { + namespaces: [namespace], + topologyKey: 'kubernetes.io/hostname', + labelSelector: { + matchExpressions: [{ + key: key, + operator: 'In', + values: values, + }], + }, + weight: 100, + }, + }, ], }, }, -- GitLab