feat: update to use capabilities
-{{- $apiAll := .Capabilities.APIVersions | toStrings -}}
-{{- $ingStableVersion := 19 | int -}}
-
{{- if .Values.webhooks.ingress.enabled }}
-{{- if ge ($.Capabilities.KubeVersion.Minor | int) $ingStableVersion }}
+{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
apiVersion: networking.k8s.io/v1
-{{- else if has "networking.k8s.io/v1beta1" $apiAll }}
+{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{- else }}
apiVersion: extensions/v1beta1
@@ -26,7 +23,7 @@ spec:
http:
paths:
- backend:
- {{- if ge ($.Capabilities.KubeVersion.Minor | int) $ingStableVersion }}
+ {{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
service:
name: {{ default (include "webhooks.name" $) $.Values.webhooks.serviceName }}
port:
