Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support setting passive mode in bgp peer #886

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 1 addition & 2 deletions lib/apis/v3/zz_generated.deepcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
package v3

import (
reflect "reflect"

apis_v1 "github.com/projectcalico/libcalico-go/lib/apis/v1"
numorstring "github.com/projectcalico/libcalico-go/lib/numorstring"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
reflect "reflect"
)

func init() {
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"`
}
5 changes: 3 additions & 2 deletions lib/backend/syncersv1/updateprocessors/bgppeerprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ func convertBGPPeerV2ToV1(kvp *model.KVPair) (*model.KVPair, error) {
return &model.KVPair{
Key: v1key,
Value: &model.BGPPeer{
PeerIP: *ip,
ASNum: v3res.Spec.ASNumber,
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