diff --git a/packages/system/monitoring-agents/tests/kube_state_metrics_labels_test.yaml b/packages/system/monitoring-agents/tests/kube_state_metrics_labels_test.yaml new file mode 100644 index 000000000..578371a1e --- /dev/null +++ b/packages/system/monitoring-agents/tests/kube_state_metrics_labels_test.yaml @@ -0,0 +1,15 @@ +suite: kube-state-metrics exports the labels of pods, deployments and PVCs +# The tenant metrics API scopes a query to one application by looking up the +# application's pods and PVCs in kube_pod_labels and +# kube_persistentvolumeclaim_labels by their apps.cozystack.io/application.* +# lineage labels. kube-state-metrics emits no kube_*_labels series at all for +# a resource missing from this allowlist, so dropping persistentvolumeclaims +# silently empties the PVC branch of that lookup. +templates: + - charts/kube-state-metrics/templates/deployment.yaml +tests: + - it: allowlists all labels of pods, deployments and persistentvolumeclaims + asserts: + - contains: + path: spec.template.spec.containers[0].args + content: --metric-labels-allowlist=pods=[*],deployments=[*],persistentvolumeclaims=[*] diff --git a/packages/system/monitoring-agents/values.yaml b/packages/system/monitoring-agents/values.yaml index a9c22cb14..84c39ce44 100644 --- a/packages/system/monitoring-agents/values.yaml +++ b/packages/system/monitoring-agents/values.yaml @@ -6,9 +6,10 @@ kube-state-metrics: # 322 pods and roughly 25.6k series, which is the smallest cluster we run. The # request sits above the 176Mi mean rather than at the peak, and the limit # carries wide headroom on purpose: this component's memory scales with the - # number of objects in the cluster, and --metric-labels-allowlist below widens - # every pod and deployment series further, so a cluster larger than the one - # measured will land well above the peak seen here. + # number of objects in the cluster, and --metric-labels-allowlist below copies + # every label of each pod, deployment and PVC onto its kube_*_labels series, + # so a cluster larger than the one measured will land well above the peak + # seen here. # 2Gi is 6.7x that peak, so scaling linearly with object count it stays a # ceiling rather than a bound up to roughly 2100 pods and 170k series. # @@ -27,7 +28,12 @@ kube-state-metrics: limits: memory: 2Gi extraArgs: - - --metric-labels-allowlist=pods=[*],deployments=[*] + # PVCs are listed so the tenant metrics API can find an application's PVCs + # in kube_persistentvolumeclaim_labels by their apps.cozystack.io/application.* + # lineage labels. kube-state-metrics emits that metric only for resources on + # this list, one series per PVC; naming only the lineage keys would emit the + # same number of series. + - --metric-labels-allowlist=pods=[*],deployments=[*],persistentvolumeclaims=[*] rbac: extraRules: - apiGroups: