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

BGPFilter: Add prefixLength to BGPFilter to match on min/max prefix length #9114

Merged
Merged
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
22 changes: 22 additions & 0 deletions api/pkg/apis/projectcalico/v3/bgpfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ type BGPFilterSpec struct {
type BGPFilterRuleV4 struct {
CIDR string `json:"cidr,omitempty" validate:"omitempty,netv4"`

PrefixLength *BGPFilterPrefixLengthV4 `json:"prefixLength,omitempty" validate:"omitempty"`

Source BGPFilterMatchSource `json:"source,omitempty" validate:"omitempty,oneof=RemotePeers"`

Interface string `json:"interface,omitempty" validate:"omitempty,bgpFilterInterface"`
Expand All @@ -77,6 +79,8 @@ type BGPFilterRuleV4 struct {
type BGPFilterRuleV6 struct {
CIDR string `json:"cidr,omitempty" validate:"omitempty,netv6"`

PrefixLength *BGPFilterPrefixLengthV6 `json:"prefixLength,omitempty" validate:"omitempty"`

Source BGPFilterMatchSource `json:"source,omitempty" validate:"omitempty,oneof=RemotePeers"`

Interface string `json:"interface,omitempty" validate:"omitempty,bgpFilterInterface"`
Expand All @@ -86,6 +90,24 @@ type BGPFilterRuleV6 struct {
Action BGPFilterAction `json:"action" validate:"required,filterAction"`
}

type BGPFilterPrefixLengthV4 struct {
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=32
Min *int32 `json:"min,omitempty" validate:"omitempty,bgpFilterPrefixLengthV4"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=32
Max *int32 `json:"max,omitempty" validate:"omitempty,bgpFilterPrefixLengthV4"`
}

type BGPFilterPrefixLengthV6 struct {
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=128
Min *int32 `json:"min,omitempty" validate:"omitempty,bgpFilterPrefixLengthV6"`
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=128
Max *int32 `json:"max,omitempty" validate:"omitempty,bgpFilterPrefixLengthV6"`
}

type BGPFilterMatchSource string

const (
Expand Down
78 changes: 74 additions & 4 deletions api/pkg/apis/projectcalico/v3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions api/pkg/openapi/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading