Skip to content

Commit

Permalink
Revert "Make the createRelease value actually not install the release…
Browse files Browse the repository at this point in the history
…. Also, change the chart version code to match up with what exists in the helm repo"

This reverts commit 929a4ca.
  • Loading branch information
slysunkin authored and Kshatrix committed Oct 9, 2024
1 parent b521d86 commit be19807
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
2 changes: 1 addition & 1 deletion config/dev/hmc_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ image:
controller:
defaultRegistryURL: oci://hmc-local-registry:5000/charts
insecureRegistry: true
createRelease: true
createRelease: false
createTemplates: false
14 changes: 5 additions & 9 deletions internal/controller/release_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,10 @@ func (r *ReleaseReconciler) ensureManagement(ctx context.Context) error {
if !apierrors.IsNotFound(err) {
return fmt.Errorf("failed to get %s Management object: %w", hmc.TemplateManagementName, err)
}

if r.CreateRelease {
mgmtObj.Spec.Release, err = r.getCurrentReleaseName(ctx)
if err != nil {
return err
}
mgmtObj.Spec.Release, err = r.getCurrentReleaseName(ctx)
if err != nil {
return err
}

if err := mgmtObj.Spec.SetProvidersDefaults(); err != nil {
return err
}
Expand Down Expand Up @@ -161,7 +157,7 @@ func (r *ReleaseReconciler) reconcileHMCTemplates(ctx context.Context, req ctrl.
l.Info("Templates creation is disabled")
return nil
}
if !r.CreateRelease || initialReconcile(req) {
if initialReconcile(req) && !r.CreateRelease {
l.Info("Initial creation of HMC Release is skipped")
return nil
}
Expand Down Expand Up @@ -210,7 +206,7 @@ func (r *ReleaseReconciler) reconcileHMCTemplates(ctx context.Context, req ctrl.
helmChart.Labels[hmc.HMCManagedLabelKey] = hmc.HMCManagedLabelValue
helmChart.Spec = sourcev1.HelmChartSpec{
Chart: r.HMCTemplatesChartName,
Version: utils.ChartVersionFromVersion(version),
Version: version,
SourceRef: sourcev1.LocalHelmChartSourceReference{
Kind: sourcev1.HelmRepositoryKind,
Name: defaultRepoName,
Expand Down
9 changes: 0 additions & 9 deletions internal/utils/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@ func ReleaseNameFromVersion(version string) string {
return "hmc-" + strings.ReplaceAll(strings.TrimPrefix(version, "v"), ".", "-")
}

func ChartVersionFromVersion(version string) string {
index := strings.Index(version, "-")
cut := strings.TrimPrefix(version, "v")
if index >= 1 {
cut = cut[:index-1]
}
return cut
}

func TemplatesChartFromReleaseName(releaseName string) string {
return releaseName + "-tpl"
}

0 comments on commit be19807

Please sign in to comment.