Skip to content

Commit 517e00e

Browse files
committed
Adjustments for CI checks
Signed-off-by: Julien Semaan <jul.semaan@gmail.com>
1 parent ddbeac0 commit 517e00e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

internal/controller/ansibleRun/ansibleRun.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import (
4747
kerrors "k8s.io/apimachinery/pkg/api/errors"
4848
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4949
"k8s.io/apimachinery/pkg/types"
50-
"k8s.io/utils/pointer"
50+
"k8s.io/utils/ptr"
5151
ctrl "sigs.k8s.io/controller-runtime"
5252
"sigs.k8s.io/controller-runtime/pkg/client"
5353

@@ -574,7 +574,7 @@ func (c *connector) releaseLease(ctx context.Context, kube client.Client, index
574574
func (c *connector) acquireLease(ctx context.Context, kube client.Client, index int) error {
575575
lease := &coordinationv1.Lease{}
576576
leaseName := c.generateLeaseName(index)
577-
leaseDurationSeconds := pointer.Int32(leaseDurationSeconds)
577+
leaseDurationSeconds := ptr.To(int32(leaseDurationSeconds))
578578

579579
ns := "upbound-system"
580580

@@ -611,7 +611,7 @@ func (c *connector) acquireLease(ctx context.Context, kube client.Client, index
611611
}
612612

613613
// Update the lease to acquire it
614-
lease.Spec.HolderIdentity = pointer.String(c.replicaID)
614+
lease.Spec.HolderIdentity = ptr.To(c.replicaID)
615615
lease.Spec.RenewTime = &metav1.MicroTime{Time: time.Now()}
616616
lease.Spec.LeaseDurationSeconds = leaseDurationSeconds
617617
if err := kube.Update(ctx, lease); err != nil {
@@ -627,10 +627,9 @@ func (c *connector) acquireLease(ctx context.Context, kube client.Client, index
627627
}
628628

629629
// Finds an available shard and acquires a lease for it. Will attempt to obtain one indefinitely.
630-
// This will also start a background go-routine to renew the lease continiously and release it when the process receives a shutdown signal
630+
// This will also start a background go-routine to renew the lease continuously and release it when the process receives a shutdown signal
631631
func (c *connector) acquireAndHoldShard(o controller.Options, s SetupOptions) (int, error) {
632632
ctx := s.ProviderCtx
633-
acquiredLease := false
634633
currentShard := -1
635634

636635
cfg := ctrl.GetConfigOrDie()
@@ -640,12 +639,11 @@ func (c *connector) acquireAndHoldShard(o controller.Options, s SetupOptions) (i
640639
}
641640

642641
AcquireLease:
643-
for !acquiredLease {
642+
for {
644643
for i := 0; i < s.ReplicasCount; i++ {
645644
if err := c.acquireLease(ctx, kube, i); err == nil {
646645
currentShard = i
647646
o.Logger.Debug("acquired lease", "id", i)
648-
acquiredLease = true
649647
go func() {
650648
sigHandler := ctrl.SetupSignalHandler()
651649

0 commit comments

Comments
 (0)