Skip to content

Commit 3a68188

Browse files
(chore): sort mirrored images to avoid controllerutil diff (#1780)
(chore): use CreateOrPatch instead of update (chore): use slices sort Signed-off-by: abhijith-darshan <abhijith.ravindra@sap.com>
1 parent 84d5105 commit 3a68188

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

internal/controller/plugin/image_mirror.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package plugin
66
import (
77
"fmt"
88
"regexp"
9+
"slices"
910
"strings"
1011

1112
helmv2 "github.com/fluxcd/helm-controller/api/v2"
@@ -90,6 +91,7 @@ func extractUniqueImages(manifests string) []string {
9091
for img := range seen {
9192
images = append(images, img)
9293
}
94+
slices.Sort(images)
9395
return images
9496
}
9597

internal/controller/plugin/plugin_controller_flux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func (r *PluginReconciler) ensureHelmRelease(
156156
return fmt.Errorf("failed to generate HelmRelease values for Plugin %s: %w", plugin.Name, err)
157157
}
158158

159-
result, err := ctrl.CreateOrUpdate(ctx, r.Client, release, func() error {
159+
result, err := controllerutil.CreateOrPatch(ctx, r.Client, release, func() error {
160160
builder := flux.NewHelmReleaseSpecBuilder().
161161
WithChart(helmv2.HelmChartTemplateSpec{
162162
Chart: pluginDefinitionSpec.HelmChart.Name,

0 commit comments

Comments
 (0)