diff --git a/Dockerfile b/Dockerfile index 3d91faaa0..d84b5df8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,7 @@ COPY controllers/ controllers/ COPY equality/ equality/ COPY generated/ generated/ COPY registry/ registry/ +COPY tableconvertor/ tableconvertor/ ARG TARGETOS TARGETARCH diff --git a/apis/networking/register.go b/apis/networking/register.go index cd020413d..a38db3afc 100644 --- a/apis/networking/register.go +++ b/apis/networking/register.go @@ -48,6 +48,10 @@ func addKnownTypes(scheme *runtime.Scheme) error { &NetworkInterfaceList{}, &Network{}, &NetworkList{}, + &VirtualIP{}, + &VirtualIPList{}, + &VirtualIPRouting{}, + &VirtualIPRoutingList{}, ) return nil } diff --git a/apis/networking/v1alpha1/register.go b/apis/networking/v1alpha1/register.go index ef5523fe9..3d4408f38 100644 --- a/apis/networking/v1alpha1/register.go +++ b/apis/networking/v1alpha1/register.go @@ -50,6 +50,10 @@ func addKnownTypes(scheme *runtime.Scheme) error { &NetworkInterfaceList{}, &Network{}, &NetworkList{}, + &VirtualIP{}, + &VirtualIPList{}, + &VirtualIPRouting{}, + &VirtualIPRoutingList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/apis/networking/v1alpha1/virtualip_types.go b/apis/networking/v1alpha1/virtualip_types.go new file mode 100644 index 000000000..20da34aca --- /dev/null +++ b/apis/networking/v1alpha1/virtualip_types.go @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2022 by the OnMetal authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1alpha1 + +import ( + commonv1alpha1 "github.com/onmetal/onmetal-api/apis/common/v1alpha1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VirtualIPSpec defines the desired state of VirtualIP +type VirtualIPSpec struct { + // Type is the type of VirtualIP. + Type VirtualIPType `json:"type"` + // IPFamily is the ip family of the VirtualIP. + IPFamily corev1.IPFamily `json:"ipFamily"` + // NetworkInterfaceSelector selects any NetworkInterface that should get the VirtualIP routed. + // If empty, it is assumed that an external process manages the VirtualIPRouting for this VirtualIP. + NetworkInterfaceSelector *metav1.LabelSelector `json:"networkInterfaceSelector,omitempty"` +} + +// VirtualIPType is a type of VirtualIP. +type VirtualIPType string + +const ( + // VirtualIPTypePublic is a VirtualIP that allocates and routes a stable public IP. + VirtualIPTypePublic VirtualIPType = "Public" +) + +// VirtualIPStatus defines the observed state of VirtualIP +type VirtualIPStatus struct { + // IP is the allocated IP, if any. + IP *commonv1alpha1.IP `json:"ip,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VirtualIP is the Schema for the virtualips API +type VirtualIP struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec VirtualIPSpec `json:"spec,omitempty"` + Status VirtualIPStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VirtualIPList contains a list of VirtualIP +type VirtualIPList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []VirtualIP `json:"items"` +} diff --git a/apis/networking/v1alpha1/virtualiprouting_types.go b/apis/networking/v1alpha1/virtualiprouting_types.go new file mode 100644 index 000000000..262416ad5 --- /dev/null +++ b/apis/networking/v1alpha1/virtualiprouting_types.go @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2022 by the OnMetal authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1alpha1 + +import ( + commonv1alpha1 "github.com/onmetal/onmetal-api/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VirtualIPRouting is the Schema for the virtualiproutings API +type VirtualIPRouting struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Subsets are the subsets that make up a VirtualIPRouting. + Subsets []VirtualIPRoutingSubset `json:"subsets,omitempty"` +} + +// LocalUIDReference is a reference to another entity including its UID. +type LocalUIDReference struct { + // Name is the name of the referenced entity. + Name string `json:"name"` + // UID is the UID of the referenced entity. + UID types.UID +} + +// VirtualIPRoutingSubset is one of the targets of a VirtualIPRouting. +type VirtualIPRoutingSubset struct { + // IP is the IP of the entity routed towards. + IP commonv1alpha1.IP `json:"ip"` + // TargetRef is the targeted entity. + TargetRef LocalUIDReference `json:"targetRef"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VirtualIPRoutingList contains a list of VirtualIPRouting +type VirtualIPRoutingList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []VirtualIPRouting `json:"items"` +} diff --git a/apis/networking/v1alpha1/zz_generated.conversion.go b/apis/networking/v1alpha1/zz_generated.conversion.go index bc04d701e..4ad950421 100644 --- a/apis/networking/v1alpha1/zz_generated.conversion.go +++ b/apis/networking/v1alpha1/zz_generated.conversion.go @@ -28,8 +28,10 @@ import ( ipamv1alpha1 "github.com/onmetal/onmetal-api/apis/ipam/v1alpha1" networking "github.com/onmetal/onmetal-api/apis/networking" v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" + types "k8s.io/apimachinery/pkg/types" ) func init() { @@ -59,6 +61,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*LocalUIDReference)(nil), (*networking.LocalUIDReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LocalUIDReference_To_networking_LocalUIDReference(a.(*LocalUIDReference), b.(*networking.LocalUIDReference), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*networking.LocalUIDReference)(nil), (*LocalUIDReference)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_networking_LocalUIDReference_To_v1alpha1_LocalUIDReference(a.(*networking.LocalUIDReference), b.(*LocalUIDReference), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*Network)(nil), (*networking.Network)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_Network_To_networking_Network(a.(*Network), b.(*networking.Network), scope) }); err != nil { @@ -119,6 +131,76 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*VirtualIP)(nil), (*networking.VirtualIP)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VirtualIP_To_networking_VirtualIP(a.(*VirtualIP), b.(*networking.VirtualIP), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*networking.VirtualIP)(nil), (*VirtualIP)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_networking_VirtualIP_To_v1alpha1_VirtualIP(a.(*networking.VirtualIP), b.(*VirtualIP), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VirtualIPList)(nil), (*networking.VirtualIPList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VirtualIPList_To_networking_VirtualIPList(a.(*VirtualIPList), b.(*networking.VirtualIPList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*networking.VirtualIPList)(nil), (*VirtualIPList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_networking_VirtualIPList_To_v1alpha1_VirtualIPList(a.(*networking.VirtualIPList), b.(*VirtualIPList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VirtualIPRouting)(nil), (*networking.VirtualIPRouting)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VirtualIPRouting_To_networking_VirtualIPRouting(a.(*VirtualIPRouting), b.(*networking.VirtualIPRouting), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*networking.VirtualIPRouting)(nil), (*VirtualIPRouting)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_networking_VirtualIPRouting_To_v1alpha1_VirtualIPRouting(a.(*networking.VirtualIPRouting), b.(*VirtualIPRouting), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VirtualIPRoutingList)(nil), (*networking.VirtualIPRoutingList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VirtualIPRoutingList_To_networking_VirtualIPRoutingList(a.(*VirtualIPRoutingList), b.(*networking.VirtualIPRoutingList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*networking.VirtualIPRoutingList)(nil), (*VirtualIPRoutingList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_networking_VirtualIPRoutingList_To_v1alpha1_VirtualIPRoutingList(a.(*networking.VirtualIPRoutingList), b.(*VirtualIPRoutingList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VirtualIPRoutingSubset)(nil), (*networking.VirtualIPRoutingSubset)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VirtualIPRoutingSubset_To_networking_VirtualIPRoutingSubset(a.(*VirtualIPRoutingSubset), b.(*networking.VirtualIPRoutingSubset), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*networking.VirtualIPRoutingSubset)(nil), (*VirtualIPRoutingSubset)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_networking_VirtualIPRoutingSubset_To_v1alpha1_VirtualIPRoutingSubset(a.(*networking.VirtualIPRoutingSubset), b.(*VirtualIPRoutingSubset), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VirtualIPSpec)(nil), (*networking.VirtualIPSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VirtualIPSpec_To_networking_VirtualIPSpec(a.(*VirtualIPSpec), b.(*networking.VirtualIPSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*networking.VirtualIPSpec)(nil), (*VirtualIPSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_networking_VirtualIPSpec_To_v1alpha1_VirtualIPSpec(a.(*networking.VirtualIPSpec), b.(*VirtualIPSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*VirtualIPStatus)(nil), (*networking.VirtualIPStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_VirtualIPStatus_To_networking_VirtualIPStatus(a.(*VirtualIPStatus), b.(*networking.VirtualIPStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*networking.VirtualIPStatus)(nil), (*VirtualIPStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_networking_VirtualIPStatus_To_v1alpha1_VirtualIPStatus(a.(*networking.VirtualIPStatus), b.(*VirtualIPStatus), scope) + }); err != nil { + return err + } return nil } @@ -164,6 +246,28 @@ func Convert_networking_IPSource_To_v1alpha1_IPSource(in *networking.IPSource, o return autoConvert_networking_IPSource_To_v1alpha1_IPSource(in, out, s) } +func autoConvert_v1alpha1_LocalUIDReference_To_networking_LocalUIDReference(in *LocalUIDReference, out *networking.LocalUIDReference, s conversion.Scope) error { + out.Name = in.Name + out.UID = types.UID(in.UID) + return nil +} + +// Convert_v1alpha1_LocalUIDReference_To_networking_LocalUIDReference is an autogenerated conversion function. +func Convert_v1alpha1_LocalUIDReference_To_networking_LocalUIDReference(in *LocalUIDReference, out *networking.LocalUIDReference, s conversion.Scope) error { + return autoConvert_v1alpha1_LocalUIDReference_To_networking_LocalUIDReference(in, out, s) +} + +func autoConvert_networking_LocalUIDReference_To_v1alpha1_LocalUIDReference(in *networking.LocalUIDReference, out *LocalUIDReference, s conversion.Scope) error { + out.Name = in.Name + out.UID = types.UID(in.UID) + return nil +} + +// Convert_networking_LocalUIDReference_To_v1alpha1_LocalUIDReference is an autogenerated conversion function. +func Convert_networking_LocalUIDReference_To_v1alpha1_LocalUIDReference(in *networking.LocalUIDReference, out *LocalUIDReference, s conversion.Scope) error { + return autoConvert_networking_LocalUIDReference_To_v1alpha1_LocalUIDReference(in, out, s) +} + func autoConvert_v1alpha1_Network_To_networking_Network(in *Network, out *networking.Network, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta return nil @@ -305,3 +409,171 @@ func autoConvert_networking_NetworkList_To_v1alpha1_NetworkList(in *networking.N func Convert_networking_NetworkList_To_v1alpha1_NetworkList(in *networking.NetworkList, out *NetworkList, s conversion.Scope) error { return autoConvert_networking_NetworkList_To_v1alpha1_NetworkList(in, out, s) } + +func autoConvert_v1alpha1_VirtualIP_To_networking_VirtualIP(in *VirtualIP, out *networking.VirtualIP, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_VirtualIPSpec_To_networking_VirtualIPSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_v1alpha1_VirtualIPStatus_To_networking_VirtualIPStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_VirtualIP_To_networking_VirtualIP is an autogenerated conversion function. +func Convert_v1alpha1_VirtualIP_To_networking_VirtualIP(in *VirtualIP, out *networking.VirtualIP, s conversion.Scope) error { + return autoConvert_v1alpha1_VirtualIP_To_networking_VirtualIP(in, out, s) +} + +func autoConvert_networking_VirtualIP_To_v1alpha1_VirtualIP(in *networking.VirtualIP, out *VirtualIP, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_networking_VirtualIPSpec_To_v1alpha1_VirtualIPSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + if err := Convert_networking_VirtualIPStatus_To_v1alpha1_VirtualIPStatus(&in.Status, &out.Status, s); err != nil { + return err + } + return nil +} + +// Convert_networking_VirtualIP_To_v1alpha1_VirtualIP is an autogenerated conversion function. +func Convert_networking_VirtualIP_To_v1alpha1_VirtualIP(in *networking.VirtualIP, out *VirtualIP, s conversion.Scope) error { + return autoConvert_networking_VirtualIP_To_v1alpha1_VirtualIP(in, out, s) +} + +func autoConvert_v1alpha1_VirtualIPList_To_networking_VirtualIPList(in *VirtualIPList, out *networking.VirtualIPList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]networking.VirtualIP)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_VirtualIPList_To_networking_VirtualIPList is an autogenerated conversion function. +func Convert_v1alpha1_VirtualIPList_To_networking_VirtualIPList(in *VirtualIPList, out *networking.VirtualIPList, s conversion.Scope) error { + return autoConvert_v1alpha1_VirtualIPList_To_networking_VirtualIPList(in, out, s) +} + +func autoConvert_networking_VirtualIPList_To_v1alpha1_VirtualIPList(in *networking.VirtualIPList, out *VirtualIPList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]VirtualIP)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_networking_VirtualIPList_To_v1alpha1_VirtualIPList is an autogenerated conversion function. +func Convert_networking_VirtualIPList_To_v1alpha1_VirtualIPList(in *networking.VirtualIPList, out *VirtualIPList, s conversion.Scope) error { + return autoConvert_networking_VirtualIPList_To_v1alpha1_VirtualIPList(in, out, s) +} + +func autoConvert_v1alpha1_VirtualIPRouting_To_networking_VirtualIPRouting(in *VirtualIPRouting, out *networking.VirtualIPRouting, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Subsets = *(*[]networking.VirtualIPRoutingSubset)(unsafe.Pointer(&in.Subsets)) + return nil +} + +// Convert_v1alpha1_VirtualIPRouting_To_networking_VirtualIPRouting is an autogenerated conversion function. +func Convert_v1alpha1_VirtualIPRouting_To_networking_VirtualIPRouting(in *VirtualIPRouting, out *networking.VirtualIPRouting, s conversion.Scope) error { + return autoConvert_v1alpha1_VirtualIPRouting_To_networking_VirtualIPRouting(in, out, s) +} + +func autoConvert_networking_VirtualIPRouting_To_v1alpha1_VirtualIPRouting(in *networking.VirtualIPRouting, out *VirtualIPRouting, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.Subsets = *(*[]VirtualIPRoutingSubset)(unsafe.Pointer(&in.Subsets)) + return nil +} + +// Convert_networking_VirtualIPRouting_To_v1alpha1_VirtualIPRouting is an autogenerated conversion function. +func Convert_networking_VirtualIPRouting_To_v1alpha1_VirtualIPRouting(in *networking.VirtualIPRouting, out *VirtualIPRouting, s conversion.Scope) error { + return autoConvert_networking_VirtualIPRouting_To_v1alpha1_VirtualIPRouting(in, out, s) +} + +func autoConvert_v1alpha1_VirtualIPRoutingList_To_networking_VirtualIPRoutingList(in *VirtualIPRoutingList, out *networking.VirtualIPRoutingList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]networking.VirtualIPRouting)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_VirtualIPRoutingList_To_networking_VirtualIPRoutingList is an autogenerated conversion function. +func Convert_v1alpha1_VirtualIPRoutingList_To_networking_VirtualIPRoutingList(in *VirtualIPRoutingList, out *networking.VirtualIPRoutingList, s conversion.Scope) error { + return autoConvert_v1alpha1_VirtualIPRoutingList_To_networking_VirtualIPRoutingList(in, out, s) +} + +func autoConvert_networking_VirtualIPRoutingList_To_v1alpha1_VirtualIPRoutingList(in *networking.VirtualIPRoutingList, out *VirtualIPRoutingList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]VirtualIPRouting)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_networking_VirtualIPRoutingList_To_v1alpha1_VirtualIPRoutingList is an autogenerated conversion function. +func Convert_networking_VirtualIPRoutingList_To_v1alpha1_VirtualIPRoutingList(in *networking.VirtualIPRoutingList, out *VirtualIPRoutingList, s conversion.Scope) error { + return autoConvert_networking_VirtualIPRoutingList_To_v1alpha1_VirtualIPRoutingList(in, out, s) +} + +func autoConvert_v1alpha1_VirtualIPRoutingSubset_To_networking_VirtualIPRoutingSubset(in *VirtualIPRoutingSubset, out *networking.VirtualIPRoutingSubset, s conversion.Scope) error { + out.IP = in.IP + if err := Convert_v1alpha1_LocalUIDReference_To_networking_LocalUIDReference(&in.TargetRef, &out.TargetRef, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_VirtualIPRoutingSubset_To_networking_VirtualIPRoutingSubset is an autogenerated conversion function. +func Convert_v1alpha1_VirtualIPRoutingSubset_To_networking_VirtualIPRoutingSubset(in *VirtualIPRoutingSubset, out *networking.VirtualIPRoutingSubset, s conversion.Scope) error { + return autoConvert_v1alpha1_VirtualIPRoutingSubset_To_networking_VirtualIPRoutingSubset(in, out, s) +} + +func autoConvert_networking_VirtualIPRoutingSubset_To_v1alpha1_VirtualIPRoutingSubset(in *networking.VirtualIPRoutingSubset, out *VirtualIPRoutingSubset, s conversion.Scope) error { + out.IP = in.IP + if err := Convert_networking_LocalUIDReference_To_v1alpha1_LocalUIDReference(&in.TargetRef, &out.TargetRef, s); err != nil { + return err + } + return nil +} + +// Convert_networking_VirtualIPRoutingSubset_To_v1alpha1_VirtualIPRoutingSubset is an autogenerated conversion function. +func Convert_networking_VirtualIPRoutingSubset_To_v1alpha1_VirtualIPRoutingSubset(in *networking.VirtualIPRoutingSubset, out *VirtualIPRoutingSubset, s conversion.Scope) error { + return autoConvert_networking_VirtualIPRoutingSubset_To_v1alpha1_VirtualIPRoutingSubset(in, out, s) +} + +func autoConvert_v1alpha1_VirtualIPSpec_To_networking_VirtualIPSpec(in *VirtualIPSpec, out *networking.VirtualIPSpec, s conversion.Scope) error { + out.Type = networking.VirtualIPType(in.Type) + out.IPFamily = v1.IPFamily(in.IPFamily) + out.NetworkInterfaceSelector = (*metav1.LabelSelector)(unsafe.Pointer(in.NetworkInterfaceSelector)) + return nil +} + +// Convert_v1alpha1_VirtualIPSpec_To_networking_VirtualIPSpec is an autogenerated conversion function. +func Convert_v1alpha1_VirtualIPSpec_To_networking_VirtualIPSpec(in *VirtualIPSpec, out *networking.VirtualIPSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_VirtualIPSpec_To_networking_VirtualIPSpec(in, out, s) +} + +func autoConvert_networking_VirtualIPSpec_To_v1alpha1_VirtualIPSpec(in *networking.VirtualIPSpec, out *VirtualIPSpec, s conversion.Scope) error { + out.Type = VirtualIPType(in.Type) + out.IPFamily = v1.IPFamily(in.IPFamily) + out.NetworkInterfaceSelector = (*metav1.LabelSelector)(unsafe.Pointer(in.NetworkInterfaceSelector)) + return nil +} + +// Convert_networking_VirtualIPSpec_To_v1alpha1_VirtualIPSpec is an autogenerated conversion function. +func Convert_networking_VirtualIPSpec_To_v1alpha1_VirtualIPSpec(in *networking.VirtualIPSpec, out *VirtualIPSpec, s conversion.Scope) error { + return autoConvert_networking_VirtualIPSpec_To_v1alpha1_VirtualIPSpec(in, out, s) +} + +func autoConvert_v1alpha1_VirtualIPStatus_To_networking_VirtualIPStatus(in *VirtualIPStatus, out *networking.VirtualIPStatus, s conversion.Scope) error { + out.IP = (*commonv1alpha1.IP)(unsafe.Pointer(in.IP)) + return nil +} + +// Convert_v1alpha1_VirtualIPStatus_To_networking_VirtualIPStatus is an autogenerated conversion function. +func Convert_v1alpha1_VirtualIPStatus_To_networking_VirtualIPStatus(in *VirtualIPStatus, out *networking.VirtualIPStatus, s conversion.Scope) error { + return autoConvert_v1alpha1_VirtualIPStatus_To_networking_VirtualIPStatus(in, out, s) +} + +func autoConvert_networking_VirtualIPStatus_To_v1alpha1_VirtualIPStatus(in *networking.VirtualIPStatus, out *VirtualIPStatus, s conversion.Scope) error { + out.IP = (*commonv1alpha1.IP)(unsafe.Pointer(in.IP)) + return nil +} + +// Convert_networking_VirtualIPStatus_To_v1alpha1_VirtualIPStatus is an autogenerated conversion function. +func Convert_networking_VirtualIPStatus_To_v1alpha1_VirtualIPStatus(in *networking.VirtualIPStatus, out *VirtualIPStatus, s conversion.Scope) error { + return autoConvert_networking_VirtualIPStatus_To_v1alpha1_VirtualIPStatus(in, out, s) +} diff --git a/apis/networking/v1alpha1/zz_generated.deepcopy.go b/apis/networking/v1alpha1/zz_generated.deepcopy.go index ad9daa88d..beed281ea 100644 --- a/apis/networking/v1alpha1/zz_generated.deepcopy.go +++ b/apis/networking/v1alpha1/zz_generated.deepcopy.go @@ -24,6 +24,7 @@ import ( commonv1alpha1 "github.com/onmetal/onmetal-api/apis/common/v1alpha1" ipamv1alpha1 "github.com/onmetal/onmetal-api/apis/ipam/v1alpha1" v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -73,6 +74,22 @@ func (in *IPSource) DeepCopy() *IPSource { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LocalUIDReference) DeepCopyInto(out *LocalUIDReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalUIDReference. +func (in *LocalUIDReference) DeepCopy() *LocalUIDReference { + if in == nil { + return nil + } + out := new(LocalUIDReference) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Network) DeepCopyInto(out *Network) { *out = *in @@ -245,3 +262,189 @@ func (in *NetworkList) DeepCopyObject() runtime.Object { } return nil } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIP) DeepCopyInto(out *VirtualIP) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIP. +func (in *VirtualIP) DeepCopy() *VirtualIP { + if in == nil { + return nil + } + out := new(VirtualIP) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VirtualIP) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIPList) DeepCopyInto(out *VirtualIPList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VirtualIP, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIPList. +func (in *VirtualIPList) DeepCopy() *VirtualIPList { + if in == nil { + return nil + } + out := new(VirtualIPList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VirtualIPList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIPRouting) DeepCopyInto(out *VirtualIPRouting) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Subsets != nil { + in, out := &in.Subsets, &out.Subsets + *out = make([]VirtualIPRoutingSubset, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIPRouting. +func (in *VirtualIPRouting) DeepCopy() *VirtualIPRouting { + if in == nil { + return nil + } + out := new(VirtualIPRouting) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VirtualIPRouting) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIPRoutingList) DeepCopyInto(out *VirtualIPRoutingList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VirtualIPRouting, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIPRoutingList. +func (in *VirtualIPRoutingList) DeepCopy() *VirtualIPRoutingList { + if in == nil { + return nil + } + out := new(VirtualIPRoutingList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VirtualIPRoutingList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIPRoutingSubset) DeepCopyInto(out *VirtualIPRoutingSubset) { + *out = *in + in.IP.DeepCopyInto(&out.IP) + out.TargetRef = in.TargetRef + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIPRoutingSubset. +func (in *VirtualIPRoutingSubset) DeepCopy() *VirtualIPRoutingSubset { + if in == nil { + return nil + } + out := new(VirtualIPRoutingSubset) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIPSpec) DeepCopyInto(out *VirtualIPSpec) { + *out = *in + if in.NetworkInterfaceSelector != nil { + in, out := &in.NetworkInterfaceSelector, &out.NetworkInterfaceSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIPSpec. +func (in *VirtualIPSpec) DeepCopy() *VirtualIPSpec { + if in == nil { + return nil + } + out := new(VirtualIPSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIPStatus) DeepCopyInto(out *VirtualIPStatus) { + *out = *in + if in.IP != nil { + in, out := &in.IP, &out.IP + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIPStatus. +func (in *VirtualIPStatus) DeepCopy() *VirtualIPStatus { + if in == nil { + return nil + } + out := new(VirtualIPStatus) + in.DeepCopyInto(out) + return out +} diff --git a/apis/networking/validation/virtualip.go b/apis/networking/validation/virtualip.go new file mode 100644 index 000000000..5cb9dc937 --- /dev/null +++ b/apis/networking/validation/virtualip.go @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2022 by the OnMetal authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package validation + +import ( + onmetalapivalidation "github.com/onmetal/onmetal-api/api/validation" + "github.com/onmetal/onmetal-api/apis/networking" + apivalidation "k8s.io/apimachinery/pkg/api/validation" + metav1validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// ValidateVirtualIP validates a virtual ip object. +func ValidateVirtualIP(virtualIP *networking.VirtualIP) field.ErrorList { + var allErrs field.ErrorList + + allErrs = append(allErrs, apivalidation.ValidateObjectMetaAccessor(virtualIP, true, apivalidation.NameIsDNSLabel, field.NewPath("metadata"))...) + allErrs = append(allErrs, validateVirtualIPSpec(&virtualIP.Spec, field.NewPath("spec"))...) + + return allErrs +} + +// ValidateVirtualIPUpdate validates a VirtualIP object before an update. +func ValidateVirtualIPUpdate(newVirtualIP, oldVirtualIP *networking.VirtualIP) field.ErrorList { + var allErrs field.ErrorList + + allErrs = append(allErrs, apivalidation.ValidateObjectMetaAccessorUpdate(newVirtualIP, oldVirtualIP, field.NewPath("metadata"))...) + allErrs = append(allErrs, validateVirtualIPSpecUpdate(&newVirtualIP.Spec, &oldVirtualIP.Spec, field.NewPath("spec"))...) + allErrs = append(allErrs, ValidateVirtualIP(newVirtualIP)...) + + return allErrs +} + +var supportedVirtualIPTypes = sets.NewString( + string(networking.VirtualIPTypePublic), +) + +func validateVirtualIPSpec(spec *networking.VirtualIPSpec, fldPath *field.Path) field.ErrorList { + var allErrs field.ErrorList + + allErrs = append(allErrs, onmetalapivalidation.ValidateStringSetEnum(supportedVirtualIPTypes, string(spec.Type), fldPath.Child("type"), "must specify type")...) + allErrs = append(allErrs, onmetalapivalidation.ValidateIPFamily(spec.IPFamily, fldPath.Child("ipFamily"))...) + allErrs = append(allErrs, metav1validation.ValidateLabelSelector(spec.NetworkInterfaceSelector, fldPath.Child("networkInterfaceSelector"))...) + + return allErrs +} + +// validateVirtualIPSpecUpdate validates the spec of a VirtualIP object before an update. +func validateVirtualIPSpecUpdate(newSpec, oldSpec *networking.VirtualIPSpec, fldPath *field.Path) field.ErrorList { + var allErrs field.ErrorList + + newSpecCopy := newSpec.DeepCopy() + oldSpecCopy := oldSpec.DeepCopy() + + oldSpecCopy.NetworkInterfaceSelector = newSpec.NetworkInterfaceSelector + allErrs = append(allErrs, onmetalapivalidation.ValidateImmutableFieldWithDiff(newSpecCopy, oldSpecCopy, fldPath)...) + + return allErrs +} diff --git a/apis/networking/validation/virtualip_test.go b/apis/networking/validation/virtualip_test.go new file mode 100644 index 000000000..5278d8508 --- /dev/null +++ b/apis/networking/validation/virtualip_test.go @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2022 by the OnMetal authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package validation + +import ( + "github.com/onmetal/onmetal-api/apis/networking" + . "github.com/onmetal/onmetal-api/testutils/validation" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/types" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +var _ = Describe("VirtualIP", func() { + DescribeTable("ValidateVirtualIP", + func(virtualIP *networking.VirtualIP, match types.GomegaMatcher) { + errList := ValidateVirtualIP(virtualIP) + Expect(errList).To(match) + }, + Entry("missing name", + &networking.VirtualIP{}, + ContainElement(RequiredField("metadata.name")), + ), + Entry("missing namespace", + &networking.VirtualIP{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}, + ContainElement(RequiredField("metadata.namespace")), + ), + Entry("bad name", + &networking.VirtualIP{ObjectMeta: metav1.ObjectMeta{Name: "foo*"}}, + ContainElement(InvalidField("metadata.name")), + ), + Entry("no type", + &networking.VirtualIP{}, + ContainElement(RequiredField("spec.type")), + ), + Entry("invalid type", + &networking.VirtualIP{ + Spec: networking.VirtualIPSpec{ + Type: "invalid", + }, + }, + ContainElement(NotSupportedField("spec.type")), + ), + Entry("no ip family", + &networking.VirtualIP{}, + ContainElement(RequiredField("spec.ipFamily")), + ), + Entry("invalid ip family", + &networking.VirtualIP{ + Spec: networking.VirtualIPSpec{ + IPFamily: "invalid", + }, + }, + ContainElement(NotSupportedField("spec.ipFamily")), + ), + Entry("valid virtual ip", + &networking.VirtualIP{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "foo", + Name: "bar", + }, + Spec: networking.VirtualIPSpec{ + Type: networking.VirtualIPTypePublic, + IPFamily: corev1.IPv4Protocol, + NetworkInterfaceSelector: &metav1.LabelSelector{ + MatchLabels: map[string]string{"foo": "bar"}, + }, + }, + }, + BeEmpty(), + ), + ) + + DescribeTable("ValidateVirtualIPUpdate", + func(newVirtualIP, oldVirtualIP *networking.VirtualIP, match types.GomegaMatcher) { + errList := ValidateVirtualIPUpdate(newVirtualIP, oldVirtualIP) + Expect(errList).To(match) + }, + Entry("immutable type", + &networking.VirtualIP{ + Spec: networking.VirtualIPSpec{ + Type: networking.VirtualIPTypePublic, + }, + }, + &networking.VirtualIP{ + Spec: networking.VirtualIPSpec{ + Type: "other", + }, + }, + ContainElement(ForbiddenField("spec")), + ), + Entry("immutable ip family", + &networking.VirtualIP{ + Spec: networking.VirtualIPSpec{ + IPFamily: corev1.IPv6Protocol, + }, + }, + &networking.VirtualIP{ + Spec: networking.VirtualIPSpec{ + IPFamily: corev1.IPv4Protocol, + }, + }, + ContainElement(ForbiddenField("spec")), + ), + Entry("mutable network interface selector", + &networking.VirtualIP{ + Spec: networking.VirtualIPSpec{ + NetworkInterfaceSelector: &metav1.LabelSelector{ + MatchLabels: map[string]string{"foo": "bar"}, + }, + }, + }, + &networking.VirtualIP{ + Spec: networking.VirtualIPSpec{ + NetworkInterfaceSelector: &metav1.LabelSelector{ + MatchLabels: map[string]string{"bar": "baz"}, + }, + }, + }, + Not(ContainElement(ForbiddenField("spec"))), + ), + ) +}) diff --git a/apis/networking/validation/virtualiprouting.go b/apis/networking/validation/virtualiprouting.go new file mode 100644 index 000000000..5c3d00e8a --- /dev/null +++ b/apis/networking/validation/virtualiprouting.go @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2022 by the OnMetal authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package validation + +import ( + commonv1alpha1 "github.com/onmetal/onmetal-api/apis/common/v1alpha1" + "github.com/onmetal/onmetal-api/apis/common/v1alpha1/validation" + "github.com/onmetal/onmetal-api/apis/networking" + apivalidation "k8s.io/apimachinery/pkg/api/validation" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +type virtualIPRoutingSubsetKey struct { + IP commonv1alpha1.IP + Ref networking.LocalUIDReference +} +type virtualIPRoutingSubsetKeySet map[virtualIPRoutingSubsetKey]struct{} + +// ValidateVirtualIPRouting validates a virtual ip object. +func ValidateVirtualIPRouting(virtualIPRouting *networking.VirtualIPRouting) field.ErrorList { + var allErrs field.ErrorList + + allErrs = append(allErrs, apivalidation.ValidateObjectMetaAccessor(virtualIPRouting, true, apivalidation.NameIsDNSLabel, field.NewPath("metadata"))...) + allErrs = append(allErrs, validateVirtualIPRoutingSubsets(virtualIPRouting, field.NewPath("subsets"))...) + + return allErrs +} + +func validateVirtualIPRoutingSubsets(virtualIPRouting *networking.VirtualIPRouting, subsetsField *field.Path) field.ErrorList { + var allErrs field.ErrorList + + seen := make(virtualIPRoutingSubsetKeySet) + for idx := range virtualIPRouting.Subsets { + subset := &virtualIPRouting.Subsets[idx] + + allErrs = append(allErrs, validateVirtualIPRoutingSubset(subset, subsetsField.Index(idx))...) + + key := virtualIPRoutingSubsetKey{IP: subset.IP, Ref: subset.TargetRef} + if _, ok := seen[key]; ok { + allErrs = append(allErrs, field.Duplicate(subsetsField.Index(idx), subset)) + } + seen[key] = struct{}{} + } + + return allErrs +} + +func validateVirtualIPRoutingSubset(subset *networking.VirtualIPRoutingSubset, fldPath *field.Path) field.ErrorList { + var allErrs field.ErrorList + + allErrs = append(allErrs, validation.ValidateIP(subset.IP.Family(), subset.IP, fldPath.Child("ip"))...) + + if subset.TargetRef.Name == "" { + allErrs = append(allErrs, field.Required(fldPath.Child("targetRef", "name"), "must specify network interface ref name")) + } + for _, msg := range apivalidation.NameIsDNSLabel(subset.TargetRef.Name, false) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("targetRef", "name"), subset.TargetRef.Name, msg)) + } + + return allErrs +} + +// ValidateVirtualIPRoutingUpdate validates a VirtualIPRouting object before an update. +func ValidateVirtualIPRoutingUpdate(newVirtualIPRouting, oldVirtualIPRouting *networking.VirtualIPRouting) field.ErrorList { + var allErrs field.ErrorList + + allErrs = append(allErrs, apivalidation.ValidateObjectMetaAccessorUpdate(newVirtualIPRouting, oldVirtualIPRouting, field.NewPath("metadata"))...) + allErrs = append(allErrs, ValidateVirtualIPRouting(newVirtualIPRouting)...) + + return allErrs +} diff --git a/apis/networking/validation/virtualiprouting_test.go b/apis/networking/validation/virtualiprouting_test.go new file mode 100644 index 000000000..95fa22021 --- /dev/null +++ b/apis/networking/validation/virtualiprouting_test.go @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2022 by the OnMetal authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package validation + +import ( + commonv1alpha1 "github.com/onmetal/onmetal-api/apis/common/v1alpha1" + "github.com/onmetal/onmetal-api/apis/networking" + . "github.com/onmetal/onmetal-api/testutils/validation" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/types" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +var _ = Describe("VirtualIPRouting", func() { + DescribeTable("ValidateVirtualIPRouting", + func(virtualIPRouting *networking.VirtualIPRouting, match types.GomegaMatcher) { + errList := ValidateVirtualIPRouting(virtualIPRouting) + Expect(errList).To(match) + }, + Entry("missing name", + &networking.VirtualIPRouting{}, + ContainElement(RequiredField("metadata.name")), + ), + Entry("missing namespace", + &networking.VirtualIPRouting{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}, + ContainElement(RequiredField("metadata.namespace")), + ), + Entry("bad name", + &networking.VirtualIPRouting{ObjectMeta: metav1.ObjectMeta{Name: "foo*"}}, + ContainElement(InvalidField("metadata.name")), + ), + Entry("invalid subset ip", + &networking.VirtualIPRouting{ + Subsets: []networking.VirtualIPRoutingSubset{{}}, + }, + ContainElement(InvalidField("subsets[0].ip")), + ), + Entry("missing subset ref name", + &networking.VirtualIPRouting{ + Subsets: []networking.VirtualIPRoutingSubset{{}}, + }, + ContainElement(RequiredField("subsets[0].targetRef.name")), + ), + Entry("invalid subset ref name", + &networking.VirtualIPRouting{ + Subsets: []networking.VirtualIPRoutingSubset{{ + TargetRef: networking.LocalUIDReference{Name: "foo*"}, + }}, + }, + ContainElement(InvalidField("subsets[0].targetRef.name")), + ), + Entry("duplicate subset entry", + &networking.VirtualIPRouting{ + Subsets: []networking.VirtualIPRoutingSubset{ + { + IP: commonv1alpha1.MustParseIP("10.0.0.1"), + TargetRef: networking.LocalUIDReference{Name: "foo*"}, + }, + { + IP: commonv1alpha1.MustParseIP("10.0.0.1"), + TargetRef: networking.LocalUIDReference{Name: "foo*"}, + }, + }, + }, + ContainElement(DuplicateField("subsets[1]")), + ), + ) + + DescribeTable("ValidateVirtualIPRoutingUpdate", + func(newVirtualIPRouting, oldVirtualIPRouting *networking.VirtualIPRouting, match types.GomegaMatcher) { + errList := ValidateVirtualIPRoutingUpdate(newVirtualIPRouting, oldVirtualIPRouting) + Expect(errList).To(match) + }, + ) +}) diff --git a/apis/networking/virtualip_types.go b/apis/networking/virtualip_types.go new file mode 100644 index 000000000..c79e7e167 --- /dev/null +++ b/apis/networking/virtualip_types.go @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2022 by the OnMetal authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package networking + +import ( + commonv1alpha1 "github.com/onmetal/onmetal-api/apis/common/v1alpha1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VirtualIPSpec defines the desired state of VirtualIP +type VirtualIPSpec struct { + // Type is the type of VirtualIP. + Type VirtualIPType + // IPFamily is the ip family of the VirtualIP. + IPFamily corev1.IPFamily + // NetworkInterfaceSelector selects any NetworkInterface that should get the VirtualIP routed. + // If empty, it is assumed that an external process manages the VirtualIPRouting for this VirtualIP. + NetworkInterfaceSelector *metav1.LabelSelector +} + +// VirtualIPType is a type of VirtualIP. +type VirtualIPType string + +const ( + // VirtualIPTypePublic is a VirtualIP that allocates and routes a stable public IP. + VirtualIPTypePublic VirtualIPType = "Public" +) + +// VirtualIPStatus defines the observed state of VirtualIP +type VirtualIPStatus struct { + // IP is the allocated IP, if any. + IP *commonv1alpha1.IP +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VirtualIP is the Schema for the virtualips API +type VirtualIP struct { + metav1.TypeMeta + metav1.ObjectMeta + + Spec VirtualIPSpec + Status VirtualIPStatus +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VirtualIPList contains a list of VirtualIP +type VirtualIPList struct { + metav1.TypeMeta + metav1.ListMeta + Items []VirtualIP +} diff --git a/apis/networking/virtualiprouting_types.go b/apis/networking/virtualiprouting_types.go new file mode 100644 index 000000000..d37044ca3 --- /dev/null +++ b/apis/networking/virtualiprouting_types.go @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2022 by the OnMetal authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package networking + +import ( + commonv1alpha1 "github.com/onmetal/onmetal-api/apis/common/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VirtualIPRouting is the Schema for the virtualiproutings API +type VirtualIPRouting struct { + metav1.TypeMeta + metav1.ObjectMeta + + // Subsets are the subsets that make up a VirtualIPRouting. + Subsets []VirtualIPRoutingSubset +} + +// LocalUIDReference is a reference to another entity including its UID. +type LocalUIDReference struct { + // Name is the name of the referenced entity. + Name string + // UID is the UID of the referenced entity. + UID types.UID +} + +// VirtualIPRoutingSubset is one of the targets of a VirtualIPRouting. +type VirtualIPRoutingSubset struct { + // IP is the IP of the entity routed towards. + IP commonv1alpha1.IP + // TargetRef is the targeted entity. + TargetRef LocalUIDReference +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VirtualIPRoutingList contains a list of VirtualIPRouting +type VirtualIPRoutingList struct { + metav1.TypeMeta + metav1.ListMeta + Items []VirtualIPRouting +} diff --git a/apis/networking/zz_generated.deepcopy.go b/apis/networking/zz_generated.deepcopy.go index da6d4de71..258855bf7 100644 --- a/apis/networking/zz_generated.deepcopy.go +++ b/apis/networking/zz_generated.deepcopy.go @@ -24,6 +24,7 @@ import ( v1alpha1 "github.com/onmetal/onmetal-api/apis/common/v1alpha1" ipam "github.com/onmetal/onmetal-api/apis/ipam" v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -73,6 +74,22 @@ func (in *IPSource) DeepCopy() *IPSource { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LocalUIDReference) DeepCopyInto(out *LocalUIDReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalUIDReference. +func (in *LocalUIDReference) DeepCopy() *LocalUIDReference { + if in == nil { + return nil + } + out := new(LocalUIDReference) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Network) DeepCopyInto(out *Network) { *out = *in @@ -245,3 +262,189 @@ func (in *NetworkList) DeepCopyObject() runtime.Object { } return nil } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIP) DeepCopyInto(out *VirtualIP) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIP. +func (in *VirtualIP) DeepCopy() *VirtualIP { + if in == nil { + return nil + } + out := new(VirtualIP) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VirtualIP) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIPList) DeepCopyInto(out *VirtualIPList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VirtualIP, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIPList. +func (in *VirtualIPList) DeepCopy() *VirtualIPList { + if in == nil { + return nil + } + out := new(VirtualIPList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VirtualIPList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIPRouting) DeepCopyInto(out *VirtualIPRouting) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Subsets != nil { + in, out := &in.Subsets, &out.Subsets + *out = make([]VirtualIPRoutingSubset, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIPRouting. +func (in *VirtualIPRouting) DeepCopy() *VirtualIPRouting { + if in == nil { + return nil + } + out := new(VirtualIPRouting) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VirtualIPRouting) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIPRoutingList) DeepCopyInto(out *VirtualIPRoutingList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VirtualIPRouting, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIPRoutingList. +func (in *VirtualIPRoutingList) DeepCopy() *VirtualIPRoutingList { + if in == nil { + return nil + } + out := new(VirtualIPRoutingList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VirtualIPRoutingList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIPRoutingSubset) DeepCopyInto(out *VirtualIPRoutingSubset) { + *out = *in + in.IP.DeepCopyInto(&out.IP) + out.TargetRef = in.TargetRef + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIPRoutingSubset. +func (in *VirtualIPRoutingSubset) DeepCopy() *VirtualIPRoutingSubset { + if in == nil { + return nil + } + out := new(VirtualIPRoutingSubset) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIPSpec) DeepCopyInto(out *VirtualIPSpec) { + *out = *in + if in.NetworkInterfaceSelector != nil { + in, out := &in.NetworkInterfaceSelector, &out.NetworkInterfaceSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIPSpec. +func (in *VirtualIPSpec) DeepCopy() *VirtualIPSpec { + if in == nil { + return nil + } + out := new(VirtualIPSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VirtualIPStatus) DeepCopyInto(out *VirtualIPStatus) { + *out = *in + if in.IP != nil { + in, out := &in.IP, &out.IP + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualIPStatus. +func (in *VirtualIPStatus) DeepCopy() *VirtualIPStatus { + if in == nil { + return nil + } + out := new(VirtualIPStatus) + in.DeepCopyInto(out) + return out +} diff --git a/config/samples/networking_v1alpha1_virtualip.yaml b/config/samples/networking_v1alpha1_virtualip.yaml new file mode 100644 index 000000000..86f495d48 --- /dev/null +++ b/config/samples/networking_v1alpha1_virtualip.yaml @@ -0,0 +1,12 @@ +apiVersion: networking.api.onmetal.de/v1alpha1 +kind: VirtualIP +metadata: + name: virtualip-sample +spec: + type: Public + ipFamily: IPv4 + networkInterfaceSelector: + matchLabels: + foo: bar +#status: +# ip: 10.0.0.1 # This will be populated by the corresponding controller. diff --git a/docs/api-reference/ipam.md b/docs/api-reference/ipam.md index 0d486faab..34c4bd427 100644 --- a/docs/api-reference/ipam.md +++ b/docs/api-reference/ipam.md @@ -603,7 +603,7 @@ Kubernetes meta/v1.Time
-(Appears on:Prefix) +(Appears on:Prefix, PrefixTemplateSpec)
PrefixSpec defines the desired state of Prefix
@@ -728,6 +728,116 @@ Kubernetes meta/v1.LabelSelector +Field | +Description | +||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
+metadata + + +Kubernetes meta/v1.ObjectMeta + + + |
+
+Refer to the Kubernetes API documentation for the fields of the
+metadata field.
+ |
+||||||||||
+spec + + +PrefixSpec + + + |
+
+ + +
|
+
string
alias)VirtualIP is the Schema for the virtualips API
+Field | +Description | +||||||
---|---|---|---|---|---|---|---|
+apiVersion +string |
+
+
+networking.api.onmetal.de/v1alpha1
+
+ |
+||||||
+kind +string + |
+VirtualIP |
+||||||
+metadata + + +Kubernetes meta/v1.ObjectMeta + + + |
+
+Refer to the Kubernetes API documentation for the fields of the
+metadata field.
+ |
+||||||
+spec + + +VirtualIPSpec + + + |
+
+ + +
|
+||||||
+status + + +VirtualIPStatus + + + |
++ | +
VirtualIPRouting is the Schema for the virtualiproutings API
+Field | +Description | +
---|---|
+apiVersion +string |
+
+
+networking.api.onmetal.de/v1alpha1
+
+ |
+
+kind +string + |
+VirtualIPRouting |
+
+metadata + + +Kubernetes meta/v1.ObjectMeta + + + |
+
+Refer to the Kubernetes API documentation for the fields of the
+metadata field.
+ |
+
+subsets + + +[]VirtualIPRoutingSubset + + + |
+
+ Subsets are the subsets that make up a VirtualIPRouting. + |
+
@@ -206,9 +383,7 @@ NetworkInterfaceStatus
prefixTemplate
+(Appears on:VirtualIPRoutingSubset) +
+LocalUIDReference is a reference to another entity including its UID.
+Field | +Description | +
---|---|
+name + +string + + |
+
+ Name is the name of the referenced entity. + |
+
+UID + +k8s.io/apimachinery/pkg/types.UID + + |
+
+ UID is the UID of the referenced entity. + |
+
@@ -360,12 +575,13 @@ IPs represent the effective IP addresses of the NetworkInterface
--(Appears on:EphemeralPrefixSource) +(Appears on:VirtualIPRouting)
VirtualIPRoutingSubset is one of the targets of a VirtualIPRouting.
-metadata + ip - -Kubernetes meta/v1.ObjectMeta + +github.com/onmetal/onmetal-api/apis/common/v1alpha1.IP |
-Refer to the Kubernetes API documentation for the fields of the
-metadata field.
+IP is the IP of the entity routed towards. |
-spec + targetRef - -github.com/onmetal/onmetal-api/apis/ipam/v1alpha1.PrefixSpec + +LocalUIDReference |
- - + TargetRef is the targeted entity. + |
+
+(Appears on:VirtualIP) +
+VirtualIPSpec defines the desired state of VirtualIP
+
-ipFamily - - -Kubernetes core/v1.IPFamily - - - |
-
- IPFamily is the IPFamily of the prefix. -If unset but Prefix is set, this can be inferred. - |
+Field | +Description |
---|---|---|---|
-prefix + type - -github.com/onmetal/onmetal-api/apis/common/v1alpha1.IPPrefix + +VirtualIPType |
- Prefix is the prefix to allocate for this Prefix. +Type is the type of VirtualIP. |
||
-prefixLength + ipFamily -int32 + +Kubernetes core/v1.IPFamily + |
- PrefixLength is the length of prefix to allocate for this Prefix. +IPFamily is the ip family of the VirtualIP. |
||
-parentRef + networkInterfaceSelector - -Kubernetes core/v1.LocalObjectReference + +Kubernetes meta/v1.LabelSelector |
- ParentRef references the parent to allocate the Prefix from. -If ParentRef and ParentSelector is empty, the Prefix is considered a root prefix and thus -allocated by itself. +NetworkInterfaceSelector selects any NetworkInterface that should get the VirtualIP routed. +If empty, it is assumed that an external process manages the VirtualIPRouting for this VirtualIP. |
+(Appears on:VirtualIP) +
+VirtualIPStatus defines the observed state of VirtualIP
+Field | +Description | +
---|---|
-parentSelector + ip - -Kubernetes meta/v1.LabelSelector + +github.com/onmetal/onmetal-api/apis/common/v1alpha1.IP |
- ParentSelector is the LabelSelector to use for determining the parent for this Prefix. +IP is the allocated IP, if any. |
string
alias)+(Appears on:VirtualIPSpec) +
+VirtualIPType is a type of VirtualIP.
+Value | +Description |
---|---|
"Public" |
+VirtualIPTypePublic is a VirtualIP that allocates and routes a stable public IP. + |
+
diff --git a/generated/clientset/internalversion/typed/networking/internalversion/fake/fake_networking_client.go b/generated/clientset/internalversion/typed/networking/internalversion/fake/fake_networking_client.go
index cfe1700fe..40d34b202 100644
--- a/generated/clientset/internalversion/typed/networking/internalversion/fake/fake_networking_client.go
+++ b/generated/clientset/internalversion/typed/networking/internalversion/fake/fake_networking_client.go
@@ -35,6 +35,14 @@ func (c *FakeNetworking) NetworkInterfaces(namespace string) internalversion.Net
return &FakeNetworkInterfaces{c, namespace}
}
+func (c *FakeNetworking) VirtualIPs(namespace string) internalversion.VirtualIPInterface {
+ return &FakeVirtualIPs{c, namespace}
+}
+
+func (c *FakeNetworking) VirtualIPRoutings(namespace string) internalversion.VirtualIPRoutingInterface {
+ return &FakeVirtualIPRoutings{c, namespace}
+}
+
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeNetworking) RESTClient() rest.Interface {
diff --git a/generated/clientset/internalversion/typed/networking/internalversion/fake/fake_virtualip.go b/generated/clientset/internalversion/typed/networking/internalversion/fake/fake_virtualip.go
new file mode 100644
index 000000000..c738ed761
--- /dev/null
+++ b/generated/clientset/internalversion/typed/networking/internalversion/fake/fake_virtualip.go
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ "context"
+
+ networking "github.com/onmetal/onmetal-api/apis/networking"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ labels "k8s.io/apimachinery/pkg/labels"
+ schema "k8s.io/apimachinery/pkg/runtime/schema"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ testing "k8s.io/client-go/testing"
+)
+
+// FakeVirtualIPs implements VirtualIPInterface
+type FakeVirtualIPs struct {
+ Fake *FakeNetworking
+ ns string
+}
+
+var virtualipsResource = schema.GroupVersionResource{Group: "networking.api.onmetal.de", Version: "", Resource: "virtualips"}
+
+var virtualipsKind = schema.GroupVersionKind{Group: "networking.api.onmetal.de", Version: "", Kind: "VirtualIP"}
+
+// Get takes name of the virtualIP, and returns the corresponding virtualIP object, and an error if there is any.
+func (c *FakeVirtualIPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *networking.VirtualIP, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(virtualipsResource, c.ns, name), &networking.VirtualIP{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*networking.VirtualIP), err
+}
+
+// List takes label and field selectors, and returns the list of VirtualIPs that match those selectors.
+func (c *FakeVirtualIPs) List(ctx context.Context, opts v1.ListOptions) (result *networking.VirtualIPList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(virtualipsResource, virtualipsKind, c.ns, opts), &networking.VirtualIPList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &networking.VirtualIPList{ListMeta: obj.(*networking.VirtualIPList).ListMeta}
+ for _, item := range obj.(*networking.VirtualIPList).Items {
+ if label.Matches(labels.Set(item.Labels)) {
+ list.Items = append(list.Items, item)
+ }
+ }
+ return list, err
+}
+
+// Watch returns a watch.Interface that watches the requested virtualIPs.
+func (c *FakeVirtualIPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(virtualipsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a virtualIP and creates it. Returns the server's representation of the virtualIP, and an error, if there is any.
+func (c *FakeVirtualIPs) Create(ctx context.Context, virtualIP *networking.VirtualIP, opts v1.CreateOptions) (result *networking.VirtualIP, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(virtualipsResource, c.ns, virtualIP), &networking.VirtualIP{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*networking.VirtualIP), err
+}
+
+// Update takes the representation of a virtualIP and updates it. Returns the server's representation of the virtualIP, and an error, if there is any.
+func (c *FakeVirtualIPs) Update(ctx context.Context, virtualIP *networking.VirtualIP, opts v1.UpdateOptions) (result *networking.VirtualIP, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(virtualipsResource, c.ns, virtualIP), &networking.VirtualIP{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*networking.VirtualIP), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeVirtualIPs) UpdateStatus(ctx context.Context, virtualIP *networking.VirtualIP, opts v1.UpdateOptions) (*networking.VirtualIP, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(virtualipsResource, "status", c.ns, virtualIP), &networking.VirtualIP{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*networking.VirtualIP), err
+}
+
+// Delete takes name of the virtualIP and deletes it. Returns an error if one occurs.
+func (c *FakeVirtualIPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteActionWithOptions(virtualipsResource, c.ns, name, opts), &networking.VirtualIP{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeVirtualIPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(virtualipsResource, c.ns, listOpts)
+
+ _, err := c.Fake.Invokes(action, &networking.VirtualIPList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched virtualIP.
+func (c *FakeVirtualIPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *networking.VirtualIP, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(virtualipsResource, c.ns, name, pt, data, subresources...), &networking.VirtualIP{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*networking.VirtualIP), err
+}
diff --git a/generated/clientset/internalversion/typed/networking/internalversion/fake/fake_virtualiprouting.go b/generated/clientset/internalversion/typed/networking/internalversion/fake/fake_virtualiprouting.go
new file mode 100644
index 000000000..56e729342
--- /dev/null
+++ b/generated/clientset/internalversion/typed/networking/internalversion/fake/fake_virtualiprouting.go
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ "context"
+
+ networking "github.com/onmetal/onmetal-api/apis/networking"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ labels "k8s.io/apimachinery/pkg/labels"
+ schema "k8s.io/apimachinery/pkg/runtime/schema"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ testing "k8s.io/client-go/testing"
+)
+
+// FakeVirtualIPRoutings implements VirtualIPRoutingInterface
+type FakeVirtualIPRoutings struct {
+ Fake *FakeNetworking
+ ns string
+}
+
+var virtualiproutingsResource = schema.GroupVersionResource{Group: "networking.api.onmetal.de", Version: "", Resource: "virtualiproutings"}
+
+var virtualiproutingsKind = schema.GroupVersionKind{Group: "networking.api.onmetal.de", Version: "", Kind: "VirtualIPRouting"}
+
+// Get takes name of the virtualIPRouting, and returns the corresponding virtualIPRouting object, and an error if there is any.
+func (c *FakeVirtualIPRoutings) Get(ctx context.Context, name string, options v1.GetOptions) (result *networking.VirtualIPRouting, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(virtualiproutingsResource, c.ns, name), &networking.VirtualIPRouting{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*networking.VirtualIPRouting), err
+}
+
+// List takes label and field selectors, and returns the list of VirtualIPRoutings that match those selectors.
+func (c *FakeVirtualIPRoutings) List(ctx context.Context, opts v1.ListOptions) (result *networking.VirtualIPRoutingList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(virtualiproutingsResource, virtualiproutingsKind, c.ns, opts), &networking.VirtualIPRoutingList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &networking.VirtualIPRoutingList{ListMeta: obj.(*networking.VirtualIPRoutingList).ListMeta}
+ for _, item := range obj.(*networking.VirtualIPRoutingList).Items {
+ if label.Matches(labels.Set(item.Labels)) {
+ list.Items = append(list.Items, item)
+ }
+ }
+ return list, err
+}
+
+// Watch returns a watch.Interface that watches the requested virtualIPRoutings.
+func (c *FakeVirtualIPRoutings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(virtualiproutingsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a virtualIPRouting and creates it. Returns the server's representation of the virtualIPRouting, and an error, if there is any.
+func (c *FakeVirtualIPRoutings) Create(ctx context.Context, virtualIPRouting *networking.VirtualIPRouting, opts v1.CreateOptions) (result *networking.VirtualIPRouting, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(virtualiproutingsResource, c.ns, virtualIPRouting), &networking.VirtualIPRouting{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*networking.VirtualIPRouting), err
+}
+
+// Update takes the representation of a virtualIPRouting and updates it. Returns the server's representation of the virtualIPRouting, and an error, if there is any.
+func (c *FakeVirtualIPRoutings) Update(ctx context.Context, virtualIPRouting *networking.VirtualIPRouting, opts v1.UpdateOptions) (result *networking.VirtualIPRouting, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(virtualiproutingsResource, c.ns, virtualIPRouting), &networking.VirtualIPRouting{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*networking.VirtualIPRouting), err
+}
+
+// Delete takes name of the virtualIPRouting and deletes it. Returns an error if one occurs.
+func (c *FakeVirtualIPRoutings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteActionWithOptions(virtualiproutingsResource, c.ns, name, opts), &networking.VirtualIPRouting{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeVirtualIPRoutings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(virtualiproutingsResource, c.ns, listOpts)
+
+ _, err := c.Fake.Invokes(action, &networking.VirtualIPRoutingList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched virtualIPRouting.
+func (c *FakeVirtualIPRoutings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *networking.VirtualIPRouting, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(virtualiproutingsResource, c.ns, name, pt, data, subresources...), &networking.VirtualIPRouting{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*networking.VirtualIPRouting), err
+}
diff --git a/generated/clientset/internalversion/typed/networking/internalversion/generated_expansion.go b/generated/clientset/internalversion/typed/networking/internalversion/generated_expansion.go
index 81852263f..91aecb97b 100644
--- a/generated/clientset/internalversion/typed/networking/internalversion/generated_expansion.go
+++ b/generated/clientset/internalversion/typed/networking/internalversion/generated_expansion.go
@@ -20,3 +20,7 @@ package internalversion
type NetworkExpansion interface{}
type NetworkInterfaceExpansion interface{}
+
+type VirtualIPExpansion interface{}
+
+type VirtualIPRoutingExpansion interface{}
diff --git a/generated/clientset/internalversion/typed/networking/internalversion/networking_client.go b/generated/clientset/internalversion/typed/networking/internalversion/networking_client.go
index 1339c5a95..e7575b81b 100644
--- a/generated/clientset/internalversion/typed/networking/internalversion/networking_client.go
+++ b/generated/clientset/internalversion/typed/networking/internalversion/networking_client.go
@@ -28,6 +28,8 @@ type NetworkingInterface interface {
RESTClient() rest.Interface
NetworksGetter
NetworkInterfacesGetter
+ VirtualIPsGetter
+ VirtualIPRoutingsGetter
}
// NetworkingClient is used to interact with features provided by the networking.api.onmetal.de group.
@@ -43,6 +45,14 @@ func (c *NetworkingClient) NetworkInterfaces(namespace string) NetworkInterfaceI
return newNetworkInterfaces(c, namespace)
}
+func (c *NetworkingClient) VirtualIPs(namespace string) VirtualIPInterface {
+ return newVirtualIPs(c, namespace)
+}
+
+func (c *NetworkingClient) VirtualIPRoutings(namespace string) VirtualIPRoutingInterface {
+ return newVirtualIPRoutings(c, namespace)
+}
+
// NewForConfig creates a new NetworkingClient for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
diff --git a/generated/clientset/internalversion/typed/networking/internalversion/virtualip.go b/generated/clientset/internalversion/typed/networking/internalversion/virtualip.go
new file mode 100644
index 000000000..95e9eec54
--- /dev/null
+++ b/generated/clientset/internalversion/typed/networking/internalversion/virtualip.go
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by client-gen. DO NOT EDIT.
+
+package internalversion
+
+import (
+ "context"
+ "time"
+
+ networking "github.com/onmetal/onmetal-api/apis/networking"
+ scheme "github.com/onmetal/onmetal-api/generated/clientset/internalversion/scheme"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ rest "k8s.io/client-go/rest"
+)
+
+// VirtualIPsGetter has a method to return a VirtualIPInterface.
+// A group's client should implement this interface.
+type VirtualIPsGetter interface {
+ VirtualIPs(namespace string) VirtualIPInterface
+}
+
+// VirtualIPInterface has methods to work with VirtualIP resources.
+type VirtualIPInterface interface {
+ Create(ctx context.Context, virtualIP *networking.VirtualIP, opts v1.CreateOptions) (*networking.VirtualIP, error)
+ Update(ctx context.Context, virtualIP *networking.VirtualIP, opts v1.UpdateOptions) (*networking.VirtualIP, error)
+ UpdateStatus(ctx context.Context, virtualIP *networking.VirtualIP, opts v1.UpdateOptions) (*networking.VirtualIP, error)
+ Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
+ DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
+ Get(ctx context.Context, name string, opts v1.GetOptions) (*networking.VirtualIP, error)
+ List(ctx context.Context, opts v1.ListOptions) (*networking.VirtualIPList, error)
+ Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
+ Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *networking.VirtualIP, err error)
+ VirtualIPExpansion
+}
+
+// virtualIPs implements VirtualIPInterface
+type virtualIPs struct {
+ client rest.Interface
+ ns string
+}
+
+// newVirtualIPs returns a VirtualIPs
+func newVirtualIPs(c *NetworkingClient, namespace string) *virtualIPs {
+ return &virtualIPs{
+ client: c.RESTClient(),
+ ns: namespace,
+ }
+}
+
+// Get takes name of the virtualIP, and returns the corresponding virtualIP object, and an error if there is any.
+func (c *virtualIPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *networking.VirtualIP, err error) {
+ result = &networking.VirtualIP{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("virtualips").
+ Name(name).
+ VersionedParams(&options, scheme.ParameterCodec).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// List takes label and field selectors, and returns the list of VirtualIPs that match those selectors.
+func (c *virtualIPs) List(ctx context.Context, opts v1.ListOptions) (result *networking.VirtualIPList, err error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ result = &networking.VirtualIPList{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("virtualips").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Watch returns a watch.Interface that watches the requested virtualIPs.
+func (c *virtualIPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ opts.Watch = true
+ return c.client.Get().
+ Namespace(c.ns).
+ Resource("virtualips").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Watch(ctx)
+}
+
+// Create takes the representation of a virtualIP and creates it. Returns the server's representation of the virtualIP, and an error, if there is any.
+func (c *virtualIPs) Create(ctx context.Context, virtualIP *networking.VirtualIP, opts v1.CreateOptions) (result *networking.VirtualIP, err error) {
+ result = &networking.VirtualIP{}
+ err = c.client.Post().
+ Namespace(c.ns).
+ Resource("virtualips").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(virtualIP).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Update takes the representation of a virtualIP and updates it. Returns the server's representation of the virtualIP, and an error, if there is any.
+func (c *virtualIPs) Update(ctx context.Context, virtualIP *networking.VirtualIP, opts v1.UpdateOptions) (result *networking.VirtualIP, err error) {
+ result = &networking.VirtualIP{}
+ err = c.client.Put().
+ Namespace(c.ns).
+ Resource("virtualips").
+ Name(virtualIP.Name).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(virtualIP).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *virtualIPs) UpdateStatus(ctx context.Context, virtualIP *networking.VirtualIP, opts v1.UpdateOptions) (result *networking.VirtualIP, err error) {
+ result = &networking.VirtualIP{}
+ err = c.client.Put().
+ Namespace(c.ns).
+ Resource("virtualips").
+ Name(virtualIP.Name).
+ SubResource("status").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(virtualIP).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Delete takes name of the virtualIP and deletes it. Returns an error if one occurs.
+func (c *virtualIPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("virtualips").
+ Name(name).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *virtualIPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ var timeout time.Duration
+ if listOpts.TimeoutSeconds != nil {
+ timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
+ }
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("virtualips").
+ VersionedParams(&listOpts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// Patch applies the patch and returns the patched virtualIP.
+func (c *virtualIPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *networking.VirtualIP, err error) {
+ result = &networking.VirtualIP{}
+ err = c.client.Patch(pt).
+ Namespace(c.ns).
+ Resource("virtualips").
+ Name(name).
+ SubResource(subresources...).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(data).
+ Do(ctx).
+ Into(result)
+ return
+}
diff --git a/generated/clientset/internalversion/typed/networking/internalversion/virtualiprouting.go b/generated/clientset/internalversion/typed/networking/internalversion/virtualiprouting.go
new file mode 100644
index 000000000..6a1c9ad49
--- /dev/null
+++ b/generated/clientset/internalversion/typed/networking/internalversion/virtualiprouting.go
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by client-gen. DO NOT EDIT.
+
+package internalversion
+
+import (
+ "context"
+ "time"
+
+ networking "github.com/onmetal/onmetal-api/apis/networking"
+ scheme "github.com/onmetal/onmetal-api/generated/clientset/internalversion/scheme"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ rest "k8s.io/client-go/rest"
+)
+
+// VirtualIPRoutingsGetter has a method to return a VirtualIPRoutingInterface.
+// A group's client should implement this interface.
+type VirtualIPRoutingsGetter interface {
+ VirtualIPRoutings(namespace string) VirtualIPRoutingInterface
+}
+
+// VirtualIPRoutingInterface has methods to work with VirtualIPRouting resources.
+type VirtualIPRoutingInterface interface {
+ Create(ctx context.Context, virtualIPRouting *networking.VirtualIPRouting, opts v1.CreateOptions) (*networking.VirtualIPRouting, error)
+ Update(ctx context.Context, virtualIPRouting *networking.VirtualIPRouting, opts v1.UpdateOptions) (*networking.VirtualIPRouting, error)
+ Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
+ DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
+ Get(ctx context.Context, name string, opts v1.GetOptions) (*networking.VirtualIPRouting, error)
+ List(ctx context.Context, opts v1.ListOptions) (*networking.VirtualIPRoutingList, error)
+ Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
+ Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *networking.VirtualIPRouting, err error)
+ VirtualIPRoutingExpansion
+}
+
+// virtualIPRoutings implements VirtualIPRoutingInterface
+type virtualIPRoutings struct {
+ client rest.Interface
+ ns string
+}
+
+// newVirtualIPRoutings returns a VirtualIPRoutings
+func newVirtualIPRoutings(c *NetworkingClient, namespace string) *virtualIPRoutings {
+ return &virtualIPRoutings{
+ client: c.RESTClient(),
+ ns: namespace,
+ }
+}
+
+// Get takes name of the virtualIPRouting, and returns the corresponding virtualIPRouting object, and an error if there is any.
+func (c *virtualIPRoutings) Get(ctx context.Context, name string, options v1.GetOptions) (result *networking.VirtualIPRouting, err error) {
+ result = &networking.VirtualIPRouting{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ Name(name).
+ VersionedParams(&options, scheme.ParameterCodec).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// List takes label and field selectors, and returns the list of VirtualIPRoutings that match those selectors.
+func (c *virtualIPRoutings) List(ctx context.Context, opts v1.ListOptions) (result *networking.VirtualIPRoutingList, err error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ result = &networking.VirtualIPRoutingList{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Watch returns a watch.Interface that watches the requested virtualIPRoutings.
+func (c *virtualIPRoutings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ opts.Watch = true
+ return c.client.Get().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Watch(ctx)
+}
+
+// Create takes the representation of a virtualIPRouting and creates it. Returns the server's representation of the virtualIPRouting, and an error, if there is any.
+func (c *virtualIPRoutings) Create(ctx context.Context, virtualIPRouting *networking.VirtualIPRouting, opts v1.CreateOptions) (result *networking.VirtualIPRouting, err error) {
+ result = &networking.VirtualIPRouting{}
+ err = c.client.Post().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(virtualIPRouting).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Update takes the representation of a virtualIPRouting and updates it. Returns the server's representation of the virtualIPRouting, and an error, if there is any.
+func (c *virtualIPRoutings) Update(ctx context.Context, virtualIPRouting *networking.VirtualIPRouting, opts v1.UpdateOptions) (result *networking.VirtualIPRouting, err error) {
+ result = &networking.VirtualIPRouting{}
+ err = c.client.Put().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ Name(virtualIPRouting.Name).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(virtualIPRouting).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Delete takes name of the virtualIPRouting and deletes it. Returns an error if one occurs.
+func (c *virtualIPRoutings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ Name(name).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *virtualIPRoutings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ var timeout time.Duration
+ if listOpts.TimeoutSeconds != nil {
+ timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
+ }
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ VersionedParams(&listOpts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// Patch applies the patch and returns the patched virtualIPRouting.
+func (c *virtualIPRoutings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *networking.VirtualIPRouting, err error) {
+ result = &networking.VirtualIPRouting{}
+ err = c.client.Patch(pt).
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ Name(name).
+ SubResource(subresources...).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(data).
+ Do(ctx).
+ Into(result)
+ return
+}
diff --git a/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_networking_client.go b/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_networking_client.go
index afd7ab12f..1d6231852 100644
--- a/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_networking_client.go
+++ b/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_networking_client.go
@@ -35,6 +35,14 @@ func (c *FakeNetworkingV1alpha1) NetworkInterfaces(namespace string) v1alpha1.Ne
return &FakeNetworkInterfaces{c, namespace}
}
+func (c *FakeNetworkingV1alpha1) VirtualIPs(namespace string) v1alpha1.VirtualIPInterface {
+ return &FakeVirtualIPs{c, namespace}
+}
+
+func (c *FakeNetworkingV1alpha1) VirtualIPRoutings(namespace string) v1alpha1.VirtualIPRoutingInterface {
+ return &FakeVirtualIPRoutings{c, namespace}
+}
+
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeNetworkingV1alpha1) RESTClient() rest.Interface {
diff --git a/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_virtualip.go b/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_virtualip.go
new file mode 100644
index 000000000..dc0d3baff
--- /dev/null
+++ b/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_virtualip.go
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ "context"
+
+ v1alpha1 "github.com/onmetal/onmetal-api/apis/networking/v1alpha1"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ labels "k8s.io/apimachinery/pkg/labels"
+ schema "k8s.io/apimachinery/pkg/runtime/schema"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ testing "k8s.io/client-go/testing"
+)
+
+// FakeVirtualIPs implements VirtualIPInterface
+type FakeVirtualIPs struct {
+ Fake *FakeNetworkingV1alpha1
+ ns string
+}
+
+var virtualipsResource = schema.GroupVersionResource{Group: "networking.api.onmetal.de", Version: "v1alpha1", Resource: "virtualips"}
+
+var virtualipsKind = schema.GroupVersionKind{Group: "networking.api.onmetal.de", Version: "v1alpha1", Kind: "VirtualIP"}
+
+// Get takes name of the virtualIP, and returns the corresponding virtualIP object, and an error if there is any.
+func (c *FakeVirtualIPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualIP, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(virtualipsResource, c.ns, name), &v1alpha1.VirtualIP{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VirtualIP), err
+}
+
+// List takes label and field selectors, and returns the list of VirtualIPs that match those selectors.
+func (c *FakeVirtualIPs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualIPList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(virtualipsResource, virtualipsKind, c.ns, opts), &v1alpha1.VirtualIPList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1alpha1.VirtualIPList{ListMeta: obj.(*v1alpha1.VirtualIPList).ListMeta}
+ for _, item := range obj.(*v1alpha1.VirtualIPList).Items {
+ if label.Matches(labels.Set(item.Labels)) {
+ list.Items = append(list.Items, item)
+ }
+ }
+ return list, err
+}
+
+// Watch returns a watch.Interface that watches the requested virtualIPs.
+func (c *FakeVirtualIPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(virtualipsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a virtualIP and creates it. Returns the server's representation of the virtualIP, and an error, if there is any.
+func (c *FakeVirtualIPs) Create(ctx context.Context, virtualIP *v1alpha1.VirtualIP, opts v1.CreateOptions) (result *v1alpha1.VirtualIP, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(virtualipsResource, c.ns, virtualIP), &v1alpha1.VirtualIP{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VirtualIP), err
+}
+
+// Update takes the representation of a virtualIP and updates it. Returns the server's representation of the virtualIP, and an error, if there is any.
+func (c *FakeVirtualIPs) Update(ctx context.Context, virtualIP *v1alpha1.VirtualIP, opts v1.UpdateOptions) (result *v1alpha1.VirtualIP, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(virtualipsResource, c.ns, virtualIP), &v1alpha1.VirtualIP{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VirtualIP), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeVirtualIPs) UpdateStatus(ctx context.Context, virtualIP *v1alpha1.VirtualIP, opts v1.UpdateOptions) (*v1alpha1.VirtualIP, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(virtualipsResource, "status", c.ns, virtualIP), &v1alpha1.VirtualIP{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VirtualIP), err
+}
+
+// Delete takes name of the virtualIP and deletes it. Returns an error if one occurs.
+func (c *FakeVirtualIPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteActionWithOptions(virtualipsResource, c.ns, name, opts), &v1alpha1.VirtualIP{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeVirtualIPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(virtualipsResource, c.ns, listOpts)
+
+ _, err := c.Fake.Invokes(action, &v1alpha1.VirtualIPList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched virtualIP.
+func (c *FakeVirtualIPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualIP, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(virtualipsResource, c.ns, name, pt, data, subresources...), &v1alpha1.VirtualIP{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VirtualIP), err
+}
diff --git a/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_virtualiprouting.go b/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_virtualiprouting.go
new file mode 100644
index 000000000..3e07dec9a
--- /dev/null
+++ b/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_virtualiprouting.go
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ "context"
+
+ v1alpha1 "github.com/onmetal/onmetal-api/apis/networking/v1alpha1"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ labels "k8s.io/apimachinery/pkg/labels"
+ schema "k8s.io/apimachinery/pkg/runtime/schema"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ testing "k8s.io/client-go/testing"
+)
+
+// FakeVirtualIPRoutings implements VirtualIPRoutingInterface
+type FakeVirtualIPRoutings struct {
+ Fake *FakeNetworkingV1alpha1
+ ns string
+}
+
+var virtualiproutingsResource = schema.GroupVersionResource{Group: "networking.api.onmetal.de", Version: "v1alpha1", Resource: "virtualiproutings"}
+
+var virtualiproutingsKind = schema.GroupVersionKind{Group: "networking.api.onmetal.de", Version: "v1alpha1", Kind: "VirtualIPRouting"}
+
+// Get takes name of the virtualIPRouting, and returns the corresponding virtualIPRouting object, and an error if there is any.
+func (c *FakeVirtualIPRoutings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualIPRouting, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(virtualiproutingsResource, c.ns, name), &v1alpha1.VirtualIPRouting{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VirtualIPRouting), err
+}
+
+// List takes label and field selectors, and returns the list of VirtualIPRoutings that match those selectors.
+func (c *FakeVirtualIPRoutings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualIPRoutingList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(virtualiproutingsResource, virtualiproutingsKind, c.ns, opts), &v1alpha1.VirtualIPRoutingList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1alpha1.VirtualIPRoutingList{ListMeta: obj.(*v1alpha1.VirtualIPRoutingList).ListMeta}
+ for _, item := range obj.(*v1alpha1.VirtualIPRoutingList).Items {
+ if label.Matches(labels.Set(item.Labels)) {
+ list.Items = append(list.Items, item)
+ }
+ }
+ return list, err
+}
+
+// Watch returns a watch.Interface that watches the requested virtualIPRoutings.
+func (c *FakeVirtualIPRoutings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(virtualiproutingsResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a virtualIPRouting and creates it. Returns the server's representation of the virtualIPRouting, and an error, if there is any.
+func (c *FakeVirtualIPRoutings) Create(ctx context.Context, virtualIPRouting *v1alpha1.VirtualIPRouting, opts v1.CreateOptions) (result *v1alpha1.VirtualIPRouting, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(virtualiproutingsResource, c.ns, virtualIPRouting), &v1alpha1.VirtualIPRouting{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VirtualIPRouting), err
+}
+
+// Update takes the representation of a virtualIPRouting and updates it. Returns the server's representation of the virtualIPRouting, and an error, if there is any.
+func (c *FakeVirtualIPRoutings) Update(ctx context.Context, virtualIPRouting *v1alpha1.VirtualIPRouting, opts v1.UpdateOptions) (result *v1alpha1.VirtualIPRouting, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(virtualiproutingsResource, c.ns, virtualIPRouting), &v1alpha1.VirtualIPRouting{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VirtualIPRouting), err
+}
+
+// Delete takes name of the virtualIPRouting and deletes it. Returns an error if one occurs.
+func (c *FakeVirtualIPRoutings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteActionWithOptions(virtualiproutingsResource, c.ns, name, opts), &v1alpha1.VirtualIPRouting{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeVirtualIPRoutings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(virtualiproutingsResource, c.ns, listOpts)
+
+ _, err := c.Fake.Invokes(action, &v1alpha1.VirtualIPRoutingList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched virtualIPRouting.
+func (c *FakeVirtualIPRoutings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualIPRouting, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(virtualiproutingsResource, c.ns, name, pt, data, subresources...), &v1alpha1.VirtualIPRouting{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.VirtualIPRouting), err
+}
diff --git a/generated/clientset/versioned/typed/networking/v1alpha1/generated_expansion.go b/generated/clientset/versioned/typed/networking/v1alpha1/generated_expansion.go
index c760c9c98..417e6d6e1 100644
--- a/generated/clientset/versioned/typed/networking/v1alpha1/generated_expansion.go
+++ b/generated/clientset/versioned/typed/networking/v1alpha1/generated_expansion.go
@@ -20,3 +20,7 @@ package v1alpha1
type NetworkExpansion interface{}
type NetworkInterfaceExpansion interface{}
+
+type VirtualIPExpansion interface{}
+
+type VirtualIPRoutingExpansion interface{}
diff --git a/generated/clientset/versioned/typed/networking/v1alpha1/networking_client.go b/generated/clientset/versioned/typed/networking/v1alpha1/networking_client.go
index fa2e35064..39356540c 100644
--- a/generated/clientset/versioned/typed/networking/v1alpha1/networking_client.go
+++ b/generated/clientset/versioned/typed/networking/v1alpha1/networking_client.go
@@ -29,6 +29,8 @@ type NetworkingV1alpha1Interface interface {
RESTClient() rest.Interface
NetworksGetter
NetworkInterfacesGetter
+ VirtualIPsGetter
+ VirtualIPRoutingsGetter
}
// NetworkingV1alpha1Client is used to interact with features provided by the networking.api.onmetal.de group.
@@ -44,6 +46,14 @@ func (c *NetworkingV1alpha1Client) NetworkInterfaces(namespace string) NetworkIn
return newNetworkInterfaces(c, namespace)
}
+func (c *NetworkingV1alpha1Client) VirtualIPs(namespace string) VirtualIPInterface {
+ return newVirtualIPs(c, namespace)
+}
+
+func (c *NetworkingV1alpha1Client) VirtualIPRoutings(namespace string) VirtualIPRoutingInterface {
+ return newVirtualIPRoutings(c, namespace)
+}
+
// NewForConfig creates a new NetworkingV1alpha1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
diff --git a/generated/clientset/versioned/typed/networking/v1alpha1/virtualip.go b/generated/clientset/versioned/typed/networking/v1alpha1/virtualip.go
new file mode 100644
index 000000000..79bbf1551
--- /dev/null
+++ b/generated/clientset/versioned/typed/networking/v1alpha1/virtualip.go
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by client-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ "context"
+ "time"
+
+ v1alpha1 "github.com/onmetal/onmetal-api/apis/networking/v1alpha1"
+ scheme "github.com/onmetal/onmetal-api/generated/clientset/versioned/scheme"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ rest "k8s.io/client-go/rest"
+)
+
+// VirtualIPsGetter has a method to return a VirtualIPInterface.
+// A group's client should implement this interface.
+type VirtualIPsGetter interface {
+ VirtualIPs(namespace string) VirtualIPInterface
+}
+
+// VirtualIPInterface has methods to work with VirtualIP resources.
+type VirtualIPInterface interface {
+ Create(ctx context.Context, virtualIP *v1alpha1.VirtualIP, opts v1.CreateOptions) (*v1alpha1.VirtualIP, error)
+ Update(ctx context.Context, virtualIP *v1alpha1.VirtualIP, opts v1.UpdateOptions) (*v1alpha1.VirtualIP, error)
+ UpdateStatus(ctx context.Context, virtualIP *v1alpha1.VirtualIP, opts v1.UpdateOptions) (*v1alpha1.VirtualIP, error)
+ Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
+ DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
+ Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VirtualIP, error)
+ List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VirtualIPList, error)
+ Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
+ Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualIP, err error)
+ VirtualIPExpansion
+}
+
+// virtualIPs implements VirtualIPInterface
+type virtualIPs struct {
+ client rest.Interface
+ ns string
+}
+
+// newVirtualIPs returns a VirtualIPs
+func newVirtualIPs(c *NetworkingV1alpha1Client, namespace string) *virtualIPs {
+ return &virtualIPs{
+ client: c.RESTClient(),
+ ns: namespace,
+ }
+}
+
+// Get takes name of the virtualIP, and returns the corresponding virtualIP object, and an error if there is any.
+func (c *virtualIPs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualIP, err error) {
+ result = &v1alpha1.VirtualIP{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("virtualips").
+ Name(name).
+ VersionedParams(&options, scheme.ParameterCodec).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// List takes label and field selectors, and returns the list of VirtualIPs that match those selectors.
+func (c *virtualIPs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualIPList, err error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ result = &v1alpha1.VirtualIPList{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("virtualips").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Watch returns a watch.Interface that watches the requested virtualIPs.
+func (c *virtualIPs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ opts.Watch = true
+ return c.client.Get().
+ Namespace(c.ns).
+ Resource("virtualips").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Watch(ctx)
+}
+
+// Create takes the representation of a virtualIP and creates it. Returns the server's representation of the virtualIP, and an error, if there is any.
+func (c *virtualIPs) Create(ctx context.Context, virtualIP *v1alpha1.VirtualIP, opts v1.CreateOptions) (result *v1alpha1.VirtualIP, err error) {
+ result = &v1alpha1.VirtualIP{}
+ err = c.client.Post().
+ Namespace(c.ns).
+ Resource("virtualips").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(virtualIP).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Update takes the representation of a virtualIP and updates it. Returns the server's representation of the virtualIP, and an error, if there is any.
+func (c *virtualIPs) Update(ctx context.Context, virtualIP *v1alpha1.VirtualIP, opts v1.UpdateOptions) (result *v1alpha1.VirtualIP, err error) {
+ result = &v1alpha1.VirtualIP{}
+ err = c.client.Put().
+ Namespace(c.ns).
+ Resource("virtualips").
+ Name(virtualIP.Name).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(virtualIP).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *virtualIPs) UpdateStatus(ctx context.Context, virtualIP *v1alpha1.VirtualIP, opts v1.UpdateOptions) (result *v1alpha1.VirtualIP, err error) {
+ result = &v1alpha1.VirtualIP{}
+ err = c.client.Put().
+ Namespace(c.ns).
+ Resource("virtualips").
+ Name(virtualIP.Name).
+ SubResource("status").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(virtualIP).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Delete takes name of the virtualIP and deletes it. Returns an error if one occurs.
+func (c *virtualIPs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("virtualips").
+ Name(name).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *virtualIPs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ var timeout time.Duration
+ if listOpts.TimeoutSeconds != nil {
+ timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
+ }
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("virtualips").
+ VersionedParams(&listOpts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// Patch applies the patch and returns the patched virtualIP.
+func (c *virtualIPs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualIP, err error) {
+ result = &v1alpha1.VirtualIP{}
+ err = c.client.Patch(pt).
+ Namespace(c.ns).
+ Resource("virtualips").
+ Name(name).
+ SubResource(subresources...).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(data).
+ Do(ctx).
+ Into(result)
+ return
+}
diff --git a/generated/clientset/versioned/typed/networking/v1alpha1/virtualiprouting.go b/generated/clientset/versioned/typed/networking/v1alpha1/virtualiprouting.go
new file mode 100644
index 000000000..e79efe8eb
--- /dev/null
+++ b/generated/clientset/versioned/typed/networking/v1alpha1/virtualiprouting.go
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by client-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ "context"
+ "time"
+
+ v1alpha1 "github.com/onmetal/onmetal-api/apis/networking/v1alpha1"
+ scheme "github.com/onmetal/onmetal-api/generated/clientset/versioned/scheme"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ rest "k8s.io/client-go/rest"
+)
+
+// VirtualIPRoutingsGetter has a method to return a VirtualIPRoutingInterface.
+// A group's client should implement this interface.
+type VirtualIPRoutingsGetter interface {
+ VirtualIPRoutings(namespace string) VirtualIPRoutingInterface
+}
+
+// VirtualIPRoutingInterface has methods to work with VirtualIPRouting resources.
+type VirtualIPRoutingInterface interface {
+ Create(ctx context.Context, virtualIPRouting *v1alpha1.VirtualIPRouting, opts v1.CreateOptions) (*v1alpha1.VirtualIPRouting, error)
+ Update(ctx context.Context, virtualIPRouting *v1alpha1.VirtualIPRouting, opts v1.UpdateOptions) (*v1alpha1.VirtualIPRouting, error)
+ Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
+ DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
+ Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VirtualIPRouting, error)
+ List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VirtualIPRoutingList, error)
+ Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
+ Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualIPRouting, err error)
+ VirtualIPRoutingExpansion
+}
+
+// virtualIPRoutings implements VirtualIPRoutingInterface
+type virtualIPRoutings struct {
+ client rest.Interface
+ ns string
+}
+
+// newVirtualIPRoutings returns a VirtualIPRoutings
+func newVirtualIPRoutings(c *NetworkingV1alpha1Client, namespace string) *virtualIPRoutings {
+ return &virtualIPRoutings{
+ client: c.RESTClient(),
+ ns: namespace,
+ }
+}
+
+// Get takes name of the virtualIPRouting, and returns the corresponding virtualIPRouting object, and an error if there is any.
+func (c *virtualIPRoutings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VirtualIPRouting, err error) {
+ result = &v1alpha1.VirtualIPRouting{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ Name(name).
+ VersionedParams(&options, scheme.ParameterCodec).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// List takes label and field selectors, and returns the list of VirtualIPRoutings that match those selectors.
+func (c *virtualIPRoutings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VirtualIPRoutingList, err error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ result = &v1alpha1.VirtualIPRoutingList{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Watch returns a watch.Interface that watches the requested virtualIPRoutings.
+func (c *virtualIPRoutings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ opts.Watch = true
+ return c.client.Get().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Watch(ctx)
+}
+
+// Create takes the representation of a virtualIPRouting and creates it. Returns the server's representation of the virtualIPRouting, and an error, if there is any.
+func (c *virtualIPRoutings) Create(ctx context.Context, virtualIPRouting *v1alpha1.VirtualIPRouting, opts v1.CreateOptions) (result *v1alpha1.VirtualIPRouting, err error) {
+ result = &v1alpha1.VirtualIPRouting{}
+ err = c.client.Post().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(virtualIPRouting).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Update takes the representation of a virtualIPRouting and updates it. Returns the server's representation of the virtualIPRouting, and an error, if there is any.
+func (c *virtualIPRoutings) Update(ctx context.Context, virtualIPRouting *v1alpha1.VirtualIPRouting, opts v1.UpdateOptions) (result *v1alpha1.VirtualIPRouting, err error) {
+ result = &v1alpha1.VirtualIPRouting{}
+ err = c.client.Put().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ Name(virtualIPRouting.Name).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(virtualIPRouting).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Delete takes name of the virtualIPRouting and deletes it. Returns an error if one occurs.
+func (c *virtualIPRoutings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ Name(name).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *virtualIPRoutings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ var timeout time.Duration
+ if listOpts.TimeoutSeconds != nil {
+ timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
+ }
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ VersionedParams(&listOpts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// Patch applies the patch and returns the patched virtualIPRouting.
+func (c *virtualIPRoutings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VirtualIPRouting, err error) {
+ result = &v1alpha1.VirtualIPRouting{}
+ err = c.client.Patch(pt).
+ Namespace(c.ns).
+ Resource("virtualiproutings").
+ Name(name).
+ SubResource(subresources...).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(data).
+ Do(ctx).
+ Into(result)
+ return
+}
diff --git a/generated/informers/externalversions/generic.go b/generated/informers/externalversions/generic.go
index 43c21983a..9da0e7473 100644
--- a/generated/informers/externalversions/generic.go
+++ b/generated/informers/externalversions/generic.go
@@ -73,6 +73,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha1().Networks().Informer()}, nil
case networkingv1alpha1.SchemeGroupVersion.WithResource("networkinterfaces"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha1().NetworkInterfaces().Informer()}, nil
+ case networkingv1alpha1.SchemeGroupVersion.WithResource("virtualips"):
+ return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha1().VirtualIPs().Informer()}, nil
+ case networkingv1alpha1.SchemeGroupVersion.WithResource("virtualiproutings"):
+ return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha1().VirtualIPRoutings().Informer()}, nil
// Group=storage.api.onmetal.de, Version=v1alpha1
case storagev1alpha1.SchemeGroupVersion.WithResource("volumes"):
diff --git a/generated/informers/externalversions/networking/v1alpha1/interface.go b/generated/informers/externalversions/networking/v1alpha1/interface.go
index 96941aeb5..d1a6bdbce 100644
--- a/generated/informers/externalversions/networking/v1alpha1/interface.go
+++ b/generated/informers/externalversions/networking/v1alpha1/interface.go
@@ -27,6 +27,10 @@ type Interface interface {
Networks() NetworkInformer
// NetworkInterfaces returns a NetworkInterfaceInformer.
NetworkInterfaces() NetworkInterfaceInformer
+ // VirtualIPs returns a VirtualIPInformer.
+ VirtualIPs() VirtualIPInformer
+ // VirtualIPRoutings returns a VirtualIPRoutingInformer.
+ VirtualIPRoutings() VirtualIPRoutingInformer
}
type version struct {
@@ -49,3 +53,13 @@ func (v *version) Networks() NetworkInformer {
func (v *version) NetworkInterfaces() NetworkInterfaceInformer {
return &networkInterfaceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
+
+// VirtualIPs returns a VirtualIPInformer.
+func (v *version) VirtualIPs() VirtualIPInformer {
+ return &virtualIPInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
+}
+
+// VirtualIPRoutings returns a VirtualIPRoutingInformer.
+func (v *version) VirtualIPRoutings() VirtualIPRoutingInformer {
+ return &virtualIPRoutingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
+}
diff --git a/generated/informers/externalversions/networking/v1alpha1/virtualip.go b/generated/informers/externalversions/networking/v1alpha1/virtualip.go
new file mode 100644
index 000000000..a4cd9dfc1
--- /dev/null
+++ b/generated/informers/externalversions/networking/v1alpha1/virtualip.go
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by informer-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ "context"
+ time "time"
+
+ networkingv1alpha1 "github.com/onmetal/onmetal-api/apis/networking/v1alpha1"
+ versioned "github.com/onmetal/onmetal-api/generated/clientset/versioned"
+ internalinterfaces "github.com/onmetal/onmetal-api/generated/informers/externalversions/internalinterfaces"
+ v1alpha1 "github.com/onmetal/onmetal-api/generated/listers/networking/v1alpha1"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ runtime "k8s.io/apimachinery/pkg/runtime"
+ watch "k8s.io/apimachinery/pkg/watch"
+ cache "k8s.io/client-go/tools/cache"
+)
+
+// VirtualIPInformer provides access to a shared informer and lister for
+// VirtualIPs.
+type VirtualIPInformer interface {
+ Informer() cache.SharedIndexInformer
+ Lister() v1alpha1.VirtualIPLister
+}
+
+type virtualIPInformer struct {
+ factory internalinterfaces.SharedInformerFactory
+ tweakListOptions internalinterfaces.TweakListOptionsFunc
+ namespace string
+}
+
+// NewVirtualIPInformer constructs a new informer for VirtualIP type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewVirtualIPInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
+ return NewFilteredVirtualIPInformer(client, namespace, resyncPeriod, indexers, nil)
+}
+
+// NewFilteredVirtualIPInformer constructs a new informer for VirtualIP type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewFilteredVirtualIPInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
+ return cache.NewSharedIndexInformer(
+ &cache.ListWatch{
+ ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.NetworkingV1alpha1().VirtualIPs(namespace).List(context.TODO(), options)
+ },
+ WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.NetworkingV1alpha1().VirtualIPs(namespace).Watch(context.TODO(), options)
+ },
+ },
+ &networkingv1alpha1.VirtualIP{},
+ resyncPeriod,
+ indexers,
+ )
+}
+
+func (f *virtualIPInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
+ return NewFilteredVirtualIPInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
+}
+
+func (f *virtualIPInformer) Informer() cache.SharedIndexInformer {
+ return f.factory.InformerFor(&networkingv1alpha1.VirtualIP{}, f.defaultInformer)
+}
+
+func (f *virtualIPInformer) Lister() v1alpha1.VirtualIPLister {
+ return v1alpha1.NewVirtualIPLister(f.Informer().GetIndexer())
+}
diff --git a/generated/informers/externalversions/networking/v1alpha1/virtualiprouting.go b/generated/informers/externalversions/networking/v1alpha1/virtualiprouting.go
new file mode 100644
index 000000000..2c5cb2c71
--- /dev/null
+++ b/generated/informers/externalversions/networking/v1alpha1/virtualiprouting.go
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by informer-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ "context"
+ time "time"
+
+ networkingv1alpha1 "github.com/onmetal/onmetal-api/apis/networking/v1alpha1"
+ versioned "github.com/onmetal/onmetal-api/generated/clientset/versioned"
+ internalinterfaces "github.com/onmetal/onmetal-api/generated/informers/externalversions/internalinterfaces"
+ v1alpha1 "github.com/onmetal/onmetal-api/generated/listers/networking/v1alpha1"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ runtime "k8s.io/apimachinery/pkg/runtime"
+ watch "k8s.io/apimachinery/pkg/watch"
+ cache "k8s.io/client-go/tools/cache"
+)
+
+// VirtualIPRoutingInformer provides access to a shared informer and lister for
+// VirtualIPRoutings.
+type VirtualIPRoutingInformer interface {
+ Informer() cache.SharedIndexInformer
+ Lister() v1alpha1.VirtualIPRoutingLister
+}
+
+type virtualIPRoutingInformer struct {
+ factory internalinterfaces.SharedInformerFactory
+ tweakListOptions internalinterfaces.TweakListOptionsFunc
+ namespace string
+}
+
+// NewVirtualIPRoutingInformer constructs a new informer for VirtualIPRouting type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewVirtualIPRoutingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
+ return NewFilteredVirtualIPRoutingInformer(client, namespace, resyncPeriod, indexers, nil)
+}
+
+// NewFilteredVirtualIPRoutingInformer constructs a new informer for VirtualIPRouting type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewFilteredVirtualIPRoutingInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
+ return cache.NewSharedIndexInformer(
+ &cache.ListWatch{
+ ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.NetworkingV1alpha1().VirtualIPRoutings(namespace).List(context.TODO(), options)
+ },
+ WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.NetworkingV1alpha1().VirtualIPRoutings(namespace).Watch(context.TODO(), options)
+ },
+ },
+ &networkingv1alpha1.VirtualIPRouting{},
+ resyncPeriod,
+ indexers,
+ )
+}
+
+func (f *virtualIPRoutingInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
+ return NewFilteredVirtualIPRoutingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
+}
+
+func (f *virtualIPRoutingInformer) Informer() cache.SharedIndexInformer {
+ return f.factory.InformerFor(&networkingv1alpha1.VirtualIPRouting{}, f.defaultInformer)
+}
+
+func (f *virtualIPRoutingInformer) Lister() v1alpha1.VirtualIPRoutingLister {
+ return v1alpha1.NewVirtualIPRoutingLister(f.Informer().GetIndexer())
+}
diff --git a/generated/informers/internalversion/generic.go b/generated/informers/internalversion/generic.go
index ce79849a9..e29716d56 100644
--- a/generated/informers/internalversion/generic.go
+++ b/generated/informers/internalversion/generic.go
@@ -73,6 +73,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().InternalVersion().Networks().Informer()}, nil
case networking.SchemeGroupVersion.WithResource("networkinterfaces"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().InternalVersion().NetworkInterfaces().Informer()}, nil
+ case networking.SchemeGroupVersion.WithResource("virtualips"):
+ return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().InternalVersion().VirtualIPs().Informer()}, nil
+ case networking.SchemeGroupVersion.WithResource("virtualiproutings"):
+ return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().InternalVersion().VirtualIPRoutings().Informer()}, nil
// Group=storage.api.onmetal.de, Version=internalVersion
case storage.SchemeGroupVersion.WithResource("volumes"):
diff --git a/generated/informers/internalversion/networking/internalversion/interface.go b/generated/informers/internalversion/networking/internalversion/interface.go
index de957cceb..4a6623fd5 100644
--- a/generated/informers/internalversion/networking/internalversion/interface.go
+++ b/generated/informers/internalversion/networking/internalversion/interface.go
@@ -27,6 +27,10 @@ type Interface interface {
Networks() NetworkInformer
// NetworkInterfaces returns a NetworkInterfaceInformer.
NetworkInterfaces() NetworkInterfaceInformer
+ // VirtualIPs returns a VirtualIPInformer.
+ VirtualIPs() VirtualIPInformer
+ // VirtualIPRoutings returns a VirtualIPRoutingInformer.
+ VirtualIPRoutings() VirtualIPRoutingInformer
}
type version struct {
@@ -49,3 +53,13 @@ func (v *version) Networks() NetworkInformer {
func (v *version) NetworkInterfaces() NetworkInterfaceInformer {
return &networkInterfaceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
+
+// VirtualIPs returns a VirtualIPInformer.
+func (v *version) VirtualIPs() VirtualIPInformer {
+ return &virtualIPInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
+}
+
+// VirtualIPRoutings returns a VirtualIPRoutingInformer.
+func (v *version) VirtualIPRoutings() VirtualIPRoutingInformer {
+ return &virtualIPRoutingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
+}
diff --git a/generated/informers/internalversion/networking/internalversion/virtualip.go b/generated/informers/internalversion/networking/internalversion/virtualip.go
new file mode 100644
index 000000000..4968c716f
--- /dev/null
+++ b/generated/informers/internalversion/networking/internalversion/virtualip.go
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by informer-gen. DO NOT EDIT.
+
+package internalversion
+
+import (
+ "context"
+ time "time"
+
+ networking "github.com/onmetal/onmetal-api/apis/networking"
+ clientsetinternalversion "github.com/onmetal/onmetal-api/generated/clientset/internalversion"
+ internalinterfaces "github.com/onmetal/onmetal-api/generated/informers/internalversion/internalinterfaces"
+ internalversion "github.com/onmetal/onmetal-api/generated/listers/networking/internalversion"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ runtime "k8s.io/apimachinery/pkg/runtime"
+ watch "k8s.io/apimachinery/pkg/watch"
+ cache "k8s.io/client-go/tools/cache"
+)
+
+// VirtualIPInformer provides access to a shared informer and lister for
+// VirtualIPs.
+type VirtualIPInformer interface {
+ Informer() cache.SharedIndexInformer
+ Lister() internalversion.VirtualIPLister
+}
+
+type virtualIPInformer struct {
+ factory internalinterfaces.SharedInformerFactory
+ tweakListOptions internalinterfaces.TweakListOptionsFunc
+ namespace string
+}
+
+// NewVirtualIPInformer constructs a new informer for VirtualIP type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewVirtualIPInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
+ return NewFilteredVirtualIPInformer(client, namespace, resyncPeriod, indexers, nil)
+}
+
+// NewFilteredVirtualIPInformer constructs a new informer for VirtualIP type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewFilteredVirtualIPInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
+ return cache.NewSharedIndexInformer(
+ &cache.ListWatch{
+ ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.Networking().VirtualIPs(namespace).List(context.TODO(), options)
+ },
+ WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.Networking().VirtualIPs(namespace).Watch(context.TODO(), options)
+ },
+ },
+ &networking.VirtualIP{},
+ resyncPeriod,
+ indexers,
+ )
+}
+
+func (f *virtualIPInformer) defaultInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
+ return NewFilteredVirtualIPInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
+}
+
+func (f *virtualIPInformer) Informer() cache.SharedIndexInformer {
+ return f.factory.InformerFor(&networking.VirtualIP{}, f.defaultInformer)
+}
+
+func (f *virtualIPInformer) Lister() internalversion.VirtualIPLister {
+ return internalversion.NewVirtualIPLister(f.Informer().GetIndexer())
+}
diff --git a/generated/informers/internalversion/networking/internalversion/virtualiprouting.go b/generated/informers/internalversion/networking/internalversion/virtualiprouting.go
new file mode 100644
index 000000000..64959f35f
--- /dev/null
+++ b/generated/informers/internalversion/networking/internalversion/virtualiprouting.go
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by informer-gen. DO NOT EDIT.
+
+package internalversion
+
+import (
+ "context"
+ time "time"
+
+ networking "github.com/onmetal/onmetal-api/apis/networking"
+ clientsetinternalversion "github.com/onmetal/onmetal-api/generated/clientset/internalversion"
+ internalinterfaces "github.com/onmetal/onmetal-api/generated/informers/internalversion/internalinterfaces"
+ internalversion "github.com/onmetal/onmetal-api/generated/listers/networking/internalversion"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ runtime "k8s.io/apimachinery/pkg/runtime"
+ watch "k8s.io/apimachinery/pkg/watch"
+ cache "k8s.io/client-go/tools/cache"
+)
+
+// VirtualIPRoutingInformer provides access to a shared informer and lister for
+// VirtualIPRoutings.
+type VirtualIPRoutingInformer interface {
+ Informer() cache.SharedIndexInformer
+ Lister() internalversion.VirtualIPRoutingLister
+}
+
+type virtualIPRoutingInformer struct {
+ factory internalinterfaces.SharedInformerFactory
+ tweakListOptions internalinterfaces.TweakListOptionsFunc
+ namespace string
+}
+
+// NewVirtualIPRoutingInformer constructs a new informer for VirtualIPRouting type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewVirtualIPRoutingInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
+ return NewFilteredVirtualIPRoutingInformer(client, namespace, resyncPeriod, indexers, nil)
+}
+
+// NewFilteredVirtualIPRoutingInformer constructs a new informer for VirtualIPRouting type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewFilteredVirtualIPRoutingInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
+ return cache.NewSharedIndexInformer(
+ &cache.ListWatch{
+ ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.Networking().VirtualIPRoutings(namespace).List(context.TODO(), options)
+ },
+ WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.Networking().VirtualIPRoutings(namespace).Watch(context.TODO(), options)
+ },
+ },
+ &networking.VirtualIPRouting{},
+ resyncPeriod,
+ indexers,
+ )
+}
+
+func (f *virtualIPRoutingInformer) defaultInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
+ return NewFilteredVirtualIPRoutingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
+}
+
+func (f *virtualIPRoutingInformer) Informer() cache.SharedIndexInformer {
+ return f.factory.InformerFor(&networking.VirtualIPRouting{}, f.defaultInformer)
+}
+
+func (f *virtualIPRoutingInformer) Lister() internalversion.VirtualIPRoutingLister {
+ return internalversion.NewVirtualIPRoutingLister(f.Informer().GetIndexer())
+}
diff --git a/generated/listers/networking/internalversion/expansion_generated.go b/generated/listers/networking/internalversion/expansion_generated.go
index de4e7de2e..88e7d3ce3 100644
--- a/generated/listers/networking/internalversion/expansion_generated.go
+++ b/generated/listers/networking/internalversion/expansion_generated.go
@@ -32,3 +32,19 @@ type NetworkInterfaceListerExpansion interface{}
// NetworkInterfaceNamespaceListerExpansion allows custom methods to be added to
// NetworkInterfaceNamespaceLister.
type NetworkInterfaceNamespaceListerExpansion interface{}
+
+// VirtualIPListerExpansion allows custom methods to be added to
+// VirtualIPLister.
+type VirtualIPListerExpansion interface{}
+
+// VirtualIPNamespaceListerExpansion allows custom methods to be added to
+// VirtualIPNamespaceLister.
+type VirtualIPNamespaceListerExpansion interface{}
+
+// VirtualIPRoutingListerExpansion allows custom methods to be added to
+// VirtualIPRoutingLister.
+type VirtualIPRoutingListerExpansion interface{}
+
+// VirtualIPRoutingNamespaceListerExpansion allows custom methods to be added to
+// VirtualIPRoutingNamespaceLister.
+type VirtualIPRoutingNamespaceListerExpansion interface{}
diff --git a/generated/listers/networking/internalversion/virtualip.go b/generated/listers/networking/internalversion/virtualip.go
new file mode 100644
index 000000000..070c02499
--- /dev/null
+++ b/generated/listers/networking/internalversion/virtualip.go
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by lister-gen. DO NOT EDIT.
+
+package internalversion
+
+import (
+ networking "github.com/onmetal/onmetal-api/apis/networking"
+ "k8s.io/apimachinery/pkg/api/errors"
+ "k8s.io/apimachinery/pkg/labels"
+ "k8s.io/client-go/tools/cache"
+)
+
+// VirtualIPLister helps list VirtualIPs.
+// All objects returned here must be treated as read-only.
+type VirtualIPLister interface {
+ // List lists all VirtualIPs in the indexer.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*networking.VirtualIP, err error)
+ // VirtualIPs returns an object that can list and get VirtualIPs.
+ VirtualIPs(namespace string) VirtualIPNamespaceLister
+ VirtualIPListerExpansion
+}
+
+// virtualIPLister implements the VirtualIPLister interface.
+type virtualIPLister struct {
+ indexer cache.Indexer
+}
+
+// NewVirtualIPLister returns a new VirtualIPLister.
+func NewVirtualIPLister(indexer cache.Indexer) VirtualIPLister {
+ return &virtualIPLister{indexer: indexer}
+}
+
+// List lists all VirtualIPs in the indexer.
+func (s *virtualIPLister) List(selector labels.Selector) (ret []*networking.VirtualIP, err error) {
+ err = cache.ListAll(s.indexer, selector, func(m interface{}) {
+ ret = append(ret, m.(*networking.VirtualIP))
+ })
+ return ret, err
+}
+
+// VirtualIPs returns an object that can list and get VirtualIPs.
+func (s *virtualIPLister) VirtualIPs(namespace string) VirtualIPNamespaceLister {
+ return virtualIPNamespaceLister{indexer: s.indexer, namespace: namespace}
+}
+
+// VirtualIPNamespaceLister helps list and get VirtualIPs.
+// All objects returned here must be treated as read-only.
+type VirtualIPNamespaceLister interface {
+ // List lists all VirtualIPs in the indexer for a given namespace.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*networking.VirtualIP, err error)
+ // Get retrieves the VirtualIP from the indexer for a given namespace and name.
+ // Objects returned here must be treated as read-only.
+ Get(name string) (*networking.VirtualIP, error)
+ VirtualIPNamespaceListerExpansion
+}
+
+// virtualIPNamespaceLister implements the VirtualIPNamespaceLister
+// interface.
+type virtualIPNamespaceLister struct {
+ indexer cache.Indexer
+ namespace string
+}
+
+// List lists all VirtualIPs in the indexer for a given namespace.
+func (s virtualIPNamespaceLister) List(selector labels.Selector) (ret []*networking.VirtualIP, err error) {
+ err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
+ ret = append(ret, m.(*networking.VirtualIP))
+ })
+ return ret, err
+}
+
+// Get retrieves the VirtualIP from the indexer for a given namespace and name.
+func (s virtualIPNamespaceLister) Get(name string) (*networking.VirtualIP, error) {
+ obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
+ if err != nil {
+ return nil, err
+ }
+ if !exists {
+ return nil, errors.NewNotFound(networking.Resource("virtualip"), name)
+ }
+ return obj.(*networking.VirtualIP), nil
+}
diff --git a/generated/listers/networking/internalversion/virtualiprouting.go b/generated/listers/networking/internalversion/virtualiprouting.go
new file mode 100644
index 000000000..c124cfd62
--- /dev/null
+++ b/generated/listers/networking/internalversion/virtualiprouting.go
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by lister-gen. DO NOT EDIT.
+
+package internalversion
+
+import (
+ networking "github.com/onmetal/onmetal-api/apis/networking"
+ "k8s.io/apimachinery/pkg/api/errors"
+ "k8s.io/apimachinery/pkg/labels"
+ "k8s.io/client-go/tools/cache"
+)
+
+// VirtualIPRoutingLister helps list VirtualIPRoutings.
+// All objects returned here must be treated as read-only.
+type VirtualIPRoutingLister interface {
+ // List lists all VirtualIPRoutings in the indexer.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*networking.VirtualIPRouting, err error)
+ // VirtualIPRoutings returns an object that can list and get VirtualIPRoutings.
+ VirtualIPRoutings(namespace string) VirtualIPRoutingNamespaceLister
+ VirtualIPRoutingListerExpansion
+}
+
+// virtualIPRoutingLister implements the VirtualIPRoutingLister interface.
+type virtualIPRoutingLister struct {
+ indexer cache.Indexer
+}
+
+// NewVirtualIPRoutingLister returns a new VirtualIPRoutingLister.
+func NewVirtualIPRoutingLister(indexer cache.Indexer) VirtualIPRoutingLister {
+ return &virtualIPRoutingLister{indexer: indexer}
+}
+
+// List lists all VirtualIPRoutings in the indexer.
+func (s *virtualIPRoutingLister) List(selector labels.Selector) (ret []*networking.VirtualIPRouting, err error) {
+ err = cache.ListAll(s.indexer, selector, func(m interface{}) {
+ ret = append(ret, m.(*networking.VirtualIPRouting))
+ })
+ return ret, err
+}
+
+// VirtualIPRoutings returns an object that can list and get VirtualIPRoutings.
+func (s *virtualIPRoutingLister) VirtualIPRoutings(namespace string) VirtualIPRoutingNamespaceLister {
+ return virtualIPRoutingNamespaceLister{indexer: s.indexer, namespace: namespace}
+}
+
+// VirtualIPRoutingNamespaceLister helps list and get VirtualIPRoutings.
+// All objects returned here must be treated as read-only.
+type VirtualIPRoutingNamespaceLister interface {
+ // List lists all VirtualIPRoutings in the indexer for a given namespace.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*networking.VirtualIPRouting, err error)
+ // Get retrieves the VirtualIPRouting from the indexer for a given namespace and name.
+ // Objects returned here must be treated as read-only.
+ Get(name string) (*networking.VirtualIPRouting, error)
+ VirtualIPRoutingNamespaceListerExpansion
+}
+
+// virtualIPRoutingNamespaceLister implements the VirtualIPRoutingNamespaceLister
+// interface.
+type virtualIPRoutingNamespaceLister struct {
+ indexer cache.Indexer
+ namespace string
+}
+
+// List lists all VirtualIPRoutings in the indexer for a given namespace.
+func (s virtualIPRoutingNamespaceLister) List(selector labels.Selector) (ret []*networking.VirtualIPRouting, err error) {
+ err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
+ ret = append(ret, m.(*networking.VirtualIPRouting))
+ })
+ return ret, err
+}
+
+// Get retrieves the VirtualIPRouting from the indexer for a given namespace and name.
+func (s virtualIPRoutingNamespaceLister) Get(name string) (*networking.VirtualIPRouting, error) {
+ obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
+ if err != nil {
+ return nil, err
+ }
+ if !exists {
+ return nil, errors.NewNotFound(networking.Resource("virtualiprouting"), name)
+ }
+ return obj.(*networking.VirtualIPRouting), nil
+}
diff --git a/generated/listers/networking/v1alpha1/expansion_generated.go b/generated/listers/networking/v1alpha1/expansion_generated.go
index ad48c3ff8..7964561fa 100644
--- a/generated/listers/networking/v1alpha1/expansion_generated.go
+++ b/generated/listers/networking/v1alpha1/expansion_generated.go
@@ -32,3 +32,19 @@ type NetworkInterfaceListerExpansion interface{}
// NetworkInterfaceNamespaceListerExpansion allows custom methods to be added to
// NetworkInterfaceNamespaceLister.
type NetworkInterfaceNamespaceListerExpansion interface{}
+
+// VirtualIPListerExpansion allows custom methods to be added to
+// VirtualIPLister.
+type VirtualIPListerExpansion interface{}
+
+// VirtualIPNamespaceListerExpansion allows custom methods to be added to
+// VirtualIPNamespaceLister.
+type VirtualIPNamespaceListerExpansion interface{}
+
+// VirtualIPRoutingListerExpansion allows custom methods to be added to
+// VirtualIPRoutingLister.
+type VirtualIPRoutingListerExpansion interface{}
+
+// VirtualIPRoutingNamespaceListerExpansion allows custom methods to be added to
+// VirtualIPRoutingNamespaceLister.
+type VirtualIPRoutingNamespaceListerExpansion interface{}
diff --git a/generated/listers/networking/v1alpha1/virtualip.go b/generated/listers/networking/v1alpha1/virtualip.go
new file mode 100644
index 000000000..f34d10704
--- /dev/null
+++ b/generated/listers/networking/v1alpha1/virtualip.go
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by lister-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ v1alpha1 "github.com/onmetal/onmetal-api/apis/networking/v1alpha1"
+ "k8s.io/apimachinery/pkg/api/errors"
+ "k8s.io/apimachinery/pkg/labels"
+ "k8s.io/client-go/tools/cache"
+)
+
+// VirtualIPLister helps list VirtualIPs.
+// All objects returned here must be treated as read-only.
+type VirtualIPLister interface {
+ // List lists all VirtualIPs in the indexer.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*v1alpha1.VirtualIP, err error)
+ // VirtualIPs returns an object that can list and get VirtualIPs.
+ VirtualIPs(namespace string) VirtualIPNamespaceLister
+ VirtualIPListerExpansion
+}
+
+// virtualIPLister implements the VirtualIPLister interface.
+type virtualIPLister struct {
+ indexer cache.Indexer
+}
+
+// NewVirtualIPLister returns a new VirtualIPLister.
+func NewVirtualIPLister(indexer cache.Indexer) VirtualIPLister {
+ return &virtualIPLister{indexer: indexer}
+}
+
+// List lists all VirtualIPs in the indexer.
+func (s *virtualIPLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualIP, err error) {
+ err = cache.ListAll(s.indexer, selector, func(m interface{}) {
+ ret = append(ret, m.(*v1alpha1.VirtualIP))
+ })
+ return ret, err
+}
+
+// VirtualIPs returns an object that can list and get VirtualIPs.
+func (s *virtualIPLister) VirtualIPs(namespace string) VirtualIPNamespaceLister {
+ return virtualIPNamespaceLister{indexer: s.indexer, namespace: namespace}
+}
+
+// VirtualIPNamespaceLister helps list and get VirtualIPs.
+// All objects returned here must be treated as read-only.
+type VirtualIPNamespaceLister interface {
+ // List lists all VirtualIPs in the indexer for a given namespace.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*v1alpha1.VirtualIP, err error)
+ // Get retrieves the VirtualIP from the indexer for a given namespace and name.
+ // Objects returned here must be treated as read-only.
+ Get(name string) (*v1alpha1.VirtualIP, error)
+ VirtualIPNamespaceListerExpansion
+}
+
+// virtualIPNamespaceLister implements the VirtualIPNamespaceLister
+// interface.
+type virtualIPNamespaceLister struct {
+ indexer cache.Indexer
+ namespace string
+}
+
+// List lists all VirtualIPs in the indexer for a given namespace.
+func (s virtualIPNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualIP, err error) {
+ err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
+ ret = append(ret, m.(*v1alpha1.VirtualIP))
+ })
+ return ret, err
+}
+
+// Get retrieves the VirtualIP from the indexer for a given namespace and name.
+func (s virtualIPNamespaceLister) Get(name string) (*v1alpha1.VirtualIP, error) {
+ obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
+ if err != nil {
+ return nil, err
+ }
+ if !exists {
+ return nil, errors.NewNotFound(v1alpha1.Resource("virtualip"), name)
+ }
+ return obj.(*v1alpha1.VirtualIP), nil
+}
diff --git a/generated/listers/networking/v1alpha1/virtualiprouting.go b/generated/listers/networking/v1alpha1/virtualiprouting.go
new file mode 100644
index 000000000..9a4e31f03
--- /dev/null
+++ b/generated/listers/networking/v1alpha1/virtualiprouting.go
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2021 by the OnMetal authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// Code generated by lister-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ v1alpha1 "github.com/onmetal/onmetal-api/apis/networking/v1alpha1"
+ "k8s.io/apimachinery/pkg/api/errors"
+ "k8s.io/apimachinery/pkg/labels"
+ "k8s.io/client-go/tools/cache"
+)
+
+// VirtualIPRoutingLister helps list VirtualIPRoutings.
+// All objects returned here must be treated as read-only.
+type VirtualIPRoutingLister interface {
+ // List lists all VirtualIPRoutings in the indexer.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*v1alpha1.VirtualIPRouting, err error)
+ // VirtualIPRoutings returns an object that can list and get VirtualIPRoutings.
+ VirtualIPRoutings(namespace string) VirtualIPRoutingNamespaceLister
+ VirtualIPRoutingListerExpansion
+}
+
+// virtualIPRoutingLister implements the VirtualIPRoutingLister interface.
+type virtualIPRoutingLister struct {
+ indexer cache.Indexer
+}
+
+// NewVirtualIPRoutingLister returns a new VirtualIPRoutingLister.
+func NewVirtualIPRoutingLister(indexer cache.Indexer) VirtualIPRoutingLister {
+ return &virtualIPRoutingLister{indexer: indexer}
+}
+
+// List lists all VirtualIPRoutings in the indexer.
+func (s *virtualIPRoutingLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualIPRouting, err error) {
+ err = cache.ListAll(s.indexer, selector, func(m interface{}) {
+ ret = append(ret, m.(*v1alpha1.VirtualIPRouting))
+ })
+ return ret, err
+}
+
+// VirtualIPRoutings returns an object that can list and get VirtualIPRoutings.
+func (s *virtualIPRoutingLister) VirtualIPRoutings(namespace string) VirtualIPRoutingNamespaceLister {
+ return virtualIPRoutingNamespaceLister{indexer: s.indexer, namespace: namespace}
+}
+
+// VirtualIPRoutingNamespaceLister helps list and get VirtualIPRoutings.
+// All objects returned here must be treated as read-only.
+type VirtualIPRoutingNamespaceLister interface {
+ // List lists all VirtualIPRoutings in the indexer for a given namespace.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*v1alpha1.VirtualIPRouting, err error)
+ // Get retrieves the VirtualIPRouting from the indexer for a given namespace and name.
+ // Objects returned here must be treated as read-only.
+ Get(name string) (*v1alpha1.VirtualIPRouting, error)
+ VirtualIPRoutingNamespaceListerExpansion
+}
+
+// virtualIPRoutingNamespaceLister implements the VirtualIPRoutingNamespaceLister
+// interface.
+type virtualIPRoutingNamespaceLister struct {
+ indexer cache.Indexer
+ namespace string
+}
+
+// List lists all VirtualIPRoutings in the indexer for a given namespace.
+func (s virtualIPRoutingNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.VirtualIPRouting, err error) {
+ err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
+ ret = append(ret, m.(*v1alpha1.VirtualIPRouting))
+ })
+ return ret, err
+}
+
+// Get retrieves the VirtualIPRouting from the indexer for a given namespace and name.
+func (s virtualIPRoutingNamespaceLister) Get(name string) (*v1alpha1.VirtualIPRouting, error) {
+ obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
+ if err != nil {
+ return nil, err
+ }
+ if !exists {
+ return nil, errors.NewNotFound(v1alpha1.Resource("virtualiprouting"), name)
+ }
+ return obj.(*v1alpha1.VirtualIPRouting), nil
+}
diff --git a/generated/openapi/api_violations.report b/generated/openapi/api_violations.report
index 911065db3..c7ea86869 100644
--- a/generated/openapi/api_violations.report
+++ b/generated/openapi/api_violations.report
@@ -14,6 +14,7 @@ API rule violation: list_type_missing,github.com/onmetal/onmetal-api/apis/ipam/v
API rule violation: list_type_missing,github.com/onmetal/onmetal-api/apis/networking/v1alpha1,NetworkInterfaceSpec,IPFamilies
API rule violation: list_type_missing,github.com/onmetal/onmetal-api/apis/networking/v1alpha1,NetworkInterfaceSpec,IPs
API rule violation: list_type_missing,github.com/onmetal/onmetal-api/apis/networking/v1alpha1,NetworkInterfaceStatus,IPs
+API rule violation: list_type_missing,github.com/onmetal/onmetal-api/apis/networking/v1alpha1,VirtualIPRouting,Subsets
API rule violation: list_type_missing,github.com/onmetal/onmetal-api/apis/storage/v1alpha1,VolumePoolSpec,Taints
API rule violation: list_type_missing,github.com/onmetal/onmetal-api/apis/storage/v1alpha1,VolumePoolStatus,AvailableVolumeClasses
API rule violation: list_type_missing,github.com/onmetal/onmetal-api/apis/storage/v1alpha1,VolumePoolStatus,Conditions
@@ -144,6 +145,7 @@ API rule violation: list_type_missing,k8s.io/apimachinery/pkg/runtime,RawExtensi
API rule violation: list_type_missing,k8s.io/apimachinery/pkg/runtime,Unknown,Raw
API rule violation: names_match,github.com/onmetal/onmetal-api/apis/compute/v1alpha1,MachineSpec,IgnitionRef
API rule violation: names_match,github.com/onmetal/onmetal-api/apis/compute/v1alpha1,MachineStatus,VolumeAttachments
+API rule violation: names_match,github.com/onmetal/onmetal-api/apis/networking/v1alpha1,LocalUIDReference,UID
API rule violation: names_match,github.com/onmetal/onmetal-api/apis/networking/v1alpha1,NetworkInterfaceSpec,IPs
API rule violation: names_match,github.com/onmetal/onmetal-api/apis/networking/v1alpha1,NetworkInterfaceStatus,IPs
API rule violation: names_match,k8s.io/api/core/v1,AzureDiskVolumeSource,DataDiskURI
diff --git a/generated/openapi/zz_generated.openapi.go b/generated/openapi/zz_generated.openapi.go
index 394bfb551..0f732db60 100644
--- a/generated/openapi/zz_generated.openapi.go
+++ b/generated/openapi/zz_generated.openapi.go
@@ -70,12 +70,20 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
"github.com/onmetal/onmetal-api/apis/ipam/v1alpha1.PrefixTemplateSpec": schema_onmetal_api_apis_ipam_v1alpha1_PrefixTemplateSpec(ref),
"github.com/onmetal/onmetal-api/apis/networking/v1alpha1.EphemeralPrefixSource": schema_onmetal_api_apis_networking_v1alpha1_EphemeralPrefixSource(ref),
"github.com/onmetal/onmetal-api/apis/networking/v1alpha1.IPSource": schema_onmetal_api_apis_networking_v1alpha1_IPSource(ref),
+ "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.LocalUIDReference": schema_onmetal_api_apis_networking_v1alpha1_LocalUIDReference(ref),
"github.com/onmetal/onmetal-api/apis/networking/v1alpha1.Network": schema_onmetal_api_apis_networking_v1alpha1_Network(ref),
"github.com/onmetal/onmetal-api/apis/networking/v1alpha1.NetworkInterface": schema_onmetal_api_apis_networking_v1alpha1_NetworkInterface(ref),
"github.com/onmetal/onmetal-api/apis/networking/v1alpha1.NetworkInterfaceList": schema_onmetal_api_apis_networking_v1alpha1_NetworkInterfaceList(ref),
"github.com/onmetal/onmetal-api/apis/networking/v1alpha1.NetworkInterfaceSpec": schema_onmetal_api_apis_networking_v1alpha1_NetworkInterfaceSpec(ref),
"github.com/onmetal/onmetal-api/apis/networking/v1alpha1.NetworkInterfaceStatus": schema_onmetal_api_apis_networking_v1alpha1_NetworkInterfaceStatus(ref),
"github.com/onmetal/onmetal-api/apis/networking/v1alpha1.NetworkList": schema_onmetal_api_apis_networking_v1alpha1_NetworkList(ref),
+ "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIP": schema_onmetal_api_apis_networking_v1alpha1_VirtualIP(ref),
+ "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPList": schema_onmetal_api_apis_networking_v1alpha1_VirtualIPList(ref),
+ "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPRouting": schema_onmetal_api_apis_networking_v1alpha1_VirtualIPRouting(ref),
+ "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPRoutingList": schema_onmetal_api_apis_networking_v1alpha1_VirtualIPRoutingList(ref),
+ "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPRoutingSubset": schema_onmetal_api_apis_networking_v1alpha1_VirtualIPRoutingSubset(ref),
+ "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPSpec": schema_onmetal_api_apis_networking_v1alpha1_VirtualIPSpec(ref),
+ "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPStatus": schema_onmetal_api_apis_networking_v1alpha1_VirtualIPStatus(ref),
"github.com/onmetal/onmetal-api/apis/storage/v1alpha1.ClaimReference": schema_onmetal_api_apis_storage_v1alpha1_ClaimReference(ref),
"github.com/onmetal/onmetal-api/apis/storage/v1alpha1.Volume": schema_onmetal_api_apis_storage_v1alpha1_Volume(ref),
"github.com/onmetal/onmetal-api/apis/storage/v1alpha1.VolumeAccess": schema_onmetal_api_apis_storage_v1alpha1_VolumeAccess(ref),
@@ -1895,6 +1903,36 @@ func schema_onmetal_api_apis_networking_v1alpha1_IPSource(ref common.ReferenceCa
}
}
+func schema_onmetal_api_apis_networking_v1alpha1_LocalUIDReference(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "LocalUIDReference is a reference to another entity including its UID.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "name": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Name is the name of the referenced entity.",
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "UID": {
+ SchemaProps: spec.SchemaProps{
+ Description: "UID is the UID of the referenced entity.",
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ },
+ Required: []string{"name", "UID"},
+ },
+ },
+ }
+}
+
func schema_onmetal_api_apis_networking_v1alpha1_Network(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@@ -2163,6 +2201,289 @@ func schema_onmetal_api_apis_networking_v1alpha1_NetworkList(ref common.Referenc
}
}
+func schema_onmetal_api_apis_networking_v1alpha1_VirtualIP(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "VirtualIP is the Schema for the virtualips API",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "kind": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "apiVersion": {
+ SchemaProps: spec.SchemaProps{
+ Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "metadata": {
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
+ },
+ },
+ "spec": {
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPSpec"),
+ },
+ },
+ "status": {
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPStatus"),
+ },
+ },
+ },
+ },
+ },
+ Dependencies: []string{
+ "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPSpec", "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
+ }
+}
+
+func schema_onmetal_api_apis_networking_v1alpha1_VirtualIPList(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "VirtualIPList contains a list of VirtualIP",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "kind": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "apiVersion": {
+ SchemaProps: spec.SchemaProps{
+ Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "metadata": {
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
+ },
+ },
+ "items": {
+ SchemaProps: spec.SchemaProps{
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIP"),
+ },
+ },
+ },
+ },
+ },
+ },
+ Required: []string{"items"},
+ },
+ },
+ Dependencies: []string{
+ "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIP", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
+ }
+}
+
+func schema_onmetal_api_apis_networking_v1alpha1_VirtualIPRouting(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "VirtualIPRouting is the Schema for the virtualiproutings API",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "kind": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "apiVersion": {
+ SchemaProps: spec.SchemaProps{
+ Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "metadata": {
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
+ },
+ },
+ "subsets": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Subsets are the subsets that make up a VirtualIPRouting.",
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPRoutingSubset"),
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ Dependencies: []string{
+ "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPRoutingSubset", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
+ }
+}
+
+func schema_onmetal_api_apis_networking_v1alpha1_VirtualIPRoutingList(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "VirtualIPRoutingList contains a list of VirtualIPRouting",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "kind": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "apiVersion": {
+ SchemaProps: spec.SchemaProps{
+ Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "metadata": {
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
+ },
+ },
+ "items": {
+ SchemaProps: spec.SchemaProps{
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPRouting"),
+ },
+ },
+ },
+ },
+ },
+ },
+ Required: []string{"items"},
+ },
+ },
+ Dependencies: []string{
+ "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.VirtualIPRouting", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
+ }
+}
+
+func schema_onmetal_api_apis_networking_v1alpha1_VirtualIPRoutingSubset(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "VirtualIPRoutingSubset is one of the targets of a VirtualIPRouting.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "ip": {
+ SchemaProps: spec.SchemaProps{
+ Description: "IP is the IP of the entity routed towards.",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/onmetal/onmetal-api/apis/common/v1alpha1.IP"),
+ },
+ },
+ "targetRef": {
+ SchemaProps: spec.SchemaProps{
+ Description: "TargetRef is the targeted entity.",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/onmetal/onmetal-api/apis/networking/v1alpha1.LocalUIDReference"),
+ },
+ },
+ },
+ Required: []string{"ip", "targetRef"},
+ },
+ },
+ Dependencies: []string{
+ "github.com/onmetal/onmetal-api/apis/common/v1alpha1.IP", "github.com/onmetal/onmetal-api/apis/networking/v1alpha1.LocalUIDReference"},
+ }
+}
+
+func schema_onmetal_api_apis_networking_v1alpha1_VirtualIPSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "VirtualIPSpec defines the desired state of VirtualIP",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "type": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Type is the type of VirtualIP.",
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "ipFamily": {
+ SchemaProps: spec.SchemaProps{
+ Description: "IPFamily is the ip family of the VirtualIP.\n\nPossible enum values:\n - `\"IPv4\"` indicates that this IP is IPv4 protocol\n - `\"IPv6\"` indicates that this IP is IPv6 protocol",
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
+ Enum: []interface{}{"IPv4", "IPv6"}},
+ },
+ "networkInterfaceSelector": {
+ SchemaProps: spec.SchemaProps{
+ Description: "NetworkInterfaceSelector selects any NetworkInterface that should get the VirtualIP routed. If empty, it is assumed that an external process manages the VirtualIPRouting for this VirtualIP.",
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"),
+ },
+ },
+ },
+ Required: []string{"type", "ipFamily"},
+ },
+ },
+ Dependencies: []string{
+ "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"},
+ }
+}
+
+func schema_onmetal_api_apis_networking_v1alpha1_VirtualIPStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "VirtualIPStatus defines the observed state of VirtualIP",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "ip": {
+ SchemaProps: spec.SchemaProps{
+ Description: "IP is the allocated IP, if any.",
+ Ref: ref("github.com/onmetal/onmetal-api/apis/common/v1alpha1.IP"),
+ },
+ },
+ },
+ },
+ },
+ Dependencies: []string{
+ "github.com/onmetal/onmetal-api/apis/common/v1alpha1.IP"},
+ }
+}
+
func schema_onmetal_api_apis_storage_v1alpha1_ClaimReference(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
diff --git a/registry/networking/rest/rest.go b/registry/networking/rest/rest.go
index f90d6722b..a8c26f1e3 100644
--- a/registry/networking/rest/rest.go
+++ b/registry/networking/rest/rest.go
@@ -20,6 +20,8 @@ import (
networkingv1alpha1 "github.com/onmetal/onmetal-api/apis/networking/v1alpha1"
networkstorage "github.com/onmetal/onmetal-api/registry/networking/network/storage"
networkinterfacestorage "github.com/onmetal/onmetal-api/registry/networking/networkinterface/storage"
+ virtualipstorage "github.com/onmetal/onmetal-api/registry/networking/virtualip/storage"
+ virtualiproutingstorage "github.com/onmetal/onmetal-api/registry/networking/virtualiprouting/storage"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apiserver/pkg/registry/generic"
@@ -69,5 +71,20 @@ func (p StorageProvider) v1alpha1Storage(restOptionsGetter generic.RESTOptionsGe
storageMap["networks"] = networkStorage.Network
+ virtualIPStorage, err := virtualipstorage.NewStorage(restOptionsGetter)
+ if err != nil {
+ return storageMap, err
+ }
+
+ storageMap["virtualips"] = virtualIPStorage.VirtualIP
+ storageMap["virtualips/status"] = virtualIPStorage.Status
+
+ virtualIPRoutingStorage, err := virtualiproutingstorage.NewStorage(restOptionsGetter)
+ if err != nil {
+ return storageMap, err
+ }
+
+ storageMap["virtualiproutings"] = virtualIPRoutingStorage.VirtualIPRouting
+
return storageMap, nil
}
diff --git a/registry/networking/virtualip/storage/storage.go b/registry/networking/virtualip/storage/storage.go
new file mode 100644
index 000000000..2d820cc5a
--- /dev/null
+++ b/registry/networking/virtualip/storage/storage.go
@@ -0,0 +1,95 @@
+// Copyright 2022 OnMetal authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package storage
+
+import (
+ "context"
+
+ "github.com/onmetal/onmetal-api/apis/compute"
+ "github.com/onmetal/onmetal-api/apis/networking"
+ "github.com/onmetal/onmetal-api/registry/networking/virtualip"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apiserver/pkg/registry/generic"
+ genericregistry "k8s.io/apiserver/pkg/registry/generic/registry"
+ "k8s.io/apiserver/pkg/registry/rest"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+type VirtualIPStorage struct {
+ VirtualIP *REST
+ Status *StatusREST
+}
+
+type REST struct {
+ *genericregistry.Store
+}
+
+func (REST) ShortNames() []string {
+ return []string{"vip"}
+}
+
+func NewStorage(optsGetter generic.RESTOptionsGetter) (VirtualIPStorage, error) {
+ store := &genericregistry.Store{
+ NewFunc: func() runtime.Object {
+ return &networking.VirtualIP{}
+ },
+ NewListFunc: func() runtime.Object {
+ return &networking.VirtualIPList{}
+ },
+ PredicateFunc: virtualip.MatchVirtualIP,
+ DefaultQualifiedResource: compute.Resource("virtualips"),
+
+ CreateStrategy: virtualip.Strategy,
+ UpdateStrategy: virtualip.Strategy,
+ DeleteStrategy: virtualip.Strategy,
+
+ TableConvertor: newTableConvertor(),
+ }
+
+ options := &generic.StoreOptions{RESTOptions: optsGetter, AttrFunc: virtualip.GetAttrs}
+ if err := store.CompleteWithOptions(options); err != nil {
+ return VirtualIPStorage{}, err
+ }
+
+ statusStore := *store
+ statusStore.UpdateStrategy = virtualip.StatusStrategy
+ statusStore.ResetFieldsStrategy = virtualip.StatusStrategy
+
+ return VirtualIPStorage{
+ VirtualIP: &REST{store},
+ Status: &StatusREST{&statusStore},
+ }, nil
+}
+
+type StatusREST struct {
+ store *genericregistry.Store
+}
+
+func (r *StatusREST) New() runtime.Object {
+ return &networking.VirtualIP{}
+}
+
+func (r *StatusREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
+ return r.store.Get(ctx, name, options)
+}
+
+func (r *StatusREST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
+ return r.store.Update(ctx, name, objInfo, createValidation, updateValidation, false, options)
+}
+
+func (r *StatusREST) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
+ return r.store.GetResetFields()
+}
diff --git a/registry/networking/virtualip/storage/tableconvertor.go b/registry/networking/virtualip/storage/tableconvertor.go
new file mode 100644
index 000000000..35a9209a2
--- /dev/null
+++ b/registry/networking/virtualip/storage/tableconvertor.go
@@ -0,0 +1,74 @@
+// Copyright 2022 OnMetal authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package storage
+
+import (
+ "context"
+
+ "github.com/onmetal/onmetal-api/apis/networking"
+ "k8s.io/apimachinery/pkg/api/meta"
+ "k8s.io/apimachinery/pkg/api/meta/table"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+)
+
+type convertor struct{}
+
+var (
+ objectMetaSwaggerDoc = metav1.ObjectMeta{}.SwaggerDoc()
+
+ headers = []metav1.TableColumnDefinition{
+ {Name: "Name", Type: "string", Format: "name", Description: objectMetaSwaggerDoc["name"]},
+ {Name: "ExternalIP", Type: "string", Description: "The external IP of this virtual IP, if any."},
+ {Name: "Age", Type: "string", Format: "date", Description: objectMetaSwaggerDoc["creationTimestamp"]},
+ }
+)
+
+func newTableConvertor() *convertor {
+ return &convertor{}
+}
+
+func (c *convertor) ConvertToTable(ctx context.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
+ tab := &metav1.Table{
+ ColumnDefinitions: headers,
+ }
+
+ if m, err := meta.ListAccessor(obj); err == nil {
+ tab.ResourceVersion = m.GetResourceVersion()
+ tab.SelfLink = m.GetSelfLink()
+ tab.Continue = m.GetContinue()
+ } else {
+ if m, err := meta.CommonAccessor(obj); err == nil {
+ tab.ResourceVersion = m.GetResourceVersion()
+ tab.SelfLink = m.GetSelfLink()
+ }
+ }
+
+ var err error
+ tab.Rows, err = table.MetaToTableRow(obj, func(obj runtime.Object, m metav1.Object, name, age string) (cells []interface{}, err error) {
+ virtualIP := obj.(*networking.VirtualIP)
+
+ cells = append(cells, name)
+ if ip := virtualIP.Status.IP; ip.IsValid() {
+ cells = append(cells, ip.String())
+ } else {
+ cells = append(cells, "None")
+ }
+ cells = append(cells, age)
+
+ return cells, nil
+ })
+ return tab, err
+}
diff --git a/registry/networking/virtualip/strategy.go b/registry/networking/virtualip/strategy.go
new file mode 100644
index 000000000..c2b223b72
--- /dev/null
+++ b/registry/networking/virtualip/strategy.go
@@ -0,0 +1,127 @@
+// Copyright 2022 OnMetal authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package virtualip
+
+import (
+ "context"
+ "fmt"
+
+ "github.com/onmetal/onmetal-api/api"
+ "github.com/onmetal/onmetal-api/apis/networking"
+ "github.com/onmetal/onmetal-api/apis/networking/validation"
+ "k8s.io/apimachinery/pkg/fields"
+ "k8s.io/apimachinery/pkg/labels"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/util/validation/field"
+ "k8s.io/apiserver/pkg/registry/generic"
+ apisrvstorage "k8s.io/apiserver/pkg/storage"
+ "k8s.io/apiserver/pkg/storage/names"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+func GetAttrs(obj runtime.Object) (labels.Set, fields.Set, error) {
+ virtualIP, ok := obj.(*networking.VirtualIP)
+ if !ok {
+ return nil, nil, fmt.Errorf("given object is not a VirtualIP")
+ }
+ return virtualIP.Labels, SelectableFields(virtualIP), nil
+}
+
+func MatchVirtualIP(label labels.Selector, field fields.Selector) apisrvstorage.SelectionPredicate {
+ return apisrvstorage.SelectionPredicate{
+ Label: label,
+ Field: field,
+ GetAttrs: GetAttrs,
+ }
+}
+
+func SelectableFields(virtualIP *networking.VirtualIP) fields.Set {
+ return generic.ObjectMetaFieldsSet(&virtualIP.ObjectMeta, true)
+}
+
+type virtualIPStrategy struct {
+ runtime.ObjectTyper
+ names.NameGenerator
+}
+
+var Strategy = virtualIPStrategy{api.Scheme, names.SimpleNameGenerator}
+
+func (virtualIPStrategy) NamespaceScoped() bool {
+ return true
+}
+
+func (virtualIPStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
+}
+
+func (virtualIPStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
+}
+
+func (virtualIPStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {
+ virtualIP := obj.(*networking.VirtualIP)
+ return validation.ValidateVirtualIP(virtualIP)
+}
+
+func (virtualIPStrategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string {
+ return nil
+}
+
+func (virtualIPStrategy) AllowCreateOnUpdate() bool {
+ return false
+}
+
+func (virtualIPStrategy) AllowUnconditionalUpdate() bool {
+ return false
+}
+
+func (virtualIPStrategy) Canonicalize(obj runtime.Object) {
+}
+
+func (virtualIPStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
+ return field.ErrorList{}
+}
+
+func (virtualIPStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string {
+ return nil
+}
+
+type virtualIPStatusStrategy struct {
+ virtualIPStrategy
+}
+
+var StatusStrategy = virtualIPStatusStrategy{Strategy}
+
+func (virtualIPStatusStrategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
+ return map[fieldpath.APIVersion]*fieldpath.Set{
+ "compute.api.onmetal.de/v1alpha1": fieldpath.NewSet(
+ fieldpath.MakePathOrDie("spec"),
+ ),
+ }
+}
+
+func (virtualIPStatusStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
+ newVirtualIP := obj.(*networking.VirtualIP)
+ oldVirtualIP := old.(*networking.VirtualIP)
+ newVirtualIP.Spec = oldVirtualIP.Spec
+}
+
+func (virtualIPStatusStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
+ newVirtualIP := obj.(*networking.VirtualIP)
+ oldVirtualIP := old.(*networking.VirtualIP)
+ return validation.ValidateVirtualIPUpdate(newVirtualIP, oldVirtualIP)
+}
+
+func (virtualIPStatusStrategy) WarningsOnUpdate(cxt context.Context, obj, old runtime.Object) []string {
+ return nil
+}
diff --git a/registry/networking/virtualiprouting/storage/storage.go b/registry/networking/virtualiprouting/storage/storage.go
new file mode 100644
index 000000000..d6c633737
--- /dev/null
+++ b/registry/networking/virtualiprouting/storage/storage.go
@@ -0,0 +1,64 @@
+// Copyright 2022 OnMetal authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package storage
+
+import (
+ "github.com/onmetal/onmetal-api/apis/compute"
+ "github.com/onmetal/onmetal-api/apis/networking"
+ "github.com/onmetal/onmetal-api/registry/networking/virtualiprouting"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apiserver/pkg/registry/generic"
+ genericregistry "k8s.io/apiserver/pkg/registry/generic/registry"
+)
+
+type VirtualIPRoutingStorage struct {
+ VirtualIPRouting *REST
+}
+
+type REST struct {
+ *genericregistry.Store
+}
+
+func (REST) ShortNames() []string {
+ return []string{"vipr", "viprouting"}
+}
+
+func NewStorage(optsGetter generic.RESTOptionsGetter) (VirtualIPRoutingStorage, error) {
+ store := &genericregistry.Store{
+ NewFunc: func() runtime.Object {
+ return &networking.VirtualIPRouting{}
+ },
+ NewListFunc: func() runtime.Object {
+ return &networking.VirtualIPRoutingList{}
+ },
+ PredicateFunc: virtualiprouting.MatchVirtualIPRouting,
+ DefaultQualifiedResource: compute.Resource("virtualiproutings"),
+
+ CreateStrategy: virtualiprouting.Strategy,
+ UpdateStrategy: virtualiprouting.Strategy,
+ DeleteStrategy: virtualiprouting.Strategy,
+
+ TableConvertor: newTableConvertor(),
+ }
+
+ options := &generic.StoreOptions{RESTOptions: optsGetter, AttrFunc: virtualiprouting.GetAttrs}
+ if err := store.CompleteWithOptions(options); err != nil {
+ return VirtualIPRoutingStorage{}, err
+ }
+
+ return VirtualIPRoutingStorage{
+ VirtualIPRouting: &REST{store},
+ }, nil
+}
diff --git a/registry/networking/virtualiprouting/storage/tableconvertor.go b/registry/networking/virtualiprouting/storage/tableconvertor.go
new file mode 100644
index 000000000..379e3fa56
--- /dev/null
+++ b/registry/networking/virtualiprouting/storage/tableconvertor.go
@@ -0,0 +1,79 @@
+// Copyright 2022 OnMetal authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package storage
+
+import (
+ "context"
+
+ "github.com/onmetal/onmetal-api/apis/networking"
+ "github.com/onmetal/onmetal-api/tableconvertor"
+ "k8s.io/apimachinery/pkg/api/meta"
+ "k8s.io/apimachinery/pkg/api/meta/table"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+)
+
+type convertor struct{}
+
+var (
+ objectMetaSwaggerDoc = metav1.ObjectMeta{}.SwaggerDoc()
+
+ headers = []metav1.TableColumnDefinition{
+ {Name: "Name", Type: "string", Format: "name", Description: objectMetaSwaggerDoc["name"]},
+ {Name: "Endpoints", Type: "string", Description: "The target endpoints of this virtual ip."},
+ {Name: "Age", Type: "string", Format: "date", Description: objectMetaSwaggerDoc["creationTimestamp"]},
+ }
+)
+
+func newTableConvertor() *convertor {
+ return &convertor{}
+}
+
+func formatEndpoints(virtualIPRoutingSubsets []networking.VirtualIPRoutingSubset) string {
+ parts := make([]string, 0, len(virtualIPRoutingSubsets))
+ for _, virtualIPRoutingSubset := range virtualIPRoutingSubsets {
+ parts = append(parts, virtualIPRoutingSubset.IP.String())
+ }
+ return tableconvertor.JoinStringsMore(parts, ",", 3)
+}
+
+func (c *convertor) ConvertToTable(ctx context.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1.Table, error) {
+ tab := &metav1.Table{
+ ColumnDefinitions: headers,
+ }
+
+ if m, err := meta.ListAccessor(obj); err == nil {
+ tab.ResourceVersion = m.GetResourceVersion()
+ tab.SelfLink = m.GetSelfLink()
+ tab.Continue = m.GetContinue()
+ } else {
+ if m, err := meta.CommonAccessor(obj); err == nil {
+ tab.ResourceVersion = m.GetResourceVersion()
+ tab.SelfLink = m.GetSelfLink()
+ }
+ }
+
+ var err error
+ tab.Rows, err = table.MetaToTableRow(obj, func(obj runtime.Object, m metav1.Object, name, age string) (cells []interface{}, err error) {
+ virtualIPRouting := obj.(*networking.VirtualIPRouting)
+
+ cells = append(cells, name)
+ cells = append(cells, formatEndpoints(virtualIPRouting.Subsets))
+ cells = append(cells, age)
+
+ return cells, nil
+ })
+ return tab, err
+}
diff --git a/registry/networking/virtualiprouting/strategy.go b/registry/networking/virtualiprouting/strategy.go
new file mode 100644
index 000000000..378f16667
--- /dev/null
+++ b/registry/networking/virtualiprouting/strategy.go
@@ -0,0 +1,98 @@
+// Copyright 2022 OnMetal authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package virtualiprouting
+
+import (
+ "context"
+ "fmt"
+
+ "github.com/onmetal/onmetal-api/api"
+ "github.com/onmetal/onmetal-api/apis/networking"
+ "github.com/onmetal/onmetal-api/apis/networking/validation"
+ "k8s.io/apimachinery/pkg/fields"
+ "k8s.io/apimachinery/pkg/labels"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/util/validation/field"
+ "k8s.io/apiserver/pkg/registry/generic"
+ apisrvstorage "k8s.io/apiserver/pkg/storage"
+ "k8s.io/apiserver/pkg/storage/names"
+)
+
+func GetAttrs(obj runtime.Object) (labels.Set, fields.Set, error) {
+ virtualIPRouting, ok := obj.(*networking.VirtualIPRouting)
+ if !ok {
+ return nil, nil, fmt.Errorf("given object is not a VirtualIPRouting")
+ }
+ return virtualIPRouting.Labels, SelectableFields(virtualIPRouting), nil
+}
+
+func MatchVirtualIPRouting(label labels.Selector, field fields.Selector) apisrvstorage.SelectionPredicate {
+ return apisrvstorage.SelectionPredicate{
+ Label: label,
+ Field: field,
+ GetAttrs: GetAttrs,
+ }
+}
+
+func SelectableFields(virtualIPRouting *networking.VirtualIPRouting) fields.Set {
+ return generic.ObjectMetaFieldsSet(&virtualIPRouting.ObjectMeta, true)
+}
+
+type virtualIPRoutingStrategy struct {
+ runtime.ObjectTyper
+ names.NameGenerator
+}
+
+var Strategy = virtualIPRoutingStrategy{api.Scheme, names.SimpleNameGenerator}
+
+func (virtualIPRoutingStrategy) NamespaceScoped() bool {
+ return true
+}
+
+func (virtualIPRoutingStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
+}
+
+func (virtualIPRoutingStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
+}
+
+func (virtualIPRoutingStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {
+ virtualIPRouting := obj.(*networking.VirtualIPRouting)
+ return validation.ValidateVirtualIPRouting(virtualIPRouting)
+}
+
+func (virtualIPRoutingStrategy) WarningsOnCreate(ctx context.Context, obj runtime.Object) []string {
+ return nil
+}
+
+func (virtualIPRoutingStrategy) AllowCreateOnUpdate() bool {
+ return false
+}
+
+func (virtualIPRoutingStrategy) AllowUnconditionalUpdate() bool {
+ return false
+}
+
+func (virtualIPRoutingStrategy) Canonicalize(obj runtime.Object) {
+}
+
+func (virtualIPRoutingStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
+ newVirtualIPRouting := obj.(*networking.VirtualIPRouting)
+ oldVirtualIPRouting := old.(*networking.VirtualIPRouting)
+ return validation.ValidateVirtualIPRoutingUpdate(newVirtualIPRouting, oldVirtualIPRouting)
+}
+
+func (virtualIPRoutingStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string {
+ return nil
+}
diff --git a/tableconvertor/tableconvertor.go b/tableconvertor/tableconvertor.go
new file mode 100644
index 000000000..1fbfca860
--- /dev/null
+++ b/tableconvertor/tableconvertor.go
@@ -0,0 +1,36 @@
+// Copyright 2022 OnMetal authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package tableconvertor
+
+import (
+ "fmt"
+ "strings"
+)
+
+func JoinStringsMore(elems []string, sep string, max int) string {
+ if max < 1 {
+ panic(fmt.Sprintf("JoinStringsMore: max < 1 (%d)", max))
+ }
+
+ if len(elems) == 0 {
+ return "