Skip to content

Commit

Permalink
Merge branch 'main' into v0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
oribon committed Sep 17, 2024
2 parents 2aca215 + 1637470 commit d5a0c45
Show file tree
Hide file tree
Showing 49 changed files with 1,085 additions and 550 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Checkout Source
uses: actions/checkout@v4
- name: Run Gosec Security Scanner
uses: securego/gosec@master
uses: securego/gosec@v2.21.2
with:
args: -exclude-dir e2etest -severity medium ./...

Expand Down
16 changes: 15 additions & 1 deletion API-DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,19 @@ _Appears in:_
| `community` _string_ | Community is the community associated to the prefixes. | | |


#### DynamicASNMode

_Underlying type:_ _string_





_Appears in:_
- [Neighbor](#neighbor)



#### FRRConfiguration


Expand Down Expand Up @@ -268,7 +281,8 @@ _Appears in:_

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `asn` _integer_ | ASN is the AS number to use for the local end of the session. | | Maximum: 4.294967295e+09 <br />Minimum: 0 <br /> |
| `asn` _integer_ | ASN is the AS number to use for the local end of the session.<br />ASN and DynamicASN are mutually exclusive and one of them must be specified. | | Maximum: 4.294967295e+09 <br />Minimum: 0 <br /> |
| `dynamicASN` _[DynamicASNMode](#dynamicasnmode)_ | DynamicASN detects the AS number to use for the local end of the session<br />without explicitly setting it via the ASN field. Limited to:<br />internal - if the neighbor's ASN is different than the router's the connection is denied.<br />external - if the neighbor's ASN is the same as the router's the connection is denied.<br />ASN and DynamicASN are mutually exclusive and one of them must be specified. | | Enum: [internal external] <br /> |
| `sourceaddress` _string_ | SourceAddress is the IPv4 or IPv6 source address to use for the BGP<br />session to this neighbour, may be specified as either an IP address<br />directly or as an interface name | | |
| `address` _string_ | Address is the IP address to establish the session with. | | |
| `port` _integer_ | Port is the port to dial when establishing the session.<br />Defaults to 179. | | Maximum: 16384 <br />Minimum: 0 <br /> |
Expand Down
10 changes: 10 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# FRRK8s Release Notes

## Release v0.0.15

### New Features

- Add DynamicASN field for a neighbor, which allows the daemon to detect the AS number to use without explicitly setting it. The new field is mutually exclusive with the existing ASN field, and one of them must be specified for any given Neighbor. (#194, @oribon)

### Bug fixes

- Update the kubernetes api / codegen and get rid of the core symlink hack. (#186, @fedepaol)

## Release v0.0.14

### New Features
Expand Down
20 changes: 19 additions & 1 deletion api/v1beta1/frrconfiguration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,20 @@ type Import struct {
// Neighbor represents a BGP Neighbor we want FRR to connect to.
type Neighbor struct {
// ASN is the AS number to use for the local end of the session.
// ASN and DynamicASN are mutually exclusive and one of them must be specified.
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=4294967295
ASN uint32 `json:"asn"`
// +optional
ASN uint32 `json:"asn,omitempty"`

// DynamicASN detects the AS number to use for the local end of the session
// without explicitly setting it via the ASN field. Limited to:
// internal - if the neighbor's ASN is different than the router's the connection is denied.
// external - if the neighbor's ASN is the same as the router's the connection is denied.
// ASN and DynamicASN are mutually exclusive and one of them must be specified.
// +kubebuilder:validation:Enum=internal;external
// +optional
DynamicASN DynamicASNMode `json:"dynamicASN,omitempty"`

// SourceAddress is the IPv4 or IPv6 source address to use for the BGP
// session to this neighbour, may be specified as either an IP address
Expand Down Expand Up @@ -371,3 +382,10 @@ const (
AllowAll AllowMode = "all"
AllowRestricted AllowMode = "filtered"
)

type DynamicASNMode string

const (
InternalASNMode DynamicASNMode = "internal"
ExternalASNMode DynamicASNMode = "external"
)
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ spec:
the session with.
type: string
asn:
description: ASN is the AS number to use for the local
end of the session.
description: |-
ASN is the AS number to use for the local end of the session.
ASN and DynamicASN are mutually exclusive and one of them must be specified.
format: int32
maximum: 4294967295
minimum: 0
Expand Down Expand Up @@ -187,6 +188,17 @@ spec:
will separate IPv4 and IPv6 route exchanges into
distinct BGP sessions.
type: boolean
dynamicASN:
description: |-
DynamicASN detects the AS number to use for the local end of the session
without explicitly setting it via the ASN field. Limited to:
internal - if the neighbor's ASN is different than the router's the connection is denied.
external - if the neighbor's ASN is the same as the router's the connection is denied.
ASN and DynamicASN are mutually exclusive and one of them must be specified.
enum:
- internal
- external
type: string
ebgpMultiHop:
description: EBGPMultiHop indicates if the BGPPeer
is multi-hops away.
Expand Down Expand Up @@ -366,7 +378,6 @@ spec:
type: object
required:
- address
- asn
type: object
type: array
prefixes:
Expand Down
17 changes: 14 additions & 3 deletions config/all-in-one/frr-k8s-prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ spec:
the session with.
type: string
asn:
description: ASN is the AS number to use for the local
end of the session.
description: |-
ASN is the AS number to use for the local end of the session.
ASN and DynamicASN are mutually exclusive and one of them must be specified.
format: int32
maximum: 4294967295
minimum: 0
Expand Down Expand Up @@ -202,6 +203,17 @@ spec:
will separate IPv4 and IPv6 route exchanges into
distinct BGP sessions.
type: boolean
dynamicASN:
description: |-
DynamicASN detects the AS number to use for the local end of the session
without explicitly setting it via the ASN field. Limited to:
internal - if the neighbor's ASN is different than the router's the connection is denied.
external - if the neighbor's ASN is the same as the router's the connection is denied.
ASN and DynamicASN are mutually exclusive and one of them must be specified.
enum:
- internal
- external
type: string
ebgpMultiHop:
description: EBGPMultiHop indicates if the BGPPeer
is multi-hops away.
Expand Down Expand Up @@ -381,7 +393,6 @@ spec:
type: object
required:
- address
- asn
type: object
type: array
prefixes:
Expand Down
17 changes: 14 additions & 3 deletions config/all-in-one/frr-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ spec:
the session with.
type: string
asn:
description: ASN is the AS number to use for the local
end of the session.
description: |-
ASN is the AS number to use for the local end of the session.
ASN and DynamicASN are mutually exclusive and one of them must be specified.
format: int32
maximum: 4294967295
minimum: 0
Expand Down Expand Up @@ -202,6 +203,17 @@ spec:
will separate IPv4 and IPv6 route exchanges into
distinct BGP sessions.
type: boolean
dynamicASN:
description: |-
DynamicASN detects the AS number to use for the local end of the session
without explicitly setting it via the ASN field. Limited to:
internal - if the neighbor's ASN is different than the router's the connection is denied.
external - if the neighbor's ASN is the same as the router's the connection is denied.
ASN and DynamicASN are mutually exclusive and one of them must be specified.
enum:
- internal
- external
type: string
ebgpMultiHop:
description: EBGPMultiHop indicates if the BGPPeer
is multi-hops away.
Expand Down Expand Up @@ -381,7 +393,6 @@ spec:
type: object
required:
- address
- asn
type: object
type: array
prefixes:
Expand Down
17 changes: 14 additions & 3 deletions config/crd/bases/frrk8s.metallb.io_frrconfigurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ spec:
the session with.
type: string
asn:
description: ASN is the AS number to use for the local
end of the session.
description: |-
ASN is the AS number to use for the local end of the session.
ASN and DynamicASN are mutually exclusive and one of them must be specified.
format: int32
maximum: 4294967295
minimum: 0
Expand Down Expand Up @@ -187,6 +188,17 @@ spec:
will separate IPv4 and IPv6 route exchanges into
distinct BGP sessions.
type: boolean
dynamicASN:
description: |-
DynamicASN detects the AS number to use for the local end of the session
without explicitly setting it via the ASN field. Limited to:
internal - if the neighbor's ASN is different than the router's the connection is denied.
external - if the neighbor's ASN is the same as the router's the connection is denied.
ASN and DynamicASN are mutually exclusive and one of them must be specified.
enum:
- internal
- external
type: string
ebgpMultiHop:
description: EBGPMultiHop indicates if the BGPPeer
is multi-hops away.
Expand Down Expand Up @@ -366,7 +378,6 @@ spec:
type: object
required:
- address
- asn
type: object
type: array
prefixes:
Expand Down
1 change: 0 additions & 1 deletion core

This file was deleted.

5 changes: 1 addition & 4 deletions e2etests/e2etest_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func handleFlags() {
flag.StringVar(&externalContainers, "external-containers", "", "a comma separated list of external containers names to use for the test. (valid parameters are: ibgp-single-hop / ibgp-multi-hop / ebgp-single-hop / ebgp-multi-hop)")
flag.StringVar(&executor.Kubectl, "kubectl", "kubectl", "the path for the kubectl binary")
flag.StringVar(&frrImage, "frr-image", "quay.io/frrouting/frr:9.1.0", "the image to use for the external frr containers")
flag.StringVar(&k8s.FRRK8sNamespace, "frr-k8s-namespace", "frr-k8s-system", "the namespace frr-k8s is running in")

flag.Parse()

Expand Down Expand Up @@ -87,10 +88,6 @@ var _ = ginkgo.BeforeSuite(func() {
}

tests.PrometheusNamespace = prometheusNamespace

h, err := k8s.FRRK8isDaemonSetReady(cs)
Expect(err).NotTo(HaveOccurred())
Expect(h).Should(BeTrue(), "frr-k8s daemonset should be ready before test")
})

var _ = ginkgo.AfterSuite(func() {
Expand Down
26 changes: 14 additions & 12 deletions e2etests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,27 @@ replace (

require (
github.com/metallb/frr-k8s v0.0.11
github.com/onsi/ginkgo/v2 v2.17.2
github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
github.com/openshift-kni/k8sreporter v1.0.4
github.com/prometheus/client_model v0.6.1
github.com/prometheus/common v0.54.0
github.com/prometheus/common v0.55.0
go.universe.tf/e2etest v0.0.0-00010101000000-000000000000
k8s.io/api v0.30.2
k8s.io/apimachinery v0.30.2
k8s.io/client-go v0.30.2
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0
sigs.k8s.io/controller-runtime v0.18.4
k8s.io/api v0.31.0
k8s.io/apimachinery v0.31.0
k8s.io/client-go v0.31.0
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
sigs.k8s.io/controller-runtime v0.19.0
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
Expand All @@ -45,7 +46,7 @@ require (
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand All @@ -58,6 +59,7 @@ require (
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.universe.tf/metallb v0.13.7 // indirect
Expand All @@ -75,9 +77,9 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.30.2 // indirect
k8s.io/component-base v0.30.2 // indirect
k8s.io/klog/v2 v2.130.0 // indirect
k8s.io/apiextensions-apiserver v0.31.0 // indirect
k8s.io/component-base v0.31.0 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240521193020-835d969ad83a // indirect
k8s.io/pod-security-admission v0.28.4 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
Expand Down
Loading

0 comments on commit d5a0c45

Please sign in to comment.