From a3ad1b1ba8b28844d342afcf27bd4e8740d602ab Mon Sep 17 00:00:00 2001 From: firmansyahn <80936459+firmansyahn@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:34:45 +0700 Subject: [PATCH 1/3] Fix Istio API and Gateway API resources --- charts/common/Chart.yaml | 4 +- charts/common/templates/_certmanager.tpl | 39 +++++++++++- charts/common/templates/_istio.tpl | 75 +++++++++++++----------- charts/common/templates/_prometheus.tpl | 2 - charts/common/templates/_sigs.tpl | 56 ++++++++++++++++++ 5 files changed, 137 insertions(+), 39 deletions(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index 0c49035..9a105bf 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -2,9 +2,7 @@ annotations: category: Infrastructure artifacthub.io/changes: | - kind: changed - description: Add more granular Istio API resources - - kind: changed - description: Add more granular Kubernetes Gateway API resources + description: Fix Istio API resources apiVersion: v2 appVersion: 0.1.7 description: A Library Helm Chart for grouping common logic between Startechnica charts. diff --git a/charts/common/templates/_certmanager.tpl b/charts/common/templates/_certmanager.tpl index 2a5804d..649aaf8 100644 --- a/charts/common/templates/_certmanager.tpl +++ b/charts/common/templates/_certmanager.tpl @@ -12,6 +12,42 @@ SPDX-License-Identifier: APACHE-2.0 {{- end -}} {{- end -}} +{{/* Return the appropriate apiVersion for cert-manager Certificate. */}} +{{- define "common.capabilities.certmanagerCertificate.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "cert-manager.io/v1/Certificate" -}} + {{- print "cert-manager.io/v1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for cert-manager CertificateRequest. */}} +{{- define "common.capabilities.certmanagerCertificateRequest.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "cert-manager.io/v1/CertificateRequest" -}} + {{- print "cert-manager.io/v1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for cert-manager ClusterIssuer. */}} +{{- define "common.capabilities.certmanagerClusterIssuer.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "cert-manager.io/v1/ClusterIssuer" -}} + {{- print "cert-manager.io/v1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for cert-manager Issuer. */}} +{{- define "common.capabilities.certmanagerIssuer.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "cert-manager.io/v1/Issuer" -}} + {{- print "cert-manager.io/v1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + {{/* Return the appropriate apiVersion for cert-manager ACME. */}} {{- define "common.capabilities.certManagerAcme.apiVersion" -}} {{- if .Capabilities.APIVersions.Has "acme.cert-manager.io/v1" -}} @@ -19,4 +55,5 @@ SPDX-License-Identifier: APACHE-2.0 {{- else -}} {{- false -}} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} + diff --git a/charts/common/templates/_istio.tpl b/charts/common/templates/_istio.tpl index 76547de..5d5e877 100644 --- a/charts/common/templates/_istio.tpl +++ b/charts/common/templates/_istio.tpl @@ -47,10 +47,10 @@ SPDX-License-Identifier: APACHE-2.0 {{/* Return the appropriate apiVersion for Istio Telemetry. */}} {{- define "common.capabilities.istioTelemetry.apiVersion" -}} -{{- if .Capabilities.APIVersions.Has "telemetry.istio.io/v1alpha1" -}} - {{- print "telemetry.istio.io/v1alpha1" -}} -{{- else if .Capabilities.APIVersions.Has "telemetry.istio.io/v1" -}} +{{- if .Capabilities.APIVersions.Has "telemetry.istio.io/v1/Telemetry" -}} {{- print "telemetry.istio.io/v1" -}} +{{- else if .Capabilities.APIVersions.Has "telemetry.istio.io/v1alpha1/Telemetry" -}} + {{- print "telemetry.istio.io/v1alpha1" -}} {{- else -}} {{- false -}} {{- end -}} @@ -58,10 +58,10 @@ SPDX-License-Identifier: APACHE-2.0 {{/* Return the appropriate apiVersion for Istio AuthorizationPolicy. */}} {{- define "common.capabilities.istioAuthorizationPolicy.apiVersion" -}} -{{- if .Capabilities.APIVersions.Has "security.istio.io/v1beta1/AuthorizationPolicy" -}} - {{- print "security.istio.io/v1beta1" -}} -{{- else if .Capabilities.APIVersions.Has "security.istio.io/v1/AuthorizationPolicy" -}} +{{- if .Capabilities.APIVersions.Has "security.istio.io/v1/AuthorizationPolicy" -}} {{- print "security.istio.io/v1" -}} +{{- else if .Capabilities.APIVersions.Has "security.istio.io/v1beta1/AuthorizationPolicy" -}} + {{- print "security.istio.io/v1beta1" -}} {{- else -}} {{- false -}} {{- end -}} @@ -69,10 +69,10 @@ SPDX-License-Identifier: APACHE-2.0 {{/* Return the appropriate apiVersion for Istio DestinationRule. */}} {{- define "common.capabilities.istioDestinationRule.apiVersion" -}} -{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/DestinationRule" -}} - {{- print "networking.istio.io/v1beta1" -}} -{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1/DestinationRule" -}} +{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1/DestinationRule" -}} {{- print "networking.istio.io/v1" -}} +{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/DestinationRule" -}} + {{- print "networking.istio.io/v1beta1" -}} {{- else -}} {{- false -}} {{- end -}} @@ -89,10 +89,10 @@ SPDX-License-Identifier: APACHE-2.0 {{/* Return the appropriate apiVersion for Istio Gateway. */}} {{- define "common.capabilities.istioGateway.apiVersion" -}} -{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/Gateway" -}} - {{- print "networking.istio.io/v1beta1" -}} -{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1/Gateway" -}} +{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1/Gateway" -}} {{- print "networking.istio.io/v1" -}} +{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/Gateway" -}} + {{- print "networking.istio.io/v1beta1" -}} {{- else -}} {{- false -}} {{- end -}} @@ -100,10 +100,10 @@ SPDX-License-Identifier: APACHE-2.0 {{/* Return the appropriate apiVersion for Istio PeerAuthentication. */}} {{- define "common.capabilities.istioPeerAuthentication.apiVersion" -}} -{{- if .Capabilities.APIVersions.Has "security.istio.io/v1beta1/PeerAuthentication" -}} - {{- print "security.istio.io/v1beta1" -}} -{{- else if .Capabilities.APIVersions.Has "security.istio.io/v1/PeerAuthentication" -}} +{{- if .Capabilities.APIVersions.Has "security.istio.io/v1/PeerAuthentication" -}} {{- print "security.istio.io/v1" -}} +{{- else if .Capabilities.APIVersions.Has "security.istio.io/v1beta1/PeerAuthentication" -}} + {{- print "security.istio.io/v1beta1" -}} {{- else -}} {{- false -}} {{- end -}} @@ -120,10 +120,10 @@ SPDX-License-Identifier: APACHE-2.0 {{/* Return the appropriate apiVersion for Istio RequestAuthentication. */}} {{- define "common.capabilities.istioRequestAuthentication.apiVersion" -}} -{{- if .Capabilities.APIVersions.Has "security.istio.io/v1beta1/RequestAuthentication" -}} - {{- print "security.istio.io/v1beta1" -}} -{{- else if .Capabilities.APIVersions.Has "security.istio.io/v1/RequestAuthentication" -}} +{{- if .Capabilities.APIVersions.Has "security.istio.io/v1/RequestAuthentication" -}} {{- print "security.istio.io/v1" -}} +{{- else if .Capabilities.APIVersions.Has "security.istio.io/v1beta1/RequestAuthentication" -}} + {{- print "security.istio.io/v1beta1" -}} {{- else -}} {{- false -}} {{- end -}} @@ -131,10 +131,10 @@ SPDX-License-Identifier: APACHE-2.0 {{/* Return the appropriate apiVersion for Istio Sidecar. */}} {{- define "common.capabilities.istioSidecar.apiVersion" -}} -{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/Sidecar" -}} - {{- print "networking.istio.io/v1beta1" -}} -{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1/Sidecar" -}} +{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1/Sidecar" -}} {{- print "networking.istio.io/v1" -}} +{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/Sidecar" -}} + {{- print "networking.istio.io/v1beta1" -}} {{- else -}} {{- false -}} {{- end -}} @@ -142,10 +142,10 @@ SPDX-License-Identifier: APACHE-2.0 {{/* Return the appropriate apiVersion for Istio ServiceEntry. */}} {{- define "common.capabilities.istioServiceEntry.apiVersion" -}} -{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/ServiceEntry" -}} - {{- print "networking.istio.io/v1beta1" -}} -{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1/ServiceEntry" -}} +{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1/ServiceEntry" -}} {{- print "networking.istio.io/v1" -}} +{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/ServiceEntry" -}} + {{- print "networking.istio.io/v1beta1" -}} {{- else -}} {{- false -}} {{- end -}} @@ -153,10 +153,10 @@ SPDX-License-Identifier: APACHE-2.0 {{/* Return the appropriate apiVersion for Istio VirtualService. */}} {{- define "common.capabilities.istioVirtualService.apiVersion" -}} -{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/VirtualService" -}} - {{- print "networking.istio.io/v1beta1" -}} -{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1/VirtualService" -}} +{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1/VirtualService" -}} {{- print "networking.istio.io/v1" -}} +{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/VirtualService" -}} + {{- print "networking.istio.io/v1beta1" -}} {{- else -}} {{- false -}} {{- end -}} @@ -173,10 +173,10 @@ SPDX-License-Identifier: APACHE-2.0 {{/* Return the appropriate apiVersion for Istio WorkloadEntry. */}} {{- define "common.capabilities.istioWorkloadEntry.apiVersion" -}} -{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/WorkloadEntry" -}} - {{- print "networking.istio.io/v1beta1" -}} -{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1/WorkloadEntry" -}} +{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1/WorkloadEntry" -}} {{- print "networking.istio.io/v1" -}} +{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/WorkloadEntry" -}} + {{- print "networking.istio.io/v1beta1" -}} {{- else -}} {{- false -}} {{- end -}} @@ -184,10 +184,19 @@ SPDX-License-Identifier: APACHE-2.0 {{/* Return the appropriate apiVersion for Istio WorkloadGroup. */}} {{- define "common.capabilities.istioWorkloadGroup.apiVersion" -}} -{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/WorkloadGroup" -}} - {{- print "networking.istio.io/v1beta1" -}} -{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1/WorkloadGroup" -}} +{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1/WorkloadGroup" -}} {{- print "networking.istio.io/v1" -}} +{{- else if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/WorkloadGroup" -}} + {{- print "networking.istio.io/v1beta1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Istio IstioOperator. */}} +{{- define "common.capabilities.istioIstioOperator.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "install.istio.io/v1alpha1/IstioOperator" -}} + {{- print "install.istio.io/v1alpha1" -}} {{- else -}} {{- false -}} {{- end -}} diff --git a/charts/common/templates/_prometheus.tpl b/charts/common/templates/_prometheus.tpl index baf25c3..23153f8 100644 --- a/charts/common/templates/_prometheus.tpl +++ b/charts/common/templates/_prometheus.tpl @@ -9,8 +9,6 @@ SPDX-License-Identifier: APACHE-2.0 {{- print "monitoring.coreos.com/v1" -}} {{- else if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1beta1" -}} {{- print "monitoring.coreos.com/v1beta1" -}} -{{- else if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1beta1" -}} - {{- print "monitoring.coreos.com/v1alpha2" -}} {{- else if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1alpha2" -}} {{- print "monitoring.coreos.com/v1alpha2" -}} {{- else if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1alpha1" -}} diff --git a/charts/common/templates/_sigs.tpl b/charts/common/templates/_sigs.tpl index 9f21227..9f88de9 100644 --- a/charts/common/templates/_sigs.tpl +++ b/charts/common/templates/_sigs.tpl @@ -16,6 +16,24 @@ SPDX-License-Identifier: APACHE-2.0 {{- end -}} {{- end -}} +{{/* Return the appropriate apiVersion for Kubernetes Gateway API BackendLBPolicy */}} +{{- define "common.capabilities.networkingGatewayBackendLBPolicy.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1alpha2/BackendLBPolicy" -}} + {{- print "gateway.networking.k8s.io/v1alpha2" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Kubernetes Gateway API BackendTLSPolicy */}} +{{- define "common.capabilities.networkingGatewayBackendTLSPolicy.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1alpha3/BackendTLSPolicy" -}} + {{- print "gateway.networking.k8s.io/v1alpha3" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + {{/* Return the appropriate apiVersion for Kubernetes Gateway API Gateway */}} {{- define "common.capabilities.networkingGatewayGateway.apiVersion" -}} {{- if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1/Gateway" -}} @@ -27,6 +45,17 @@ SPDX-License-Identifier: APACHE-2.0 {{- end -}} {{- end -}} +{{/* Return the appropriate apiVersion for Kubernetes Gateway API GatewayClass */}} +{{- define "common.capabilities.networkingGatewayGatewayClass.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1/GatewayClass" -}} + {{- print "gateway.networking.k8s.io/v1" -}} +{{- else if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1beta1/GatewayClass" -}} + {{- print "gateway.networking.k8s.io/v1beta1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + {{/* Return the appropriate apiVersion for Kubernetes Gateway API GRPCRoute */}} {{- define "common.capabilities.networkingGatewayGRPCRoute.apiVersion" -}} {{- if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1/GRPCRoute" -}} @@ -49,6 +78,33 @@ SPDX-License-Identifier: APACHE-2.0 {{- end -}} {{- end -}} +{{/* Return the appropriate apiVersion for Kubernetes Gateway API TCPRoute */}} +{{- define "common.capabilities.networkingGatewayTCPRoute.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1alpha2/TCPRoute" -}} + {{- print "gateway.networking.k8s.io/v1alpha2" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Kubernetes Gateway API TLSRoute */}} +{{- define "common.capabilities.networkingGatewayTLSRoute.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1alpha2/TLSRoute" -}} + {{- print "gateway.networking.k8s.io/v1alpha2" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Kubernetes Gateway API UDPRoute */}} +{{- define "common.capabilities.networkingGatewayUDPRoute.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1alpha2/UDPRoute" -}} + {{- print "gateway.networking.k8s.io/v1alpha2" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + {{/* Return the appropriate apiVersion for Kubernetes Gateway API ReferenceGrant */}} {{- define "common.capabilities.networkingGatewayReferenceGrant.apiVersion" -}} {{- if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1/ReferenceGrant" -}} From 1eb58a2f64546d0cc8dcec6de3f04b35b18f00f3 Mon Sep 17 00:00:00 2001 From: firmansyahn <80936459+firmansyahn@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:42:49 +0700 Subject: [PATCH 2/3] Fix Prometheus API resources --- charts/common/templates/_prometheus.tpl | 104 ++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/charts/common/templates/_prometheus.tpl b/charts/common/templates/_prometheus.tpl index 23153f8..abaae42 100644 --- a/charts/common/templates/_prometheus.tpl +++ b/charts/common/templates/_prometheus.tpl @@ -16,4 +16,108 @@ SPDX-License-Identifier: APACHE-2.0 {{- else -}} {{- false -}} {{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Prometheus API AlertmanagerConfig */}} +{{- define "common.capabilities.coreosMonitoringAlertmanagerConfig.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1alpha1/AlertmanagerConfig" -}} + {{- print "monitoring.coreos.com/v1alpha1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Prometheus API Alertmanager */}} +{{- define "common.capabilities.coreosMonitoringAlertmanager.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1/Alertmanager" -}} + {{- print "monitoring.coreos.com/v1" -}} +{{- else if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1beta1/Alertmanager" -}} + {{- print "monitoring.coreos.com/v1beta1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Prometheus API PodMonitor */}} +{{- define "common.capabilities.coreosMonitoringPodMonitor.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1/PodMonitor" -}} + {{- print "monitoring.coreos.com/v1" -}} +{{- else if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1beta1/PodMonitor" -}} + {{- print "monitoring.coreos.com/v1beta1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Prometheus API Probe */}} +{{- define "common.capabilities.coreosMonitoringProbe.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1/Probe" -}} + {{- print "monitoring.coreos.com/v1" -}} +{{- else if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1beta1/Probe" -}} + {{- print "monitoring.coreos.com/v1beta1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Prometheus API Prometheus */}} +{{- define "common.capabilities.coreosMonitoringPrometheus.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1/Prometheus" -}} + {{- print "monitoring.coreos.com/v1" -}} +{{- else if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1beta1/Prometheus" -}} + {{- print "monitoring.coreos.com/v1beta1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Prometheus API PrometheusAgent */}} +{{- define "common.capabilities.coreosMonitoringPrometheusAgent.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1alpha1/PrometheusAgent" -}} + {{- print "monitoring.coreos.com/v1alpha1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Prometheus API PrometheusRule */}} +{{- define "common.capabilities.coreosMonitoringPrometheusRule.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1/PrometheusRule" -}} + {{- print "monitoring.coreos.com/v1" -}} +{{- else if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1beta1/PrometheusRule" -}} + {{- print "monitoring.coreos.com/v1beta1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Prometheus API ScrapeConfig */}} +{{- define "common.capabilities.coreosMonitoringScrapeConfig.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1alpha1/ScrapeConfig" -}} + {{- print "monitoring.coreos.com/v1alpha1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Prometheus API ServiceMonitor */}} +{{- define "common.capabilities.coreosMonitoringServiceMonitor.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ServiceMonitor" -}} + {{- print "monitoring.coreos.com/v1" -}} +{{- else if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1beta1/ServiceMonitor" -}} + {{- print "monitoring.coreos.com/v1beta1" -}} +{{- else -}} + {{- false -}} +{{- end -}} +{{- end -}} + +{{/* Return the appropriate apiVersion for Prometheus API ThanosRuler */}} +{{- define "common.capabilities.coreosMonitoringThanosRuler.apiVersion" -}} +{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ThanosRuler" -}} + {{- print "monitoring.coreos.com/v1" -}} +{{- else if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1beta1/ThanosRuler" -}} + {{- print "monitoring.coreos.com/v1beta1" -}} +{{- else -}} + {{- false -}} +{{- end -}} {{- end -}} \ No newline at end of file From 52cf75bf197dd3cf5cc83f10eae12634d90a8bc2 Mon Sep 17 00:00:00 2001 From: firmansyahn <80936459+firmansyahn@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:43:37 +0700 Subject: [PATCH 3/3] Bump version to 0.1.8 --- charts/common/Chart.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index 9a105bf..323caef 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -3,8 +3,12 @@ annotations: artifacthub.io/changes: | - kind: changed description: Fix Istio API resources + - kind: changed + description: Fix Kubernetes Gateway API resources + - kind: changed + description: Fix Prometheus API resources apiVersion: v2 -appVersion: 0.1.7 +appVersion: 0.1.8 description: A Library Helm Chart for grouping common logic between Startechnica charts. This chart is not deployable by itself. home: https://github.com/startechnica/apps/tree/main/charts/common @@ -23,4 +27,4 @@ name: st-common sources: - https://startechnica.github.io/apps type: library -version: 0.1.7 \ No newline at end of file +version: 0.1.8 \ No newline at end of file