diff --git a/pkg/cluster/cluster_chart.go b/pkg/cluster/cluster_chart.go index ecf395ad1..a9a41daa1 100644 --- a/pkg/cluster/cluster_chart.go +++ b/pkg/cluster/cluster_chart.go @@ -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()) diff --git a/pkg/cmd/cluster/create_subcmds.go b/pkg/cmd/cluster/create_subcmds.go index 2bcdd0415..975dab52b 100644 --- a/pkg/cmd/cluster/create_subcmds.go +++ b/pkg/cmd/cluster/create_subcmds.go @@ -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 { @@ -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 }