Skip to content

Commit

Permalink
helm & metrics: fix hive config properties of type stringslice
Browse files Browse the repository at this point in the history
Hive config flags of type `StringSlice` are no longer split by space.
Instead, they are split by comma. This leads to issues for config values
that have been lately migrated to a Hive cell and didn't change this in the
Helm files.

Therefore, this commit changes the affected config values to pass them as
a comma-separated string.

* `prometheus.metrics` -> `metrics`
* `prometheus.controllerGroupMetrics` -> `controller-group-metrics`

Fixes: cilium#26850, cilium#28771

Suggested-by: Marco Iorio <marco.iorio@isovalent.com>

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
  • Loading branch information
mhofstetter committed Nov 1, 2023
1 parent 28ce005 commit 6a4ca5a
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Documentation/cmdref/cilium-agent.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Documentation/cmdref/cilium-agent_hive.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Documentation/cmdref/cilium-agent_hive_dot-graph.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Documentation/helm-values.rst

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Documentation/observability/metrics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,14 @@ passing an empty IP (e.g. ``:9962``) will bind the server to all available
interfaces (there is usually only one in a container).

To customize ``cilium-agent`` metrics, configure the ``--metrics`` option with
``"+metric_a -metric_b -metric_c"``, where ``+/-`` means to enable/disable
``"+metric_a,-metric_b,-metric_c"``, where ``+/-`` means to enable/disable
the metric. For example, for really large clusters, users may consider to
disable the following two metrics as they generate too much data:

- ``cilium_node_connectivity_status``
- ``cilium_node_connectivity_latency_seconds``

You can then configure the agent with ``--metrics="-cilium_node_connectivity_status -cilium_node_connectivity_latency_seconds"``.
You can then configure the agent with ``--metrics="-cilium_node_connectivity_status,-cilium_node_connectivity_latency_seconds"``.

Exported Metrics
^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion install/kubernetes/cilium/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions install/kubernetes/cilium/templates/cilium-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,12 @@ data:
# Metrics that should be enabled or disabled from the default metric
# list. (+metric_foo to enable metric_foo , -metric_bar to disable
# metric_bar).
metrics: {{- range .Values.prometheus.metrics }}
{{ . }}
{{- end }}
metrics: {{ .Values.prometheus.metrics | join "," | quote }}
{{- end }}
{{- if .Values.prometheus.controllerGroupMetrics }}
# A space-separated list of controller groups for which to enable metrics.
# A comma-separated list of controller groups for which to enable metrics.
# The special values of "all" and "none" are supported.
controller-group-metrics: {{- range .Values.prometheus.controllerGroupMetrics }}
{{ . }}
{{- end }}
controller-group-metrics: {{ .Values.prometheus.controllerGroupMetrics | join "," | quote }}
{{- end }}
{{- end }}

Expand Down
3 changes: 1 addition & 2 deletions install/kubernetes/cilium/values.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions install/kubernetes/cilium/values.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1926,8 +1926,7 @@ prometheus:
trustCRDsExist: false

# -- Metrics that should be enabled or disabled from the default metric list.
# The list is expected to be separated by a space. (+metric_foo to enable
# metric_foo , -metric_bar to disable metric_bar).
# (+metric_foo to enable metric_foo , -metric_bar to disable metric_bar).
# ref: https://docs.cilium.io/en/stable/observability/metrics/
metrics: ~

Expand Down
2 changes: 1 addition & 1 deletion pkg/metrics/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type RegistryConfig struct {

func (rc RegistryConfig) Flags(flags *pflag.FlagSet) {
flags.String("prometheus-serve-addr", rc.PrometheusServeAddr, "IP:Port on which to serve prometheus metrics (pass \":Port\" to bind on all interfaces, \"\" is off)")
flags.StringSlice("metrics", rc.Metrics, "Metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo, -metric_bar to disable metric_bar)")
flags.StringSlice("metrics", rc.Metrics, "Comma separated list of metrics that should be enabled or disabled from the default metric list. (+metric_foo to enable metric_foo, -metric_bar to disable metric_bar)")
}

// RegistryParams are the parameters needed to construct a Registry
Expand Down

0 comments on commit 6a4ca5a

Please sign in to comment.