Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chart/webhook] fix Kubernetes version comparison #987

Merged
merged 1 commit into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/vault-secrets-webhook/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
appVersion: 1.2.0
version: 1.2.1
version: 1.2.2
description: A Helm chart that deploys a mutating admission webhook that configures applications to request env vars from Vault Secrets
name: vault-secrets-webhook
home: https://banzaicloud.com/products/bank-vaults/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
{{- $tlsKey = required "Required when certificate.generate is false" .Values.certificate.server.tls.key }}
{{- $caCrt = required "Required when certificate.generate is false" .Values.certificate.ca.crt }}
{{- end }}
{{- $major := .Capabilities.KubeVersion.Major -}}
{{- $minor := .Capabilities.KubeVersion.Minor -}}

{{- if (eq .Values.certificate.useCertManager false) }}
apiVersion: v1
Expand Down Expand Up @@ -74,7 +72,7 @@ webhooks:
operator: NotIn
values:
- {{ .Release.Namespace }}
{{- if and (eq (int $major) 1) (ge (int $minor) 15) }}
{{- if semverCompare ">=1.15-0" .Capabilities.KubeVersion.GitVersion }}
objectSelector:
matchExpressions:
{{- if .Values.objectSelector.matchExpressions }}
Expand Down Expand Up @@ -181,7 +179,7 @@ webhooks:
operator: NotIn
values:
- {{ .Release.Namespace }}
{{- if and (eq (int $major) 1) (ge (int $minor) 15) }}
{{- if semverCompare ">=1.15-0" .Capabilities.KubeVersion.GitVersion }}
objectSelector:
matchExpressions:
{{- if .Values.objectSelector.matchExpressions }}
Expand All @@ -193,6 +191,6 @@ webhooks:
- skip
{{- end }}
{{- end }}
{{- if and (ge (int $major) 1) (ge (int $minor) 12) }}
{{- if semverCompare ">=1.12-0" .Capabilities.KubeVersion.GitVersion }}
sideEffects: {{ .Values.apiSideEffectValue }}
{{- end }}
7 changes: 2 additions & 5 deletions charts/vault-secrets-webhook/templates/webhook-psp.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{{- $major := .Capabilities.KubeVersion.Major -}}
{{- $minor := .Capabilities.KubeVersion.Minor -}}

{{- if and .Values.rbac.enabled .Values.rbac.psp.enabled}}
{{- if and (eq (int $major) 1) (ge (int $minor) 16) }}
{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
apiVersion: policy/v1beta1
{{- else }}
apiVersion: extensions/v1beta1
Expand Down Expand Up @@ -38,7 +35,7 @@ spec:
- emptyDir
- configMap
---
{{- if and (eq (int $major) 1) (ge (int $minor) 16) }}
{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
apiVersion: policy/v1beta1
{{- else }}
apiVersion: extensions/v1beta1
Expand Down