Skip to content
Snippets Groups Projects
Unverified Commit cf7bb870 authored by Lili Cosic's avatar Lili Cosic Committed by GitHub
Browse files

Merge pull request #463 from rajatvig/support_standard_labels_nodeexporter

Support standard labels for nodeexporter
parents 86b0419f 805d2e65
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,10 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; ...@@ -16,6 +16,10 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
nodeExporter+:: { nodeExporter+:: {
port: 9100, port: 9100,
labels: {
'app.kubernetes.io/name': 'node-exporter',
'app.kubernetes.io/version': $._config.versions.nodeExporter,
},
}, },
}, },
...@@ -64,7 +68,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; ...@@ -64,7 +68,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
local toleration = daemonset.mixin.spec.template.spec.tolerationsType; local toleration = daemonset.mixin.spec.template.spec.tolerationsType;
local containerEnv = container.envType; local containerEnv = container.envType;
local podLabels = { app: 'node-exporter' }; local podLabels = $._config.nodeExporter.labels;
local existsToleration = toleration.new() + local existsToleration = toleration.new() +
toleration.withOperator('Exists'); toleration.withOperator('Exists');
...@@ -154,16 +158,12 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; ...@@ -154,16 +158,12 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
metadata: { metadata: {
name: 'node-exporter', name: 'node-exporter',
namespace: $._config.namespace, namespace: $._config.namespace,
labels: { labels: $._config.nodeExporter.labels,
'k8s-app': 'node-exporter',
},
}, },
spec: { spec: {
jobLabel: 'k8s-app', jobLabel: 'app.kubernetes.io/name',
selector: { selector: {
matchLabels: { matchLabels: $._config.nodeExporter.labels,
'k8s-app': 'node-exporter',
},
}, },
endpoints: [ endpoints: [
{ {
...@@ -196,7 +196,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; ...@@ -196,7 +196,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
service.new('node-exporter', $.nodeExporter.daemonset.spec.selector.matchLabels, nodeExporterPort) + service.new('node-exporter', $.nodeExporter.daemonset.spec.selector.matchLabels, nodeExporterPort) +
service.mixin.metadata.withNamespace($._config.namespace) + service.mixin.metadata.withNamespace($._config.namespace) +
service.mixin.metadata.withLabels({ 'k8s-app': 'node-exporter' }) + service.mixin.metadata.withLabels($._config.nodeExporter.labels) +
service.mixin.spec.withClusterIp('None'), service.mixin.spec.withClusterIp('None'),
}, },
} }
...@@ -2,17 +2,20 @@ apiVersion: apps/v1 ...@@ -2,17 +2,20 @@ apiVersion: apps/v1
kind: DaemonSet kind: DaemonSet
metadata: metadata:
labels: labels:
app: node-exporter app.kubernetes.io/name: node-exporter
app.kubernetes.io/version: v0.18.1
name: node-exporter name: node-exporter
namespace: monitoring namespace: monitoring
spec: spec:
selector: selector:
matchLabels: matchLabels:
app: node-exporter app.kubernetes.io/name: node-exporter
app.kubernetes.io/version: v0.18.1
template: template:
metadata: metadata:
labels: labels:
app: node-exporter app.kubernetes.io/name: node-exporter
app.kubernetes.io/version: v0.18.1
spec: spec:
containers: containers:
- args: - args:
......
...@@ -2,7 +2,8 @@ apiVersion: v1 ...@@ -2,7 +2,8 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
labels: labels:
k8s-app: node-exporter app.kubernetes.io/name: node-exporter
app.kubernetes.io/version: v0.18.1
name: node-exporter name: node-exporter
namespace: monitoring namespace: monitoring
spec: spec:
...@@ -12,4 +13,5 @@ spec: ...@@ -12,4 +13,5 @@ spec:
port: 9100 port: 9100
targetPort: https targetPort: https
selector: selector:
app: node-exporter app.kubernetes.io/name: node-exporter
app.kubernetes.io/version: v0.18.1
...@@ -2,7 +2,8 @@ apiVersion: monitoring.coreos.com/v1 ...@@ -2,7 +2,8 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor kind: ServiceMonitor
metadata: metadata:
labels: labels:
k8s-app: node-exporter app.kubernetes.io/name: node-exporter
app.kubernetes.io/version: v0.18.1
name: node-exporter name: node-exporter
namespace: monitoring namespace: monitoring
spec: spec:
...@@ -20,7 +21,8 @@ spec: ...@@ -20,7 +21,8 @@ spec:
scheme: https scheme: https
tlsConfig: tlsConfig:
insecureSkipVerify: true insecureSkipVerify: true
jobLabel: k8s-app jobLabel: app.kubernetes.io/name
selector: selector:
matchLabels: matchLabels:
k8s-app: node-exporter app.kubernetes.io/name: node-exporter
app.kubernetes.io/version: v0.18.1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment