Skip to content

Commit

Permalink
rename to --enable-unscheduled-pods-fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
CatherineF-dev committed Jun 13, 2024
1 parent 8d5c6d9 commit a90876a
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions README.md.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion docs/developer/cli-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/daemonsetsharding/deployment-no-node-pods.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions jsonnet/kube-state-metrics/kube-state-metrics.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
56 changes: 28 additions & 28 deletions pkg/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)")
Expand Down

0 comments on commit a90876a

Please sign in to comment.