Skip to content

Commit

Permalink
hack/observability: add flag to disable cert-manager image preload
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Büringer buringerst@vmware.com
  • Loading branch information
sbueringer committed Jun 28, 2023
1 parent 4920e6e commit 0245cf4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
3 changes: 3 additions & 0 deletions docs/book/src/developer/tilt.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ Supported settings:

**deploy_cert_manager** (Boolean, default=`true`): Deploys cert-manager into the cluster for use for webhook registration.

**preload_cert_manager_images** (Boolean, default=`true`): Preloads cert-manager images into the cluster. This allows disabling preloading images,
because if the cluster is not a kind cluster the preload fails.

**trigger_mode** (String, default=`auto`): Optional setting to configure if tilt should automatically rebuild on changes.
Set to `manual` to disable auto-rebuilding and require users to trigger rebuilds of individual changed components through the UI.

Expand Down
26 changes: 16 additions & 10 deletions hack/tools/tilt-prepare/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,14 @@ var (
// Types used to de-serialize the tilt-settings.yaml/json file from the Cluster API repository.

type tiltSettings struct {
Debug map[string]tiltSettingsDebugConfig `json:"debug,omitempty"`
ExtraArgs map[string]tiltSettingsExtraArgs `json:"extra_args,omitempty"`
DeployCertManager *bool `json:"deploy_cert_manager,omitempty"`
DeployObservability []string `json:"deploy_observability,omitempty"`
EnableProviders []string `json:"enable_providers,omitempty"`
AllowedContexts []string `json:"allowed_contexts,omitempty"`
ProviderRepos []string `json:"provider_repos,omitempty"`
Debug map[string]tiltSettingsDebugConfig `json:"debug,omitempty"`
ExtraArgs map[string]tiltSettingsExtraArgs `json:"extra_args,omitempty"`
DeployCertManager *bool `json:"deploy_cert_manager,omitempty"`
PreloadCertManagerImages *bool `json:"preload_cert_manager_images,omitempty"`
DeployObservability []string `json:"deploy_observability,omitempty"`
EnableProviders []string `json:"enable_providers,omitempty"`
AllowedContexts []string `json:"allowed_contexts,omitempty"`
ProviderRepos []string `json:"provider_repos,omitempty"`
}

type tiltSettingsDebugConfig struct {
Expand Down Expand Up @@ -214,6 +215,9 @@ func setTiltSettingsDefaults(ts *tiltSettings) {
if ts.DeployCertManager == nil {
ts.DeployCertManager = pointer.Bool(true)
}
if ts.PreloadCertManagerImages == nil {
ts.PreloadCertManagerImages = pointer.Bool(true)
}

for k := range ts.Debug {
p := ts.Debug[k]
Expand Down Expand Up @@ -283,9 +287,11 @@ func tiltResources(ctx context.Context, ts *tiltSettings) error {
// NOTE: strictly speaking cert-manager is not a resource, however it is a dependency for most of the actual resources
// and running this is the same task group of the kustomize/provider tasks gives the maximum benefits in terms of reducing the total elapsed time.
if ts.DeployCertManager == nil || *ts.DeployCertManager {
tasks["cert-manager-cainjector"] = preLoadImageTask(fmt.Sprintf("quay.io/jetstack/cert-manager-cainjector:%s", config.CertManagerDefaultVersion))
tasks["cert-manager-webhook"] = preLoadImageTask(fmt.Sprintf("quay.io/jetstack/cert-manager-webhook:%s", config.CertManagerDefaultVersion))
tasks["cert-manager-controller"] = preLoadImageTask(fmt.Sprintf("quay.io/jetstack/cert-manager-controller:%s", config.CertManagerDefaultVersion))
if ts.PreloadCertManagerImages == nil || *ts.PreloadCertManagerImages {
tasks["cert-manager-cainjector"] = preLoadImageTask(fmt.Sprintf("quay.io/jetstack/cert-manager-cainjector:%s", config.CertManagerDefaultVersion))
tasks["cert-manager-webhook"] = preLoadImageTask(fmt.Sprintf("quay.io/jetstack/cert-manager-webhook:%s", config.CertManagerDefaultVersion))
tasks["cert-manager-controller"] = preLoadImageTask(fmt.Sprintf("quay.io/jetstack/cert-manager-controller:%s", config.CertManagerDefaultVersion))
}
tasks["cert-manager"] = certManagerTask()
}

Expand Down

0 comments on commit 0245cf4

Please sign in to comment.