Skip to content

Commit

Permalink
Add wrapper in clusteraddon_controller.go
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Wolf <[email protected]>
  • Loading branch information
NotTheEvilOne committed Jan 23, 2024
1 parent a8aceaa commit 86ddf68
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/controller/clusteraddon_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,12 @@ func (r *ClusterAddonReconciler) templateAndApplyClusterAddonHelmChart(ctx conte
clusterAddonChart := in.clusterAddonChartPath
var shouldRequeue bool

buildTemplate, err := buildTemplateFromClusterAddonValues(ctx, in.clusterAddonValuesPath, in.cluster, r.Client)
clusterAddonTemplate, err := buildTemplateFromClusterAddonValues(ctx, in.clusterAddonValuesPath, in.cluster, r.Client)
if err != nil {
return false, fmt.Errorf("failed to build template from cluster addon values: %w", err)
}

helmTemplate, err := helmTemplateWithValues(in.restConfig, clusterAddonChart, "cluster-addon", clusterAddonNamespace, buildTemplate)
helmTemplate, err := helmTemplateWithClusterAddonTemplate(in.restConfig, clusterAddonChart, clusterAddonTemplate)
if err != nil {
return false, fmt.Errorf("failed to template helm chart: %w", err)
}
Expand Down Expand Up @@ -346,6 +346,10 @@ func buildTemplateFromClusterAddonValues(ctx context.Context, addonValuePath str
return values, nil
}

func helmTemplateWithClusterAddonTemplate(restConfig *rest.Config, clusterAddonChart string, template string) ([]byte, error) {

Check failure on line 349 in internal/controller/clusteraddon_controller.go

View workflow job for this annotation

GitHub Actions / Lint Pull Request

importShadow: shadow of imported package 'template' (gocritic)
return helmTemplateWithValues(restConfig, clusterAddonChart, "cluster-addon", clusterAddonNamespace, template)
}

// initializeBuiltins takes a map of keys to object references, attempts to get the referenced objects, and returns a map of keys to the actual objects.
// These objects are a map[string]interface{} so that they can be used as values in the template.
func initializeBuiltins(ctx context.Context, c client.Client, referenceMap map[string]corev1.ObjectReference, cluster *clusterv1.Cluster) (map[string]interface{}, error) {
Expand Down

0 comments on commit 86ddf68

Please sign in to comment.