mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-28 18:38:40 +00:00
Auto-detect Kyverno version in policies chart (#4460)
* Auto-detect Kyverno version in policies chart Signed-off-by: David Young <davidy@funkypenguin.co.nz> * Don't bump chart (another process will do this) Signed-off-by: David Young <davidy@funkypenguin.co.nz> * Also don't bump version in README Signed-off-by: David Young <davidy@funkypenguin.co.nz> Signed-off-by: David Young <davidy@funkypenguin.co.nz> Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
parent
7c9792d03f
commit
eb96862cd1
4 changed files with 11 additions and 0 deletions
|
@ -23,6 +23,8 @@ annotations:
|
|||
artifacthub.io/prerelease: "false"
|
||||
# valid kinds are: added, changed, deprecated, removed, fixed and security
|
||||
artifacthub.io/changes: |
|
||||
- kind: added
|
||||
description: Add possibility to manually set kyvernoVersion and avoid autodetection
|
||||
- kind: added
|
||||
description: Support for artifacthub.io/changes annotation
|
||||
- kind: fixed
|
||||
|
|
|
@ -77,6 +77,7 @@ The command removes all the Kubernetes components associated with the chart and
|
|||
| nameOverride | string | `nil` | Name override. |
|
||||
| customLabels | object | `{}` | Additional labels. |
|
||||
| background | bool | `true` | Policies background mode |
|
||||
| kyvernoVersion | string | `"autodetect"` | Kyverno version The default of "autodetect" will try to determine the currently installed version from the deployment |
|
||||
|
||||
## Source Code
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ helm.sh/chart: {{ template "kyverno-policies.chart" . }}
|
|||
{{/* Get deployed Kyverno version from Kubernetes */}}
|
||||
{{- define "kyverno-policies.kyvernoVersion" -}}
|
||||
{{- $version := "" -}}
|
||||
{{- if eq .Values.kyvernoVersion "autodetect" }}
|
||||
{{- with (lookup "apps/v1" "Deployment" .Release.Namespace "kyverno") -}}
|
||||
{{- with (first .spec.template.spec.containers) -}}
|
||||
{{- $imageTag := (last (splitList ":" .image)) -}}
|
||||
|
@ -66,6 +67,9 @@ helm.sh/chart: {{ template "kyverno-policies.chart" . }}
|
|||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{ $version }}
|
||||
{{- else -}}
|
||||
{{ .Values.kyvernoVersion }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Fail if deployed Kyverno does not match */}}
|
||||
|
|
|
@ -92,3 +92,7 @@ customLabels: {}
|
|||
|
||||
# -- Policies background mode
|
||||
background: true
|
||||
|
||||
# -- Kyverno version
|
||||
# The default of "autodetect" will try to determine the currently installed version from the deployment
|
||||
kyvernoVersion: autodetect
|
||||
|
|
Loading…
Add table
Reference in a new issue