Skip to content

Commit

Permalink
feat: expose Helm skip schema validation option in Zarf schema (zarf-…
Browse files Browse the repository at this point in the history
…dev#3165)

Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
  • Loading branch information
AustinAbro321 authored and Jneville0815 committed Dec 12, 2024
1 parent b666092 commit 1492ec7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/api/v1alpha1/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ type ZarfChart struct {
ValuesFiles []string `json:"valuesFiles,omitempty"`
// [alpha] List of variables to set in the Helm chart.
Variables []ZarfChartVariable `json:"variables,omitempty"`
// Whether or not to validate the values.yaml schema, defaults to true. Necessary in the air-gap when the JSON Schema references resources on the internet.
SchemaValidation *bool `json:"schemaValidation,omitempty"`
}

// ShouldRunSchemaValidation returns if Helm schema validation should be run or not
func (zc ZarfChart) ShouldRunSchemaValidation() bool {
if zc.SchemaValidation != nil {
return *zc.SchemaValidation
}
return true
}

// ZarfChartVariable represents a variable that can be set for a Helm chart overrides.
Expand Down
4 changes: 4 additions & 0 deletions src/internal/packager/helm/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ func (h *Helm) installChart(ctx context.Context, postRender *renderer) (*release
// Must be unique per-namespace and < 53 characters. @todo: restrict helm loadedChart name to this.
client.ReleaseName = h.chart.ReleaseName

client.SkipSchemaValidation = !h.chart.ShouldRunSchemaValidation()

// Namespace must be specified.
client.Namespace = h.chart.Namespace

Expand Down Expand Up @@ -329,6 +331,8 @@ func (h *Helm) upgradeChart(ctx context.Context, lastRelease *release.Release, p

client.SkipCRDs = true

client.SkipSchemaValidation = !h.chart.ShouldRunSchemaValidation()

// Namespace must be specified.
client.Namespace = h.chart.Namespace

Expand Down
4 changes: 4 additions & 0 deletions zarf.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@
},
"type": "array",
"description": "[alpha] List of variables to set in the Helm chart."
},
"schemaValidation": {
"type": "boolean",
"description": "Whether or not to validate the values.yaml schema, defaults to true. Necessary in the air-gap when the JSON Schema references resources on the internet."
}
},
"additionalProperties": false,
Expand Down

0 comments on commit 1492ec7

Please sign in to comment.