diff --git a/internal/tiltfile/api/__init__.py b/internal/tiltfile/api/__init__.py index 032e5d32bd..a80c552175 100644 --- a/internal/tiltfile/api/__init__.py +++ b/internal/tiltfile/api/__init__.py @@ -721,7 +721,7 @@ def kustomize(pathToDir: str, kustomize_bin: str = None, flags: List[str] = []) """ pass -def helm(pathToChartDir: str, name: str = "", namespace: str = "", values: Union[str, List[str]]=[], set: Union[str, List[str]]=[], kube_version: str = "") -> Blob: +def helm(pathToChartDir: str, name: str = "", namespace: str = "", values: Union[str, List[str]]=[], set: Union[str, List[str]]=[], kube_version: str = "", skip_crds: bool = False) -> Blob: """Run `helm template `_ on a given directory that contains a chart and return the fully rendered YAML as a Blob Chart directory is watched (See ``watch_file``). @@ -734,6 +734,7 @@ def helm(pathToChartDir: str, name: str = "", namespace: str = "", values: Union values: Specify one or more values files (in addition to the `values.yaml` file in the chart). Equivalent to the Helm ``--values`` or ``-f`` flags (`see docs `_). set: Specify one or more values. Equivalent to the Helm ``--set`` flag. kube_version: Specify for which kubernetes version template will be generated. Equivalent to the Helm ``--kube-version`` flag. + skip_crds: If set, no CRDs will be installed. By default, CRDs are installed. """ pass diff --git a/internal/tiltfile/files.go b/internal/tiltfile/files.go index 8d1caaa866..919c4fbd4d 100644 --- a/internal/tiltfile/files.go +++ b/internal/tiltfile/files.go @@ -196,6 +196,7 @@ func (s *tiltfileState) helm(thread *starlark.Thread, fn *starlark.Builtin, args var valueFiles value.StringOrStringList var set value.StringOrStringList var kubeVersion string + var skip_crds bool err := s.unpackArgs(fn.Name(), args, kwargs, "paths", &path, @@ -204,6 +205,7 @@ func (s *tiltfileState) helm(thread *starlark.Thread, fn *starlark.Builtin, args "values?", &valueFiles, "set?", &set, "kube_version?", &kubeVersion, + "skip_crds?", &skip_crds, ) if err != nil { return nil, err @@ -251,9 +253,7 @@ func (s *tiltfileState) helm(thread *starlark.Thread, fn *starlark.Builtin, args name = "chart" } - if version == helmV3_1andAbove { - cmd = []string{"helm", "template", name, localPath, "--include-crds"} - } else if version == helmV3_0 { + if version == helmV3_0 || version == helmV3_1andAbove { cmd = []string{"helm", "template", name, localPath} } else { cmd = []string{"helm", "template", localPath, "--name", name} @@ -267,6 +267,10 @@ func (s *tiltfileState) helm(thread *starlark.Thread, fn *starlark.Builtin, args cmd = append(cmd, "--kube-version", kubeVersion) } + if !skip_crds && version == helmV3_1andAbove { + cmd = append(cmd, "--include-crds") + } + for _, valueFile := range valueFiles.Values { cmd = append(cmd, "--values", valueFile) err := tiltfile_io.RecordReadPath(thread, tiltfile_io.WatchFileOnly, starkit.AbsPath(thread, valueFile))