Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitoring: Add toleration for promethues and grafana #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion k8s-cluster-monitor/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
},
etcdDashboards+:: {
'etcd.json': (import 'dashboards/etcd.json'),
}
},

tolerations+:: [
{
operator: 'Exists',
},
]
},

}
21 changes: 20 additions & 1 deletion k8s-cluster-monitor/kubernetes-cluster-monitoring.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ local privateCloudConfig = {
notKubeDnsSelector: 'job="kube-test"',
};

local statefulSet = k.apps.v1beta2.statefulSet;
local toleration = statefulSet.mixin.spec.template.spec.tolerationsType;

local cloud = (import 'kube-prometheus/kube-prometheus.libsonnet') + (import 'public-cloud-config.libsonnet');
local cloudConfig = {
namespace: 'monitoring',
Expand Down Expand Up @@ -43,6 +46,14 @@ local kp = (if std.extVar("PrivateCloudEnv") == "true" then privateCloud else c
},
prometheus+: {
spec+: {
tolerations: [
toleration.new() + (
if std.objectHas(t, 'key') then toleration.withKey(t.key) else toleration) + (
if std.objectHas(t, 'operator') then toleration.withOperator(t.operator) else toleration) + (
if std.objectHas(t, 'value') then toleration.withValue(t.value) else toleration) + (
if std.objectHas(t, 'effect') then toleration.withEffect(t.effect) else toleration),
for t in config._config.tolerations
],
retention: '15d',
storage: {
volumeClaimTemplate:
Expand Down Expand Up @@ -195,7 +206,15 @@ local kp = (if std.extVar("PrivateCloudEnv") == "true" then privateCloud else c
deployment.mixin.spec.template.spec.withNodeSelector({ 'beta.kubernetes.io/os': 'linux' }) +
deployment.mixin.spec.template.spec.withVolumes(volumes) +
deployment.mixin.spec.template.spec.withServiceAccountName('grafana') +
deployment.mixin.spec.template.spec.withInitContainers(initContainer)
deployment.mixin.spec.template.spec.withInitContainers(initContainer) +
deployment.mixin.spec.template.spec.withTolerations([
toleration.new() + (
if std.objectHas(t, 'key') then toleration.withKey(t.key) else toleration) + (
if std.objectHas(t, 'operator') then toleration.withOperator(t.operator) else toleration) + (
if std.objectHas(t, 'value') then toleration.withValue(t.value) else toleration) + (
if std.objectHas(t, 'effect') then toleration.withEffect(t.effect) else toleration),
for t in config._config.tolerations
])
},
};

Expand Down
Binary file modified k8s-cluster-monitor/manifests/archive/prometheus-operator.tar.gz
Binary file not shown.
Binary file modified k8s-cluster-monitor/manifests/archive/prometheus.tar.gz
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ spec:
nodeSelector:
beta.kubernetes.io/os: linux
serviceAccountName: grafana
tolerations:
- operator: Exists
volumes:
- name: grafana-storage
persistentVolumeClaim:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ spec:
requests:
storage: 30Gi
storageClassName: local-storage
tolerations:
- operator: Exists
version: v2.7.2