From d33929e543c54260c555157e69177d65100ea847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=93=9D=E5=AE=9D=E7=9F=B3=E7=9A=84=E5=82=BB=E8=AF=9D?= Date: Thu, 12 Oct 2023 23:20:38 +0800 Subject: [PATCH] examples generated from libsonnet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 蓝宝石的傻话 --- .../deployment-no-node-pods.yaml | 4 ++-- .../kube-state-metrics.libsonnet | 24 +++++++++++++++++++ pkg/options/options.go | 1 - 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/examples/daemonsetsharding/deployment-no-node-pods.yaml b/examples/daemonsetsharding/deployment-no-node-pods.yaml index b22d105758..5b4c2c0526 100644 --- a/examples/daemonsetsharding/deployment-no-node-pods.yaml +++ b/examples/daemonsetsharding/deployment-no-node-pods.yaml @@ -3,9 +3,9 @@ kind: Deployment metadata: labels: app.kubernetes.io/component: exporter - app.kubernetes.io/name: kube-state-metrics + app.kubernetes.io/name: kube-state-metrics-global app.kubernetes.io/version: 2.10.0 - name: kube-state-metrics-pods + name: kube-state-metrics-global namespace: kube-system spec: replicas: 1 diff --git a/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet b/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet index 4ac16fbbc3..a492ef1a9b 100644 --- a/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet +++ b/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet @@ -373,6 +373,30 @@ }, ), + deploymentNoNodePods: + local c = ksm.deployment.spec.template.spec.containers[0] { + args: [ + '--resources=pods', + '--node=""', + ], + }; + local shardksmname = ksm.name + "-global"; + std.mergePatch(ksm.deployment, + { + metadata: { + name: shardksmname, + labels: {'app.kubernetes.io/name': shardksmname} + }, + spec: { + template: { + spec: { + containers: [c], + }, + }, + }, + }, + ), + daemonset: // extending the default container from above local c0 = ksm.deployment.spec.template.spec.containers[0] { diff --git a/pkg/options/options.go b/pkg/options/options.go index dc20bf0e79..c89ef63f43 100644 --- a/pkg/options/options.go +++ b/pkg/options/options.go @@ -46,7 +46,6 @@ type Options struct { Namespaces NamespaceList `yaml:"namespaces"` NamespacesDenylist NamespaceList `yaml:"namespaces_denylist"` Node NodeType `yaml:"node"` - NoNodeScrape bool `yaml:"no_node_scrape"` Pod string `yaml:"pod"` Port int `yaml:"port"` Resources ResourceSet `yaml:"resources"`