From dc54219735bd724bb66beba07e592acb21bdb35e Mon Sep 17 00:00:00 2001 From: Hongliang Liu Date: Wed, 18 Dec 2024 13:38:59 +0800 Subject: [PATCH] Add BGP confederation support in BGPPolicy Signed-off-by: Hongliang Liu --- build/charts/antrea/crds/bgppolicy.yaml | 13 +++++++++++ build/yamls/antrea-aks.yml | 13 +++++++++++ build/yamls/antrea-crds.yml | 13 +++++++++++ build/yamls/antrea-eks.yml | 13 +++++++++++ build/yamls/antrea-gke.yml | 13 +++++++++++ build/yamls/antrea-ipsec.yml | 13 +++++++++++ build/yamls/antrea.yml | 13 +++++++++++ pkg/apis/crd/v1alpha1/types.go | 14 ++++++++++++ .../crd/v1alpha1/zz_generated.deepcopy.go | 22 +++++++++++++++++++ 9 files changed, 127 insertions(+) diff --git a/build/charts/antrea/crds/bgppolicy.yaml b/build/charts/antrea/crds/bgppolicy.yaml index 1dd326f03e4..fade910d8c3 100644 --- a/build/charts/antrea/crds/bgppolicy.yaml +++ b/build/charts/antrea/crds/bgppolicy.yaml @@ -55,6 +55,19 @@ spec: minimum: 1 maximum: 65535 default: 179 + confederation: + type: object + properties: + enable: + type: boolean + default: false + identifier: + type: integer + format: int32 + peers: + type: array + items: + type: integer advertisements: type: object properties: diff --git a/build/yamls/antrea-aks.yml b/build/yamls/antrea-aks.yml index c7c7798c1dc..4604d6ea2ca 100644 --- a/build/yamls/antrea-aks.yml +++ b/build/yamls/antrea-aks.yml @@ -359,6 +359,19 @@ spec: minimum: 1 maximum: 65535 default: 179 + confederation: + type: object + properties: + enable: + type: boolean + default: false + identifier: + type: integer + format: int32 + peers: + type: array + items: + type: integer advertisements: type: object properties: diff --git a/build/yamls/antrea-crds.yml b/build/yamls/antrea-crds.yml index 9300377ee62..84a9009dab1 100644 --- a/build/yamls/antrea-crds.yml +++ b/build/yamls/antrea-crds.yml @@ -354,6 +354,19 @@ spec: minimum: 1 maximum: 65535 default: 179 + confederation: + type: object + properties: + enable: + type: boolean + default: false + identifier: + type: integer + format: int32 + peers: + type: array + items: + type: integer advertisements: type: object properties: diff --git a/build/yamls/antrea-eks.yml b/build/yamls/antrea-eks.yml index c2428bf8d85..823b35f4766 100644 --- a/build/yamls/antrea-eks.yml +++ b/build/yamls/antrea-eks.yml @@ -359,6 +359,19 @@ spec: minimum: 1 maximum: 65535 default: 179 + confederation: + type: object + properties: + enable: + type: boolean + default: false + identifier: + type: integer + format: int32 + peers: + type: array + items: + type: integer advertisements: type: object properties: diff --git a/build/yamls/antrea-gke.yml b/build/yamls/antrea-gke.yml index e1f07fc564c..bb2bbab6aa6 100644 --- a/build/yamls/antrea-gke.yml +++ b/build/yamls/antrea-gke.yml @@ -359,6 +359,19 @@ spec: minimum: 1 maximum: 65535 default: 179 + confederation: + type: object + properties: + enable: + type: boolean + default: false + identifier: + type: integer + format: int32 + peers: + type: array + items: + type: integer advertisements: type: object properties: diff --git a/build/yamls/antrea-ipsec.yml b/build/yamls/antrea-ipsec.yml index dbb2119becb..3fe78ef232a 100644 --- a/build/yamls/antrea-ipsec.yml +++ b/build/yamls/antrea-ipsec.yml @@ -359,6 +359,19 @@ spec: minimum: 1 maximum: 65535 default: 179 + confederation: + type: object + properties: + enable: + type: boolean + default: false + identifier: + type: integer + format: int32 + peers: + type: array + items: + type: integer advertisements: type: object properties: diff --git a/build/yamls/antrea.yml b/build/yamls/antrea.yml index 0580bbfb76b..81343b7be39 100644 --- a/build/yamls/antrea.yml +++ b/build/yamls/antrea.yml @@ -359,6 +359,19 @@ spec: minimum: 1 maximum: 65535 default: 179 + confederation: + type: object + properties: + enable: + type: boolean + default: false + identifier: + type: integer + format: int32 + peers: + type: array + items: + type: integer advertisements: type: object properties: diff --git a/pkg/apis/crd/v1alpha1/types.go b/pkg/apis/crd/v1alpha1/types.go index 82b2b422d13..f1049774a4e 100644 --- a/pkg/apis/crd/v1alpha1/types.go +++ b/pkg/apis/crd/v1alpha1/types.go @@ -269,6 +269,9 @@ type BGPPolicySpec struct { // ListenPort is the port on which the BGP process listens, and the default value is 179. ListenPort *int32 `json:"listenPort,omitempty"` + // Confederation specifies BGP confederation configuration. + Confederation Confederation `json:"confederation"` + // Advertisements configures IPs or CIDRs to be advertised to BGP peers. Advertisements Advertisements `json:"advertisements,omitempty"` @@ -289,6 +292,17 @@ type Advertisements struct { Egress *EgressAdvertisement `json:"egress,omitempty"` } +type Confederation struct { + // Enabled indicates whether BGP confederation is enabled. + Enabled bool `json:"enabled,omitempty"` + + // Identifier specifies the confederation's ASN. + Identifier int32 `json:"identifier,omitempty"` + + // Peers lists the ASNs of other members in the confederation. + Peers []int32 `json:"peers,omitempty"` +} + type ServiceIPType string const ( diff --git a/pkg/apis/crd/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/crd/v1alpha1/zz_generated.deepcopy.go index 4dea41e333a..2270ffd43d7 100644 --- a/pkg/apis/crd/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/crd/v1alpha1/zz_generated.deepcopy.go @@ -157,6 +157,7 @@ func (in *BGPPolicySpec) DeepCopyInto(out *BGPPolicySpec) { *out = new(int32) **out = **in } + in.Confederation.DeepCopyInto(&out.Confederation) in.Advertisements.DeepCopyInto(&out.Advertisements) if in.BGPPeers != nil { in, out := &in.BGPPeers, &out.BGPPeers @@ -293,6 +294,27 @@ func (in *CaptureConfig) DeepCopy() *CaptureConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Confederation) DeepCopyInto(out *Confederation) { + *out = *in + if in.Peers != nil { + in, out := &in.Peers, &out.Peers + *out = make([]int32, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Confederation. +func (in *Confederation) DeepCopy() *Confederation { + if in == nil { + return nil + } + out := new(Confederation) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Destination) DeepCopyInto(out *Destination) { *out = *in