Skip to content

Commit

Permalink
chore: support to skip helm schema validattion (#481)
Browse files Browse the repository at this point in the history
(cherry picked from commit 2e2279f)
  • Loading branch information
ldming committed Nov 1, 2024
1 parent aad6577 commit f157f16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
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 @@ -53,14 +53,18 @@ type CreateSubCmdsOptions struct {
// and validate the values.
ChartInfo *cluster.ChartInfo

// 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 @@ -303,7 +307,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

0 comments on commit f157f16

Please sign in to comment.