Skip to content

Commit

Permalink
Merge pull request #80 from startechnica/st-common
Browse files Browse the repository at this point in the history
[st-common] Bump version to 0.1.7
Add more Istio and Kubernetes Gateway API resources
  • Loading branch information
firmansyahn authored Aug 9, 2024
2 parents 12b2c72 + 491749e commit 432d149
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 3 deletions.
8 changes: 5 additions & 3 deletions charts/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ annotations:
category: Infrastructure
artifacthub.io/changes: |
- kind: changed
description: Add Flux CD
description: Add more granular Istio API resources
- kind: changed
description: Add more granular Kubernetes Gateway API resources
apiVersion: v2
appVersion: 0.1.6
appVersion: 0.1.7
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 @@ -23,4 +25,4 @@ name: st-common
sources:
- https://startechnica.github.io/apps
type: library
version: 0.1.6
version: 0.1.7
114 changes: 114 additions & 0 deletions charts/common/templates/_istio.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,36 @@ SPDX-License-Identifier: APACHE-2.0
{{- 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" -}}
{{- print "security.istio.io/v1" -}}
{{- 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" -}}
{{- print "networking.istio.io/v1" -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}

{{/* Return the appropriate apiVersion for Istio EnvoyFilter. */}}
{{- define "common.capabilities.istioEnvoyFilter.apiVersion" -}}
{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1alpha3/EnvoyFilter" -}}
{{- print "networking.istio.io/v1alpha3" -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}

{{/* Return the appropriate apiVersion for Istio Gateway. */}}
{{- define "common.capabilities.istioGateway.apiVersion" -}}
Expand All @@ -68,6 +98,59 @@ SPDX-License-Identifier: APACHE-2.0
{{- 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" -}}
{{- print "security.istio.io/v1" -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}

{{/* Return the appropriate apiVersion for Istio ProxyConfig. */}}
{{- define "common.capabilities.istioProxyConfig.apiVersion" -}}
{{- if .Capabilities.APIVersions.Has "networking.istio.io/v1beta1/ProxyConfig" -}}
{{- print "networking.istio.io/v1beta1" -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}

{{/* 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" -}}
{{- print "security.istio.io/v1" -}}
{{- 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" -}}
{{- print "networking.istio.io/v1" -}}
{{- 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" -}}
{{- print "networking.istio.io/v1" -}}
{{- 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" -}}
Expand All @@ -77,4 +160,35 @@ SPDX-License-Identifier: APACHE-2.0
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}

{{/* Return the appropriate apiVersion for Istio WasmPlugin. */}}
{{- define "common.capabilities.istioWasmPlugin.apiVersion" -}}
{{- if .Capabilities.APIVersions.Has "extensions.istio.io/v1alpha1/WasmPlugin" -}}
{{- print "extensions.istio.io/v1alpha1" -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}

{{/* 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" -}}
{{- print "networking.istio.io/v1" -}}
{{- 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" -}}
{{- print "networking.istio.io/v1" -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}
44 changes: 44 additions & 0 deletions charts/common/templates/_sigs.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,48 @@ SPDX-License-Identifier: APACHE-2.0
{{- 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" -}}
{{- print "gateway.networking.k8s.io/v1" -}}
{{- else if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1beta1/Gateway" -}}
{{- 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" -}}
{{- print "gateway.networking.k8s.io/v1" -}}
{{- else if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1beta1/GRPCRoute" -}}
{{- print "gateway.networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}

{{/* Return the appropriate apiVersion for Kubernetes Gateway API HTTPRoute */}}
{{- define "common.capabilities.networkingGatewayHTTPRoute.apiVersion" -}}
{{- if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1/HTTPRoute" -}}
{{- print "gateway.networking.k8s.io/v1" -}}
{{- else if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1beta1/HTTPRoute" -}}
{{- print "gateway.networking.k8s.io/v1beta1" -}}
{{- 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" -}}
{{- print "gateway.networking.k8s.io/v1" -}}
{{- else if .Capabilities.APIVersions.Has "gateway.networking.k8s.io/v1beta1/ReferenceGrant" -}}
{{- print "gateway.networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}

0 comments on commit 432d149

Please sign in to comment.