From 54f0b42b343827618d24c2245039907fce7f88e7 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Fri, 20 Sep 2024 22:28:51 +0300 Subject: [PATCH] Add `disableSchemaValidation` to Helm install/upgrade actions Signed-off-by: Stefan Prodan --- api/v2/helmrelease_types.go | 10 +++++++ .../helm.toolkit.fluxcd.io_helmreleases.yaml | 10 +++++++ docs/api/v2/helm.md | 26 +++++++++++++++++++ docs/spec/v2/helmreleases.md | 4 +++ internal/action/install.go | 1 + internal/action/upgrade.go | 1 + 6 files changed, 52 insertions(+) diff --git a/api/v2/helmrelease_types.go b/api/v2/helmrelease_types.go index 800470bfb..bebbafc03 100644 --- a/api/v2/helmrelease_types.go +++ b/api/v2/helmrelease_types.go @@ -451,6 +451,11 @@ type Install struct { // +optional DisableOpenAPIValidation bool `json:"disableOpenAPIValidation,omitempty"` + // DisableSchemaValidation prevents the Helm install action from validating + // the values against the JSON Schema. + // +optional + DisableSchemaValidation bool `json:"disableSchemaValidation,omitempty"` + // Replace tells the Helm install action to re-use the 'ReleaseName', but only // if that name is a deleted release which remains in the history. // +optional @@ -624,6 +629,11 @@ type Upgrade struct { // +optional DisableOpenAPIValidation bool `json:"disableOpenAPIValidation,omitempty"` + // DisableSchemaValidation prevents the Helm upgrade action from validating + // the values against the JSON Schema. + // +optional + DisableSchemaValidation bool `json:"disableSchemaValidation,omitempty"` + // Force forces resource updates through a replacement strategy. // +optional Force bool `json:"force,omitempty"` diff --git a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml index 44411e09a..c15433935 100644 --- a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml +++ b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml @@ -365,6 +365,11 @@ spec: DisableOpenAPIValidation prevents the Helm install action from validating rendered templates against the Kubernetes OpenAPI Schema. type: boolean + disableSchemaValidation: + description: |- + DisableSchemaValidation prevents the Helm install action from validating + the values against the JSON Schema. + type: boolean disableWait: description: |- DisableWait disables the waiting for resources to be ready after a Helm @@ -774,6 +779,11 @@ spec: DisableOpenAPIValidation prevents the Helm upgrade action from validating rendered templates against the Kubernetes OpenAPI Schema. type: boolean + disableSchemaValidation: + description: |- + DisableSchemaValidation prevents the Helm upgrade action from validating + the values against the JSON Schema. + type: boolean disableWait: description: |- DisableWait disables the waiting for resources to be ready after a Helm diff --git a/docs/api/v2/helm.md b/docs/api/v2/helm.md index 6d0504e36..1ab62cf9e 100644 --- a/docs/api/v2/helm.md +++ b/docs/api/v2/helm.md @@ -1832,6 +1832,19 @@ rendered templates against the Kubernetes OpenAPI Schema.

+disableSchemaValidation
+ +bool + + + +(Optional) +

DisableSchemaValidation prevents the Helm install action from validating +the values against the JSON Schema.

+ + + + replace
bool @@ -2720,6 +2733,19 @@ rendered templates against the Kubernetes OpenAPI Schema.

+disableSchemaValidation
+ +bool + + + +(Optional) +

DisableSchemaValidation prevents the Helm upgrade action from validating +the values against the JSON Schema.

+ + + + force
bool diff --git a/docs/spec/v2/helmreleases.md b/docs/spec/v2/helmreleases.md index 8393fbf3d..5aacfa7d8 100644 --- a/docs/spec/v2/helmreleases.md +++ b/docs/spec/v2/helmreleases.md @@ -492,6 +492,8 @@ The field offers the following subfields: from running during the installation of the chart. Defaults to `false`. - `.disableOpenAPIValidation` (Optional): Prevents Helm from validating the rendered templates against the Kubernetes OpenAPI Schema. Defaults to `false`. +- `.disableSchemaValidation` (Optional): Prevents Helm from validating the + values against the JSON Schema. Defaults to `false`. - `.disableWait` (Optional): Disables waiting for resources to be ready after the installation of the chart. Defaults to `false`. - `.disableWaitForJobs` (Optional): Disables waiting for any Jobs to complete @@ -534,6 +536,8 @@ The field offers the following subfields: from running during the upgrade of the release. Defaults to `false`. - `.disableOpenAPIValidation` (Optional): Prevents Helm from validating the rendered templates against the Kubernetes OpenAPI Schema. Defaults to `false`. +- `.disableSchemaValidation` (Optional): Prevents Helm from validating the + values against the JSON Schema. Defaults to `false`. - `.disableWait` (Optional): Disables waiting for resources to be ready after upgrading the release. Defaults to `false`. - `.disableWaitForJobs` (Optional): Disables waiting for any Jobs to complete diff --git a/internal/action/install.go b/internal/action/install.go index f790a1106..da093c688 100644 --- a/internal/action/install.go +++ b/internal/action/install.go @@ -72,6 +72,7 @@ func newInstall(config *helmaction.Configuration, obj *v2.HelmRelease, opts []In install.WaitForJobs = !obj.GetInstall().DisableWaitForJobs install.DisableHooks = obj.GetInstall().DisableHooks install.DisableOpenAPIValidation = obj.GetInstall().DisableOpenAPIValidation + install.SkipSchemaValidation = obj.GetInstall().DisableSchemaValidation install.Replace = obj.GetInstall().Replace install.Devel = true install.SkipCRDs = true diff --git a/internal/action/upgrade.go b/internal/action/upgrade.go index df07a1185..079a1336a 100644 --- a/internal/action/upgrade.go +++ b/internal/action/upgrade.go @@ -73,6 +73,7 @@ func newUpgrade(config *helmaction.Configuration, obj *v2.HelmRelease, opts []Up upgrade.WaitForJobs = !obj.GetUpgrade().DisableWaitForJobs upgrade.DisableHooks = obj.GetUpgrade().DisableHooks upgrade.DisableOpenAPIValidation = obj.GetUpgrade().DisableOpenAPIValidation + upgrade.SkipSchemaValidation = obj.GetUpgrade().DisableSchemaValidation upgrade.Force = obj.GetUpgrade().Force upgrade.CleanupOnFail = obj.GetUpgrade().CleanupOnFail upgrade.Devel = true