v1

package
v0.1.0-beta.15 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

+k8s:deepcopy-gen=package +groupName=flatnetwork.pandaria.io

+k8s:deepcopy-gen=package +groupName=flatnetwork.pandaria.io

+k8s:deepcopy-gen=package +groupName=flatnetwork.pandaria.io

Index

Constants

View Source
const (
	SubnetNamespace = "cattle-flat-network"

	// Specification for Annotations
	AnnotationPrefix             = "flatnetwork.pandaria.io/"
	AnnotationIP                 = "flatnetwork.pandaria.io/ip"
	AnnotationSubnet             = "flatnetwork.pandaria.io/subnet"
	AnnotationMac                = "flatnetwork.pandaria.io/mac"
	AnnotationIngress            = "flatnetwork.pandaria.io/ingress"
	AnnotationFlatNetworkService = "flatnetwork.pandaria.io/flatNetworkService"
	AnnotationsIPv6to4           = "flatnetwork.pandaria.io/ipv6to4"

	// Specification for Labels
	LabelSelectedIP        = "flatnetwork.pandaria.io/selectedIP"
	LabelSubnet            = "flatnetwork.pandaria.io/subnet"
	LabelFlatNetworkIPType = "flatnetwork.pandaria.io/flatNetworkIPType"
	LabelSelectedMac       = "flatnetwork.pandaria.io/selectedMac"

	LabelWorkloadSelector = "workload.user.cattle.io/workloadselector"
	LabelProjectID        = "field.cattle.io/projectId"

	AllocateModeAuto     = "auto"
	AllocateModeSpecific = "specific"

	FlatModeIPvlan  = "ipvlan"
	FlatModeMacvlan = "macvlan"
)

Variables

View Source
var (
	FlatNetworkIPResourceName     = "flatnetworkips"
	FlatNetworkSubnetResourceName = "flatnetworksubnets"
)
View Source
var (
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	AddToScheme   = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: flatnetwork.GroupName, Version: "v1"}

SchemeGroupVersion is group version used to register these objects

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 FlatNetworkIP

type FlatNetworkIP struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   IPSpec   `json:"spec"`
	Status IPStatus `json:"status"`
}

FlatNetworkIP is a specification for a flat-network FlatNetworkIP resource

func NewFlatNetworkIP

func NewFlatNetworkIP(namespace, name string, obj FlatNetworkIP) *FlatNetworkIP

func (*FlatNetworkIP) DeepCopy

func (in *FlatNetworkIP) DeepCopy() *FlatNetworkIP

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

func (*FlatNetworkIP) DeepCopyInto

func (in *FlatNetworkIP) DeepCopyInto(out *FlatNetworkIP)

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

func (*FlatNetworkIP) DeepCopyObject

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

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

type FlatNetworkIPList

type FlatNetworkIPList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []FlatNetworkIP `json:"items"`
}

FlatNetworkIPList is a list of FlatNetworkIP resources

func (*FlatNetworkIPList) DeepCopy

func (in *FlatNetworkIPList) DeepCopy() *FlatNetworkIPList

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

func (*FlatNetworkIPList) DeepCopyInto

func (in *FlatNetworkIPList) DeepCopyInto(out *FlatNetworkIPList)

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

func (*FlatNetworkIPList) DeepCopyObject

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

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

type FlatNetworkSubnet

type FlatNetworkSubnet struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   SubnetSpec   `json:"spec"`
	Status SubnetStatus `json:"status"`
}

func NewFlatNetworkSubnet

func NewFlatNetworkSubnet(namespace, name string, obj FlatNetworkSubnet) *FlatNetworkSubnet

func (*FlatNetworkSubnet) DeepCopy

func (in *FlatNetworkSubnet) DeepCopy() *FlatNetworkSubnet

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

func (*FlatNetworkSubnet) DeepCopyInto

func (in *FlatNetworkSubnet) DeepCopyInto(out *FlatNetworkSubnet)

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

func (*FlatNetworkSubnet) DeepCopyObject

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

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

type FlatNetworkSubnetList

type FlatNetworkSubnetList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []FlatNetworkSubnet `json:"items"`
}

FlatNetworkSubnetList is a list of FlatNetworkSubnet resources

func (*FlatNetworkSubnetList) DeepCopy

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

func (*FlatNetworkSubnetList) DeepCopyInto

func (in *FlatNetworkSubnetList) DeepCopyInto(out *FlatNetworkSubnetList)

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

func (*FlatNetworkSubnetList) DeepCopyObject

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

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

type IPRange

type IPRange struct {
	From net.IP `json:"from"`
	To   net.IP `json:"to"`
}

IPRange defines the closed interval [from, to] of IP ranges.

func (*IPRange) DeepCopy

func (in *IPRange) DeepCopy() *IPRange

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

func (*IPRange) DeepCopyInto

func (in *IPRange) DeepCopyInto(out *IPRange)

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

type IPSpec

type IPSpec struct {
	// Subnet is the name of the flat-network subnet resource (required).
	Subnet string `json:"subnet"`

	// Addrs is the user specified IP addresses (optional).
	Addrs []net.IP `json:"addrs"`

	// MACs is the user specified MAC addresses (optional).
	MACs []string `json:"macs"`

	// PodID is the Pod metadata.UID
	PodID string `json:"podId"`
}

IPSpec is the spec for a IP resource

func (*IPSpec) DeepCopy

func (in *IPSpec) DeepCopy() *IPSpec

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

func (*IPSpec) DeepCopyInto

func (in *IPSpec) DeepCopyInto(out *IPSpec)

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

type IPStatus

type IPStatus struct {
	Phase          string `json:"phase"`
	FailureMessage string `json:"failureMessage"`

	// Addr is the allocated IP address.
	Addr net.IP `json:"addr"`

	// MAC is actual allocated MAC address by CNI
	// can be random in auto mode, or specidied by user.
	MAC string `json:"mac"`
}

func (*IPStatus) DeepCopy

func (in *IPStatus) DeepCopy() *IPStatus

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

func (*IPStatus) DeepCopyInto

func (in *IPStatus) DeepCopyInto(out *IPStatus)

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

type Route

type Route struct {
	Dev      string `json:"dev"`           // Interface (dev) name
	Dst      string `json:"dst"`           // Dst CIDR
	Src      net.IP `json:"src,omitempty"` // Src (optional)
	Via      net.IP `json:"via,omitempty"` // Via (gateway) (optional)
	Priority int    `json:"priority"`      // Priority (optional)
}

Example: ip route add <DST_CIDR> dev <DEV_NAME> via <VIA_GATEWAY_ADDR> src <SRC_ADDR> metrics <PRIORITY>

func (*Route) DeepCopy

func (in *Route) DeepCopy() *Route

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

func (*Route) DeepCopyInto

func (in *Route) DeepCopyInto(out *Route)

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

type RouteSettings

type RouteSettings struct {
	// AddClusterCIDR adds ClusterCIDR route to eth0 for flat-network pod if enabled.
	// This option can be used when eth1 (flatNetwork iface) is default gateway.
	AddClusterCIDR bool `json:"addClusterCIDR"`

	// AddServiceCIDR adds ServiceCIDR route to eth0 for flat-network pod if enabled.
	// This option can be used when eth1 (flatNetwork iface) is default gateway.
	AddServiceCIDR bool `json:"addServiceCIDR"`

	// AddNodeCIDR adds node CIDR route to eth0 for flat-network pod if enabled.
	// This option can be used when eth1 (flatNetwork iface) is default gateway.
	AddNodeCIDR bool `json:"addNodeCIDR"`

	// AddPodIPToHost adds pod flat-network IP routes on node host NS if enabled.
	// If true, it will allow node to directly access Pods running on the current node by flat-network IP.
	// If false, node cannot access Pods running on the current node by flat-network IP.
	AddPodIPToHost bool `json:"addPodIPToHost"`

	// FlatNetworkDefaultGateway lets Pod using the flat-network iface as default gateway.
	// NOTE: set 'addClusterCIDR', 'addServiceCIDR', 'addNodeCIDR' to true if needed
	// when pod is using the flat-network iface as the default gateway.
	//
	// And the pods’ access to other networks will be restricted.
	// For example, Pods cannot directly access the public networks.
	FlatNetworkDefaultGateway bool `json:"flatNetworkDefaultGateway"`
}

func (*RouteSettings) DeepCopy

func (in *RouteSettings) DeepCopy() *RouteSettings

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

func (*RouteSettings) DeepCopyInto

func (in *RouteSettings) DeepCopyInto(out *RouteSettings)

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

type SubnetSpec

type SubnetSpec struct {
	// FlatMode is the mode of the flat-network, can be 'macvlan', 'ipvlan'
	FlatMode string `json:"flatMode"`

	// Master is the network interface name.
	Master string `json:"master"`

	// VLAN is the VLAN ID of this subnet.
	VLAN int `json:"vlan"`

	// CIDR is a IPv4/IPv6 network CIDR block of this subnet.
	CIDR string `json:"cidr"`

	// Mode is the network mode for macvlan/ipvlan.
	//
	// macvlan: 'bridge, vepa, private, passthru' (default 'bridge');
	// ipvlan: 'l2, l3, l3s' (default 'l2');
	Mode string `json:"mode"`

	// IPvlanFlag is the flag of IPvlan.
	// Only required when Mode is 'ipvlan'.
	// can be 'bridge, private, vepa' (default 'bridge')
	IPvlanFlag string `json:"ipvlanFlag"`

	// Gateway is the gateway of the subnet (optional).
	Gateway net.IP `json:"gateway"`

	// Ranges is the IP range to allocate IP address (optional).
	Ranges []IPRange `json:"ranges,omitempty"`

	// Routes defines the custom routes.
	Routes []Route `json:"routes,omitempty"`

	// RouteSettings provides some advanced options for custom routes.
	RouteSettings RouteSettings `json:"routeSettings"`
}

func (*SubnetSpec) DeepCopy

func (in *SubnetSpec) DeepCopy() *SubnetSpec

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

func (*SubnetSpec) DeepCopyInto

func (in *SubnetSpec) DeepCopyInto(out *SubnetSpec)

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

type SubnetStatus

type SubnetStatus struct {
	Phase          string `json:"phase"`
	FailureMessage string `json:"failureMessage"`

	// Gateway is the gateway of the subnet.
	Gateway net.IP `json:"gateway"`

	// UsedIP is the used IPRange of this subnet.
	UsedIP      []IPRange `json:"usedIP"`
	UsedIPCount int       `json:"usedIPCount"`

	// UsedMAC is the **USER SPECIFIED** used MAC address.
	UsedMAC []string `json:"usedMac"`
}

func (*SubnetStatus) DeepCopy

func (in *SubnetStatus) DeepCopy() *SubnetStatus

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

func (*SubnetStatus) DeepCopyInto

func (in *SubnetStatus) DeepCopyInto(out *SubnetStatus)

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

Jump to

Keyboard shortcuts

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