mirror of
https://github.com/carlosedp/cluster-monitoring.git
synced 2024-11-20 19:07:17 +01:00
Formatted files with jsonnet_fmt
This commit is contained in:
parent
408e21d044
commit
362478a928
@ -1,7 +1,7 @@
|
|||||||
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
||||||
{
|
{
|
||||||
_config+:: {
|
_config+:: {
|
||||||
namespace: "monitoring",
|
namespace: 'monitoring',
|
||||||
|
|
||||||
urls+:: {
|
urls+:: {
|
||||||
prom_ingress: 'prometheus.internal.carlosedp.com',
|
prom_ingress: 'prometheus.internal.carlosedp.com',
|
||||||
@ -13,7 +13,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
prometheus+:: {
|
prometheus+:: {
|
||||||
names: 'k8s',
|
names: 'k8s',
|
||||||
replicas: 1,
|
replicas: 1,
|
||||||
namespaces: ["default", "kube-system", "monitoring", "logging", "metallb-system"],
|
namespaces: ['default', 'kube-system', 'monitoring', 'logging', 'metallb-system'],
|
||||||
},
|
},
|
||||||
|
|
||||||
alertmanager+:: {
|
alertmanager+:: {
|
||||||
@ -58,7 +58,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
password: '',
|
password: '',
|
||||||
from_address: 'carlosedp@gmail.com',
|
from_address: 'carlosedp@gmail.com',
|
||||||
from_name: 'Grafana Alert',
|
from_name: 'Grafana Alert',
|
||||||
skip_verify: true
|
skip_verify: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -78,15 +78,15 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
volumeClaimTemplate:
|
volumeClaimTemplate:
|
||||||
pvc.new() +
|
pvc.new() +
|
||||||
pvc.mixin.spec.withAccessModes('ReadWriteOnce') +
|
pvc.mixin.spec.withAccessModes('ReadWriteOnce') +
|
||||||
pvc.mixin.spec.resources.withRequests({ storage: '20Gi' })
|
pvc.mixin.spec.resources.withRequests({ storage: '20Gi' }),
|
||||||
# Uncomment below to define a StorageClass name
|
// Uncomment below to define a StorageClass name
|
||||||
#+ pvc.mixin.spec.withStorageClassName('nfs-master-ssd'),
|
//+ pvc.mixin.spec.withStorageClassName('nfs-master-ssd'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
# Override deployment for Grafana data persistence
|
// Override deployment for Grafana data persistence
|
||||||
grafana+:: {
|
grafana+:: {
|
||||||
deployment+: {
|
deployment+: {
|
||||||
spec+: {
|
spec+: {
|
||||||
@ -96,9 +96,11 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
std.map(
|
std.map(
|
||||||
function(v)
|
function(v)
|
||||||
if v.name == 'grafana-storage' then
|
if v.name == 'grafana-storage' then
|
||||||
{'name':'grafana-storage',
|
{
|
||||||
'persistentVolumeClaim': {
|
name: 'grafana-storage',
|
||||||
'claimName': 'grafana-storage'}
|
persistentVolumeClaim: {
|
||||||
|
claimName: 'grafana-storage',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
else v,
|
else v,
|
||||||
super.volumes
|
super.volumes
|
||||||
@ -111,7 +113,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
local pvc = k.core.v1.persistentVolumeClaim;
|
local pvc = k.core.v1.persistentVolumeClaim;
|
||||||
pvc.new() +
|
pvc.new() +
|
||||||
pvc.mixin.metadata.withNamespace($._config.namespace) +
|
pvc.mixin.metadata.withNamespace($._config.namespace) +
|
||||||
pvc.mixin.metadata.withName("grafana-storage") +
|
pvc.mixin.metadata.withName('grafana-storage') +
|
||||||
pvc.mixin.spec.withAccessModes('ReadWriteMany') +
|
pvc.mixin.spec.withAccessModes('ReadWriteMany') +
|
||||||
pvc.mixin.spec.resources.withRequests({ storage: '2Gi' }),
|
pvc.mixin.spec.resources.withRequests({ storage: '2Gi' }),
|
||||||
},
|
},
|
||||||
@ -140,7 +142,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
httpIngressPath.mixin.backend.withServicePort('web')
|
httpIngressPath.mixin.backend.withServicePort('web')
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'grafana':
|
grafana:
|
||||||
ingress.new() +
|
ingress.new() +
|
||||||
ingress.mixin.metadata.withName('grafana') +
|
ingress.mixin.metadata.withName('grafana') +
|
||||||
ingress.mixin.metadata.withNamespace($._config.namespace) +
|
ingress.mixin.metadata.withNamespace($._config.namespace) +
|
||||||
|
@ -22,17 +22,19 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
local elasticExporter =
|
local elasticExporter =
|
||||||
container.new('elasticsearch-exporter',
|
container.new('elasticsearch-exporter',
|
||||||
$._config.imageRepos.elasticExporter + ':' + $._config.versions.elasticExporter) +
|
$._config.imageRepos.elasticExporter + ':' + $._config.versions.elasticExporter) +
|
||||||
container.withCommand(['/bin/elasticsearch_exporter',
|
container.withCommand([
|
||||||
|
'/bin/elasticsearch_exporter',
|
||||||
'-es.uri=http://elasticsearch.logging.svc:9200',
|
'-es.uri=http://elasticsearch.logging.svc:9200',
|
||||||
'-es.timeout=60s',
|
'-es.timeout=60s',
|
||||||
'-es.all=true']) +
|
'-es.all=true',
|
||||||
|
]) +
|
||||||
container.withPorts(containerPort.newNamed('es-metrics', 9108)) +
|
container.withPorts(containerPort.newNamed('es-metrics', 9108)) +
|
||||||
container.mixin.securityContext.capabilities.withDrop(['SETPCAP', 'MKNOD', 'AUDIT_WRITE', 'CHOWN', 'NET_RAW', 'DAC_OVERRIDE', 'FOWNER', 'FSETID', 'KILL', 'SETGID', 'SETUID', 'NET_BIND_SERVICE', 'SYS_CHROOT', 'SETFCAP']) +
|
container.mixin.securityContext.capabilities.withDrop(['SETPCAP', 'MKNOD', 'AUDIT_WRITE', 'CHOWN', 'NET_RAW', 'DAC_OVERRIDE', 'FOWNER', 'FSETID', 'KILL', 'SETGID', 'SETUID', 'NET_BIND_SERVICE', 'SYS_CHROOT', 'SETFCAP']) +
|
||||||
container.mixin.securityContext.withRunAsNonRoot(true) +
|
container.mixin.securityContext.withRunAsNonRoot(true) +
|
||||||
container.mixin.securityContext.withRunAsUser(1000) +
|
container.mixin.securityContext.withRunAsUser(1000) +
|
||||||
container.mixin.securityContext.withReadOnlyRootFilesystem(true) +
|
container.mixin.securityContext.withReadOnlyRootFilesystem(true) +
|
||||||
container.mixin.resources.withRequests({memory: "64Mi", cpu: "25m"}) +
|
container.mixin.resources.withRequests({ memory: '64Mi', cpu: '25m' }) +
|
||||||
container.mixin.resources.withLimits({memory: "128Mi", cpu: "100m"}) +
|
container.mixin.resources.withLimits({ memory: '128Mi', cpu: '100m' }) +
|
||||||
container.mixin.livenessProbe.httpGet.withPath('/health') +
|
container.mixin.livenessProbe.httpGet.withPath('/health') +
|
||||||
container.mixin.livenessProbe.httpGet.withPort(9108) +
|
container.mixin.livenessProbe.httpGet.withPort(9108) +
|
||||||
container.mixin.livenessProbe.withInitialDelaySeconds(30) +
|
container.mixin.livenessProbe.withInitialDelaySeconds(30) +
|
||||||
@ -91,7 +93,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
namespaceSelector: {
|
namespaceSelector: {
|
||||||
matchNames: [
|
matchNames: [
|
||||||
'monitoring',
|
'monitoring',
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -123,7 +125,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
namespaceSelector: {
|
namespaceSelector: {
|
||||||
matchNames: [
|
matchNames: [
|
||||||
'logging',
|
'logging',
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1,37 +1,37 @@
|
|||||||
{
|
{
|
||||||
_config+:: {
|
_config+:: {
|
||||||
versions+:: {
|
versions+:: {
|
||||||
prometheus: "v2.7.0",
|
prometheus: 'v2.7.0',
|
||||||
alertmanager: "v0.16.0",
|
alertmanager: 'v0.16.0',
|
||||||
kubeStateMetrics: "v1.5.0",
|
kubeStateMetrics: 'v1.5.0',
|
||||||
kubeRbacProxy: "v0.4.1",
|
kubeRbacProxy: 'v0.4.1',
|
||||||
addonResizer: "2.1",
|
addonResizer: '2.1',
|
||||||
nodeExporter: "v0.17.0",
|
nodeExporter: 'v0.17.0',
|
||||||
prometheusOperator: "v0.28.0",
|
prometheusOperator: 'v0.28.0',
|
||||||
prometheusAdapter: "v0.4.1",
|
prometheusAdapter: 'v0.4.1',
|
||||||
grafana: "5.4.3",
|
grafana: '5.4.3',
|
||||||
configmapReloader: "v0.2.2",
|
configmapReloader: 'v0.2.2',
|
||||||
prometheusConfigReloader: "v0.28.0",
|
prometheusConfigReloader: 'v0.28.0',
|
||||||
armExporter: 'latest',
|
armExporter: 'latest',
|
||||||
smtpServer: 'v1.0.1',
|
smtpServer: 'v1.0.1',
|
||||||
elasticExporter: '1.0.4rc1'
|
elasticExporter: '1.0.4rc1',
|
||||||
},
|
},
|
||||||
|
|
||||||
imageRepos+:: {
|
imageRepos+:: {
|
||||||
prometheus: "carlosedp/prometheus",
|
prometheus: 'carlosedp/prometheus',
|
||||||
alertmanager: "carlosedp/alertmanager",
|
alertmanager: 'carlosedp/alertmanager',
|
||||||
kubeStateMetrics: "carlosedp/kube-state-metrics",
|
kubeStateMetrics: 'carlosedp/kube-state-metrics',
|
||||||
kubeRbacProxy: "carlosedp/kube-rbac-proxy",
|
kubeRbacProxy: 'carlosedp/kube-rbac-proxy',
|
||||||
addonResizer: "carlosedp/addon-resizer",
|
addonResizer: 'carlosedp/addon-resizer',
|
||||||
nodeExporter: "carlosedp/node_exporter",
|
nodeExporter: 'carlosedp/node_exporter',
|
||||||
prometheusOperator: "carlosedp/prometheus-operator",
|
prometheusOperator: 'carlosedp/prometheus-operator',
|
||||||
prometheusAdapter: "carlosedp/k8s-prometheus-adapter",
|
prometheusAdapter: 'carlosedp/k8s-prometheus-adapter',
|
||||||
grafana: "grafana/grafana",
|
grafana: 'grafana/grafana',
|
||||||
configmapReloader: "carlosedp/configmap-reload",
|
configmapReloader: 'carlosedp/configmap-reload',
|
||||||
prometheusConfigReloader: "carlosedp/prometheus-config-reloader",
|
prometheusConfigReloader: 'carlosedp/prometheus-config-reloader',
|
||||||
armExporter: 'carlosedp/arm_exporter',
|
armExporter: 'carlosedp/arm_exporter',
|
||||||
smtpServer: 'carlosedp/docker-smtp',
|
smtpServer: 'carlosedp/docker-smtp',
|
||||||
elasticExporter: 'carlosedp/elasticsearch-exporter'
|
elasticExporter: 'carlosedp/elasticsearch-exporter',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
15
main.jsonnet
15
main.jsonnet
@ -1,9 +1,10 @@
|
|||||||
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
||||||
|
|
||||||
// Enable or disable additional modules
|
// Enable or disable additional modules
|
||||||
local installModules = { 'arm-exporter': true,
|
local installModules = {
|
||||||
'metallb': true,
|
'arm-exporter': true,
|
||||||
'traefik': true,
|
metallb: true,
|
||||||
|
traefik: true,
|
||||||
'ups-exporter': true,
|
'ups-exporter': true,
|
||||||
'elastic-exporter': true,
|
'elastic-exporter': true,
|
||||||
};
|
};
|
||||||
@ -17,8 +18,8 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet')
|
|||||||
+ (import 'smtp_server.jsonnet')
|
+ (import 'smtp_server.jsonnet')
|
||||||
// Additional Modules
|
// Additional Modules
|
||||||
+ (if installModules['arm-exporter'] then (import 'arm_exporter.jsonnet') else {})
|
+ (if installModules['arm-exporter'] then (import 'arm_exporter.jsonnet') else {})
|
||||||
+ (if installModules['metallb'] then (import 'metallb.jsonnet') else {})
|
+ (if installModules.metallb then (import 'metallb.jsonnet') else {})
|
||||||
+ (if installModules['traefik'] then (import 'traefik.jsonnet') else {})
|
+ (if installModules.traefik then (import 'traefik.jsonnet') else {})
|
||||||
+ (if installModules['ups-exporter'] then (import 'ups_exporter.jsonnet') else {})
|
+ (if installModules['ups-exporter'] then (import 'ups_exporter.jsonnet') else {})
|
||||||
+ (if installModules['elastic-exporter'] then (import 'elasticsearch_exporter.jsonnet') else {});
|
+ (if installModules['elastic-exporter'] then (import 'elasticsearch_exporter.jsonnet') else {});
|
||||||
|
|
||||||
@ -35,9 +36,9 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet')
|
|||||||
// Additional Modules
|
// Additional Modules
|
||||||
(if installModules['arm-exporter'] then
|
(if installModules['arm-exporter'] then
|
||||||
{ ['arm-exporter-' + name]: kp.armExporter[name] for name in std.objectFields(kp.armExporter) } else {}) +
|
{ ['arm-exporter-' + name]: kp.armExporter[name] for name in std.objectFields(kp.armExporter) } else {}) +
|
||||||
(if installModules['metallb'] then
|
(if installModules.metallb then
|
||||||
{ ['metallb-' + name]: kp.metallb[name] for name in std.objectFields(kp.metallb) } else {}) +
|
{ ['metallb-' + name]: kp.metallb[name] for name in std.objectFields(kp.metallb) } else {}) +
|
||||||
(if installModules['traefik'] then
|
(if installModules.traefik then
|
||||||
{ ['traefik-' + name]: kp.traefik[name] for name in std.objectFields(kp.traefik) } else {}) +
|
{ ['traefik-' + name]: kp.traefik[name] for name in std.objectFields(kp.traefik) } else {}) +
|
||||||
(if installModules['ups-exporter'] then
|
(if installModules['ups-exporter'] then
|
||||||
{ ['ups-exporter-' + name]: kp.upsExporter[name] for name in std.objectFields(kp.upsExporter) } else {}) +
|
{ ['ups-exporter-' + name]: kp.upsExporter[name] for name in std.objectFields(kp.upsExporter) } else {}) +
|
||||||
|
@ -34,7 +34,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
namespaceSelector: {
|
namespaceSelector: {
|
||||||
matchNames: [
|
matchNames: [
|
||||||
'metallb-system',
|
'metallb-system',
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -45,7 +45,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
local servicePort = k.core.v1.service.mixin.spec.portsType;
|
local servicePort = k.core.v1.service.mixin.spec.portsType;
|
||||||
local metallbPort = servicePort.newNamed('http', 7472, 7472);
|
local metallbPort = servicePort.newNamed('http', 7472, 7472);
|
||||||
|
|
||||||
service.new('metallb-controller', {"app": "metallb", "component": "controller"}, metallbPort) +
|
service.new('metallb-controller', { app: 'metallb', component: 'controller' }, metallbPort) +
|
||||||
service.mixin.metadata.withNamespace('metallb-system') +
|
service.mixin.metadata.withNamespace('metallb-system') +
|
||||||
service.mixin.metadata.withLabels({ 'k8s-app': 'metallb-controller' }) +
|
service.mixin.metadata.withLabels({ 'k8s-app': 'metallb-controller' }) +
|
||||||
service.mixin.spec.withClusterIp('None'),
|
service.mixin.spec.withClusterIp('None'),
|
||||||
|
@ -29,8 +29,10 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
secretKeyRef: { name: 'smtp-account', key: 'password' },
|
secretKeyRef: { name: 'smtp-account', key: 'password' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{name: 'DISABLE_IPV6',
|
{
|
||||||
value: 'True'},
|
name: 'DISABLE_IPV6',
|
||||||
|
value: 'True',
|
||||||
|
},
|
||||||
{ name: 'RELAY_DOMAINS', value: ':192.168.0.0/24:10.0.0.0/16' },
|
{ name: 'RELAY_DOMAINS', value: ':192.168.0.0/24:10.0.0.0/16' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -48,6 +50,6 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
|
|
||||||
service.new('smtp-server', $.smtpServer.deployment.spec.selector.matchLabels, smtpServerPorts) +
|
service.new('smtp-server', $.smtpServer.deployment.spec.selector.matchLabels, smtpServerPorts) +
|
||||||
service.mixin.metadata.withNamespace($._config.namespace) +
|
service.mixin.metadata.withNamespace($._config.namespace) +
|
||||||
service.mixin.metadata.withLabels({ 'run': 'smtp-server' })
|
service.mixin.metadata.withLabels({ run: 'smtp-server' }),
|
||||||
},
|
},
|
||||||
}
|
}
|
@ -38,7 +38,7 @@ local k = import 'ksonnet/ksonnet.beta.3/k.libsonnet';
|
|||||||
namespaceSelector: {
|
namespaceSelector: {
|
||||||
matchNames: [
|
matchNames: [
|
||||||
'kube-system',
|
'kube-system',
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user