Skip to content

Commit

Permalink
Take in pointer ref as param
Browse files Browse the repository at this point in the history
  • Loading branch information
LorcanMcVeigh committed Feb 26, 2025
1 parent 2fe1ff3 commit f084ed1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pkg/controller/ippool/pool_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) (
// when it attempts to create overlappin IP pools.
for _, cnp := range installation.Spec.CalicoNetwork.IPPools {
v1p := operatorapi.IPPool{}
FromProjectCalicoV1(v1p, p)
FromProjectCalicoV1(&v1p, p)
reqLogger.V(1).Info("Comparing IP pool", "clusterPool", p, "installationPool", cnp)
if !reflect.DeepEqual(cnp, v1p) {
// The IP pool in the cluster doesn't match the IP pool in the Installation - ignore it.
Expand Down Expand Up @@ -454,7 +454,7 @@ func ToProjectCalicoV1(p operatorapi.IPPool) (*crdv1.IPPool, error) {
// FromProjectCalicoV1 populates the IP pool with the data from the given
// crd.projectcalico.org/v1 IP pool. It is the direct inverse of ToProjectCalicoV1,
// and should be updated with every new field added to the IP pool structure.
func FromProjectCalicoV1(p operatorapi.IPPool, crd crdv1.IPPool) {
func FromProjectCalicoV1(p *operatorapi.IPPool, crd crdv1.IPPool) {
p.Name = crd.Name
p.CIDR = crd.Spec.CIDR

Expand Down Expand Up @@ -511,7 +511,7 @@ func CRDPoolsToOperator(crds []crdv1.IPPool) []operatorapi.IPPool {
pools := []operatorapi.IPPool{}
for _, p := range crds {
op := operatorapi.IPPool{}
FromProjectCalicoV1(op, p)
FromProjectCalicoV1(&op, p)
pools = append(pools, op)
}
return pools
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/ippool/pool_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ = table.DescribeTable("IPPool operator.tigera.io <-> crd.projectcalico.org

// Convert back to operator.tigera.io, expect it to be equal to the input.
operPool := operator.IPPool{}
FromProjectCalicoV1(operPool, *crdPool)
FromProjectCalicoV1(&operPool, *crdPool)
Expect(operPool).To(Equal(input))
},

Expand Down

0 comments on commit f084ed1

Please sign in to comment.