Skip to content

Commit

Permalink
Use ptr helper
Browse files Browse the repository at this point in the history
  • Loading branch information
caseydavenport committed Aug 27, 2024
1 parent 1d40e30 commit e2a84c3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/controller/ippool/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
configv1 "github.com/openshift/api/config/v1"
operator "github.com/tigera/operator/api/v1"
crdv1 "github.com/tigera/operator/pkg/apis/crd.projectcalico.org/v1"
"github.com/tigera/operator/pkg/ptr"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -183,8 +184,7 @@ func fillDefaults(ctx context.Context, client client.Client, instance *operator.
pool.NodeSelector = operator.NodeSelectorDefault
}
if pool.BlockSize == nil {
var twentySix int32 = 26
pool.BlockSize = &twentySix
pool.BlockSize = ptr.ToPtr[int32](26)
}
} else if err == nil && addr.To16() != nil {
// This is an IPv6 pool.
Expand All @@ -198,14 +198,12 @@ func fillDefaults(ctx context.Context, client client.Client, instance *operator.
pool.NodeSelector = operator.NodeSelectorDefault
}
if pool.BlockSize == nil {
var oneTwentyTwo int32 = 122
pool.BlockSize = &oneTwentyTwo
pool.BlockSize = ptr.ToPtr[int32](122)
}
}

if pool.DisableNewAllocations == nil {
disabled := false
pool.DisableNewAllocations = &disabled
pool.DisableNewAllocations = ptr.ToPtr(false)
}

// Default the name if it's not set.
Expand Down

0 comments on commit e2a84c3

Please sign in to comment.