Remove custom k8s-app label in favor of standard k8s labels in the manifest for node-exporter

This commit is contained in:
Rajat Vig 2020-03-21 12:12:22 +00:00
parent 68505af1f9
commit 6f4f34606d
No known key found for this signature in database
GPG Key ID: 17CFBB6A8F5F136C
4 changed files with 18 additions and 13 deletions

View File

@ -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,
},
}, },
}, },
@ -128,7 +132,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
daemonset.new() + daemonset.new() +
daemonset.mixin.metadata.withName('node-exporter') + daemonset.mixin.metadata.withName('node-exporter') +
daemonset.mixin.metadata.withNamespace($._config.namespace) + daemonset.mixin.metadata.withNamespace($._config.namespace) +
daemonset.mixin.metadata.withLabels(podLabels) + daemonset.mixin.metadata.withLabels(podLabels + $._config.nodeExporter.labels) +
daemonset.mixin.spec.selector.withMatchLabels(podLabels) + daemonset.mixin.spec.selector.withMatchLabels(podLabels) +
daemonset.mixin.spec.template.metadata.withLabels(podLabels) + daemonset.mixin.spec.template.metadata.withLabels(podLabels) +
daemonset.mixin.spec.template.spec.withTolerations([existsToleration]) + daemonset.mixin.spec.template.spec.withTolerations([existsToleration]) +
@ -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';
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'),
}, },
} }

View File

@ -3,6 +3,8 @@ kind: DaemonSet
metadata: metadata:
labels: labels:
app: node-exporter 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:

View File

@ -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:

View File

@ -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:
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