mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +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"
|
artifacthub.io/prerelease: "false"
|
||||||
# valid kinds are: added, changed, deprecated, removed, fixed and security
|
# valid kinds are: added, changed, deprecated, removed, fixed and security
|
||||||
artifacthub.io/changes: |
|
artifacthub.io/changes: |
|
||||||
|
- kind: added
|
||||||
|
description: Add possibility to manually set kyvernoVersion and avoid autodetection
|
||||||
- kind: added
|
- kind: added
|
||||||
description: Support for artifacthub.io/changes annotation
|
description: Support for artifacthub.io/changes annotation
|
||||||
- kind: fixed
|
- kind: fixed
|
||||||
|
|
|
@ -77,6 +77,7 @@ The command removes all the Kubernetes components associated with the chart and
|
||||||
| nameOverride | string | `nil` | Name override. |
|
| nameOverride | string | `nil` | Name override. |
|
||||||
| customLabels | object | `{}` | Additional labels. |
|
| customLabels | object | `{}` | Additional labels. |
|
||||||
| background | bool | `true` | Policies background mode |
|
| 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
|
## Source Code
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ helm.sh/chart: {{ template "kyverno-policies.chart" . }}
|
||||||
{{/* Get deployed Kyverno version from Kubernetes */}}
|
{{/* Get deployed Kyverno version from Kubernetes */}}
|
||||||
{{- define "kyverno-policies.kyvernoVersion" -}}
|
{{- define "kyverno-policies.kyvernoVersion" -}}
|
||||||
{{- $version := "" -}}
|
{{- $version := "" -}}
|
||||||
|
{{- if eq .Values.kyvernoVersion "autodetect" }}
|
||||||
{{- with (lookup "apps/v1" "Deployment" .Release.Namespace "kyverno") -}}
|
{{- with (lookup "apps/v1" "Deployment" .Release.Namespace "kyverno") -}}
|
||||||
{{- with (first .spec.template.spec.containers) -}}
|
{{- with (first .spec.template.spec.containers) -}}
|
||||||
{{- $imageTag := (last (splitList ":" .image)) -}}
|
{{- $imageTag := (last (splitList ":" .image)) -}}
|
||||||
|
@ -66,6 +67,9 @@ helm.sh/chart: {{ template "kyverno-policies.chart" . }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{ $version }}
|
{{ $version }}
|
||||||
|
{{- else -}}
|
||||||
|
{{ .Values.kyvernoVersion }}
|
||||||
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{/* Fail if deployed Kyverno does not match */}}
|
{{/* Fail if deployed Kyverno does not match */}}
|
||||||
|
|
|
@ -92,3 +92,7 @@ customLabels: {}
|
||||||
|
|
||||||
# -- Policies background mode
|
# -- Policies background mode
|
||||||
background: true
|
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