v1

package
v0.0.0-...-18c0211 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package v1 contains API Schema definitions for the network v1 API group +k8s:deepcopy-gen=package +groupName=k8s.ovn.org

Index

Constants

This section is empty.

Variables

View Source
var (
	GroupName          = "k8s.ovn.org"
	SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
	SchemeBuilder      = runtime.NewSchemeBuilder(addKnownTypes)
	AddToScheme        = SchemeBuilder.AddToScheme
)

Functions

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type CIDR

type CIDR string

+ --- + TODO: Add the following validations when available (kube v1.31). + kubebuilder:validation:XValidation:rule="isCIDR(self)", message="CIDR is invalid"

type ClusterUserDefinedNetwork

type ClusterUserDefinedNetwork struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// +kubebuilder:validation:Required
	// +required
	Spec ClusterUserDefinedNetworkSpec `json:"spec"`
	// +optional
	Status ClusterUserDefinedNetworkStatus `json:"status,omitempty"`
}

ClusterUserDefinedNetwork describe network request for a shared network across namespaces.

+genclient +genclient:nonNamespaced +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:resource:path=clusteruserdefinednetworks,scope=Cluster +kubebuilder:singular=clusteruserdefinednetwork +kubebuilder:object:root=true +kubebuilder:subresource:status

func (*ClusterUserDefinedNetwork) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterUserDefinedNetwork.

func (*ClusterUserDefinedNetwork) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterUserDefinedNetwork) DeepCopyObject

func (in *ClusterUserDefinedNetwork) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ClusterUserDefinedNetworkList

type ClusterUserDefinedNetworkList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []ClusterUserDefinedNetwork `json:"items"`
}

ClusterUserDefinedNetworkList contains a list of ClusterUserDefinedNetwork. +kubebuilder:object:root=true +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ClusterUserDefinedNetworkList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterUserDefinedNetworkList.

func (*ClusterUserDefinedNetworkList) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterUserDefinedNetworkList) DeepCopyObject

func (in *ClusterUserDefinedNetworkList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ClusterUserDefinedNetworkSpec

type ClusterUserDefinedNetworkSpec struct {
	// NamespaceSelector Label selector for which namespace network should be available for.
	// +kubebuilder:validation:Required
	// +required
	NamespaceSelector metav1.LabelSelector `json:"namespaceSelector"`

	// Network is the user-defined-network spec
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="Network spec is immutable"
	// +required
	Network NetworkSpec `json:"network"`
}

ClusterUserDefinedNetworkSpec defines the desired state of ClusterUserDefinedNetwork.

func (*ClusterUserDefinedNetworkSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterUserDefinedNetworkSpec.

func (*ClusterUserDefinedNetworkSpec) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ClusterUserDefinedNetworkStatus

type ClusterUserDefinedNetworkStatus struct {
	// Conditions slice of condition objects indicating details about ClusterUserDefineNetwork status.
	// +listType=map
	// +listMapKey=type
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

ClusterUserDefinedNetworkStatus contains the observed status of the ClusterUserDefinedNetwork.

func (*ClusterUserDefinedNetworkStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterUserDefinedNetworkStatus.

func (*ClusterUserDefinedNetworkStatus) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DualStackCIDRs

type DualStackCIDRs []CIDR

+kubebuilder:validation:MinItems=1 +kubebuilder:validation:MaxItems=2 + --- + TODO: Add the following validations when available (kube v1.31). + kubebuilder:validation:XValidation:rule="size(self) != 2 || isCIDR(self[0]) && isCIDR(self[1]) && cidr(self[0]).ip().family() != cidr(self[1]).ip().family()", message="When 2 CIDRs are set, they must be from different IP families"

func (DualStackCIDRs) DeepCopy

func (in DualStackCIDRs) DeepCopy() DualStackCIDRs

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DualStackCIDRs.

func (DualStackCIDRs) DeepCopyInto

func (in DualStackCIDRs) DeepCopyInto(out *DualStackCIDRs)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Layer2Config

type Layer2Config struct {
	// Role describes the network role in the pod.
	//
	// Allowed value is "Secondary".
	// Secondary network is only assigned to pods that use `k8s.v1.cni.cncf.io/networks` annotation to select given network.
	//
	// +kubebuilder:validation:Required
	// +required
	Role NetworkRole `json:"role"`

	// MTU is the maximum transmission unit for a network.
	// MTU is optional, if not provided, the globally configured value in OVN-Kubernetes (defaults to 1400) is used for the network.
	//
	// +kubebuilder:validation:Minimum=576
	// +kubebuilder:validation:Maximum=65536
	// +optional
	MTU int32 `json:"mtu,omitempty"`

	// Subnets are used for the pod network across the cluster.
	// Dual-stack clusters may set 2 subnets (one for each IP family), otherwise only 1 subnet is allowed.
	//
	// The format should match standard CIDR notation (for example, "10.128.0.0/16").
	// This field may be omitted. In that case the logical switch implementing the network only provides layer 2 communication,
	// and users must configure IP addresses for the pods. As a consequence, Port security only prevents MAC spoofing.
	//
	// +optional
	Subnets DualStackCIDRs `json:"subnets,omitempty"`

	// JoinSubnets are used inside the OVN network topology.
	//
	// Dual-stack clusters may set 2 subnets (one for each IP family), otherwise only 1 subnet is allowed.
	// This field is only allowed for "Primary" network.
	// It is not recommended to set this field without explicit need and understanding of the OVN network topology.
	// When omitted, the platform will choose a reasonable default which is subject to change over time.
	//
	// +optional
	JoinSubnets DualStackCIDRs `json:"joinSubnets,omitempty"`

	// IPAMLifecycle controls IP addresses management lifecycle.
	//
	// The only allowed value is Persistent. When set, OVN Kubernetes assigned IP addresses will be persisted in an
	// `ipamclaims.k8s.cni.cncf.io` object. These IP addresses will be reused by other pods if requested.
	// Only supported when "subnets" are set.
	//
	// +optional
	IPAMLifecycle NetworkIPAMLifecycle `json:"ipamLifecycle,omitempty"`
}

+kubebuilder:validation:XValidation:rule="self.role != 'Primary' || has(self.subnets) && size(self.subnets) > 0", message="Subnets is required for Primary Layer2 topology" +kubebuilder:validation:XValidation:rule="!has(self.joinSubnets) || has(self.role) && self.role == 'Primary'", message="JoinSubnets is only supported for Primary network" +kubebuilder:validation:XValidation:rule="!has(self.ipamLifecycle) || has(self.subnets) && size(self.subnets) > 0", message="IPAMLifecycle is only supported when subnets are set" + TODO This validation does not work and needs to be fixed + kubebuilder:validation:XValidation:rule="!has(self.subnets) || !self.subnets.exists_one(i, cidr(i).ip().family() == 6) || self.mtu >= 1280", message="MTU should be greater than or equal to 1280 when IPv6 subent is used"

func (*Layer2Config) DeepCopy

func (in *Layer2Config) DeepCopy() *Layer2Config

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Layer2Config.

func (*Layer2Config) DeepCopyInto

func (in *Layer2Config) DeepCopyInto(out *Layer2Config)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Layer3Config

type Layer3Config struct {
	// Role describes the network role in the pod.
	//
	// Allowed values are "Primary" and "Secondary".
	// Primary network is automatically assigned to every pod created in the same namespace.
	// Secondary network is only assigned to pods that use `k8s.v1.cni.cncf.io/networks` annotation to select given network.
	//
	// +kubebuilder:validation:Required
	// +required
	Role NetworkRole `json:"role"`

	// MTU is the maximum transmission unit for a network.
	//
	// MTU is optional, if not provided, the globally configured value in OVN-Kubernetes (defaults to 1400) is used for the network.
	//
	// +kubebuilder:validation:Minimum=576
	// +kubebuilder:validation:Maximum=65536
	// +optional
	MTU int32 `json:"mtu,omitempty"`

	// Subnets are used for the pod network across the cluster.
	//
	// Dual-stack clusters may set 2 subnets (one for each IP family), otherwise only 1 subnet is allowed.
	// Given subnet is split into smaller subnets for every node.
	//
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=2
	// +required
	// + ---
	// + TODO: Add the following validations when available (kube v1.31).
	// + kubebuilder:validation:XValidation:rule="size(self) != 2 || isCIDR(self[0].cidr) && isCIDR(self[1].cidr) && cidr(self[0].cidr).ip().family() != cidr(self[1].cidr).ip().family()", message="When 2 CIDRs are set, they must be from different IP families"
	Subnets []Layer3Subnet `json:"subnets,omitempty"`

	// JoinSubnets are used inside the OVN network topology.
	//
	// Dual-stack clusters may set 2 subnets (one for each IP family), otherwise only 1 subnet is allowed.
	// This field is only allowed for "Primary" network.
	// It is not recommended to set this field without explicit need and understanding of the OVN network topology.
	// When omitted, the platform will choose a reasonable default which is subject to change over time.
	//
	// +optional
	JoinSubnets DualStackCIDRs `json:"joinSubnets,omitempty"`
}

+kubebuilder:validation:XValidation:rule="has(self.subnets) && size(self.subnets) > 0", message="Subnets is required for Layer3 topology" +kubebuilder:validation:XValidation:rule="!has(self.joinSubnets) || has(self.role) && self.role == 'Primary'", message="JoinSubnets is only supported for Primary network" + TODO This validation does not work and needs to be fixed + kubebuilder:validation:XValidation:rule="!has(self.subnets) || !self.subnets.exists_one(i, cidr(i.cidr).ip().family() == 6) || self.mtu >= 1280", message="MTU should be greater than or equal to 1280 when IPv6 subent is used"

func (*Layer3Config) DeepCopy

func (in *Layer3Config) DeepCopy() *Layer3Config

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Layer3Config.

func (*Layer3Config) DeepCopyInto

func (in *Layer3Config) DeepCopyInto(out *Layer3Config)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Layer3Subnet

type Layer3Subnet struct {
	// CIDR specifies L3Subnet, which is split into smaller subnets for every node.
	//
	// +required
	CIDR CIDR `json:"cidr,omitempty"`

	// HostSubnet specifies the subnet size for every node.
	//
	// When not set, it will be assigned automatically.
	//
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=127
	// +optional
	HostSubnet int32 `json:"hostSubnet,omitempty"`
}

+ --- + TODO: Add the following validations when available (kube v1.31). + kubebuilder:validation:XValidation:rule="!has(self.hostSubnet) || (isCIDR(self.cidr) && self.hostSubnet > cidr(self.cidr).prefixLength())", message="HostSubnet must be smaller than CIDR subnet" + kubebuilder:validation:XValidation:rule="!has(self.hostSubnet) || (isCIDR(self.cidr) && (cidr(self.cidr).ip().family() == 6 || self.hostSubnet < 32))", message="HostSubnet must < 32 for ipv4 CIDR"

func (*Layer3Subnet) DeepCopy

func (in *Layer3Subnet) DeepCopy() *Layer3Subnet

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Layer3Subnet.

func (*Layer3Subnet) DeepCopyInto

func (in *Layer3Subnet) DeepCopyInto(out *Layer3Subnet)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NetworkIPAMLifecycle

type NetworkIPAMLifecycle string

+kubebuilder:validation:Enum=Persistent

const IPAMLifecyclePersistent NetworkIPAMLifecycle = "Persistent"

type NetworkRole

type NetworkRole string

+kubebuilder:validation:Enum=Primary;Secondary

const (
	NetworkRolePrimary   NetworkRole = "Primary"
	NetworkRoleSecondary NetworkRole = "Secondary"
)

type NetworkSpec

type NetworkSpec struct {
	// Topology describes network configuration.
	//
	// Allowed values are "Layer3", "Layer2".
	// Layer3 topology creates a layer 2 segment per node, each with a different subnet. Layer 3 routing is used to interconnect node subnets.
	// Layer2 topology creates one logical switch shared by all nodes.
	//
	// +kubebuilder:validation:Required
	// +required
	// +unionDiscriminator
	Topology NetworkTopology `json:"topology"`

	// Layer3 is the Layer3 topology configuration.
	// +optional
	Layer3 *Layer3Config `json:"layer3,omitempty"`

	// Layer2 is the Layer2 topology configuration.
	// +optional
	Layer2 *Layer2Config `json:"layer2,omitempty"`
}

NetworkSpec defines the desired state of UserDefinedNetworkSpec. +union

func (*NetworkSpec) DeepCopy

func (in *NetworkSpec) DeepCopy() *NetworkSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSpec.

func (*NetworkSpec) DeepCopyInto

func (in *NetworkSpec) DeepCopyInto(out *NetworkSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NetworkSpec) GetLayer2

func (s *NetworkSpec) GetLayer2() *Layer2Config

func (*NetworkSpec) GetLayer3

func (s *NetworkSpec) GetLayer3() *Layer3Config

func (*NetworkSpec) GetTopology

func (s *NetworkSpec) GetTopology() NetworkTopology

type NetworkTopology

type NetworkTopology string

+kubebuilder:validation:Enum=Layer2;Layer3

const (
	NetworkTopologyLayer2 NetworkTopology = "Layer2"
	NetworkTopologyLayer3 NetworkTopology = "Layer3"
)

type UserDefinedNetwork

type UserDefinedNetwork struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="Spec is immutable"
	// +kubebuilder:validation:XValidation:rule="has(self.topology) && self.topology == 'Layer3' ? has(self.layer3): !has(self.layer3)", message="spec.layer3 is required when topology is Layer3 and forbidden otherwise"
	// +kubebuilder:validation:XValidation:rule="has(self.topology) && self.topology == 'Layer2' ? has(self.layer2): !has(self.layer2)", message="spec.layer2 is required when topology is Layer2 and forbidden otherwise"
	// +required
	Spec UserDefinedNetworkSpec `json:"spec"`
	// +optional
	Status UserDefinedNetworkStatus `json:"status,omitempty"`
}

UserDefinedNetwork describe network request for a Namespace.

+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:resource:path=userdefinednetworks,scope=Namespaced +kubebuilder:singular=userdefinednetwork +kubebuilder:object:root=true +kubebuilder:subresource:status

func (*UserDefinedNetwork) DeepCopy

func (in *UserDefinedNetwork) DeepCopy() *UserDefinedNetwork

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserDefinedNetwork.

func (*UserDefinedNetwork) DeepCopyInto

func (in *UserDefinedNetwork) DeepCopyInto(out *UserDefinedNetwork)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*UserDefinedNetwork) DeepCopyObject

func (in *UserDefinedNetwork) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type UserDefinedNetworkList

type UserDefinedNetworkList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []UserDefinedNetwork `json:"items"`
}

UserDefinedNetworkList contains a list of UserDefinedNetwork. +kubebuilder:object:root=true +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*UserDefinedNetworkList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserDefinedNetworkList.

func (*UserDefinedNetworkList) DeepCopyInto

func (in *UserDefinedNetworkList) DeepCopyInto(out *UserDefinedNetworkList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*UserDefinedNetworkList) DeepCopyObject

func (in *UserDefinedNetworkList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type UserDefinedNetworkSpec

type UserDefinedNetworkSpec struct {
	// Topology describes network configuration.
	//
	// Allowed values are "Layer3", "Layer2".
	// Layer3 topology creates a layer 2 segment per node, each with a different subnet. Layer 3 routing is used to interconnect node subnets.
	// Layer2 topology creates one logical switch shared by all nodes.
	//
	// +kubebuilder:validation:Required
	// +required
	// +unionDiscriminator
	Topology NetworkTopology `json:"topology"`

	// Layer3 is the Layer3 topology configuration.
	// +optional
	Layer3 *Layer3Config `json:"layer3,omitempty"`

	// Layer2 is the Layer2 topology configuration.
	// +optional
	Layer2 *Layer2Config `json:"layer2,omitempty"`
}

UserDefinedNetworkSpec defines the desired state of UserDefinedNetworkSpec. +union

func (*UserDefinedNetworkSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserDefinedNetworkSpec.

func (*UserDefinedNetworkSpec) DeepCopyInto

func (in *UserDefinedNetworkSpec) DeepCopyInto(out *UserDefinedNetworkSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*UserDefinedNetworkSpec) GetLayer2

func (s *UserDefinedNetworkSpec) GetLayer2() *Layer2Config

func (*UserDefinedNetworkSpec) GetLayer3

func (s *UserDefinedNetworkSpec) GetLayer3() *Layer3Config

func (*UserDefinedNetworkSpec) GetTopology

func (s *UserDefinedNetworkSpec) GetTopology() NetworkTopology

type UserDefinedNetworkStatus

type UserDefinedNetworkStatus struct {
	// +listType=map
	// +listMapKey=type
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

UserDefinedNetworkStatus contains the observed status of the UserDefinedNetwork.

func (*UserDefinedNetworkStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserDefinedNetworkStatus.

func (*UserDefinedNetworkStatus) DeepCopyInto

func (in *UserDefinedNetworkStatus) DeepCopyInto(out *UserDefinedNetworkStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Directories

Path Synopsis
apis
clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
clientset/versioned/typed/userdefinednetwork/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
clientset/versioned/typed/userdefinednetwork/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL