Skip to content

Commit

Permalink
Merge pull request #81 from startechnica/st-common
Browse files Browse the repository at this point in the history
[st-common] Bump version to 0.1.8
  • Loading branch information
firmansyahn authored Sep 24, 2024
2 parents 432d149 + 52cf75b commit e90fe5e
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 40 deletions.
10 changes: 6 additions & 4 deletions charts/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ annotations:
category: Infrastructure
artifacthub.io/changes: |
- kind: changed
description: Add more granular Istio API resources
description: Fix Istio API resources
- kind: changed
description: Add more granular Kubernetes Gateway API resources
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
Expand All @@ -25,4 +27,4 @@ name: st-common
sources:
- https://startechnica.github.io/apps
type: library
version: 0.1.7
version: 0.1.8
39 changes: 38 additions & 1 deletion charts/common/templates/_certmanager.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,48 @@ 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" -}}
{{- print "acme.cert-manager.io/v1" -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}
{{- end -}}

75 changes: 42 additions & 33 deletions charts/common/templates/_istio.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,32 @@ 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 -}}
{{- end -}}

{{/* 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 -}}
{{- end -}}

{{/* 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 -}}
Expand All @@ -89,21 +89,21 @@ 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 -}}
{{- end -}}

{{/* 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 -}}
Expand All @@ -120,43 +120,43 @@ 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 -}}
{{- end -}}

{{/* 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 -}}
{{- end -}}

{{/* 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 -}}
{{- end -}}

{{/* 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 -}}
Expand All @@ -173,21 +173,30 @@ 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 -}}
{{- end -}}

{{/* 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 -}}
Expand Down
106 changes: 104 additions & 2 deletions charts/common/templates/_prometheus.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,115 @@ 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" -}}
{{- print "monitoring.coreos.com/v1alpha1" -}}
{{- 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 -}}
Loading

0 comments on commit e90fe5e

Please sign in to comment.