Skip to content

Commit

Permalink
Add network PeeringPrefix type and its validation
Browse files Browse the repository at this point in the history
  • Loading branch information
kasabe28 committed Jun 24, 2024
1 parent 7ff4d63 commit 96ca386
Show file tree
Hide file tree
Showing 18 changed files with 967 additions and 7 deletions.
33 changes: 33 additions & 0 deletions api/networking/v1alpha1/network_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package v1alpha1

import (
commonv1alpha1 "github.com/ironcore-dev/ironcore/api/common/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
Expand Down Expand Up @@ -51,6 +52,28 @@ 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 PeeringPrefixRef `json:"prefixRef,omitempty"`
}

type PeeringPrefixRef struct {
// Namespace is the namespace of the referenced entity. If empty,
// the same namespace as the referring resource is implied.
Namespace string `json:"namespace,omitempty"`
// Name is the name of the referenced entity.
Name string `json:"name"`
}

// NetworkStatus defines the observed state of Network
Expand Down Expand Up @@ -86,6 +109,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
79 changes: 77 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.

46 changes: 46 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.

48 changes: 48 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.

Loading

0 comments on commit 96ca386

Please sign in to comment.