From 3c38ca1a62f9daf0b0355518e4ed659ad07fdbb7 Mon Sep 17 00:00:00 2001 From: "Maohsiang @github" <6195019+titanlien@users.noreply.github.com> Date: Wed, 8 Nov 2023 16:20:52 +0100 Subject: [PATCH] [prometheus-adapter] allow customize clusterrole resources (#3944) Allow end user to change cluster role resources in external and custom metrics Signed-off-by: Mao-Hsiang Lien <6195019+titanlien@users.noreply.github.com> --- charts/prometheus-adapter/Chart.yaml | 2 +- .../templates/custom-metrics-cluster-role.yaml | 2 +- .../templates/external-metrics-cluster-role.yaml | 3 +-- charts/prometheus-adapter/values.yaml | 4 ++++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/charts/prometheus-adapter/Chart.yaml b/charts/prometheus-adapter/Chart.yaml index c9326246b5a2..2532c89d1d69 100644 --- a/charts/prometheus-adapter/Chart.yaml +++ b/charts/prometheus-adapter/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: prometheus-adapter -version: 4.7.1 +version: 4.8.0 appVersion: v0.11.1 description: A Helm chart for k8s prometheus adapter home: https://github.com/kubernetes-sigs/prometheus-adapter diff --git a/charts/prometheus-adapter/templates/custom-metrics-cluster-role.yaml b/charts/prometheus-adapter/templates/custom-metrics-cluster-role.yaml index 4aa15ffe9916..f441e1bdb6fe 100644 --- a/charts/prometheus-adapter/templates/custom-metrics-cluster-role.yaml +++ b/charts/prometheus-adapter/templates/custom-metrics-cluster-role.yaml @@ -12,6 +12,6 @@ metadata: rules: - apiGroups: - custom.metrics.k8s.io - resources: ["*"] + resources: {{ toYaml .Values.rbac.customMetrics.resources | nindent 2 }} verbs: ["*"] {{- end -}} diff --git a/charts/prometheus-adapter/templates/external-metrics-cluster-role.yaml b/charts/prometheus-adapter/templates/external-metrics-cluster-role.yaml index 212ea78b25aa..71783fd4b287 100644 --- a/charts/prometheus-adapter/templates/external-metrics-cluster-role.yaml +++ b/charts/prometheus-adapter/templates/external-metrics-cluster-role.yaml @@ -12,8 +12,7 @@ metadata: rules: - apiGroups: - "external.metrics.k8s.io" - resources: - - "*" + resources: {{ toYaml .Values.rbac.externalMetrics.resources | nindent 2 }} verbs: - list - get diff --git a/charts/prometheus-adapter/values.yaml b/charts/prometheus-adapter/values.yaml index 5098e69fa655..695490b15611 100644 --- a/charts/prometheus-adapter/values.yaml +++ b/charts/prometheus-adapter/values.yaml @@ -58,6 +58,10 @@ securityContext: rbac: # Specifies whether RBAC resources should be created create: true + externalMetrics: + resources: ["*"] + customMetrics: + resources: ["*"] psp: # Specifies whether PSP resources should be created