diff --git a/README.md b/README.md index 8a7b154a66..819d8db67b 100644 --- a/README.md +++ b/README.md @@ -280,7 +280,7 @@ spec: fieldPath: spec.nodeName ``` -To track metrics for unassigned pods, you need to add an additional deployment and set `--fetch-unscheduled-pods`, as shown in the following example: +To track metrics for unassigned pods, you need to add an additional deployment and set `--enable-unscheduled-pods-fetching`, as shown in the following example: ``` apiVersion: apps/v1 @@ -293,7 +293,7 @@ spec: name: kube-state-metrics args: - --resources=pods - - --fetch-unscheduled-pods + - --enable-unscheduled-pods-fetching ``` Other metrics can be sharded via [Horizontal sharding](#horizontal-sharding). diff --git a/README.md.tpl b/README.md.tpl index 005b88b97b..5e2630147a 100644 --- a/README.md.tpl +++ b/README.md.tpl @@ -281,7 +281,7 @@ spec: fieldPath: spec.nodeName ``` -To track metrics for unassigned pods, you need to add an additional deployment and set `--fetch-unscheduled-pods`, as shown in the following example: +To track metrics for unassigned pods, you need to add an additional deployment and set `--enable-unscheduled-pods-fetching`, as shown in the following example: ``` apiVersion: apps/v1 @@ -294,7 +294,7 @@ spec: name: kube-state-metrics args: - --resources=pods - - --fetch-unscheduled-pods + - --enable-unscheduled-pods-fetching ``` Other metrics can be sharded via [Horizontal sharding](#horizontal-sharding). diff --git a/docs/developer/cli-arguments.md b/docs/developer/cli-arguments.md index 3a54f4d445..25e1a7474d 100644 --- a/docs/developer/cli-arguments.md +++ b/docs/developer/cli-arguments.md @@ -46,7 +46,7 @@ Flags: --custom-resource-state-config-file string Path to a Custom Resource State Metrics config file (experimental) --custom-resource-state-only Only provide Custom Resource State metrics (experimental) --enable-gzip-encoding Gzip responses when requested by clients via 'Accept-Encoding: gzip' header. - --fetch-unscheduled-pods This configuration is used in conjunction with node configuration. When this configuration is true, node configuration is empty and the metric of no scheduled pods is scraped. This is experimental. + --enable-unscheduled-pods-fetching This configuration is used in conjunction with node configuration. When this configuration is true, node configuration is empty and the metric of no scheduled pods is scraped. This is experimental. -h, --help Print Help text --host string Host to expose metrics on. (default "::") --kubeconfig string Absolute path to the kubeconfig file diff --git a/examples/daemonsetsharding/deployment-no-node-pods.yaml b/examples/daemonsetsharding/deployment-no-node-pods.yaml index a422467bd5..8d106bfc1e 100644 --- a/examples/daemonsetsharding/deployment-no-node-pods.yaml +++ b/examples/daemonsetsharding/deployment-no-node-pods.yaml @@ -23,7 +23,7 @@ spec: containers: - args: - --resources=pods - - --fetch-unscheduled-pods + - --enable-unscheduled-pods-fetching image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.12.0 livenessProbe: httpGet: diff --git a/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet b/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet index 22c4b6667d..f17c13fc7c 100644 --- a/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet +++ b/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet @@ -377,7 +377,7 @@ local c = ksm.deployment.spec.template.spec.containers[0] { args: [ '--resources=pods', - '--fetch-unscheduled-pods', + '--enable-unscheduled-pods-fetching', ], name: shardksmname, }; @@ -410,7 +410,7 @@ local c = ksm.deployment.spec.template.spec.containers[0] { args: [ '--resources=pods', - '--fetch-unscheduled-pods', + '--enable-unscheduled-pods-fetching', ], }; local shardksmname = ksm.name + "-no-node-pods"; diff --git a/pkg/app/server.go b/pkg/app/server.go index dc295b1ebe..8b96347e26 100644 --- a/pkg/app/server.go +++ b/pkg/app/server.go @@ -205,7 +205,7 @@ func RunKubeStateMetrics(ctx context.Context, opts *options.Options) error { namespaces := opts.Namespaces.GetNamespaces() nsFieldSelector := namespaces.GetExcludeNSFieldSelector(opts.NamespacesDenylist) - nodeFieldSelector := opts.Node.GetNodeFieldSelector(opts.FetchUnscheduledPods) + nodeFieldSelector := opts.Node.GetNodeFieldSelector(opts.EnableUnscheduledPodsFetching) merged, err := storeBuilder.MergeFieldSelectors([]string{nsFieldSelector, nodeFieldSelector}) if err != nil { return err diff --git a/pkg/options/options.go b/pkg/options/options.go index c5c186301b..e3106fe38a 100644 --- a/pkg/options/options.go +++ b/pkg/options/options.go @@ -46,7 +46,7 @@ type Options struct { Namespaces NamespaceList `yaml:"namespaces"` NamespacesDenylist NamespaceList `yaml:"namespaces_denylist"` Node NodeType `yaml:"node"` - FetchUnscheduledPods bool `yaml:"fetch_unscheduled_pods"` + EnableUnscheduledPodsFetching bool `yaml:"enable_unscheduled_pods_fetching"` Pod string `yaml:"pod"` Port int `yaml:"port"` Resources ResourceSet `yaml:"resources"` @@ -121,7 +121,7 @@ func (o *Options) AddFlags(cmd *cobra.Command) { o.cmd.Flags().BoolVar(&o.CustomResourcesOnly, "custom-resource-state-only", false, "Only provide Custom Resource State metrics (experimental)") o.cmd.Flags().BoolVar(&o.EnableGZIPEncoding, "enable-gzip-encoding", false, "Gzip responses when requested by clients via 'Accept-Encoding: gzip' header.") - o.cmd.Flags().BoolVar(&o.FetchUnscheduledPods, "fetch-unscheduled-pods", false, "This configuration is used in conjunction with node configuration. When this configuration is true, node configuration is empty and the metric of no scheduled pods is scraped. This is experimental.") + o.cmd.Flags().BoolVar(&o.EnableUnscheduledPodsFetching, "enable-unscheduled-pods-fetching", false, "This configuration is used in conjunction with node configuration. When this configuration is true, node configuration is empty and the metric of no scheduled pods is scraped. This is experimental.") o.cmd.Flags().BoolVarP(&o.Help, "help", "h", false, "Print Help text") o.cmd.Flags().BoolVarP(&o.UseAPIServerCache, "use-apiserver-cache", "", false, "Sets resourceVersion=0 for ListWatch requests, using cached resources from the apiserver instead of an etcd quorum read.") o.cmd.Flags().Int32Var(&o.Shard, "shard", int32(0), "The instances shard nominal (zero indexed) within the total number of shards. (default 0)")