Merge pull request #2285 from geethub97/k8s-1.25-deprecations-fix

Updating rancher monitoring charts to support k8s 1.25.
pull/2293/head
Geet Samra 2022-12-22 16:03:14 -08:00 committed by GitHub
commit 4f2b3a9579
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 47 additions and 25 deletions

View File

@ -9,7 +9,7 @@ annotations:
catalog.cattle.io/certified: rancher
catalog.cattle.io/deploys-on-os: windows
catalog.cattle.io/display-name: Monitoring
catalog.cattle.io/kube-version: '>= 1.16.0-0 < 1.25.0-0'
catalog.cattle.io/kube-version: '>= 1.16.0-0 <= 1.25.0-0'
catalog.cattle.io/namespace: cattle-monitoring-system
catalog.cattle.io/permits-os: linux,windows
catalog.cattle.io/provides-gvr: monitoring.coreos.com.prometheus/v1

View File

@ -157,6 +157,17 @@ Return the appropriate apiVersion for rbac.
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for HorizontalPodAutoscaler.
*/}}
{{- define "grafana.hpa.apiVersion" -}}
{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
{{- print "autoscaling/v2" -}}
{{- else if .Capabilities.APIVersions.Has "autoscaling/v1" }}
{{- print "autoscaling/v1" -}}
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for ingress.
*/}}

View File

@ -1,5 +1,5 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
apiVersion: {{ template "grafana.hpa.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "grafana.fullname" . }}

View File

@ -6,12 +6,10 @@ metadata:
name: psp-{{ template "prometheus-node-exporter.fullname" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
rules:
{{- if .Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicies" }}
- apiGroups: ['extensions']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames:
{{- end }}
- {{ template "prometheus-node-exporter.fullname" . }}
{{- end }}
{{- end }}

View File

@ -8281,7 +8281,7 @@ entries:
catalog.cattle.io/certified: rancher
catalog.cattle.io/deploys-on-os: windows
catalog.cattle.io/display-name: Monitoring
catalog.cattle.io/kube-version: '>= 1.16.0-0 < 1.25.0-0'
catalog.cattle.io/kube-version: '>= 1.16.0-0 <= 1.25.0-0'
catalog.cattle.io/namespace: cattle-monitoring-system
catalog.cattle.io/permits-os: linux,windows
catalog.cattle.io/provides-gvr: monitoring.coreos.com.prometheus/v1
@ -8294,7 +8294,7 @@ entries:
catalog.cattle.io/upstream-version: 19.0.3
apiVersion: v2
appVersion: 0.59.1
created: "2022-12-20T15:14:27.458161-08:00"
created: "2022-12-22T15:48:51.113238-08:00"
dependencies:
- condition: grafana.enabled
name: grafana
@ -8365,7 +8365,7 @@ entries:
description: Collects several related Helm charts, Grafana dashboards, and Prometheus
rules combined with documentation and scripts to provide easy to operate end-to-end
Kubernetes cluster monitoring with Prometheus using the Prometheus Operator.
digest: 000641c5849c714c8c81acc8a23935f2c2ee383b3d8c9917f122b60930cb55fe
digest: 8c1d85f6cc813f29ed772ac29215e8d706ba135ee2c37e25df24a693ad4cf1cc
home: https://github.com/prometheus-operator/kube-prometheus
icon: https://raw.githubusercontent.com/prometheus/prometheus.github.io/master/assets/prometheus_logo-cb55bb5c346.png
keywords:

View File

@ -33,3 +33,21 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
@@ -125,6 +154,17 @@
{{- print "rbac.authorization.k8s.io/v1" -}}
{{- else -}}
{{- print "rbac.authorization.k8s.io/v1beta1" -}}
+ {{- end -}}
+{{- end -}}
+
+{{/*
+Return the appropriate apiVersion for HorizontalPodAutoscaler.
+*/}}
+{{- define "grafana.hpa.apiVersion" -}}
+ {{- if .Capabilities.APIVersions.Has "autoscaling/v2" }}
+ {{- print "autoscaling/v2" -}}
+ {{- else if .Capabilities.APIVersions.Has "autoscaling/v1" }}
+ {{- print "autoscaling/v1" -}}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,9 @@
--- charts-original/templates/hpa.yaml
+++ charts/templates/hpa.yaml
@@ -1,5 +1,5 @@
{{- if .Values.autoscaling.enabled }}
-apiVersion: autoscaling/v2beta1
+apiVersion: {{ template "grafana.hpa.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "grafana.fullname" . }}

View File

@ -6,8 +6,9 @@
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
@@ -28,4 +27,3 @@
@@ -27,5 +26,4 @@
- projected
- csi
- secret
{{- end }}
-{{- end }}
{{- end }}

View File

@ -8,7 +8,7 @@
+ catalog.cattle.io/certified: rancher
+ catalog.cattle.io/deploys-on-os: windows
+ catalog.cattle.io/display-name: Monitoring
+ catalog.cattle.io/kube-version: '>= 1.16.0-0 < 1.25.0-0'
+ catalog.cattle.io/kube-version: '>= 1.16.0-0 <= 1.25.0-0'
+ catalog.cattle.io/namespace: cattle-monitoring-system
+ catalog.cattle.io/permits-os: linux,windows
+ catalog.cattle.io/provides-gvr: monitoring.coreos.com.prometheus/v1

View File

@ -1,15 +0,0 @@
--- charts-original/templates/psp-clusterrole.yaml
+++ charts/templates/psp-clusterrole.yaml
@@ -6,10 +6,12 @@
name: psp-{{ template "prometheus-node-exporter.fullname" . }}
labels: {{ include "prometheus-node-exporter.labels" . | indent 4 }}
rules:
+{{- if .Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicies" }}
- apiGroups: ['extensions']
resources: ['podsecuritypolicies']
verbs: ['use']
resourceNames:
+{{- end }}
- {{ template "prometheus-node-exporter.fullname" . }}
{{- end }}
{{- end }}