Skip to content

Commit

Permalink
support setting passive mode in bgp peer
Browse files Browse the repository at this point in the history
This allow use to set `passive: true` in bgp peer spec so we can
leverage that in calico/node to set proper bird config.
  • Loading branch information
dqminh authored and Matt Alberts committed Jun 13, 2018
1 parent 4d93d1d commit 8ab8d05
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/apis/v3/bgppeer.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ type BGPPeerSpec struct {
PeerIP string `json:"peerIP" validate:"omitempty,ip"`
// The AS Number of the peer.
ASNumber numorstring.ASNumber `json:"asNumber"`
// Passive specifies whether the peer is in passive mode
Passive bool `json:"passive,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
1 change: 1 addition & 0 deletions lib/backend/k8s/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ var _ = Describe("Test Syncer API for Kubernetes backend", func() {
Spec: apiv3.BGPPeerSpec{
PeerIP: "10.0.0.1",
ASNumber: numorstring.ASNumber(6513),
Passive: true,
},
},
}
Expand Down
3 changes: 3 additions & 0 deletions lib/backend/model/bgppeer.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,7 @@ type BGPPeer struct {
// converts large uints to float e notation which breaks the BIRD
// configuration.
ASNum numorstring.ASNumber `json:"as_num,string"`

// Passive is the passive setting of the BGP peer.
Passive bool `json:"passive"`
}
1 change: 1 addition & 0 deletions lib/backend/syncersv1/updateprocessors/bgppeerprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func convertBGPPeerV2ToV1(kvp *model.KVPair) (*model.KVPair, error) {
Value: &model.BGPPeer{
PeerIP: *ip,
ASNum: v3res.Spec.ASNumber,
Passive: v3res.Spec.Passive,
},
Revision: kvp.Revision,
}, nil
Expand Down
1 change: 1 addition & 0 deletions lib/clientv3/bgppeer_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ var _ = testutils.E2eDatastoreDescribe("BGPPeer tests", testutils.DatastoreAll,
Node: "node2",
PeerIP: "20.0.0.1",
ASNumber: numorstring.ASNumber(6511),
Passive: true,
}

DescribeTable("BGPPeer e2e CRUD tests",
Expand Down

0 comments on commit 8ab8d05

Please sign in to comment.