[incubator/vault] Api version backwards compatibility (#18378)

* adds compatibility for deployment api version

Signed-off-by: Janusz Bialy <janusz.bialy@qlik.com>

* adds backwards compatibility for ingress api version

Signed-off-by: Janusz Bialy <janusz.bialy@qlik.com>

* adds function to determine networkPolicy api version

Signed-off-by: Janusz Bialy <janusz.bialy@qlik.com>

* bump Chart version

Signed-off-by: Janusz Bialy <janusz.bialy@qlik.com>
This commit is contained in:
Janusz Bialy
2019-10-27 23:49:25 -07:00
committed by Kubernetes Prow Robot
parent e44ec47fac
commit 49d8d6adb9
4 changed files with 36 additions and 3 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
apiVersion: v1
description: A Helm chart for Vault, a tool for managing secrets
name: vault
version: 0.22.2
version: 0.23.0
appVersion: 1.2.3
home: https://www.vaultproject.io/
icon: https://www.vaultproject.io/assets/images/mega-nav/logo-vault-0f83e3d2.svg
+33
View File
@@ -41,3 +41,36 @@ Create chart name and version as used by the chart label.
{{- define "vault.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the apiVersion of deployment.
*/}}
{{- define "deployment.apiVersion" -}}
{{- if .Capabilities.APIVersions.Has "apps/v1" -}}
{{- print "apps/v1" -}}
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}
{{/*
Return the apiVersion of ingress.
*/}}
{{- define "ingress.apiVersion" -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}
{{/*
Return the apiVersion of networkPolicy.
*/}}
{{- define "networkPolicy.apiVersion" -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}}
{{- print "networking.k8s.io/v1" -}}
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: apps/v1
apiVersion: {{ template "deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "vault.fullname" . }}
+1 -1
View File
@@ -1,7 +1,7 @@
{{- if .Values.ingress.enabled -}}
{{- $serviceName := include "vault.fullname" . -}}
{{- $servicePort := .Values.service.externalPort -}}
apiVersion: networking.k8s.io/v1beta1
apiVersion: {{ template "ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ template "vault.fullname" . }}