Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Jan 8, 2024
1 parent 48eaa76 commit a74ae29
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
8 changes: 4 additions & 4 deletions docs/book/src/developer/tilt.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 10 additions & 11 deletions hack/tools/internal/tilt-prepare/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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))
}
}
Expand Down Expand Up @@ -686,12 +686,11 @@ 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}
}
args := []string{"build"}
args = append(args, options...)
args = append(args, path)
kustomizeCmd := exec.CommandContext(ctx, kustomizePath, args...) //nolint: gosec

Check failure on line 694 in hack/tools/internal/tilt-prepare/main.go

View workflow job for this annotation

GitHub Actions / lint (hack/tools)

directive `//nolint: gosec` is unused for linter "gosec" (nolintlint)

Check failure on line 694 in hack/tools/internal/tilt-prepare/main.go

View workflow job for this annotation

GitHub Actions / lint (hack/tools)

directive `//nolint: gosec` is unused for linter "gosec" (nolintlint)
var stdout1, stderr1 bytes.Buffer
kustomizeCmd.Dir = rootPath
Expand Down

0 comments on commit a74ae29

Please sign in to comment.