Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add option to use non strict engine for helm addon #248

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/addonfactory/addonfactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type AgentAddonFactory struct {
trimCRDDescription bool
hostingCluster *clusterv1.ManagedCluster
agentInstallNamespace func(addon *addonapiv1alpha1.ManagedClusterAddOn) string
helmEngineStrict bool
}

// NewAgentAddonFactory builds an addonAgentFactory instance with addon name and fs.
Expand All @@ -59,6 +60,7 @@ func NewAgentAddonFactory(addonName string, fs embed.FS, dir string) *AgentAddon
},
trimCRDDescription: false,
scheme: s,
helmEngineStrict: false,
}
}

Expand Down Expand Up @@ -115,6 +117,12 @@ func (f *AgentAddonFactory) WithTrimCRDDescription() *AgentAddonFactory {
return f
}

// WithHelmEngineStrict is to enable script go template rendering for Helm charts to generate manifestWork.
func (f *AgentAddonFactory) WithHelmEngineStrict() *AgentAddonFactory {
f.helmEngineStrict = true
return f
}

// WithConfigGVRs defines the addon supported configuration GroupVersionResource
func (f *AgentAddonFactory) WithConfigGVRs(gvrs ...schema.GroupVersionResource) *AgentAddonFactory {
f.agentAddonOptions.SupportedConfigGVRs = append(f.agentAddonOptions.SupportedConfigGVRs, gvrs...)
Expand Down
4 changes: 3 additions & 1 deletion pkg/addonfactory/helm_agentaddon.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type HelmAgentAddon struct {
trimCRDDescription bool
hostingCluster *clusterv1.ManagedCluster
agentInstallNamespace func(addon *addonapiv1alpha1.ManagedClusterAddOn) string
helmEngineStrict bool
}

func newHelmAgentAddon(factory *AgentAddonFactory, chart *chart.Chart) *HelmAgentAddon {
Expand All @@ -60,6 +61,7 @@ func newHelmAgentAddon(factory *AgentAddonFactory, chart *chart.Chart) *HelmAgen
trimCRDDescription: factory.trimCRDDescription,
hostingCluster: factory.hostingCluster,
agentInstallNamespace: factory.agentInstallNamespace,
helmEngineStrict: factory.helmEngineStrict,
}
}

Expand All @@ -74,7 +76,7 @@ func (a *HelmAgentAddon) Manifests(
}

helmEngine := engine.Engine{
Strict: true,
Strict: a.helmEngineStrict,
LintMode: false,
}

Expand Down
Loading