Documentation ¶
Overview ¶
Package v1alpha1 contains API Schema definitions for the alcor v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=alcor.io
Package v1alpha1 contains API Schema definitions for the alcor v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=alcor.io
Index ¶
- Constants
- Variables
- func AddFinalizer(client client.Client, ipclaim *IPClaim, ippool *IPPool) error
- func ClaimIPs(client client.Client, reqLogger logr.Logger, ippool *IPPool, replicas int, ...) ([]string, error)
- func Contains(list []string, s string) bool
- func GetAllocatedValue(namespace, name string) string
- func GetIPFromIndex(index uint32) string
- func GetIPIndex(ip string) uint32
- func ReleaseClaimedIPs(client client.Client, reqLogger logr.Logger, ...) (map[string]string, error)
- func RemoveFinalizer(client client.Client, ipclaim *IPClaim, ippool *IPPool) error
- type IPClaim
- type IPClaimList
- type IPClaimSpec
- type IPClaimStatus
- type IPPool
- type IPPoolList
- type IPPoolSpec
- type IPPoolStatus
Constants ¶
const ( // IPClaimFinalizer is finalizer for IPClaim and IPClaimSet instance IPClaimFinalizer = "finalizer.ipclaim.alcor.io" // StatusReady stands ready status for instance IPClaim, IPClaimSet, IPPool StatusReady = "Ready" // StatusNotReady stands notReady status for instance IPClaim, IPClaimSet, IPPool StatusNotReady = "NotReady" // StatusIPPoolNotFound stands for IPPool not found status for IPClaim or IPClaimSet StatusIPPoolNotFound = "IPPool not found" // StatusIPPoolDrained stands for IPPool is drained status for IPClaim or IPClaimSet StatusIPPoolDrained = "IPPool is drained" // StatusIPClaimFailed stands for IPClaim status failed StatusIPClaimFailed = "Failed to claim IP" // StatusIPPreferedClaimFailed stands for IPClaim status that prefered IP is in using StatusIPPreferedClaimFailed = "Failed to claim prefered IP, it's in using" // StatusIPsInIPClaimSetStillInUse stands for IPClaimSet status that IP in use, so IPClaimSet cannot be deleted. StatusIPsInIPClaimSetStillInUse = "Failed to delete IPClaimSet, since some IPs are still in-use" // ErrorInnerErrorNoValidInstance stands for inner error that valid IPClaim or IPClaimSet found ErrorInnerErrorNoValidInstance = "No valid instance found" // ErrorInnerErrorClaimIPsParamError stands for inner error that ipPerfered used with replicase > 1 ErrorInnerErrorClaimIPsParamError = "IPPrefered cannot be used with replicas larger then 1" )
Variables ¶
var ( // SchemeGroupVersion is group version used to register these objects SchemeGroupVersion = schema.GroupVersion{Group: "alcor.io", Version: "v1alpha1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} )
Functions ¶
func AddFinalizer ¶
AddFinalizer add finalizer to IPClaim or IPPool instance
func ClaimIPs ¶
func ClaimIPs(client client.Client, reqLogger logr.Logger, ippool *IPPool, replicas int, namespace, name, ipPrefered string) ([]string, error)
ClaimIPs claims replicas specified number of IPs from IPPool
func GetAllocatedValue ¶
GetAllocatedValue will return owner info stored in allocatedIPs map
func GetIPFromIndex ¶
GetIPFromIndex calculates IP string from given IPIndex
Types ¶
type IPClaim ¶
type IPClaim struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec IPClaimSpec `json:"spec,omitempty"` Status IPClaimStatus `json:"status,omitempty"` }
IPClaim is the Schema for the ipclaims API +kubebuilder:subresource:status +kubebuilder:resource:path=ipclaims,scope=Namespaced,shortName=ipc +kubebuilder:printcolumn:name="IPPool",type=string,JSONPath=`.spec.ippool`,priority=0 +kubebuilder:printcolumn:name="IP",type=string,JSONPath=`.status.IP`,priority=0 +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.Status`,priority=0
func (*IPClaim) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaim.
func (*IPClaim) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*IPClaim) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type IPClaimList ¶
type IPClaimList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []IPClaim `json:"items"` }
IPClaimList contains a list of IPClaim
func (*IPClaimList) DeepCopy ¶
func (in *IPClaimList) DeepCopy() *IPClaimList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaimList.
func (*IPClaimList) DeepCopyInto ¶
func (in *IPClaimList) DeepCopyInto(out *IPClaimList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*IPClaimList) DeepCopyObject ¶
func (in *IPClaimList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type IPClaimSpec ¶
type IPClaimSpec struct { // IPPool name where IPClaim will try to claim IP from. IPPool string `json:"ippool"` // Perfered IP, IPClaim will try to claim specified IP if not in-using, otherwise, IPClaim will failed to claim an IP. IP string `json:"ip,omitempty"` // Mbps will be used by CNI to set bandwidth with claimd IP. NOTE: not all CNI(IPPool backend) support bandwidth setting. Mbps int32 `json:"mbps,omitempty"` }
IPClaimSpec defines the desired state of IPClaim
func (*IPClaimSpec) DeepCopy ¶
func (in *IPClaimSpec) DeepCopy() *IPClaimSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaimSpec.
func (*IPClaimSpec) DeepCopyInto ¶
func (in *IPClaimSpec) DeepCopyInto(out *IPClaimSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type IPClaimStatus ¶
type IPClaimStatus struct { // Claimed IP. IP string `json:"IP"` // IPPool backend, e.g. sriov/calico. Backend string `json:"Backend"` // IPClaim Status. "Ready" if IPClaim claims an IP successfully. "Failed to claim prefered IP, it's in using" if an IP is assigned in IPClaim.spec, but the specifed IP is claimed by another IPClaim. "Failed to claim IP" failed to locate an IP in IPPool. Status string `json:"Status"` }
IPClaimStatus defines the observed state of IPClaim
func (*IPClaimStatus) DeepCopy ¶
func (in *IPClaimStatus) DeepCopy() *IPClaimStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPClaimStatus.
func (*IPClaimStatus) DeepCopyInto ¶
func (in *IPClaimStatus) DeepCopyInto(out *IPClaimStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type IPPool ¶
type IPPool struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec IPPoolSpec `json:"spec,omitempty"` Status IPPoolStatus `json:"status,omitempty"` }
IPPool is the Schema for the ippools API +kubebuilder:subresource:status +kubebuilder:resource:path=ippools,scope=Cluster,shortName=ipp +kubebuilder:printcolumn:name="Start",type=string,JSONPath=`.spec.startIP`,priority=0 +kubebuilder:printcolumn:name="End",type=string,JSONPath=`.spec.endIP`,priority=0 +kubebuilder:printcolumn:name="Total",type=integer,JSONPath=`.status.ipCount`,priority=0 +kubebuilder:printcolumn:name="Avaialble",type=integer,JSONPath=`.status.availableCount`,priority=0
func (*IPPool) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPool.
func (*IPPool) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*IPPool) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type IPPoolList ¶
type IPPoolList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []IPPool `json:"items"` }
IPPoolList contains a list of IPPool
func (*IPPoolList) DeepCopy ¶
func (in *IPPoolList) DeepCopy() *IPPoolList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPoolList.
func (*IPPoolList) DeepCopyInto ¶
func (in *IPPoolList) DeepCopyInto(out *IPPoolList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*IPPoolList) DeepCopyObject ¶
func (in *IPPoolList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type IPPoolSpec ¶
type IPPoolSpec struct { // [StartIP, EndIP] defines the range of IPPool. StartIP string `json:"startIP"` // [StartIP, EndIP] defines the range of IPPool. EndIP string `json:"endIP"` // Defautl route/gateway in IPPool. Route string `json:"route"` // Mask for IP in IPPool, e.g. IP/MASK: 10.10.10.2/23 Mask int `json:"mask"` // Vlan for IP in IPPool. Vlan int `json:"vlan"` // Not supported yet. DisabledIP []string `json:"disabledIP"` // Which CNI will be used, this is used by other CRD resources to add annotations for pod. Backend string `json:"backend"` }
IPPoolSpec defines the desired state of IPPool
func (*IPPoolSpec) DeepCopy ¶
func (in *IPPoolSpec) DeepCopy() *IPPoolSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPoolSpec.
func (*IPPoolSpec) DeepCopyInto ¶
func (in *IPPoolSpec) DeepCopyInto(out *IPPoolSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type IPPoolStatus ¶
type IPPoolStatus struct { // Total count of IPs in IPPool. IPCount int `json:"ipCount"` // Count of IPs not in-use in IPPool. AvailableCount int `json:"availableCount"` // Allocated IPs map. in format {"uint32": "namespaceName.podName"}, you can use `python3 -c "import ipaddress; print(ipaddress.IPv4Address(<UINT32>))"` to get IP. AllocatedIPs map[string]string `json:"allocatedIPs"` // Status description of IPPool. Status string `json:"status"` // Last applied StartIP, equals to spec.StartIP if scaling successfully. LastAppliedStartIP string `json:"lastAppliedStartIP"` // Last applied EndIP, equals to spec.EndIP if scaling successfully. LastAppliedEndIP string `json:"lastAppliedEndIP"` }
IPPoolStatus defines the observed state of IPPool
func (*IPPoolStatus) DeepCopy ¶
func (in *IPPoolStatus) DeepCopy() *IPPoolStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPoolStatus.
func (*IPPoolStatus) DeepCopyInto ¶
func (in *IPPoolStatus) DeepCopyInto(out *IPPoolStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.