diff --git a/docs/book/src/developer/tilt.md b/docs/book/src/developer/tilt.md index c333ffe98769..037a518721ac 100644 --- a/docs/book/src/developer/tilt.md +++ b/docs/book/src/developer/tilt.md @@ -430,12 +430,12 @@ COPY --from=tilt-helper /go/kubernetes/client/bin/kubectl /usr/bin/kubectl ``` **kustomize_folder** (String, default=config/default): The folder where the kustomize file for a provider -are defined; the path is relative to the provider root folder. +is defined; the path is relative to the provider root folder. -**kustomize_options** (String, default="""): Options to be applied when running kustomize for genereating -yaml manifest for a provider. e.g. `"kustomize_options": "--load-restrictor=LoadRestrictionsNone"` +**kustomize_options** ([]String, default=[]): Options to be applied when running kustomize for generating the +yaml manifest for a provider. e.g. `"kustomize_options": [ "--load-restrictor=LoadRestrictionsNone" ]` -**apply_provider_yaml** (Bool, default=true): Whether or not apply the provider yaml. +**apply_provider_yaml** (Bool, default=true): Whether to apply the provider yaml. Set to `false` if your provider does not have a ./config folder or you do not want it to be applied in the cluster. **go_main** (String, default="main.go"): The go main file if not located at the root of the folder diff --git a/hack/tools/internal/tilt-prepare/main.go b/hack/tools/internal/tilt-prepare/main.go index 562d022b968c..07b34a85f3c4 100644 --- a/hack/tools/internal/tilt-prepare/main.go +++ b/hack/tools/internal/tilt-prepare/main.go @@ -131,11 +131,11 @@ type tiltProvider struct { } type tiltProviderConfig struct { - Context *string `json:"context,omitempty"` - Version *string `json:"version,omitempty"` - ApplyProviderYaml *bool `json:"apply_provider_yaml,omitempty"` - KustomizeFolder *string `json:"kustomize_folder,omitempty"` - KustomizeOptions *string `json:"kustomize_options,omitempty"` + Context *string `json:"context,omitempty"` + Version *string `json:"version,omitempty"` + ApplyProviderYaml *bool `json:"apply_provider_yaml,omitempty"` + KustomizeFolder *string `json:"kustomize_folder,omitempty"` + KustomizeOptions []string `json:"kustomize_options,omitempty"` } func init() { @@ -346,7 +346,7 @@ func tiltResources(ctx context.Context, ts *tiltSettings) error { } if ptr.Deref(config.ApplyProviderYaml, true) { kustomizeFolder := path.Join(*config.Context, ptr.Deref(config.KustomizeFolder, "config/default")) - kustomizeOptions := ptr.Deref(config.KustomizeOptions, "") + kustomizeOptions := config.KustomizeOptions tasks[providerName] = workloadTask(providerName, "provider", "manager", "manager", ts, kustomizeFolder, kustomizeOptions, getProviderObj(config.Version)) } } @@ -686,13 +686,12 @@ func kustomizeTask(path, out string) taskFunction { // workloadTask generates a task for creating the component yaml for a workload and saving the output on a file. // NOTE: This task has several sub steps including running kustomize, envsubst, fixing components for debugging, // and adding the workload resource mimicking what clusterctl init does. -func workloadTask(name, workloadType, binaryName, containerName string, ts *tiltSettings, path, options string, getAdditionalObject func(string, []unstructured.Unstructured) (*unstructured.Unstructured, error)) taskFunction { +func workloadTask(name, workloadType, binaryName, containerName string, ts *tiltSettings, path string, options []string, getAdditionalObject func(string, []unstructured.Unstructured) (*unstructured.Unstructured, error)) taskFunction { return func(ctx context.Context, prefix string, errCh chan error) { - args := []string{"build", path} - if options != "" { - args = []string{"build", options, path} - } - kustomizeCmd := exec.CommandContext(ctx, kustomizePath, args...) //nolint: gosec + args := []string{"build"} + args = append(args, options...) + args = append(args, path) + kustomizeCmd := exec.CommandContext(ctx, kustomizePath, args...) var stdout1, stderr1 bytes.Buffer kustomizeCmd.Dir = rootPath kustomizeCmd.Stdout = &stdout1