Skip to content

Commit

Permalink
Add network peering prefixes types and its validation (#1078)
Browse files Browse the repository at this point in the history
* Add network PeeringPrefix type and its validation

* Change PrefixRef type to LocalObjectReference
  • Loading branch information
kasabe28 authored Jul 2, 2024
1 parent 0b33ec3 commit 8d4f7b4
Show file tree
Hide file tree
Showing 18 changed files with 795 additions and 7 deletions.
26 changes: 26 additions & 0 deletions api/networking/v1alpha1/network_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package v1alpha1

import (
commonv1alpha1 "github.com/ironcore-dev/ironcore/api/common/v1alpha1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
Expand Down Expand Up @@ -51,6 +53,20 @@ type NetworkPeering struct {
// NetworkRef is the reference to the network to peer with.
// An empty namespace indicates that the target network resides in the same namespace as the source network.
NetworkRef NetworkPeeringNetworkRef `json:"networkRef"`
// Prefixes is a list of prefixes that we want only to be exposed
// to the peered network, if no prefixes are specified no filtering will be done.
Prefixes []PeeringPrefix `json:"prefixes,omitempty"`
}

// PeeringPrefixes defines prefixes to be exposed to the peered network
type PeeringPrefix struct {
// Name is the semantical name of the peering prefixes
Name string `json:"name"`
// CIDR to be exposed to the peered network
Prefix *commonv1alpha1.IPPrefix `json:"prefix,omitempty"`
// PrefixRef is the reference to the prefix to be exposed to peered network
// An empty namespace indicates that the prefix resides in the same namespace as the source network.
PrefixRef corev1.LocalObjectReference `json:"prefixRef,omitempty"`
}

// NetworkStatus defines the observed state of Network
Expand Down Expand Up @@ -86,6 +102,16 @@ type NetworkPeeringStatus struct {
Name string `json:"name"`
// State represents the network peering state
State NetworkPeeringState `json:"state,omitempty"`
// Prefixes contains the prefixes exposed to the peered network
Prefixes []PeeringPrefixStatus `json:"prefixes,omitempty"`
}

// PeeringPrefixStatus lists prefixes exposed to peered network
type PeeringPrefixStatus struct {
// Name is the name of the peering prefix
Name string `json:"name"`
// CIDR exposed to the peered network
Prefix *commonv1alpha1.IPPrefix `json:"prefix,omitempty"`
}

const (
Expand Down
63 changes: 61 additions & 2 deletions api/networking/v1alpha1/zz_generated.deepcopy.go

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

36 changes: 36 additions & 0 deletions client-go/applyconfigurations/internal/internal.go

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

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

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

49 changes: 49 additions & 0 deletions client-go/applyconfigurations/networking/v1alpha1/peeringprefix.go

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

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

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

Loading

0 comments on commit 8d4f7b4

Please sign in to comment.