Skip to content

Commit 06970a1

Browse files
committed
Miscellaneous tidying of minor things
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
1 parent 514224d commit 06970a1

7 files changed

+16
-13
lines changed

internal/action/diff.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
helmaction "helm.sh/helm/v3/pkg/action"
2525
helmrelease "helm.sh/helm/v3/pkg/release"
2626
"k8s.io/apimachinery/pkg/util/errors"
27-
"k8s.io/utils/pointer"
27+
"k8s.io/utils/ptr"
2828
"sigs.k8s.io/controller-runtime/pkg/client"
2929
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
3030

@@ -42,7 +42,7 @@ func Diff(ctx context.Context, config *helmaction.Configuration, rls *helmreleas
4242
if err != nil {
4343
return nil, err
4444
}
45-
c, err := client.New(cfg, client.Options{DryRun: pointer.Bool(true)})
45+
c, err := client.New(cfg, client.Options{DryRun: ptr.To(true)})
4646
if err != nil {
4747
return nil, err
4848
}

internal/controller/helmrelease_controller.go

+3
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,9 @@ func (r *HelmReleaseReconciler) adoptLegacyRelease(ctx context.Context, getter g
549549
action.WithStorage(action.DefaultStorageDriver, storageNamespace),
550550
action.WithStorageLog(action.NewDebugLog(ctrl.LoggerFrom(ctx).V(logger.TraceLevel))),
551551
)
552+
if err != nil {
553+
return err
554+
}
552555

553556
// Get the last successful release based on the observation for the v2beta1
554557
// object.

internal/controller/helmrelease_controller_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ func TestHelmReleaseReconciler_reconcileRelease(t *testing.T) {
512512
Status: v2.HelmReleaseStatus{
513513
HelmChart: chart.Namespace + "/" + chart.Name,
514514
LastReleaseRevision: rls.Version,
515-
LastAttemptedValuesChecksum: valChecksum.Hex(),
515+
LastAttemptedValuesChecksum: valChecksum.Encoded(),
516516
},
517517
}
518518

internal/reconcile/atomic_release.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func (r *AtomicRelease) actionForState(ctx context.Context, req *Request, state
321321
log.Info(msgWithReason("detected changes in cluster state", diff.SummarizeDiffSetBrief(state.Diff)))
322322
for _, change := range state.Diff {
323323
if change.Type == jsondiff.DiffTypeCreate || change.Type == jsondiff.DiffTypeUpdate {
324-
log.V(logger.DebugLevel).Info(fmt.Sprintf("observed change in cluster state"), "diff", change)
324+
log.V(logger.DebugLevel).Info("observed change in cluster state", "diff", change)
325325
}
326326
}
327327

internal/reconcile/atomic_release_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3434
"k8s.io/apimachinery/pkg/runtime/schema"
3535
"k8s.io/client-go/tools/record"
36-
"k8s.io/utils/pointer"
36+
"k8s.io/utils/ptr"
3737
"sigs.k8s.io/controller-runtime/pkg/client/fake"
3838

3939
"github.com/fluxcd/pkg/apis/meta"
@@ -616,7 +616,7 @@ func TestAtomicRelease_Reconcile_Scenarios(t *testing.T) {
616616
spec: func(spec *v2.HelmReleaseSpec) {
617617
spec.Install = &v2.Install{
618618
Remediation: &v2.InstallRemediation{
619-
RemediateLastFailure: pointer.Bool(true),
619+
RemediateLastFailure: ptr.To(true),
620620
},
621621
}
622622
spec.Uninstall = &v2.Uninstall{
@@ -635,7 +635,7 @@ func TestAtomicRelease_Reconcile_Scenarios(t *testing.T) {
635635
spec: func(spec *v2.HelmReleaseSpec) {
636636
spec.Install = &v2.Install{
637637
Remediation: &v2.InstallRemediation{
638-
RemediateLastFailure: pointer.Bool(true),
638+
RemediateLastFailure: ptr.To(true),
639639
},
640640
}
641641
spec.Test = &v2.Test{
@@ -740,7 +740,7 @@ func TestAtomicRelease_Reconcile_Scenarios(t *testing.T) {
740740
spec: func(spec *v2.HelmReleaseSpec) {
741741
spec.Upgrade = &v2.Upgrade{
742742
Remediation: &v2.UpgradeRemediation{
743-
RemediateLastFailure: pointer.Bool(true),
743+
RemediateLastFailure: ptr.To(true),
744744
},
745745
}
746746
},
@@ -778,7 +778,7 @@ func TestAtomicRelease_Reconcile_Scenarios(t *testing.T) {
778778
spec.Upgrade = &v2.Upgrade{
779779
Remediation: &v2.UpgradeRemediation{
780780
Strategy: &strategy,
781-
RemediateLastFailure: pointer.Bool(true),
781+
RemediateLastFailure: ptr.To(true),
782782
},
783783
}
784784
spec.Uninstall = &v2.Uninstall{
@@ -816,7 +816,7 @@ func TestAtomicRelease_Reconcile_Scenarios(t *testing.T) {
816816
spec: func(spec *v2.HelmReleaseSpec) {
817817
spec.Upgrade = &v2.Upgrade{
818818
Remediation: &v2.UpgradeRemediation{
819-
RemediateLastFailure: pointer.Bool(true),
819+
RemediateLastFailure: ptr.To(true),
820820
},
821821
}
822822
spec.Test = &v2.Test{

internal/reconcile/state.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func DetermineReleaseState(ctx context.Context, cfg *action.ConfigFactory, req *
129129
case helmrelease.StatusFailed:
130130
return ReleaseState{Status: ReleaseStatusFailed}, nil
131131
case helmrelease.StatusUninstalled:
132-
return ReleaseState{Status: ReleaseStatusAbsent, Reason: fmt.Sprintf("found uninstalled release in storage")}, nil
132+
return ReleaseState{Status: ReleaseStatusAbsent, Reason: "found uninstalled release in storage"}, nil
133133
case helmrelease.StatusDeployed:
134134
// Verify the release is in sync with the desired configuration.
135135
if err = action.VerifyRelease(rls, cur, req.Chart.Metadata, req.Values); err != nil {

main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
2929
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
3030
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
31-
"k8s.io/utils/pointer"
31+
"k8s.io/utils/ptr"
3232
ctrl "sigs.k8s.io/controller-runtime"
3333
ctrlcache "sigs.k8s.io/controller-runtime/pkg/cache"
3434
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
@@ -204,7 +204,7 @@ func main() {
204204
},
205205
},
206206
Controller: ctrlcfg.Controller{
207-
RecoverPanic: pointer.Bool(true),
207+
RecoverPanic: ptr.To(true),
208208
MaxConcurrentReconciles: concurrent,
209209
},
210210
Metrics: metricsserver.Options{

0 commit comments

Comments
 (0)