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

chore: support to skip helm schema validattion #481

Merged
merged 3 commits into from
Nov 1, 2024
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
3 changes: 3 additions & 0 deletions pkg/cluster/cluster_chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ func (c *ChartInfo) BuildClusterSchema() error {
var err error
cht := c.Chart
buildSchema := func(bs []byte) (*spec.Schema, error) {
if len(bs) == 0 {
return nil, nil
}
schema := &spec.Schema{}
if err = json.Unmarshal(bs, schema); err != nil {
return nil, errors.Wrapf(err, "failed to build schema for engine %s", cht.Name())
Expand Down
10 changes: 7 additions & 3 deletions pkg/cmd/cluster/create_subcmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,18 @@ type CreateSubCmdsOptions struct {
Tenancy string `json:"tenancy"`
TolerationsRaw []string `json:"-"`

// SkipSchemaValidation is used to skip the schema validation of the helm chart.
SkipSchemaValidation bool `json:"-"`

*action.CreateOptions
}

func NewSubCmdsOptions(createOptions *action.CreateOptions, t cluster.ClusterType) (*CreateSubCmdsOptions, error) {
var err error
o := &CreateSubCmdsOptions{
CreateOptions: createOptions,
ClusterType: t,
CreateOptions: createOptions,
ClusterType: t,
SkipSchemaValidation: false,
}

if o.ChartInfo, err = cluster.BuildChartInfo(t); err != nil {
Expand Down Expand Up @@ -297,7 +301,7 @@ func (o *CreateSubCmdsOptions) getObjectsInfo() ([]*objectInfo, error) {
}

// get cluster manifests
manifests, err := cluster.GetManifests(o.ChartInfo.Chart, false, o.Namespace, o.Name, kubeVersion, values)
manifests, err := cluster.GetManifests(o.ChartInfo.Chart, o.SkipSchemaValidation, o.Namespace, o.Name, kubeVersion, values)
if err != nil {
return nil, err
}
Expand Down
Loading