From 88f225679cbb098fb2e141d7ca915f4e293f794a Mon Sep 17 00:00:00 2001 From: Steven Sheehy <17552371+steven-sheehy@users.noreply.github.com> Date: Wed, 2 Dec 2020 10:14:54 -0600 Subject: [PATCH] [prometheus-adapter] Template prometheus.url & rename files (#205) - Template `prometheus.url` to allow it to contain dynamic variables like release name - Remove `custom-metrics` from the file name of template files that are not custom metrics API specific Signed-off-by: Steven Sheehy --- charts/prometheus-adapter/Chart.yaml | 2 +- ...-binding.yaml => cluster-role-binding-auth-delegator.yaml} | 0 ...binding.yaml => cluster-role-binding-resource-reader.yaml} | 0 ...er-cluster-role.yaml => cluster-role-resource-reader.yaml} | 0 .../{custom-metrics-configmap.yaml => configmap.yaml} | 0 ...ding.yaml => custom-metrics-cluster-role-binding-hpa.yaml} | 0 ...stom-metrics-apiserver-deployment.yaml => deployment.yaml} | 4 ++-- ...ng.yaml => external-metrics-cluster-role-binding-hpa.yaml} | 0 .../templates/{custom-metrics-apiserver-pdb.yaml => pdb.yaml} | 0 .../templates/{custom-metrics-apiserver-psp.yaml => psp.yaml} | 0 ...reader-role-binding.yaml => role-binding-auth-reader.yaml} | 0 .../{custom-metrics-apiserver-service.yaml => service.yaml} | 0 ...ics-apiserver-service-account.yaml => serviceaccount.yaml} | 0 charts/prometheus-adapter/values.yaml | 1 + 14 files changed, 4 insertions(+), 3 deletions(-) rename charts/prometheus-adapter/templates/{custom-metrics-apiserver-auth-delegator-cluster-role-binding.yaml => cluster-role-binding-auth-delegator.yaml} (100%) rename charts/prometheus-adapter/templates/{custom-metrics-apiserver-resource-reader-cluster-role-binding.yaml => cluster-role-binding-resource-reader.yaml} (100%) rename charts/prometheus-adapter/templates/{custom-metrics-resource-reader-cluster-role.yaml => cluster-role-resource-reader.yaml} (100%) rename charts/prometheus-adapter/templates/{custom-metrics-configmap.yaml => configmap.yaml} (100%) rename charts/prometheus-adapter/templates/{hpa-custom-metrics-cluster-role-binding.yaml => custom-metrics-cluster-role-binding-hpa.yaml} (100%) rename charts/prometheus-adapter/templates/{custom-metrics-apiserver-deployment.yaml => deployment.yaml} (95%) rename charts/prometheus-adapter/templates/{hpa-external-metrics-cluster-role-binding.yaml => external-metrics-cluster-role-binding-hpa.yaml} (100%) rename charts/prometheus-adapter/templates/{custom-metrics-apiserver-pdb.yaml => pdb.yaml} (100%) rename charts/prometheus-adapter/templates/{custom-metrics-apiserver-psp.yaml => psp.yaml} (100%) rename charts/prometheus-adapter/templates/{custom-metrics-apiserver-auth-reader-role-binding.yaml => role-binding-auth-reader.yaml} (100%) rename charts/prometheus-adapter/templates/{custom-metrics-apiserver-service.yaml => service.yaml} (100%) rename charts/prometheus-adapter/templates/{custom-metrics-apiserver-service-account.yaml => serviceaccount.yaml} (100%) diff --git a/charts/prometheus-adapter/Chart.yaml b/charts/prometheus-adapter/Chart.yaml index a77e1b7d..607f1099 100644 --- a/charts/prometheus-adapter/Chart.yaml +++ b/charts/prometheus-adapter/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: prometheus-adapter -version: 2.7.1 +version: 2.7.2 appVersion: v0.7.0 description: A Helm chart for k8s prometheus adapter home: https://github.com/DirectXMan12/k8s-prometheus-adapter diff --git a/charts/prometheus-adapter/templates/custom-metrics-apiserver-auth-delegator-cluster-role-binding.yaml b/charts/prometheus-adapter/templates/cluster-role-binding-auth-delegator.yaml similarity index 100% rename from charts/prometheus-adapter/templates/custom-metrics-apiserver-auth-delegator-cluster-role-binding.yaml rename to charts/prometheus-adapter/templates/cluster-role-binding-auth-delegator.yaml diff --git a/charts/prometheus-adapter/templates/custom-metrics-apiserver-resource-reader-cluster-role-binding.yaml b/charts/prometheus-adapter/templates/cluster-role-binding-resource-reader.yaml similarity index 100% rename from charts/prometheus-adapter/templates/custom-metrics-apiserver-resource-reader-cluster-role-binding.yaml rename to charts/prometheus-adapter/templates/cluster-role-binding-resource-reader.yaml diff --git a/charts/prometheus-adapter/templates/custom-metrics-resource-reader-cluster-role.yaml b/charts/prometheus-adapter/templates/cluster-role-resource-reader.yaml similarity index 100% rename from charts/prometheus-adapter/templates/custom-metrics-resource-reader-cluster-role.yaml rename to charts/prometheus-adapter/templates/cluster-role-resource-reader.yaml diff --git a/charts/prometheus-adapter/templates/custom-metrics-configmap.yaml b/charts/prometheus-adapter/templates/configmap.yaml similarity index 100% rename from charts/prometheus-adapter/templates/custom-metrics-configmap.yaml rename to charts/prometheus-adapter/templates/configmap.yaml diff --git a/charts/prometheus-adapter/templates/hpa-custom-metrics-cluster-role-binding.yaml b/charts/prometheus-adapter/templates/custom-metrics-cluster-role-binding-hpa.yaml similarity index 100% rename from charts/prometheus-adapter/templates/hpa-custom-metrics-cluster-role-binding.yaml rename to charts/prometheus-adapter/templates/custom-metrics-cluster-role-binding-hpa.yaml diff --git a/charts/prometheus-adapter/templates/custom-metrics-apiserver-deployment.yaml b/charts/prometheus-adapter/templates/deployment.yaml similarity index 95% rename from charts/prometheus-adapter/templates/custom-metrics-apiserver-deployment.yaml rename to charts/prometheus-adapter/templates/deployment.yaml index ea5fb346..a9658034 100644 --- a/charts/prometheus-adapter/templates/custom-metrics-apiserver-deployment.yaml +++ b/charts/prometheus-adapter/templates/deployment.yaml @@ -26,7 +26,7 @@ spec: {{- end }} name: {{ template "k8s-prometheus-adapter.name" . }} annotations: - checksum/config: {{ include (print $.Template.BasePath "/custom-metrics-configmap.yaml") . | sha256sum }} + checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} {{- with .Values.podAnnotations }} {{- toYaml . | trim | nindent 8 }} {{- end }} @@ -48,7 +48,7 @@ spec: {{- end }} - --cert-dir=/tmp/cert - --logtostderr=true - - --prometheus-url={{ .Values.prometheus.url }}{{ if .Values.prometheus.port }}:{{ .Values.prometheus.port }}{{end}}{{ .Values.prometheus.path }} + - --prometheus-url={{ tpl .Values.prometheus.url . }}{{ if .Values.prometheus.port }}:{{ .Values.prometheus.port }}{{end}}{{ .Values.prometheus.path }} - --metrics-relist-interval={{ .Values.metricsRelistInterval }} - --v={{ .Values.logLevel }} - --config=/etc/adapter/config.yaml diff --git a/charts/prometheus-adapter/templates/hpa-external-metrics-cluster-role-binding.yaml b/charts/prometheus-adapter/templates/external-metrics-cluster-role-binding-hpa.yaml similarity index 100% rename from charts/prometheus-adapter/templates/hpa-external-metrics-cluster-role-binding.yaml rename to charts/prometheus-adapter/templates/external-metrics-cluster-role-binding-hpa.yaml diff --git a/charts/prometheus-adapter/templates/custom-metrics-apiserver-pdb.yaml b/charts/prometheus-adapter/templates/pdb.yaml similarity index 100% rename from charts/prometheus-adapter/templates/custom-metrics-apiserver-pdb.yaml rename to charts/prometheus-adapter/templates/pdb.yaml diff --git a/charts/prometheus-adapter/templates/custom-metrics-apiserver-psp.yaml b/charts/prometheus-adapter/templates/psp.yaml similarity index 100% rename from charts/prometheus-adapter/templates/custom-metrics-apiserver-psp.yaml rename to charts/prometheus-adapter/templates/psp.yaml diff --git a/charts/prometheus-adapter/templates/custom-metrics-apiserver-auth-reader-role-binding.yaml b/charts/prometheus-adapter/templates/role-binding-auth-reader.yaml similarity index 100% rename from charts/prometheus-adapter/templates/custom-metrics-apiserver-auth-reader-role-binding.yaml rename to charts/prometheus-adapter/templates/role-binding-auth-reader.yaml diff --git a/charts/prometheus-adapter/templates/custom-metrics-apiserver-service.yaml b/charts/prometheus-adapter/templates/service.yaml similarity index 100% rename from charts/prometheus-adapter/templates/custom-metrics-apiserver-service.yaml rename to charts/prometheus-adapter/templates/service.yaml diff --git a/charts/prometheus-adapter/templates/custom-metrics-apiserver-service-account.yaml b/charts/prometheus-adapter/templates/serviceaccount.yaml similarity index 100% rename from charts/prometheus-adapter/templates/custom-metrics-apiserver-service-account.yaml rename to charts/prometheus-adapter/templates/serviceaccount.yaml diff --git a/charts/prometheus-adapter/values.yaml b/charts/prometheus-adapter/values.yaml index 187124e0..23548a5d 100644 --- a/charts/prometheus-adapter/values.yaml +++ b/charts/prometheus-adapter/values.yaml @@ -18,6 +18,7 @@ priorityClassName: "" # Url to access prometheus prometheus: + # Value is templated url: http://prometheus.default.svc port: 9090 path: ""