From a90876ac109291cf6647f55f178ebd857719e2c3 Mon Sep 17 00:00:00 2001 From: Catherine Fang Date: Thu, 13 Jun 2024 12:46:48 -0400 Subject: [PATCH] rename to --enable-unscheduled-pods-fetching --- README.md | 4 +- README.md.tpl | 4 +- docs/developer/cli-arguments.md | 2 +- .../deployment-no-node-pods.yaml | 2 +- .../kube-state-metrics.libsonnet | 4 +- pkg/app/server.go | 2 +- pkg/options/options.go | 56 +++++++++---------- 7 files changed, 37 insertions(+), 37 deletions(-) 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..9a13b8f0a9 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..fc080674a5 100644 --- a/pkg/options/options.go +++ b/pkg/options/options.go @@ -29,33 +29,33 @@ import ( // Options are the configurable parameters for kube-state-metrics. type Options struct { - AnnotationsAllowList LabelsAllowList `yaml:"annotations_allow_list"` - Apiserver string `yaml:"apiserver"` - CustomResourceConfig string `yaml:"custom_resource_config"` - CustomResourceConfigFile string `yaml:"custom_resource_config_file"` - CustomResourcesOnly bool `yaml:"custom_resources_only"` - EnableGZIPEncoding bool `yaml:"enable_gzip_encoding"` - Help bool `yaml:"help"` - Host string `yaml:"host"` - Kubeconfig string `yaml:"kubeconfig"` - LabelsAllowList LabelsAllowList `yaml:"labels_allow_list"` - MetricAllowlist MetricSet `yaml:"metric_allowlist"` - MetricDenylist MetricSet `yaml:"metric_denylist"` - MetricOptInList MetricSet `yaml:"metric_opt_in_list"` - Namespace string `yaml:"namespace"` - Namespaces NamespaceList `yaml:"namespaces"` - NamespacesDenylist NamespaceList `yaml:"namespaces_denylist"` - Node NodeType `yaml:"node"` - FetchUnscheduledPods bool `yaml:"fetch_unscheduled_pods"` - Pod string `yaml:"pod"` - Port int `yaml:"port"` - Resources ResourceSet `yaml:"resources"` - Shard int32 `yaml:"shard"` - TLSConfig string `yaml:"tls_config"` - TelemetryHost string `yaml:"telemetry_host"` - TelemetryPort int `yaml:"telemetry_port"` - TotalShards int `yaml:"total_shards"` - UseAPIServerCache bool `yaml:"use_api_server_cache"` + AnnotationsAllowList LabelsAllowList `yaml:"annotations_allow_list"` + Apiserver string `yaml:"apiserver"` + CustomResourceConfig string `yaml:"custom_resource_config"` + CustomResourceConfigFile string `yaml:"custom_resource_config_file"` + CustomResourcesOnly bool `yaml:"custom_resources_only"` + EnableGZIPEncoding bool `yaml:"enable_gzip_encoding"` + Help bool `yaml:"help"` + Host string `yaml:"host"` + Kubeconfig string `yaml:"kubeconfig"` + LabelsAllowList LabelsAllowList `yaml:"labels_allow_list"` + MetricAllowlist MetricSet `yaml:"metric_allowlist"` + MetricDenylist MetricSet `yaml:"metric_denylist"` + MetricOptInList MetricSet `yaml:"metric_opt_in_list"` + Namespace string `yaml:"namespace"` + Namespaces NamespaceList `yaml:"namespaces"` + NamespacesDenylist NamespaceList `yaml:"namespaces_denylist"` + Node NodeType `yaml:"node"` + EnableUnscheduledPodsFetching bool `yaml:"enable_unscheduled_pods_fetching"` + Pod string `yaml:"pod"` + Port int `yaml:"port"` + Resources ResourceSet `yaml:"resources"` + Shard int32 `yaml:"shard"` + TLSConfig string `yaml:"tls_config"` + TelemetryHost string `yaml:"telemetry_host"` + TelemetryPort int `yaml:"telemetry_port"` + TotalShards int `yaml:"total_shards"` + UseAPIServerCache bool `yaml:"use_api_server_cache"` Config string @@ -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)")