Skip to content

Commit

Permalink
Private.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 committed Oct 24, 2024
1 parent 88cd871 commit f0a4885
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions pkg/controllers/loadbalancer/config/cilium_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestCiliumConfig(t *testing.T) {
},
},
},
Peers: []*Peer{},
Peers: []*peer{},
},
},
},
Expand Down Expand Up @@ -95,7 +95,7 @@ func TestCiliumConfig(t *testing.T) {
},
},
},
Peers: []*Peer{},
Peers: []*peer{},
},
},
},
Expand Down Expand Up @@ -157,7 +157,7 @@ func TestCiliumConfig(t *testing.T) {
},
},
},
Peers: []*Peer{},
Peers: []*peer{},
},
},
},
Expand Down Expand Up @@ -291,7 +291,7 @@ func TestCiliumConfig(t *testing.T) {
},
},
},
Peers: []*Peer{},
Peers: []*peer{},
},
}},
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/controllers/loadbalancer/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type LoadBalancerConfig interface {
}

type baseConfig struct {
Peers []*Peer `json:"peers,omitempty" yaml:"peers,omitempty"`
Peers []*peer `json:"peers,omitempty" yaml:"peers,omitempty"`
AddressPools addressPools `json:"address-pools,omitempty" yaml:"address-pools,omitempty"`
}

Expand Down Expand Up @@ -88,8 +88,8 @@ func computeAddressPools(ips []*models.V1IPResponse, nws sets.Set[string]) (addr
return pools, nil
}

func computePeers(nodes []v1.Node) ([]*Peer, error) {
var peers []*Peer
func computePeers(nodes []v1.Node) ([]*peer, error) {
var peers []*peer

for _, n := range nodes {
asn, err := getASNFromNodeLabels(n)
Expand Down
8 changes: 4 additions & 4 deletions pkg/controllers/loadbalancer/config/metallb_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestMetalLBConfig(t *testing.T) {
CIDRs: []string{"84.1.1.1/32"},
},
},
Peers: []*Peer{},
Peers: []*peer{},
},
namespace: metallbNamespace,
},
Expand Down Expand Up @@ -103,7 +103,7 @@ func TestMetalLBConfig(t *testing.T) {
},
},
},
Peers: []*Peer{},
Peers: []*peer{},
},
namespace: metallbNamespace,
},
Expand Down Expand Up @@ -166,7 +166,7 @@ func TestMetalLBConfig(t *testing.T) {
},
},
},
Peers: []*Peer{},
Peers: []*peer{},
},
namespace: metallbNamespace,
},
Expand Down Expand Up @@ -301,7 +301,7 @@ func TestMetalLBConfig(t *testing.T) {
},
},
},
Peers: []*Peer{},
Peers: []*peer{},
},
namespace: metallbNamespace,
},
Expand Down
6 changes: 3 additions & 3 deletions pkg/controllers/loadbalancer/config/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type Peer struct {
type peer struct {
MyASN uint32 `json:"my-asn" yaml:"my-asn"`
ASN uint32 `json:"peer-asn" yaml:"peer-asn"`
Address string `json:"peer-address" yaml:"peer-address"`
NodeSelector metav1.LabelSelector `json:"node-selectors,omitempty" yaml:"node-selectors,omitempty"`
}

func newPeer(node v1.Node, asn int64) (*Peer, error) {
func newPeer(node v1.Node, asn int64) (*peer, error) {
hostname := node.GetName()

matchExpression := metav1.LabelSelectorRequirement{
Expand All @@ -29,7 +29,7 @@ func newPeer(node v1.Node, asn int64) (*Peer, error) {
return nil, err
}

return &Peer{
return &peer{
// we can safely cast the asn to an uint32 because its max value is defined as such
// see: https://en.wikipedia.org/wiki/Autonomous_system_(Internet)
MyASN: uint32(asn), // nolint:gosec
Expand Down

0 comments on commit f0a4885

Please sign in to comment.