From 62d4edbf7b00b6958270db20cad7f4e2364ff828 Mon Sep 17 00:00:00 2001 From: Cyclinder Kuo Date: Wed, 20 Nov 2024 15:27:26 +0800 Subject: [PATCH] Bump api version from v2beta1 to v2beta2 Signed-off-by: Cyclinder Kuo --- .github/workflows/trivy-scan-image.yaml | 1 + ...pool.spidernet.io_spidermultusconfigs.yaml | 70 +- cmd/spiderpool-agent/cmd/coordinator.go | 2 +- cmd/spiderpool-agent/cmd/crd_manager.go | 2 +- cmd/spiderpool-controller/cmd/clean.go | 2 +- cmd/spiderpool-controller/cmd/crd_manager.go | 2 +- .../cmd/metrics_server.go | 2 +- cmd/spiderpool-init/cmd/client.go | 2 +- cmd/spiderpool-init/cmd/config.go | 2 +- cmd/spiderpool-init/cmd/root.go | 2 +- docs/reference/crd-spidermultusconfig.md | 9 +- .../install/ai/get-started-macvlan-zh_CN.md | 1 - docs/usage/install/ai/get-started-macvlan.md | 1 - .../install/ai/get-started-sriov-zh_CN.md | 10 +- pkg/applicationcontroller/app_controller.go | 2 +- .../applicationcontroller_suite_test.go | 2 +- .../applicationinformers/utils.go | 2 +- .../applicationinformers/utils_test.go | 2 +- .../coordinator_informer.go | 2 +- pkg/coordinatormanager/coordinator_mutate.go | 2 +- .../coordinator_validate.go | 2 +- pkg/coordinatormanager/coordinator_webhook.go | 2 +- pkg/gcmanager/scanAll_IPPool.go | 2 +- pkg/ipam/allocate.go | 2 +- pkg/ipam/pool_selections.go | 2 +- pkg/ipam/release.go | 2 +- pkg/ipam/types.go | 2 +- pkg/ipam/utils.go | 2 +- pkg/ippoolmanager/ippool_informer.go | 2 +- pkg/ippoolmanager/ippool_informer_test.go | 2 +- pkg/ippoolmanager/ippool_manager.go | 2 +- .../ippool_manager_suite_test.go | 2 +- pkg/ippoolmanager/ippool_manager_test.go | 2 +- pkg/ippoolmanager/ippool_mutate.go | 2 +- pkg/ippoolmanager/ippool_subnet_validate.go | 2 +- pkg/ippoolmanager/ippool_validate.go | 2 +- pkg/ippoolmanager/ippool_webhook.go | 2 +- pkg/ippoolmanager/ippool_webhook_test.go | 2 +- pkg/ippoolmanager/utils.go | 2 +- pkg/ippoolmanager/utils_test.go | 2 +- .../spiderpool.spidernet.io/v2beta2/doc.go | 6 + .../v2beta2/groupversion_info.go | 26 + .../spiderpool.spidernet.io/v2beta2/rbac.go | 24 + .../v2beta2/register.go | 16 + .../v2beta2/spiderclaimparameters_types.go | 65 + .../v2beta2/spidercoordinator_types.go | 140 ++ .../v2beta2/spiderendpoint_types.go | 98 ++ .../v2beta2/spiderippool_types.go | 130 ++ .../v2beta2/spidermultus_types.go | 266 ++++ .../v2beta2/spiderreservedip_types.go | 44 + .../v2beta2/spidersubnet_types.go | 91 ++ .../v2beta2/types_string.go | 217 +++ .../v2beta2/zz_generated.deepcopy.go | 1329 +++++++++++++++++ .../client/clientset/versioned/clientset.go | 13 + .../versioned/fake/clientset_generated.go | 7 + .../clientset/versioned/fake/register.go | 4 +- .../clientset/versioned/scheme/register.go | 4 +- .../v2beta1/fake/fake_spiderclaimparameter.go | 2 +- .../v2beta1/fake/fake_spidercoordinator.go | 2 +- .../v2beta1/fake/fake_spiderippool.go | 2 +- .../v2beta1/fake/fake_spidermultusconfig.go | 2 +- .../v2beta1/fake/fake_spidersubnet.go | 2 +- .../v2beta1/spiderclaimparameter.go | 2 +- .../v2beta1/spidercoordinator.go | 2 +- .../v2beta1/spiderippool.go | 2 +- .../v2beta1/spidermultusconfig.go | 2 +- .../v2beta1/spiderpool.spidernet.io_client.go | 2 +- .../v2beta1/spidersubnet.go | 2 +- .../spiderpool.spidernet.io/v2beta2/doc.go | 7 + .../v2beta2/fake/doc.go | 7 + .../v2beta2/fake/fake_spiderclaimparameter.go | 116 ++ .../v2beta2/fake/fake_spidercoordinator.go | 119 ++ .../v2beta2/fake/fake_spiderippool.go | 119 ++ .../v2beta2/fake/fake_spidermultusconfig.go | 116 ++ .../fake_spiderpool.spidernet.io_client.go | 43 + .../v2beta2/fake/fake_spidersubnet.go | 119 ++ .../v2beta2/generated_expansion.go | 16 + .../v2beta2/spiderclaimparameter.go | 165 ++ .../v2beta2/spidercoordinator.go | 171 +++ .../v2beta2/spiderippool.go | 171 +++ .../v2beta2/spidermultusconfig.go | 165 ++ .../v2beta2/spiderpool.spidernet.io_client.go | 114 ++ .../v2beta2/spidersubnet.go | 171 +++ .../informers/externalversions/generic.go | 15 +- .../spiderpool.spidernet.io/interface.go | 8 + .../v2beta1/spiderclaimparameter.go | 2 +- .../v2beta1/spidercoordinator.go | 2 +- .../v2beta1/spiderippool.go | 2 +- .../v2beta1/spidermultusconfig.go | 2 +- .../v2beta1/spidersubnet.go | 2 +- .../v2beta2/interface.go | 60 + .../v2beta2/spiderclaimparameter.go | 77 + .../v2beta2/spidercoordinator.go | 76 + .../v2beta2/spiderippool.go | 76 + .../v2beta2/spidermultusconfig.go | 77 + .../v2beta2/spidersubnet.go | 76 + .../v2beta1/spiderclaimparameter.go | 2 +- .../v2beta1/spidercoordinator.go | 2 +- .../v2beta1/spiderippool.go | 2 +- .../v2beta1/spidermultusconfig.go | 2 +- .../v2beta1/spidersubnet.go | 2 +- .../v2beta2/expansion_generated.go | 34 + .../v2beta2/spiderclaimparameter.go | 86 ++ .../v2beta2/spidercoordinator.go | 55 + .../v2beta2/spiderippool.go | 55 + .../v2beta2/spidermultusconfig.go | 86 ++ .../v2beta2/spidersubnet.go | 55 + .../spidercliamparameter_webhook.go | 2 +- pkg/multuscniconfig/multusconfig_informer.go | 4 +- pkg/multuscniconfig/multusconfig_mutate.go | 2 +- pkg/multuscniconfig/multusconfig_validate.go | 10 +- pkg/multuscniconfig/multusconfig_webhook.go | 2 +- pkg/multuscniconfig/utils.go | 8 +- pkg/podmanager/utils.go | 11 +- pkg/podmanager/utils_test.go | 28 +- .../mock/reservedip_manager_mock.go | 2 +- pkg/reservedipmanager/reservedip_manager.go | 2 +- .../reservedip_manager_suite_test.go | 2 +- .../reservedip_manager_test.go | 2 +- pkg/reservedipmanager/reservedip_mutate.go | 2 +- pkg/reservedipmanager/reservedip_validate.go | 2 +- pkg/reservedipmanager/reservedip_webhook.go | 2 +- .../reservedip_webhook_test.go | 2 +- pkg/subnetmanager/subnet_informer.go | 2 +- pkg/subnetmanager/subnet_informer_test.go | 2 +- pkg/subnetmanager/subnet_manager.go | 2 +- .../subnet_manager_suite_test.go | 2 +- pkg/subnetmanager/subnet_manager_test.go | 2 +- pkg/subnetmanager/subnet_mutate.go | 2 +- pkg/subnetmanager/subnet_validate.go | 2 +- pkg/subnetmanager/subnet_webhook.go | 2 +- pkg/subnetmanager/subnet_webhook_test.go | 2 +- pkg/utils/convert/convert.go | 2 +- pkg/workloadendpointmanager/utils.go | 2 +- pkg/workloadendpointmanager/utils_test.go | 2 +- .../workloadendpoint_manager.go | 2 +- .../workloadendpoint_manager_suite_test.go | 2 +- .../workloadendpoint_manager_test.go | 2 +- test/e2e/affinity/affinity_suite_test.go | 2 +- test/e2e/affinity/affinity_test.go | 2 +- test/e2e/annotation/annotation_suite_test.go | 2 +- test/e2e/annotation/annotation_test.go | 2 +- test/e2e/assignip/assiginip_suite_test.go | 2 +- test/e2e/assignip/assignip_test.go | 2 +- test/e2e/common/reservedip.go | 2 +- test/e2e/common/spiderpool.go | 2 +- test/e2e/common/spidersubnet.go | 2 +- .../macvlan_overlay_one_suite_test.go | 2 +- .../macvlan_overlay_one_test.go | 2 +- .../macvlan_underlay_one_suite_test.go | 2 +- .../macvlan_underlay_one_test.go | 2 +- test/e2e/ifacer/ifacer_suite_test.go | 2 +- test/e2e/ifacer/ifacer_test.go | 2 +- test/e2e/ippoolcr/ippoolcr_suite_test.go | 2 +- test/e2e/ippoolcr/ippoolcr_test.go | 2 +- test/e2e/kruise/kruise_suite_test.go | 2 +- test/e2e/kruise/kruise_test.go | 2 +- test/e2e/kubevirt/kubevirt_suite_test.go | 2 +- test/e2e/kubevirt/kubevirt_test.go | 2 +- .../e2e/performance/performance_suite_test.go | 2 +- test/e2e/performance/performance_test.go | 2 +- test/e2e/podwebhook/podwebhook_suite_test.go | 2 +- test/e2e/podwebhook/podwebhook_test.go | 3 +- test/e2e/reclaim/chaos_test.go | 2 +- test/e2e/reclaim/reclaim_suite_test.go | 2 +- test/e2e/reclaim/reclaim_test.go | 2 +- .../e2e/reliability/reliability_suite_test.go | 2 +- test/e2e/reservedip/reservedip_suite_test.go | 2 +- test/e2e/reservedip/reservedip_test.go | 2 +- .../spiderclaimparameter_suite_test.go | 2 +- .../spiderclaimparameter_test.go | 2 +- .../spidercoordinator_suite_test.go | 2 +- .../spidercoordinator_test.go | 2 +- .../spidermultus/spidermultus_suite_test.go | 2 +- test/e2e/spidermultus/spidermultus_test.go | 13 +- test/e2e/subnet/subnet_suite_test.go | 2 +- test/e2e/subnet/subnet_test.go | 2 +- .../update-controller-gen.sh | 60 +- 178 files changed, 5184 insertions(+), 216 deletions(-) create mode 100644 pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/doc.go create mode 100644 pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/groupversion_info.go create mode 100644 pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/rbac.go create mode 100644 pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/register.go create mode 100644 pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderclaimparameters_types.go create mode 100644 pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidercoordinator_types.go create mode 100644 pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderendpoint_types.go create mode 100644 pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderippool_types.go create mode 100644 pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidermultus_types.go create mode 100644 pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderreservedip_types.go create mode 100644 pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidersubnet_types.go create mode 100644 pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/types_string.go create mode 100644 pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/zz_generated.deepcopy.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/doc.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/doc.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderclaimparameter.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidercoordinator.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderippool.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidermultusconfig.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderpool.spidernet.io_client.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidersubnet.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/generated_expansion.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderclaimparameter.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidercoordinator.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderippool.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderpool.spidernet.io_client.go create mode 100644 pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidersubnet.go create mode 100644 pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/interface.go create mode 100644 pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spiderclaimparameter.go create mode 100644 pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidercoordinator.go create mode 100644 pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spiderippool.go create mode 100644 pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go create mode 100644 pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidersubnet.go create mode 100644 pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/expansion_generated.go create mode 100644 pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spiderclaimparameter.go create mode 100644 pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidercoordinator.go create mode 100644 pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spiderippool.go create mode 100644 pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go create mode 100644 pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidersubnet.go diff --git a/.github/workflows/trivy-scan-image.yaml b/.github/workflows/trivy-scan-image.yaml index ec79053bb0..f60b114029 100644 --- a/.github/workflows/trivy-scan-image.yaml +++ b/.github/workflows/trivy-scan-image.yaml @@ -27,6 +27,7 @@ jobs: uses: actions/download-artifact@v4.1.8 with: pattern: image-tar-spiderpool-*-${{ inputs.ref }} + merge-multiple: true path: test/.download - name: List downloaded files diff --git a/charts/spiderpool/crds/spiderpool.spidernet.io_spidermultusconfigs.yaml b/charts/spiderpool/crds/spiderpool.spidernet.io_spidermultusconfigs.yaml index 461d27a569..dc6f2df685 100644 --- a/charts/spiderpool/crds/spiderpool.spidernet.io_spidermultusconfigs.yaml +++ b/charts/spiderpool/crds/spiderpool.spidernet.io_spidermultusconfigs.yaml @@ -163,6 +163,7 @@ spec: properties: ibKubernetesEnabled: default: false + description: Enforces ib-sriov-cni to work with ib-kubernetes. type: boolean ippools: description: SpiderpoolPools could specify the IPAM spiderpool @@ -179,17 +180,30 @@ spec: type: object linkState: default: enable + description: 'Enforces link state for the VF. Allowed values: + auto, enable, disable.' enum: - auto - enable - disable type: string pkey: + description: infiniBand pkey for VF, this field is used by ib-kubernetes + to add pkey with guid to InfiniBand subnet manager client e.g. + Mellanox UFM, OpenSM type: string rdmaIsolation: default: true + description: rdmaIsolation enablw RDMA CNI plugin is intended + to be run as a chained CNI plugin. it ensures isolation of RDMA + traffic from other workloads in the system by moving the associated + RDMA interfaces of the provided network interface to the container's + network namespace path. type: boolean resourceName: + description: The SR-IOV RDMA resource name of the SpiderMultusConfig. + the SR-IOV RDMA resource is often reported to kubelet by the + sriov-device-plugin. type: string required: - resourceName @@ -210,11 +224,14 @@ spec: type: array type: object master: + description: name of the host interface to create the link from. type: string type: object ipvlan: properties: bond: + description: Optional bond configuration for the CNI. It must + not be nil if the multiple master interfaces are specified. properties: mode: format: int32 @@ -229,10 +246,6 @@ spec: - mode - name type: object - enableRdma: - default: false - description: enable share rdma for ipvlan - type: boolean ippools: description: SpiderpoolPools could specify the IPAM spiderpool CNI configuration default IPv4&IPv6 pools. @@ -247,15 +260,23 @@ spec: type: array type: object master: + description: The master interface(s) for the CNI configuration. + At least one master interface must be specified. If multiple + master interfaces are specified, the spiderpool will create + a bond device with the bondConfig by the ifacer plugin. items: type: string type: array rdmaResourceName: - description: Resource name of the rdma device-plugin, If it's - empty and enableRdma is true, the value will be auto set by - operator. and the user can also set this value manually. + description: The RDMA resource name of the nic. the RDMA resource + is often reported to kubelet by the k8s-rdma-shared-dev-plugin. + when it is not empty and spiderpool podResourceInject feature + is enabled, spiderpool can automatically inject it into the + container's resources via webhook. type: string vlanID: + description: 'The VLAN ID for the CNI configuration, optional + and must be within the specified range: [0.4096).' format: int32 maximum: 4094 minimum: 0 @@ -266,6 +287,8 @@ spec: macvlan: properties: bond: + description: Optional bond configuration for the CNI. It must + not be nil if the multiple master interfaces are specified. properties: mode: format: int32 @@ -280,10 +303,6 @@ spec: - mode - name type: object - enableRdma: - default: false - description: enable share rdma for macvlan - type: boolean ippools: description: SpiderpoolPools could specify the IPAM spiderpool CNI configuration default IPv4&IPv6 pools. @@ -298,15 +317,23 @@ spec: type: array type: object master: + description: The master interface(s) for the CNI configuration. + At least one master interface must be specified. If multiple + master interfaces are specified, the spiderpool will create + a bond device with the bondConfig by the ifacer plugin. items: type: string type: array rdmaResourceName: - description: Resource name of the rdma device-plugin, If it's - empty and enableRdma is true, the value will be auto set by - operator. and the user can also set this value manually. + description: The RDMA resource name of the nic. the RDMA resource + is often reported to kubelet by the k8s-rdma-shared-dev-plugin. + when it is not empty and spiderpool podResourceInject feature + is enabled, spiderpool can automatically inject it into the + container's resources via webhook. type: string vlanID: + description: 'The VLAN ID for the CNI configuration, optional + and must be within the specified range: [0.4096).' format: int32 maximum: 4094 minimum: 0 @@ -361,6 +388,7 @@ spec: properties: enableRdma: default: false + description: DEPRECATED, use RdmaIsolation flled instead. type: boolean ippools: description: SpiderpoolPools could specify the IPAM spiderpool @@ -376,14 +404,28 @@ spec: type: array type: object maxTxRateMbps: + description: Mbps, 0 = disable rate limiting minimum: 0 type: integer minTxRateMbps: minimum: 0 type: integer + rdmaIsolation: + default: false + description: rdmaIsolation enable RDMA CNI plugin is intended + to be run as a chained CNI plugin. it ensures isolation of RDMA + traffic from other workloads in the system by moving the associated + RDMA interfaces of the provided network interface to the container's + network namespace path. + type: boolean resourceName: + description: The SR-IOV RDMA resource name of the SpiderMultusConfig. + the SR-IOV RDMA resource is often reported to kubelet by the + sriov-device-plugin. type: string vlanID: + description: 'The VLAN ID for the CNI configuration, optional + and must be within the specified range: [0.4096).' format: int32 maximum: 4094 minimum: 0 diff --git a/cmd/spiderpool-agent/cmd/coordinator.go b/cmd/spiderpool-agent/cmd/coordinator.go index 1697d2a8ca..abfdbe07cd 100644 --- a/cmd/spiderpool-agent/cmd/coordinator.go +++ b/cmd/spiderpool-agent/cmd/coordinator.go @@ -16,7 +16,7 @@ import ( "github.com/spidernet-io/spiderpool/api/v1/agent/server/restapi/daemonset" "github.com/spidernet-io/spiderpool/pkg/constant" "github.com/spidernet-io/spiderpool/pkg/coordinatormanager" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" ) var unixGetCoordinatorConfig = &_unixGetCoordinatorConfig{} diff --git a/cmd/spiderpool-agent/cmd/crd_manager.go b/cmd/spiderpool-agent/cmd/crd_manager.go index 8a37619aa8..b594394beb 100644 --- a/cmd/spiderpool-agent/cmd/crd_manager.go +++ b/cmd/spiderpool-agent/cmd/crd_manager.go @@ -17,7 +17,7 @@ import ( metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" ) var scheme = runtime.NewScheme() diff --git a/cmd/spiderpool-controller/cmd/clean.go b/cmd/spiderpool-controller/cmd/clean.go index bc1f86b923..ad001b7490 100644 --- a/cmd/spiderpool-controller/cmd/clean.go +++ b/cmd/spiderpool-controller/cmd/clean.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-multierror" "github.com/spf13/cobra" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/k8s/utils" "github.com/spidernet-io/spiderpool/pkg/utils/retry" webhook "k8s.io/api/admissionregistration/v1" diff --git a/cmd/spiderpool-controller/cmd/crd_manager.go b/cmd/spiderpool-controller/cmd/crd_manager.go index b50ed9ea6d..5195679965 100644 --- a/cmd/spiderpool-controller/cmd/crd_manager.go +++ b/cmd/spiderpool-controller/cmd/crd_manager.go @@ -24,7 +24,7 @@ import ( runtimeWebhook "sigs.k8s.io/controller-runtime/pkg/webhook" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" ) var scheme = runtime.NewScheme() diff --git a/cmd/spiderpool-controller/cmd/metrics_server.go b/cmd/spiderpool-controller/cmd/metrics_server.go index bd05cb5c50..7be2e00202 100644 --- a/cmd/spiderpool-controller/cmd/metrics_server.go +++ b/cmd/spiderpool-controller/cmd/metrics_server.go @@ -12,7 +12,7 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/metric" ) diff --git a/cmd/spiderpool-init/cmd/client.go b/cmd/spiderpool-init/cmd/client.go index 2e57bcbe5b..7f1b6e74c4 100644 --- a/cmd/spiderpool-init/cmd/client.go +++ b/cmd/spiderpool-init/cmd/client.go @@ -16,7 +16,7 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" ) diff --git a/cmd/spiderpool-init/cmd/config.go b/cmd/spiderpool-init/cmd/config.go index 65fe70948c..42a80d0bf2 100644 --- a/cmd/spiderpool-init/cmd/config.go +++ b/cmd/spiderpool-init/cmd/config.go @@ -16,7 +16,7 @@ import ( coordinatorcmd "github.com/spidernet-io/spiderpool/cmd/coordinator/cmd" "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" ) const ( diff --git a/cmd/spiderpool-init/cmd/root.go b/cmd/spiderpool-init/cmd/root.go index 151ac337b2..cb6b04acb5 100644 --- a/cmd/spiderpool-init/cmd/root.go +++ b/cmd/spiderpool-init/cmd/root.go @@ -11,7 +11,7 @@ import ( "k8s.io/utils/ptr" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" ) diff --git a/docs/reference/crd-spidermultusconfig.md b/docs/reference/crd-spidermultusconfig.md index 3ce8f583c2..e294c51ab2 100644 --- a/docs/reference/crd-spidermultusconfig.md +++ b/docs/reference/crd-spidermultusconfig.md @@ -71,6 +71,7 @@ This is the SpiderReservedIP spec for users to configure. | master | the Interfaces on your master, you could specify a single one Interface
or multiple Interfaces to generate one bond Interface | list of strings | required | | | vlanID | vlan ID | int | optional | [0,4094] | | bond | expected bond Interface configurations | [BondConfig](./crd-spidermultusconfig.md#bondconfig) | optional | | +| rdmaResourceName | rdma resource name of the spiderMultusConfig, it often reported to kubelet by the k8s-rdma-shared-dev-plugin. when it is not empty and spiderpool podResourceInject feature is enabled, spiderpool can automatically inject it into the container's resources via webhook | string | optional | | | ippools | the default IPPools in your CNI configurations | [SpiderpoolPools](./crd-spidermultusconfig.md#spiderpoolpools) | optional | | #### SpiderIPvlanCniConfig @@ -80,24 +81,26 @@ This is the SpiderReservedIP spec for users to configure. | master | the Interfaces on your master, you could specify a single one Interface
or multiple Interfaces to generate one bond Interface | list of strings | required | | | vlanID | vlan ID | int | optional | [0,4094] | | bond | expected bond Interface configurations | [BondConfig](./crd-spidermultusconfig.md#bondconfig) | optional | | +| rdmaResourceName | rdma resource name of the spiderMultusConfig, it often reported to kubelet by the k8s-rdma-shared-dev-plugin. when it is not empty and spiderpool podResourceInject feature is enabled, spiderpool can automatically inject it into the container's resources via webhook | string | optional | | | ippools | the default IPPools in your CNI configurations | [SpiderpoolPools](./crd-spidermultusconfig.md#spiderpoolpools) | optional | | #### SpiderSRIOVCniConfig | Field | Description | Schema | Validation | |---------------|-------------------------------------------------------------------------------------------|----------------------------------------------------------------|------------| -| resourceName | this property will create an annotation for Multus net-attach-def to cooperate with SRIOV | string | required | +| resourceName | this property will create an annotation for Multus net-attach-def to cooperate with SRIOV, if spiderpool podResourceInject feature is enabled, spiderpool can automatically inject it into the container's resources via webhook | string | required | | vlanID | vlan ID | int | optional | | minTxRateMbps | change the allowed minimum transmit bandwidth, in Mbps, for the VF. Setting this to 0 disables rate limiting. The min_tx_rate value should be <= max_tx_rate. Support of this feature depends on NICs and drivers | int | optional | | maxTxRateMbps | change the allowed maximum transmit bandwidth, in Mbps, for the VF. Setting this to 0 disables rate limiting | int | optional | -| enableRdma | enable rdma chain cni to isolate the rdma device | bool | optional | +| enableRdma(deprecated) | It will be remove in the furture, use rdmaIsolation instead. | bool | optional | + rdmaIsolation | rdmaIsolation enable RDMA CNI plugin is intended to be run as a chained CNI plugin. it ensures isolation of RDMA traffic from other workloads in the system by moving the associated RDMA interfaces of the provided network interface to the container's network namespace path. | bool | optional | | ippools | the default IPPools in your CNI configurations | [SpiderpoolPools](./crd-spidermultusconfig.md#spiderpoolpools) | optional | #### SpiderIBSRIOVCniConfig | Field | Description | Schema | Validation | |----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------|------------| -| resourceName | this property will create an annotation for Multus net-attach-def to cooperate with ib-sriov | string | required | +| resourceName | this property will create an annotation for Multus net-attach-def to cooperate with SRIOV, if spiderpool podResourceInject feature is enabled, spiderpool can automatically inject it into the container's resources via webhook | string | required | | pkey | InfiniBand pkey for VF, this field is used by [ib-kubernetes](https://github.com/Mellanox/ib-kubernetes) to add pkey with guid to InfiniBand subnet manager client e.g. [Mellanox UFM](https://www.nvidia.com/en-us/networking/infiniband/ufm/) | string | optional | | linkState | Enforces link state for the VF. Allowed values: auto, enable [default], disable | string | optional | | rdmaIsolation | Enable RDMA network namespace isolation for RDMA workloads, default to true | bool | optional | diff --git a/docs/usage/install/ai/get-started-macvlan-zh_CN.md b/docs/usage/install/ai/get-started-macvlan-zh_CN.md index 6fd0586d3b..5e1edbb8a3 100644 --- a/docs/usage/install/ai/get-started-macvlan-zh_CN.md +++ b/docs/usage/install/ai/get-started-macvlan-zh_CN.md @@ -300,7 +300,6 @@ spidernet.io/shared_cx5_gpu6: 1 spidernet.io/shared_cx5_gpu7: 1 spidernet.io/shared_cx5_gpu8: 1 - #nvidia.com/gpu: 1 EOF $ helm install rdma-tools spiderchart/rdma-tools -f ./values.yaml diff --git a/docs/usage/install/ai/get-started-macvlan.md b/docs/usage/install/ai/get-started-macvlan.md index 8ced42507f..7652971177 100644 --- a/docs/usage/install/ai/get-started-macvlan.md +++ b/docs/usage/install/ai/get-started-macvlan.md @@ -299,7 +299,6 @@ The network planning for the cluster is as follows: spidernet.io/shared_cx5_gpu6: 1 spidernet.io/shared_cx5_gpu7: 1 spidernet.io/shared_cx5_gpu8: 1 - #nvidia.com/gpu: 1 ``` During the creation of the network namespace for the container, Spiderpool will perform connectivity tests on the gateway of the macvlan interface. diff --git a/docs/usage/install/ai/get-started-sriov-zh_CN.md b/docs/usage/install/ai/get-started-sriov-zh_CN.md index 78877db006..e699a4234c 100644 --- a/docs/usage/install/ai/get-started-sriov-zh_CN.md +++ b/docs/usage/install/ai/get-started-sriov-zh_CN.md @@ -360,7 +360,7 @@ Spiderpool 使用了 [sriov-network-operator](https://github.com/k8snetworkplumb cniType: sriov sriov: resourceName: spidernet.io/gpu1sriov - enableRdma: true + rdmaIsolation: true ippools: ipv4: ["gpu1-net11"] EOF @@ -598,10 +598,10 @@ Spiderpool 使用了 [sriov-network-operator](https://github.com/k8snetworkplumb name: ib-sriov namespace: spiderpool spec: - cniType: ib-sriov - ibsriov: - pkey: 1000 - ... + cniType: ib-sriov + ibsriov: + pkey: 1000 + ... EOF ``` diff --git a/pkg/applicationcontroller/app_controller.go b/pkg/applicationcontroller/app_controller.go index 40ec2c8e92..6f38fffc19 100644 --- a/pkg/applicationcontroller/app_controller.go +++ b/pkg/applicationcontroller/app_controller.go @@ -32,7 +32,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/applicationcontroller/applicationinformers" "github.com/spidernet-io/spiderpool/pkg/constant" "github.com/spidernet-io/spiderpool/pkg/election" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/subnetmanager" "github.com/spidernet-io/spiderpool/pkg/types" diff --git a/pkg/applicationcontroller/applicationcontroller_suite_test.go b/pkg/applicationcontroller/applicationcontroller_suite_test.go index 7b13d3a832..cddfc0dbe5 100644 --- a/pkg/applicationcontroller/applicationcontroller_suite_test.go +++ b/pkg/applicationcontroller/applicationcontroller_suite_test.go @@ -16,7 +16,7 @@ import ( "k8s.io/client-go/tools/cache" "sigs.k8s.io/controller-runtime/pkg/client/fake" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/reservedipmanager" "github.com/spidernet-io/spiderpool/pkg/subnetmanager" ) diff --git a/pkg/applicationcontroller/applicationinformers/utils.go b/pkg/applicationcontroller/applicationinformers/utils.go index 3337cb4c49..fc27c29ffe 100644 --- a/pkg/applicationcontroller/applicationinformers/utils.go +++ b/pkg/applicationcontroller/applicationinformers/utils.go @@ -30,7 +30,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" ) diff --git a/pkg/applicationcontroller/applicationinformers/utils_test.go b/pkg/applicationcontroller/applicationinformers/utils_test.go index e62544b73f..a0f0d776bf 100644 --- a/pkg/applicationcontroller/applicationinformers/utils_test.go +++ b/pkg/applicationcontroller/applicationinformers/utils_test.go @@ -19,7 +19,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/pkg/utils/convert" diff --git a/pkg/coordinatormanager/coordinator_informer.go b/pkg/coordinatormanager/coordinator_informer.go index 0f6da33d98..e6fab45f1d 100644 --- a/pkg/coordinatormanager/coordinator_informer.go +++ b/pkg/coordinatormanager/coordinator_informer.go @@ -42,7 +42,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" "github.com/spidernet-io/spiderpool/pkg/election" "github.com/spidernet-io/spiderpool/pkg/event" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" clientset "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions" spiderinformers "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1" diff --git a/pkg/coordinatormanager/coordinator_mutate.go b/pkg/coordinatormanager/coordinator_mutate.go index e26ca0e37b..44b7584ac3 100644 --- a/pkg/coordinatormanager/coordinator_mutate.go +++ b/pkg/coordinatormanager/coordinator_mutate.go @@ -15,7 +15,7 @@ import ( coordinator_cmd "github.com/spidernet-io/spiderpool/cmd/coordinator/cmd" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" ) diff --git a/pkg/coordinatormanager/coordinator_validate.go b/pkg/coordinatormanager/coordinator_validate.go index 4577a338e3..8a189a7ff4 100644 --- a/pkg/coordinatormanager/coordinator_validate.go +++ b/pkg/coordinatormanager/coordinator_validate.go @@ -13,7 +13,7 @@ import ( "k8s.io/utils/strings/slices" "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" ) var ( diff --git a/pkg/coordinatormanager/coordinator_webhook.go b/pkg/coordinatormanager/coordinator_webhook.go index 9f5d5beeee..a5d18eefa7 100644 --- a/pkg/coordinatormanager/coordinator_webhook.go +++ b/pkg/coordinatormanager/coordinator_webhook.go @@ -15,7 +15,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook/admission" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" ) diff --git a/pkg/gcmanager/scanAll_IPPool.go b/pkg/gcmanager/scanAll_IPPool.go index 82bab960e8..6040d70248 100644 --- a/pkg/gcmanager/scanAll_IPPool.go +++ b/pkg/gcmanager/scanAll_IPPool.go @@ -14,7 +14,7 @@ import ( "k8s.io/client-go/tools/cache" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/podmanager" "github.com/spidernet-io/spiderpool/pkg/types" diff --git a/pkg/ipam/allocate.go b/pkg/ipam/allocate.go index b7314cf1dc..6576eaa696 100644 --- a/pkg/ipam/allocate.go +++ b/pkg/ipam/allocate.go @@ -25,7 +25,7 @@ import ( "github.com/spidernet-io/spiderpool/api/v1/agent/models" "github.com/spidernet-io/spiderpool/pkg/constant" "github.com/spidernet-io/spiderpool/pkg/ippoolmanager" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/metric" "github.com/spidernet-io/spiderpool/pkg/multuscniconfig" diff --git a/pkg/ipam/pool_selections.go b/pkg/ipam/pool_selections.go index 1aa2854326..1630fa8fb1 100644 --- a/pkg/ipam/pool_selections.go +++ b/pkg/ipam/pool_selections.go @@ -20,7 +20,7 @@ import ( "github.com/spidernet-io/spiderpool/api/v1/agent/models" "github.com/spidernet-io/spiderpool/pkg/applicationcontroller/applicationinformers" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/namespacemanager" "github.com/spidernet-io/spiderpool/pkg/types" diff --git a/pkg/ipam/release.go b/pkg/ipam/release.go index 887e7b78f6..9d67f60969 100644 --- a/pkg/ipam/release.go +++ b/pkg/ipam/release.go @@ -20,7 +20,7 @@ import ( "github.com/spidernet-io/spiderpool/api/v1/agent/models" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/metric" "github.com/spidernet-io/spiderpool/pkg/podmanager" diff --git a/pkg/ipam/types.go b/pkg/ipam/types.go index 5014493651..f3617f9966 100644 --- a/pkg/ipam/types.go +++ b/pkg/ipam/types.go @@ -6,7 +6,7 @@ package ipam import ( "fmt" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" ) diff --git a/pkg/ipam/utils.go b/pkg/ipam/utils.go index 7c51f25407..3b85fc2285 100644 --- a/pkg/ipam/utils.go +++ b/pkg/ipam/utils.go @@ -19,7 +19,7 @@ import ( subnetmanagercontrollers "github.com/spidernet-io/spiderpool/pkg/applicationcontroller/applicationinformers" "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/pkg/utils/convert" diff --git a/pkg/ippoolmanager/ippool_informer.go b/pkg/ippoolmanager/ippool_informer.go index 6cba9e95d0..27bbd85d6d 100644 --- a/pkg/ippoolmanager/ippool_informer.go +++ b/pkg/ippoolmanager/ippool_informer.go @@ -26,7 +26,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" "github.com/spidernet-io/spiderpool/pkg/election" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" crdclientset "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions" informers "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1" diff --git a/pkg/ippoolmanager/ippool_informer_test.go b/pkg/ippoolmanager/ippool_informer_test.go index 605bea4711..72710623dc 100644 --- a/pkg/ippoolmanager/ippool_informer_test.go +++ b/pkg/ippoolmanager/ippool_informer_test.go @@ -23,7 +23,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/applicationcontroller/applicationinformers" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" spiderpoolfake "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/fake" "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions" "github.com/spidernet-io/spiderpool/pkg/metric" diff --git a/pkg/ippoolmanager/ippool_manager.go b/pkg/ippoolmanager/ippool_manager.go index d63d9997ae..69b92dd569 100644 --- a/pkg/ippoolmanager/ippool_manager.go +++ b/pkg/ippoolmanager/ippool_manager.go @@ -21,7 +21,7 @@ import ( "github.com/spidernet-io/spiderpool/api/v1/agent/models" "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/metric" "github.com/spidernet-io/spiderpool/pkg/reservedipmanager" diff --git a/pkg/ippoolmanager/ippool_manager_suite_test.go b/pkg/ippoolmanager/ippool_manager_suite_test.go index 94fbc82a8d..39262d4d31 100644 --- a/pkg/ippoolmanager/ippool_manager_suite_test.go +++ b/pkg/ippoolmanager/ippool_manager_suite_test.go @@ -21,7 +21,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" electionmock "github.com/spidernet-io/spiderpool/pkg/election/mock" "github.com/spidernet-io/spiderpool/pkg/ippoolmanager" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/metric" reservedipmanagermock "github.com/spidernet-io/spiderpool/pkg/reservedipmanager/mock" ) diff --git a/pkg/ippoolmanager/ippool_manager_test.go b/pkg/ippoolmanager/ippool_manager_test.go index f1fa2ca715..5e563db02e 100644 --- a/pkg/ippoolmanager/ippool_manager_test.go +++ b/pkg/ippoolmanager/ippool_manager_test.go @@ -27,7 +27,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" "github.com/spidernet-io/spiderpool/pkg/ippoolmanager" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" spiderpooltypes "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/pkg/utils/convert" ) diff --git a/pkg/ippoolmanager/ippool_mutate.go b/pkg/ippoolmanager/ippool_mutate.go index 7510ba951b..8713931a4c 100644 --- a/pkg/ippoolmanager/ippool_mutate.go +++ b/pkg/ippoolmanager/ippool_mutate.go @@ -16,7 +16,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/types" ) diff --git a/pkg/ippoolmanager/ippool_subnet_validate.go b/pkg/ippoolmanager/ippool_subnet_validate.go index cc68fe7535..aa3a477c4b 100644 --- a/pkg/ippoolmanager/ippool_subnet_validate.go +++ b/pkg/ippoolmanager/ippool_subnet_validate.go @@ -16,7 +16,7 @@ import ( "k8s.io/apimachinery/pkg/util/validation/field" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/utils/convert" ) diff --git a/pkg/ippoolmanager/ippool_validate.go b/pkg/ippoolmanager/ippool_validate.go index 1b09e43f2a..965e5e2152 100644 --- a/pkg/ippoolmanager/ippool_validate.go +++ b/pkg/ippoolmanager/ippool_validate.go @@ -16,7 +16,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/pkg/utils/convert" ) diff --git a/pkg/ippoolmanager/ippool_webhook.go b/pkg/ippoolmanager/ippool_webhook.go index 28ea7a2f70..774325b4ea 100644 --- a/pkg/ippoolmanager/ippool_webhook.go +++ b/pkg/ippoolmanager/ippool_webhook.go @@ -20,7 +20,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook/admission" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" ) diff --git a/pkg/ippoolmanager/ippool_webhook_test.go b/pkg/ippoolmanager/ippool_webhook_test.go index 07766f5ed3..d04b77e958 100644 --- a/pkg/ippoolmanager/ippool_webhook_test.go +++ b/pkg/ippoolmanager/ippool_webhook_test.go @@ -27,7 +27,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" "github.com/spidernet-io/spiderpool/pkg/ippoolmanager" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/pkg/utils/convert" diff --git a/pkg/ippoolmanager/utils.go b/pkg/ippoolmanager/utils.go index 28e118673b..f0774e5946 100644 --- a/pkg/ippoolmanager/utils.go +++ b/pkg/ippoolmanager/utils.go @@ -11,7 +11,7 @@ import ( "k8s.io/apimachinery/pkg/labels" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" ) diff --git a/pkg/ippoolmanager/utils_test.go b/pkg/ippoolmanager/utils_test.go index b5e374d468..c647e12f10 100644 --- a/pkg/ippoolmanager/utils_test.go +++ b/pkg/ippoolmanager/utils_test.go @@ -14,7 +14,7 @@ import ( "k8s.io/apimachinery/pkg/util/uuid" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" ) diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/doc.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/doc.go new file mode 100644 index 0000000000..2227d9a76e --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/doc.go @@ -0,0 +1,6 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Package v2beta1 is the v2beta1 version of the API. +// +groupName=spiderpool.spidernet.io +package v2beta1 diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/groupversion_info.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/groupversion_info.go new file mode 100644 index 0000000000..8d467fde07 --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/groupversion_info.go @@ -0,0 +1,26 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// +kubebuilder:object:generate=true +// +groupName=spiderpool.spidernet.io + +// Package v1 contains API Schema definitions for the spiderpool v1 API group +package v2beta1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" + + "github.com/spidernet-io/spiderpool/pkg/constant" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: constant.SpiderpoolAPIGroup, Version: constant.SpiderpoolAPIVersion} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/rbac.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/rbac.go new file mode 100644 index 0000000000..e086256096 --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/rbac.go @@ -0,0 +1,24 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// +kubebuilder:rbac:groups=spiderpool.spidernet.io,resources=spiderippools,verbs=get;list;watch;create;update;patch;delete;deletecollection +// +kubebuilder:rbac:groups=spiderpool.spidernet.io,resources=spidersubnets;spiderendpoints;spiderreservedips;spidermultusconfigs;spiderclaimparameters,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=spiderpool.spidernet.io,resources=spidercoordinators,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=spiderpool.spidernet.io,resources=spidersubnets/status;spiderippools/status;spidercoordinators/status,verbs=get;update;patch +// +kubebuilder:rbac:groups="",resources=events,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups="coordination.k8s.io",resources=leases,verbs=create;get;update +// +kubebuilder:rbac:groups="apps",resources=statefulsets;deployments;replicasets;daemonsets,verbs=get;list;watch;update +// +kubebuilder:rbac:groups="resource.k8s.io",resources=resourceclaims;resourceclaims/status;podschedulingcontexts/status;resourceclaimtemplates;resourceclasses;podschedulingcontexts,verbs=get;list;patch;watch;update +// +kubebuilder:rbac:groups="networking.k8s.io",resources=servicecidrs,verbs=get;list;watch +// +kubebuilder:rbac:groups="batch",resources=jobs;cronjobs,verbs=get;list;watch;update;delete +// +kubebuilder:rbac:groups="",resources=nodes,verbs=get;list;watch +// +kubebuilder:rbac:groups="",resources=namespaces;endpoints;pods;pods/status;configmaps,verbs=get;list;watch;update;patch;delete;deletecollection +// +kubebuilder:rbac:groups=k8s.cni.cncf.io,resources=network-attachment-definitions,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=kubevirt.io,resources=virtualmachines;virtualmachineinstances,verbs=get;list +// +kubebuilder:rbac:groups=admissionregistration.k8s.io,resources=mutatingwebhookconfigurations;validatingwebhookconfigurations,verbs=get;list;watch;delete;update +// +kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=apps.kruise.io,resources=clonesets;statefulsets,verbs=get;list;watch +// +kubebuilder:rbac:groups=crd.projectcalico.org,resources=ippools,verbs=get;list;watch +// +kubebuilder:rbac:groups=cilium.io,resources=ciliumpodippools,verbs=get;list;watch + +package v2beta1 diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/register.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/register.go new file mode 100644 index 0000000000..be93634ade --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/register.go @@ -0,0 +1,16 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// SchemeGroupVersion is group version used to register these objects. +var SchemeGroupVersion = GroupVersion + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderclaimparameters_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderclaimparameters_types.go new file mode 100644 index 0000000000..e38a338bb0 --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderclaimparameters_types.go @@ -0,0 +1,65 @@ +// Copyright 2024 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ClaimParameterSpec defines the desired state of SpiderClaimParameter. +type ClaimParameterSpec struct { + // EnableRDMA If it is true, then all SpiderMultusConfig references in + // this SpiderClaimParameter must be enabled. + // +kubebuilder:default=false + EnableRDMA bool `json:"enableRdma"` + + // DefaultNic aSpecify which SpiderMultusConfig is to be used as the + // default NIC for the pod. + // +kubebuilder:validation:Optional + DefaultNic *MultusConfig `json:"defaultNic"` + + // SecondaryNics a list of SpiderMultusConfig references that are to be + // used as secondary NICs for the pod. + // +kubebuilder:validation:Optional + SecondaryNics []MultusConfig `json:"secondaryNics"` +} + +type MultusConfig struct { + // MultusName the name of the SpiderMultusConfig instance + // +kubebuilder:validation:Required + MultusName string `json:"multusName"` + // Namespace the namespace of the SpiderMultusConfig instance + // +kubebuilder:validation:Required + Namespace string `json:"namespace"` + // DefaultRoute indicated whether this nic is the default route nic for the pod + // +kubebuilder:validation:Optional + DefaultRoute bool `json:"defaultRoute"` +} + +// +kubebuilder:resource:categories={spiderpool},path="spiderclaimparameters",scope="Namespaced",shortName={scp},singular="spiderclaimparameter" +// +kubebuilder:object:root=true +// +genclient:noStatus +// +genclient + +// SpiderClaimParameter is the Schema for the spiderclaimparameters API. +type SpiderClaimParameter struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ClaimParameterSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true + +// SpiderClaimParameterList contains a list of SpiderClaimParameter. +type SpiderClaimParameterList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []SpiderClaimParameter `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SpiderClaimParameter{}, &SpiderClaimParameterList{}) +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidercoordinator_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidercoordinator_types.go new file mode 100644 index 0000000000..4176b649ec --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidercoordinator_types.go @@ -0,0 +1,140 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// CoordinationSpec defines the desired state of SpiderCoordinator. +type CoordinatorSpec struct { + + // Mode mode specifies the mode in which the coordinator runs, + // and the configurable values include auto (default), underlay, + // overlay, disabled. + // +kubebuilder:validation:Enum=auto;underlay;overlay;disabled + // +kubebuilder:validation:Optional + // +kubebuilder:default=auto + Mode *string `json:"mode,omitempty"` + + // CoordinatorSpec is used by SpiderCoordinator and SpiderMultusConfig + // in spidermultusconfig CRD , podCIDRType should not be required, which + // could be merged from SpiderCoordinator CR + // but in SpiderCoordinator CRD, podCIDRType should be required + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Enum=auto;cluster;calico;cilium;none + PodCIDRType *string `json:"podCIDRType,omitempty"` + + // HijackCIDR configure static routing tables in the pod that target these + // subnets to ensure that when the pod accesses these subnets, packets + // are forwarded through the host network stack, such as nodelocaldns(169.254.0.0/16) + // +kubebuilder:validation:Optional + HijackCIDR []string `json:"hijackCIDR,omitempty"` + + // PodMACPrefix the fixed MAC address prefix, the length is two bytes. + // the lowest bit of the first byte must be 0, which indicates the + // unicast MAC address. example: 0a:1b + // +kubebuilder:validation:Optional + PodMACPrefix *string `json:"podMACPrefix,omitempty"` + + // TunePodRoutes specifies whether to tune pod routes of multiple NICs on pods. + // +kubebuilder:validation:Optional + // +kubebuilder:default=true + TunePodRoutes *bool `json:"tunePodRoutes,omitempty"` + + // PodDefaultRouteNIC PodDefaultRouteNIC is used to configure the NIC where + // the pod's default route resides. the default value is empty, which means + // the default route will remain at eth0. + // +kubebuilder:validation:Optional + PodDefaultRouteNIC *string `json:"podDefaultRouteNIC,omitempty"` + + // HostRuleTable specifies the table number of the routing table used + // to configure the communication between the pod and the local node. + // +kubebuilder:validation:Optional + // +kubebuilder:default=500 + HostRuleTable *int `json:"hostRuleTable,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=0 + // HostRPFilter is used for coordiantor to help set the rp_filter parameters + // of the node. NOTE: This field is considered deprecated in the future. + // the rp_filter of the node should be configured by spiderpool-agent + // rather than coordinator plugin. + // Configurable values: /0/1/2, -1 means leave it as it is. the default value is 0. + // +kubebuilder:validation:Optional + // +kubebuilder:default=0 + HostRPFilter *int `json:"hostRPFilter,omitempty"` + + // PodRPFilter is used for coordiantor to help set the rp_filter parameters of the pod. + // Configurable values: /0/1/2. negative number means leave it as it is. + // the default value is 0. + // +kubebuilder:validation:Optional + // +kubebuilder:default=0 + PodRPFilter *int `json:"podRPFilter,omitempty"` + + // TxQueueLen to set the tx_queue_len of the pod. requirement is a positive integer + // the default value is 0, which means leaving it as it is. + // +kubebuilder:validation:Optional + // +kubebuilder:default=0 + TxQueueLen *int `json:"txQueueLen,omitempty"` + + // DetectIPConflict to detect the ip conflict for the pod + // +kubebuilder:validation:Optional + // +kubebuilder:default=false + DetectIPConflict *bool `json:"detectIPConflict,omitempty"` + + // DetectGateway to detect the gateway for the pod + // +kubebuilder:validation:Optional + // +kubebuilder:default=false + DetectGateway *bool `json:"detectGateway,omitempty"` + + // VethLinkAddress configure a ipv4 link-local address + // for veth0 device. empty means disable. default is empty. + // Format is like 169.254.100.1 + VethLinkAddress *string `json:"vethLinkAddress,omitempty"` +} + +// CoordinationStatus defines the observed state of SpiderCoordinator. +type CoordinatorStatus struct { + // +kubebuilder:validation:Requred + Phase string `json:"phase"` + + // +kubebuilder: validation:Optional + Reason string `json:"reason,omitempty"` + + // +kubebuilder:validation:Optional + OverlayPodCIDR []string `json:"overlayPodCIDR"` + + // +kubebuilder:validation:Optional + ServiceCIDR []string `json:"serviceCIDR"` +} + +// +kubebuilder:resource:categories={spiderpool},path="spidercoordinators",scope="Cluster",shortName={scc},singular="spidercoordinator" +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +genclient +// +genclient:nonNamespaced + +// SpiderCoordinator is the Schema for the spidercoordinators API. +type SpiderCoordinator struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec CoordinatorSpec `json:"spec,omitempty"` + Status CoordinatorStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// SpiderCoordinatorList contains a list of SpiderCoordinator. +type SpiderCoordinatorList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []SpiderCoordinator `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SpiderCoordinator{}, &SpiderCoordinatorList{}) +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderendpoint_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderendpoint_types.go new file mode 100644 index 0000000000..b46ff852a7 --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderendpoint_types.go @@ -0,0 +1,98 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// WorkloadEndpointStatus defines the observed state of SpiderEndpoint. +type WorkloadEndpointStatus struct { + // +kubebuilder:validation:Required + Current PodIPAllocation `json:"current"` + + // +kubebuilder:validation:Required + OwnerControllerType string `json:"ownerControllerType"` + + // +kubebuilder:validation:Required + OwnerControllerName string `json:"ownerControllerName"` +} + +type PodIPAllocation struct { + // +kubebuilder:validation:Required + UID string `json:"uid"` + + // +kubebuilder:validation:Required + Node string `json:"node"` + + // +kubebuilder:validation:Required + IPs []IPAllocationDetail `json:"ips"` +} + +type IPAllocationDetail struct { + // +kubebuilder:validation:Required + NIC string `json:"interface"` + + // +kubebuilder:validation:Optional + IPv4 *string `json:"ipv4,omitempty"` + + // +kubebuilder:validation:Optional + IPv6 *string `json:"ipv6,omitempty"` + + // +kubebuilder:validation:Optional + IPv4Pool *string `json:"ipv4Pool,omitempty"` + + // +kubebuilder:validation:Optional + IPv6Pool *string `json:"ipv6Pool,omitempty"` + + // DEPRECATED: Vlan is deprecated. + // +kubebuilder:default=0 + // +kubebuilder:validation:Maximum=4094 + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + Vlan *int64 `json:"vlan,omitempty"` + + // +kubebuilder:validation:Optional + IPv4Gateway *string `json:"ipv4Gateway,omitempty"` + + // +kubebuilder:validation:Optional + IPv6Gateway *string `json:"ipv6Gateway,omitempty"` + + // +kubebuilder:validation:Optional + CleanGateway *bool `json:"cleanGateway,omitempty"` + + // +kubebuilder:validation:Optional + Routes []Route `json:"routes,omitempty"` +} + +// +kubebuilder:resource:categories={spiderpool},path="spiderendpoints",scope="Namespaced",shortName={se},singular="spiderendpoint" +// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].interface",description="interface",name="INTERFACE",type=string +// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].ipv4Pool",description="ipv4Pool",name="IPV4POOL",type=string +// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].ipv4",description="ipv4",name="IPV4",type=string +// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].ipv6Pool",description="ipv6Pool",name="IPV6POOL",type=string +// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].ipv6",description="ipv6",name="IPV6",type=string +// +kubebuilder:printcolumn:JSONPath=".status.current.node",description="node",name="NODE",type=string +// +kubebuilder:object:root=true + +// Spiderndpoint is the Schema for the spiderendpoints API. +type SpiderEndpoint struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Status WorkloadEndpointStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// SpiderEndpointList contains a list of SpiderEndpoint. +type SpiderEndpointList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []SpiderEndpoint `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SpiderEndpoint{}, &SpiderEndpointList{}) +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderippool_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderippool_types.go new file mode 100644 index 0000000000..9de6251f1e --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderippool_types.go @@ -0,0 +1,130 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// IPPoolSpec defines the desired state of SpiderIPPool. +type IPPoolSpec struct { + // +kubebuilder:validation:Enum=4;6 + // +kubebuilder:validation:Optional + IPVersion *int64 `json:"ipVersion,omitempty"` + + // +kubebuilder:validation:Required + Subnet string `json:"subnet"` + + // +kubebuilder:validation:Optional + IPs []string `json:"ips,omitempty"` + + // +kubebuilder:validation:Optional + ExcludeIPs []string `json:"excludeIPs,omitempty"` + + // +kubebuilder:validation:Optional + Gateway *string `json:"gateway,omitempty"` + + // DEPRECATED: Vlan is deprecated. + // +kubebuilder:validation:Maximum=4094 + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + Vlan *int64 `json:"vlan,omitempty"` + + // +kubebuilder:validation:Optional + Routes []Route `json:"routes,omitempty"` + + // +kubebuilder:validation:Optional + PodAffinity *metav1.LabelSelector `json:"podAffinity,omitempty"` + + // +kubebuilder:validation:Optional + NamespaceAffinity *metav1.LabelSelector `json:"namespaceAffinity,omitempty"` + + // +kubebuilder:validation:Optional + NamespaceName []string `json:"namespaceName,omitempty"` + + // +kubebuilder:validation:Optional + NodeAffinity *metav1.LabelSelector `json:"nodeAffinity,omitempty"` + + // +kubebuilder:validation:Optional + NodeName []string `json:"nodeName,omitempty"` + + // +kubebuilder:validation:Optional + MultusName []string `json:"multusName,omitempty"` + + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + Default *bool `json:"default,omitempty"` + + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + Disable *bool `json:"disable,omitempty"` +} + +type Route struct { + // +kubebuilder:validation:Required + Dst string `json:"dst"` + + // +kubebuilder:validation:Required + Gw string `json:"gw"` +} + +// IPPoolStatus defines the observed state of SpiderIPPool. +type IPPoolStatus struct { + // +kubebuilder:validation:Optional + AllocatedIPs *string `json:"allocatedIPs,omitempty"` + + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + TotalIPCount *int64 `json:"totalIPCount,omitempty"` + + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + AllocatedIPCount *int64 `json:"allocatedIPCount,omitempty"` +} + +// PoolIPAllocations is a map of IP allocation details indexed by IP address. +type PoolIPAllocations map[string]PoolIPAllocation + +type PoolIPAllocation struct { + NamespacedName string `json:"pod"` + PodUID string `json:"podUid"` +} + +// +kubebuilder:resource:categories={spiderpool},path="spiderippools",scope="Cluster",shortName={sp},singular="spiderippool" +// +kubebuilder:printcolumn:JSONPath=".spec.ipVersion",description="ipVersion",name="VERSION",type=string +// +kubebuilder:printcolumn:JSONPath=".spec.subnet",description="subnet",name="SUBNET",type=string +// +kubebuilder:printcolumn:JSONPath=".status.allocatedIPCount",description="allocatedIPCount",name="ALLOCATED-IP-COUNT",type=integer +// +kubebuilder:printcolumn:JSONPath=".status.totalIPCount",description="totalIPCount",name="TOTAL-IP-COUNT",type=integer +// +kubebuilder:printcolumn:JSONPath=".spec.default",description="default",name="DEFAULT",type=boolean +// +kubebuilder:printcolumn:JSONPath=".spec.disable",description="disable",name="DISABLE",type=boolean,priority=10 +// +kubebuilder:printcolumn:JSONPath=".spec.nodeName",description="nodeName",name="NodeName",type=string,priority=10 +// +kubebuilder:printcolumn:JSONPath=".spec.multusName",description="multusName",name="MultusName",type=string,priority=10 +// +kubebuilder:printcolumn:JSONPath=`.spec.podAffinity.matchLabels['ipam\.spidernet\.io/app\-namespace']`,description="AppNamespace",name="APP-NAMESPACE",type=string,priority=10 +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +genclient +// +genclient:nonNamespaced + +// SpiderIPPool is the Schema for the spiderippools API. +type SpiderIPPool struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec IPPoolSpec `json:"spec,omitempty"` + Status IPPoolStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// SpiderIPPoolList contains a list of SpiderIPPool. +type SpiderIPPoolList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []SpiderIPPool `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SpiderIPPool{}, &SpiderIPPoolList{}) +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidermultus_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidermultus_types.go new file mode 100644 index 0000000000..4a95ac4dee --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidermultus_types.go @@ -0,0 +1,266 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// +kubebuilder:resource:categories={spiderpool},path="spidermultusconfigs",scope="Namespaced",shortName={smc},singular="spidermultusconfig" +// +kubebuilder:object:root=true +// +genclient +// +genclient:noStatus +type SpiderMultusConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec is the specification of the MultusCNIConfig + Spec MultusCNIConfigSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true +type SpiderMultusConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []SpiderMultusConfig `json:"items"` +} + +// MultusCNIConfigSpec defines the desired state of SpiderMultusConfig. +type MultusCNIConfigSpec struct { + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Enum=macvlan;ipvlan;sriov;ovs;ib-sriov;ipoib;custom + // +kubebuilder:default=custom + CniType *string `json:"cniType,omitempty"` + + // +kubebuilder:validation:Optional + MacvlanConfig *SpiderMacvlanCniConfig `json:"macvlan,omitempty"` + + // +kubebuilder:validation:Optional + IPVlanConfig *SpiderIPvlanCniConfig `json:"ipvlan,omitempty"` + + // +kubebuilder:validation:Optional + SriovConfig *SpiderSRIOVCniConfig `json:"sriov,omitempty"` + + // +kubebuilder:validation:Optional + OvsConfig *SpiderOvsCniConfig `json:"ovs,omitempty"` + + // +kubebuilder:validation:Optional + IbSriovConfig *SpiderIBSriovCniConfig `json:"ibsriov,omitempty"` + + // +kubebuilder:validation:Optional + IpoibConfig *SpiderIpoibCniConfig `json:"ipoib,omitempty"` + + // if CniType was set to custom, we'll mutate this field to be false + // +kubebuilder:default=true + // +kubebuilder:validation:Optional + EnableCoordinator *bool `json:"enableCoordinator,omitempty"` + + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + DisableIPAM *bool `json:"disableIPAM,omitempty"` + + // +kubebuilder:validation:Optional + CoordinatorConfig *CoordinatorSpec `json:"coordinator,omitempty"` + + // ChainCNIJsonData is used to configure the configuration of chain CNI. + // format in json. + // +kubebuilder:validation:Optional + ChainCNIJsonData []string `json:"chainCNIJsonData"` + + // OtherCniTypeConfig only used for CniType custom, valid json format, can be empty + // +kubebuilder:validation:Optional + CustomCNIConfig *string `json:"customCNI,omitempty"` +} + +type SpiderMacvlanCniConfig struct { + // +kubebuilder:validation:Required + // The master interface(s) for the CNI configuration. At least one master interface must be specified. + // If multiple master interfaces are specified, the spiderpool will create a bond device with the bondConfig + // by the ifacer plugin. + Master []string `json:"master"` + + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=4094 + // The VLAN ID for the CNI configuration, optional and must be within the specified range: [0.4096). + VlanID *int32 `json:"vlanID,omitempty"` + + // +kubebuilder:validation:Optional + // Optional bond configuration for the CNI. It must not be nil if the multiple master interfaces are specified. + Bond *BondConfig `json:"bond,omitempty"` + + // +kubebuilder:validation:Optional + // The RDMA resource name of the nic. the RDMA resource is often reported to kubelet by the + // k8s-rdma-shared-dev-plugin. when it is not empty and spiderpool podResourceInject feature + // is enabled, spiderpool can automatically inject it into the container's resources via webhook. + RdmaResourceName string `json:"rdmaResourceName"` + + // +kubebuilder:validation:Optional + SpiderpoolConfigPools *SpiderpoolPools `json:"ippools,omitempty"` +} + +type SpiderIPvlanCniConfig struct { + // +kubebuilder:validation:Required + // The master interface(s) for the CNI configuration. At least one master interface must be specified. + // If multiple master interfaces are specified, the spiderpool will create a bond device with the bondConfig + // by the ifacer plugin. + Master []string `json:"master"` + + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=4094 + // The VLAN ID for the CNI configuration, optional and must be within the specified range: [0.4096). + VlanID *int32 `json:"vlanID,omitempty"` + + // +kubebuilder:validation:Optional + // Optional bond configuration for the CNI. It must not be nil if the multiple master interfaces are specified. + Bond *BondConfig `json:"bond,omitempty"` + + // +kubebuilder:validation:Optional + // The RDMA resource name of the nic. the RDMA resource is often reported to kubelet by the + // k8s-rdma-shared-dev-plugin. when it is not empty and spiderpool podResourceInject feature + // is enabled, spiderpool can automatically inject it into the container's resources via webhook. + RdmaResourceName string `json:"rdmaResourceName"` + + // +kubebuilder:validation:Optional + SpiderpoolConfigPools *SpiderpoolPools `json:"ippools,omitempty"` +} + +type SpiderSRIOVCniConfig struct { + // +kubebuilder:validation:Required + // The SR-IOV RDMA resource name of the SpiderMultusConfig. the SR-IOV RDMA resource is often + // reported to kubelet by the sriov-device-plugin. + ResourceName string `json:"resourceName"` + + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=4094 + // The VLAN ID for the CNI configuration, optional and must be within the specified range: [0.4096). + VlanID *int32 `json:"vlanID,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + MinTxRateMbps *int `json:"minTxRateMbps,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // Mbps, 0 = disable rate limiting + MaxTxRateMbps *int `json:"maxTxRateMbps,omitempty"` // Mbps, 0 = disable rate limiting + + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + // +kubebuilder:deprecated:reason="This field is deprecated and will be removed in future versions." + // DEPRECATED, use RdmaIsolation flled instead. + EnableRdma bool `json:"enableRdma"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + // rdmaIsolation enable RDMA CNI plugin is intended to be run as a chained CNI plugin. + // it ensures isolation of RDMA traffic from other workloads in the system by moving + // the associated RDMA interfaces of the provided network interface to the container's + // network namespace path. + RdmaIsolation bool `json:"rdmaIsolation"` + + // +kubebuilder:validation:Optional + SpiderpoolConfigPools *SpiderpoolPools `json:"ippools,omitempty"` +} + +type SpiderIBSriovCniConfig struct { + // +kubebuilder:validation:Required + // The SR-IOV RDMA resource name of the SpiderMultusConfig. the SR-IOV RDMA resource is often + // reported to kubelet by the sriov-device-plugin. + ResourceName string `json:"resourceName"` + + // +kubebuilder:validation:Optional + // infiniBand pkey for VF, this field is used by ib-kubernetes to add pkey with + // guid to InfiniBand subnet manager client e.g. Mellanox UFM, OpenSM + Pkey *string `json:"pkey,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=enable + // +kubebuilder:validation:Enum=auto;enable;disable + // Enforces link state for the VF. Allowed values: auto, enable, disable. + LinkState *string `json:"linkState,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=true + // +kubebuilder:validation:Optional + // rdmaIsolation enablw RDMA CNI plugin is intended to be run as a chained CNI plugin. + // it ensures isolation of RDMA traffic from other workloads in the system by moving + // the associated RDMA interfaces of the provided network interface to the container's + // network namespace path. + RdmaIsolation *bool `json:"rdmaIsolation,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=false + // Enforces ib-sriov-cni to work with ib-kubernetes. + IbKubernetesEnabled *bool `json:"ibKubernetesEnabled,omitempty"` + + // +kubebuilder:validation:Optional + SpiderpoolConfigPools *SpiderpoolPools `json:"ippools,omitempty"` +} + +type SpiderIpoibCniConfig struct { + // +kubebuilder:validation:Required + // name of the host interface to create the link from. + Master string `json:"master,omitempty"` + + // +kubebuilder:validation:Optional + SpiderpoolConfigPools *SpiderpoolPools `json:"ippools,omitempty"` +} + +type SpiderOvsCniConfig struct { + // +kubebuilder:validation:Required + BrName string `json:"bridge"` + // +kubebuilder:validation:Optional + VlanTag *int32 `json:"vlan,omitempty"` + // +kubebuilder:validation:Optional + Trunk []*Trunk `json:"trunk,omitempty"` + // +kubebuilder:validation:Optional + // PCI address of a VF in valid sysfs format + DeviceID string `json:"deviceID"` + // +kubebuilder:validation:Optional + SpiderpoolConfigPools *SpiderpoolPools `json:"ippools,omitempty"` +} + +type Trunk struct { + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=4094 + MinID *uint `json:"minID,omitempty"` + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=4094 + MaxID *uint `json:"maxID,omitempty"` + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=4094 + ID *uint `json:"id,omitempty"` +} + +type BondConfig struct { + // +kubebuilder:validation:Required + Name string `json:"name"` + + // +kubebuilder:validation:Required + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=6 + Mode int32 `json:"mode"` + + // +kubebuilder:validation:Optional + Options *string `json:"options,omitempty"` +} + +// SpiderpoolPools could specify the IPAM spiderpool CNI configuration default IPv4&IPv6 pools. +type SpiderpoolPools struct { + // +kubebuilder:validation:Optional + IPv4IPPool []string `json:"ipv4,omitempty"` + + // +kubebuilder:validation:Optional + IPv6IPPool []string `json:"ipv6,omitempty"` +} + +func init() { + SchemeBuilder.Register(&SpiderMultusConfig{}, &SpiderMultusConfigList{}) +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderreservedip_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderreservedip_types.go new file mode 100644 index 0000000000..4993cf8ee8 --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderreservedip_types.go @@ -0,0 +1,44 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ReservedIPSpec defines the desired state of SpiderReservedIP. +type ReservedIPSpec struct { + // +kubebuilder:validation:Enum=4;6 + // +kubebuilder:validation:Optional + IPVersion *int64 `json:"ipVersion,omitempty"` + + // +kubebuilder:validation:Optional + IPs []string `json:"ips,omitempty"` +} + +// +kubebuilder:resource:categories={spiderpool},path="spiderreservedips",scope="Cluster",shortName={sr},singular="spiderreservedip" +// +kubebuilder:printcolumn:JSONPath=".spec.ipVersion",description="ipVersion",name="VERSION",type=string +// +kubebuilder:object:root=true + +// SpiderReservedIP is the Schema for the spiderreservedips API. +type SpiderReservedIP struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ReservedIPSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true + +// SpiderReservedIPList contains a list of SpiderReservedIP. +type SpiderReservedIPList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []SpiderReservedIP `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SpiderReservedIP{}, &SpiderReservedIPList{}) +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidersubnet_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidersubnet_types.go new file mode 100644 index 0000000000..00dbd1c2fc --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidersubnet_types.go @@ -0,0 +1,91 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// SubnetSpec defines the desired state of SpiderSubnet. +type SubnetSpec struct { + // +kubebuilder:validation:Enum=4;6 + // +kubebuilder:validation:Optional + IPVersion *int64 `json:"ipVersion,omitempty"` + + // +kubebuilder:validation:Required + Subnet string `json:"subnet"` + + // +kubebuilder:validation:Optional + IPs []string `json:"ips,omitempty"` + + // +kubebuilder:validation:Optional + ExcludeIPs []string `json:"excludeIPs,omitempty"` + + // +kubebuilder:validation:Optional + Gateway *string `json:"gateway,omitempty"` + + // DEPRECATED: Vlan is deprecated. + // +kubebuilder:validation:Maximum=4094 + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + Vlan *int64 `json:"vlan,omitempty"` + + // +kubebuilder:validation:Optional + Routes []Route `json:"routes,omitempty"` +} + +// SubnetStatus defines the observed state of SpiderSubnet. +type SubnetStatus struct { + // +kubebuilder:validation:Optional + ControlledIPPools *string `json:"controlledIPPools,omitempty"` + + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + TotalIPCount *int64 `json:"totalIPCount,omitempty"` + + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + AllocatedIPCount *int64 `json:"allocatedIPCount,omitempty"` +} + +// PoolIPPreAllocations is a map of pool IP pre-allocation details indexed by pool name. +type PoolIPPreAllocations map[string]PoolIPPreAllocation + +type PoolIPPreAllocation struct { + IPs []string `json:"ips"` + Application *string `json:"application,omitempty"` +} + +// +kubebuilder:resource:categories={spiderpool},path="spidersubnets",scope="Cluster",shortName={ss},singular="spidersubnet" +// +kubebuilder:printcolumn:JSONPath=".spec.ipVersion",description="ipVersion",name="VERSION",type=string +// +kubebuilder:printcolumn:JSONPath=".spec.subnet",description="subnet",name="SUBNET",type=string +// +kubebuilder:printcolumn:JSONPath=".status.allocatedIPCount",description="allocatedIPCount",name="ALLOCATED-IP-COUNT",type=integer +// +kubebuilder:printcolumn:JSONPath=".status.totalIPCount",description="totalIPCount",name="TOTAL-IP-COUNT",type=integer +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +genclient +// +genclient:nonNamespaced + +// SpiderSubnet is the Schema for the spidersubnets API. +type SpiderSubnet struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec SubnetSpec `json:"spec,omitempty"` + Status SubnetStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// SpiderSubnetList contains a list of SpiderSubnet. +type SpiderSubnetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []SpiderSubnet `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SpiderSubnet{}, &SpiderSubnetList{}) +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/types_string.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/types_string.go new file mode 100644 index 0000000000..4e76fa1d6d --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/types_string.go @@ -0,0 +1,217 @@ +// Copyright 2019 The Kubernetes Authors +// SPDX-License-Identifier: Apache-2.0 + +package v2beta1 + +import ( + "fmt" + "strings" + + stringutil "github.com/spidernet-io/spiderpool/pkg/utils/string" +) + +// String serves for SpiderIPPool +func (in *SpiderIPPool) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&SpiderIPPool{`, + `ObjectMeta:` + strings.Replace(fmt.Sprintf("%v", in.ObjectMeta), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(in.Spec.String(), "IPPoolSpec", "IPPoolSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(in.Status.String(), "IPPoolStatus", "IPPoolStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderIPPool Spec IPPoolSpec +func (in *IPPoolSpec) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&IPPoolSpec{`, + `IPVersion:` + stringutil.ValueToStringGenerated(in.IPVersion) + `,`, + `Subnet:` + fmt.Sprintf("%v", in.Subnet) + `,`, + `IPs:` + fmt.Sprintf("%v", in.IPs) + `,`, + `ExcludeIPs:` + fmt.Sprintf("%v", in.ExcludeIPs) + `,`, + `Gateway:` + stringutil.ValueToStringGenerated(in.Gateway) + `,`, + `Vlan:` + stringutil.ValueToStringGenerated(in.Vlan) + `,`, + `Routes:` + fmt.Sprintf("%+v", in.Routes) + `,`, + `PodAffinity:` + fmt.Sprintf("%v", in.PodAffinity.String()) + `,`, + `NamespaceAffinity:` + fmt.Sprintf("%v", in.NamespaceAffinity.String()) + `,`, + `NamespaceName:` + fmt.Sprintf("%v", in.NamespaceName) + `,`, + `NodeAffinity:` + fmt.Sprintf("%v", in.NodeAffinity.String()) + `,`, + `NodeName:` + fmt.Sprintf("%v", in.NodeName) + `,`, + `MultusName:` + fmt.Sprintf("%v", in.MultusName) + `,`, + `Default:` + stringutil.ValueToStringGenerated(in.Default) + `,`, + `Disable:` + stringutil.ValueToStringGenerated(in.Disable) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderIPPool Status IPPoolStatus +func (in *IPPoolStatus) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&IPPoolStatus{`, + `AllocatedIPs:` + stringutil.ValueToStringGenerated(in.AllocatedIPs) + `,`, + `TotalIPCount:` + stringutil.ValueToStringGenerated(in.TotalIPCount) + `,`, + `AllocatedIPCount:` + stringutil.ValueToStringGenerated(in.AllocatedIPCount) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderEndpoint +func (in *SpiderEndpoint) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&SpiderEndpoint{`, + `ObjectMeta:` + strings.Replace(fmt.Sprintf("%v", in.ObjectMeta), `&`, ``, 1) + `,`, + `Status:` + in.Status.String() + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderEndpoint Status WorkloadEndpointStatus +func (in *WorkloadEndpointStatus) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&WorkloadEndpointStatus{`, + `Current:` + fmt.Sprintf("%v", in.Current.String()) + `,`, + `OwnerControllerType:` + fmt.Sprintf("%v", in.OwnerControllerType) + `,`, + `OwnerControllerName:` + fmt.Sprintf("%v", in.OwnerControllerName) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderEndpoint Status PodIPAllocation +func (in *PodIPAllocation) String() string { + if in == nil { + return "nil" + } + + repeatedStringForIPs := "[]IPs{" + for _, f := range in.IPs { + repeatedStringForIPs += strings.Replace(strings.Replace(f.String(), "IPs", "IPs", 1), `&`, ``, 1) + "," + } + repeatedStringForIPs += "}" + + s := strings.Join([]string{`&PodIPAllocation{`, + `UID:` + fmt.Sprintf("%+v", in.UID) + `,`, + `Node:` + fmt.Sprintf("%+v", in.Node) + `,`, + `IPs:` + repeatedStringForIPs + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderEndpoint Status +func (in *IPAllocationDetail) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&IPAllocationDetail{`, + `NIC:` + fmt.Sprintf("%v", in.NIC) + `,`, + `IPv4:` + stringutil.ValueToStringGenerated(in.IPv4) + `,`, + `IPv6:` + stringutil.ValueToStringGenerated(in.IPv6) + `,`, + `IPv4Pool:` + stringutil.ValueToStringGenerated(in.IPv4Pool) + `,`, + `IPv6Pool:` + stringutil.ValueToStringGenerated(in.IPv6Pool) + `,`, + `Vlan:` + stringutil.ValueToStringGenerated(in.Vlan) + `,`, + `IPv4Gateway:` + stringutil.ValueToStringGenerated(in.IPv4Gateway) + `,`, + `IPv6Gateway:` + stringutil.ValueToStringGenerated(in.IPv6Gateway) + `,`, + `CleanGateway:` + stringutil.ValueToStringGenerated(in.CleanGateway) + `,`, + `Routes:` + fmt.Sprintf("%+v", in.Routes) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderReservedIP +func (in *SpiderReservedIP) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&SpiderReservedIP{`, + `ObjectMeta:` + strings.Replace(fmt.Sprintf("%v", in.ObjectMeta), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(in.Spec.String(), "ReservedIPSpec", "ReservedIPSpec", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderReservedIP Spec +func (in *ReservedIPSpec) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&ReservedIPSpec{`, + `IPVersion:` + stringutil.ValueToStringGenerated(in.IPVersion) + `,`, + `IPs:` + fmt.Sprintf("%v", in.IPs) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderSubnet +func (in *SpiderSubnet) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&SpiderSubnet{`, + `ObjectMeta:` + strings.Replace(fmt.Sprintf("%v", in.ObjectMeta), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(in.Spec.String(), "SubnetSpec", "SubnetSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(in.Status.String(), "SubnetStatus", "SubnetStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderSubnet Spec +func (in *SubnetSpec) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&SubnetSpec{`, + `IPVersion:` + stringutil.ValueToStringGenerated(in.IPVersion) + `,`, + `Subnet:` + fmt.Sprintf("%v", in.Subnet) + `,`, + `IPs:` + fmt.Sprintf("%v", in.IPs) + `,`, + `ExcludeIPs:` + fmt.Sprintf("%v", in.ExcludeIPs) + `,`, + `Gateway:` + stringutil.ValueToStringGenerated(in.Gateway) + `,`, + `Vlan:` + stringutil.ValueToStringGenerated(in.Vlan) + `,`, + `Routes:` + fmt.Sprintf("%+v", in.Routes) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderSubnet Status +func (in *SubnetStatus) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`SubnetStatus{`, + `ControlledIPPools:` + stringutil.ValueToStringGenerated(in.ControlledIPPools) + `,`, + `TotalIPCount:` + stringutil.ValueToStringGenerated(in.TotalIPCount) + `,`, + `AllocatedIPCount:` + stringutil.ValueToStringGenerated(in.AllocatedIPCount) + `,`, + `}`, + }, "") + return s +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/zz_generated.deepcopy.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/zz_generated.deepcopy.go new file mode 100644 index 0000000000..eb4b02976d --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/zz_generated.deepcopy.go @@ -0,0 +1,1329 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by controller-gen. DO NOT EDIT. + +package v2beta1 + +import ( + "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BondConfig) DeepCopyInto(out *BondConfig) { + *out = *in + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BondConfig. +func (in *BondConfig) DeepCopy() *BondConfig { + if in == nil { + return nil + } + out := new(BondConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClaimParameterSpec) DeepCopyInto(out *ClaimParameterSpec) { + *out = *in + if in.DefaultNic != nil { + in, out := &in.DefaultNic, &out.DefaultNic + *out = new(MultusConfig) + **out = **in + } + if in.SecondaryNics != nil { + in, out := &in.SecondaryNics, &out.SecondaryNics + *out = make([]MultusConfig, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClaimParameterSpec. +func (in *ClaimParameterSpec) DeepCopy() *ClaimParameterSpec { + if in == nil { + return nil + } + out := new(ClaimParameterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CoordinatorSpec) DeepCopyInto(out *CoordinatorSpec) { + *out = *in + if in.Mode != nil { + in, out := &in.Mode, &out.Mode + *out = new(string) + **out = **in + } + if in.PodCIDRType != nil { + in, out := &in.PodCIDRType, &out.PodCIDRType + *out = new(string) + **out = **in + } + if in.HijackCIDR != nil { + in, out := &in.HijackCIDR, &out.HijackCIDR + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PodMACPrefix != nil { + in, out := &in.PodMACPrefix, &out.PodMACPrefix + *out = new(string) + **out = **in + } + if in.TunePodRoutes != nil { + in, out := &in.TunePodRoutes, &out.TunePodRoutes + *out = new(bool) + **out = **in + } + if in.PodDefaultRouteNIC != nil { + in, out := &in.PodDefaultRouteNIC, &out.PodDefaultRouteNIC + *out = new(string) + **out = **in + } + if in.HostRuleTable != nil { + in, out := &in.HostRuleTable, &out.HostRuleTable + *out = new(int) + **out = **in + } + if in.HostRPFilter != nil { + in, out := &in.HostRPFilter, &out.HostRPFilter + *out = new(int) + **out = **in + } + if in.PodRPFilter != nil { + in, out := &in.PodRPFilter, &out.PodRPFilter + *out = new(int) + **out = **in + } + if in.TxQueueLen != nil { + in, out := &in.TxQueueLen, &out.TxQueueLen + *out = new(int) + **out = **in + } + if in.DetectIPConflict != nil { + in, out := &in.DetectIPConflict, &out.DetectIPConflict + *out = new(bool) + **out = **in + } + if in.DetectGateway != nil { + in, out := &in.DetectGateway, &out.DetectGateway + *out = new(bool) + **out = **in + } + if in.VethLinkAddress != nil { + in, out := &in.VethLinkAddress, &out.VethLinkAddress + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CoordinatorSpec. +func (in *CoordinatorSpec) DeepCopy() *CoordinatorSpec { + if in == nil { + return nil + } + out := new(CoordinatorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CoordinatorStatus) DeepCopyInto(out *CoordinatorStatus) { + *out = *in + if in.OverlayPodCIDR != nil { + in, out := &in.OverlayPodCIDR, &out.OverlayPodCIDR + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ServiceCIDR != nil { + in, out := &in.ServiceCIDR, &out.ServiceCIDR + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CoordinatorStatus. +func (in *CoordinatorStatus) DeepCopy() *CoordinatorStatus { + if in == nil { + return nil + } + out := new(CoordinatorStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPAllocationDetail) DeepCopyInto(out *IPAllocationDetail) { + *out = *in + if in.IPv4 != nil { + in, out := &in.IPv4, &out.IPv4 + *out = new(string) + **out = **in + } + if in.IPv6 != nil { + in, out := &in.IPv6, &out.IPv6 + *out = new(string) + **out = **in + } + if in.IPv4Pool != nil { + in, out := &in.IPv4Pool, &out.IPv4Pool + *out = new(string) + **out = **in + } + if in.IPv6Pool != nil { + in, out := &in.IPv6Pool, &out.IPv6Pool + *out = new(string) + **out = **in + } + if in.Vlan != nil { + in, out := &in.Vlan, &out.Vlan + *out = new(int64) + **out = **in + } + if in.IPv4Gateway != nil { + in, out := &in.IPv4Gateway, &out.IPv4Gateway + *out = new(string) + **out = **in + } + if in.IPv6Gateway != nil { + in, out := &in.IPv6Gateway, &out.IPv6Gateway + *out = new(string) + **out = **in + } + if in.CleanGateway != nil { + in, out := &in.CleanGateway, &out.CleanGateway + *out = new(bool) + **out = **in + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAllocationDetail. +func (in *IPAllocationDetail) DeepCopy() *IPAllocationDetail { + if in == nil { + return nil + } + out := new(IPAllocationDetail) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPPoolSpec) DeepCopyInto(out *IPPoolSpec) { + *out = *in + if in.IPVersion != nil { + in, out := &in.IPVersion, &out.IPVersion + *out = new(int64) + **out = **in + } + if in.IPs != nil { + in, out := &in.IPs, &out.IPs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludeIPs != nil { + in, out := &in.ExcludeIPs, &out.ExcludeIPs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Gateway != nil { + in, out := &in.Gateway, &out.Gateway + *out = new(string) + **out = **in + } + if in.Vlan != nil { + in, out := &in.Vlan, &out.Vlan + *out = new(int64) + **out = **in + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route, len(*in)) + copy(*out, *in) + } + if in.PodAffinity != nil { + in, out := &in.PodAffinity, &out.PodAffinity + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.NamespaceAffinity != nil { + in, out := &in.NamespaceAffinity, &out.NamespaceAffinity + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.NamespaceName != nil { + in, out := &in.NamespaceName, &out.NamespaceName + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.NodeAffinity != nil { + in, out := &in.NodeAffinity, &out.NodeAffinity + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.NodeName != nil { + in, out := &in.NodeName, &out.NodeName + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.MultusName != nil { + in, out := &in.MultusName, &out.MultusName + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Default != nil { + in, out := &in.Default, &out.Default + *out = new(bool) + **out = **in + } + if in.Disable != nil { + in, out := &in.Disable, &out.Disable + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPoolSpec. +func (in *IPPoolSpec) DeepCopy() *IPPoolSpec { + if in == nil { + return nil + } + out := new(IPPoolSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPPoolStatus) DeepCopyInto(out *IPPoolStatus) { + *out = *in + if in.AllocatedIPs != nil { + in, out := &in.AllocatedIPs, &out.AllocatedIPs + *out = new(string) + **out = **in + } + if in.TotalIPCount != nil { + in, out := &in.TotalIPCount, &out.TotalIPCount + *out = new(int64) + **out = **in + } + if in.AllocatedIPCount != nil { + in, out := &in.AllocatedIPCount, &out.AllocatedIPCount + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPoolStatus. +func (in *IPPoolStatus) DeepCopy() *IPPoolStatus { + if in == nil { + return nil + } + out := new(IPPoolStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MultusCNIConfigSpec) DeepCopyInto(out *MultusCNIConfigSpec) { + *out = *in + if in.CniType != nil { + in, out := &in.CniType, &out.CniType + *out = new(string) + **out = **in + } + if in.MacvlanConfig != nil { + in, out := &in.MacvlanConfig, &out.MacvlanConfig + *out = new(SpiderMacvlanCniConfig) + (*in).DeepCopyInto(*out) + } + if in.IPVlanConfig != nil { + in, out := &in.IPVlanConfig, &out.IPVlanConfig + *out = new(SpiderIPvlanCniConfig) + (*in).DeepCopyInto(*out) + } + if in.SriovConfig != nil { + in, out := &in.SriovConfig, &out.SriovConfig + *out = new(SpiderSRIOVCniConfig) + (*in).DeepCopyInto(*out) + } + if in.OvsConfig != nil { + in, out := &in.OvsConfig, &out.OvsConfig + *out = new(SpiderOvsCniConfig) + (*in).DeepCopyInto(*out) + } + if in.IbSriovConfig != nil { + in, out := &in.IbSriovConfig, &out.IbSriovConfig + *out = new(SpiderIBSriovCniConfig) + (*in).DeepCopyInto(*out) + } + if in.IpoibConfig != nil { + in, out := &in.IpoibConfig, &out.IpoibConfig + *out = new(SpiderIpoibCniConfig) + (*in).DeepCopyInto(*out) + } + if in.EnableCoordinator != nil { + in, out := &in.EnableCoordinator, &out.EnableCoordinator + *out = new(bool) + **out = **in + } + if in.DisableIPAM != nil { + in, out := &in.DisableIPAM, &out.DisableIPAM + *out = new(bool) + **out = **in + } + if in.CoordinatorConfig != nil { + in, out := &in.CoordinatorConfig, &out.CoordinatorConfig + *out = new(CoordinatorSpec) + (*in).DeepCopyInto(*out) + } + if in.ChainCNIJsonData != nil { + in, out := &in.ChainCNIJsonData, &out.ChainCNIJsonData + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.CustomCNIConfig != nil { + in, out := &in.CustomCNIConfig, &out.CustomCNIConfig + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MultusCNIConfigSpec. +func (in *MultusCNIConfigSpec) DeepCopy() *MultusCNIConfigSpec { + if in == nil { + return nil + } + out := new(MultusCNIConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MultusConfig) DeepCopyInto(out *MultusConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MultusConfig. +func (in *MultusConfig) DeepCopy() *MultusConfig { + if in == nil { + return nil + } + out := new(MultusConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodIPAllocation) DeepCopyInto(out *PodIPAllocation) { + *out = *in + if in.IPs != nil { + in, out := &in.IPs, &out.IPs + *out = make([]IPAllocationDetail, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodIPAllocation. +func (in *PodIPAllocation) DeepCopy() *PodIPAllocation { + if in == nil { + return nil + } + out := new(PodIPAllocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PoolIPAllocation) DeepCopyInto(out *PoolIPAllocation) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PoolIPAllocation. +func (in *PoolIPAllocation) DeepCopy() *PoolIPAllocation { + if in == nil { + return nil + } + out := new(PoolIPAllocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in PoolIPAllocations) DeepCopyInto(out *PoolIPAllocations) { + { + in := &in + *out = make(PoolIPAllocations, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PoolIPAllocations. +func (in PoolIPAllocations) DeepCopy() PoolIPAllocations { + if in == nil { + return nil + } + out := new(PoolIPAllocations) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PoolIPPreAllocation) DeepCopyInto(out *PoolIPPreAllocation) { + *out = *in + if in.IPs != nil { + in, out := &in.IPs, &out.IPs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Application != nil { + in, out := &in.Application, &out.Application + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PoolIPPreAllocation. +func (in *PoolIPPreAllocation) DeepCopy() *PoolIPPreAllocation { + if in == nil { + return nil + } + out := new(PoolIPPreAllocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in PoolIPPreAllocations) DeepCopyInto(out *PoolIPPreAllocations) { + { + in := &in + *out = make(PoolIPPreAllocations, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PoolIPPreAllocations. +func (in PoolIPPreAllocations) DeepCopy() PoolIPPreAllocations { + if in == nil { + return nil + } + out := new(PoolIPPreAllocations) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReservedIPSpec) DeepCopyInto(out *ReservedIPSpec) { + *out = *in + if in.IPVersion != nil { + in, out := &in.IPVersion, &out.IPVersion + *out = new(int64) + **out = **in + } + if in.IPs != nil { + in, out := &in.IPs, &out.IPs + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReservedIPSpec. +func (in *ReservedIPSpec) DeepCopy() *ReservedIPSpec { + if in == nil { + return nil + } + out := new(ReservedIPSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Route) DeepCopyInto(out *Route) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route. +func (in *Route) DeepCopy() *Route { + if in == nil { + return nil + } + out := new(Route) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderClaimParameter) DeepCopyInto(out *SpiderClaimParameter) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderClaimParameter. +func (in *SpiderClaimParameter) DeepCopy() *SpiderClaimParameter { + if in == nil { + return nil + } + out := new(SpiderClaimParameter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderClaimParameter) 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 *SpiderClaimParameterList) DeepCopyInto(out *SpiderClaimParameterList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SpiderClaimParameter, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderClaimParameterList. +func (in *SpiderClaimParameterList) DeepCopy() *SpiderClaimParameterList { + if in == nil { + return nil + } + out := new(SpiderClaimParameterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderClaimParameterList) 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 *SpiderCoordinator) DeepCopyInto(out *SpiderCoordinator) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderCoordinator. +func (in *SpiderCoordinator) DeepCopy() *SpiderCoordinator { + if in == nil { + return nil + } + out := new(SpiderCoordinator) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderCoordinator) 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 *SpiderCoordinatorList) DeepCopyInto(out *SpiderCoordinatorList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SpiderCoordinator, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderCoordinatorList. +func (in *SpiderCoordinatorList) DeepCopy() *SpiderCoordinatorList { + if in == nil { + return nil + } + out := new(SpiderCoordinatorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderCoordinatorList) 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 *SpiderEndpoint) DeepCopyInto(out *SpiderEndpoint) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderEndpoint. +func (in *SpiderEndpoint) DeepCopy() *SpiderEndpoint { + if in == nil { + return nil + } + out := new(SpiderEndpoint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderEndpoint) 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 *SpiderEndpointList) DeepCopyInto(out *SpiderEndpointList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SpiderEndpoint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderEndpointList. +func (in *SpiderEndpointList) DeepCopy() *SpiderEndpointList { + if in == nil { + return nil + } + out := new(SpiderEndpointList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderEndpointList) 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 *SpiderIBSriovCniConfig) DeepCopyInto(out *SpiderIBSriovCniConfig) { + *out = *in + if in.Pkey != nil { + in, out := &in.Pkey, &out.Pkey + *out = new(string) + **out = **in + } + if in.LinkState != nil { + in, out := &in.LinkState, &out.LinkState + *out = new(string) + **out = **in + } + if in.RdmaIsolation != nil { + in, out := &in.RdmaIsolation, &out.RdmaIsolation + *out = new(bool) + **out = **in + } + if in.IbKubernetesEnabled != nil { + in, out := &in.IbKubernetesEnabled, &out.IbKubernetesEnabled + *out = new(bool) + **out = **in + } + if in.SpiderpoolConfigPools != nil { + in, out := &in.SpiderpoolConfigPools, &out.SpiderpoolConfigPools + *out = new(SpiderpoolPools) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderIBSriovCniConfig. +func (in *SpiderIBSriovCniConfig) DeepCopy() *SpiderIBSriovCniConfig { + if in == nil { + return nil + } + out := new(SpiderIBSriovCniConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderIPPool) DeepCopyInto(out *SpiderIPPool) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderIPPool. +func (in *SpiderIPPool) DeepCopy() *SpiderIPPool { + if in == nil { + return nil + } + out := new(SpiderIPPool) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderIPPool) 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 *SpiderIPPoolList) DeepCopyInto(out *SpiderIPPoolList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SpiderIPPool, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderIPPoolList. +func (in *SpiderIPPoolList) DeepCopy() *SpiderIPPoolList { + if in == nil { + return nil + } + out := new(SpiderIPPoolList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderIPPoolList) 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 *SpiderIPvlanCniConfig) DeepCopyInto(out *SpiderIPvlanCniConfig) { + *out = *in + if in.Master != nil { + in, out := &in.Master, &out.Master + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.VlanID != nil { + in, out := &in.VlanID, &out.VlanID + *out = new(int32) + **out = **in + } + if in.Bond != nil { + in, out := &in.Bond, &out.Bond + *out = new(BondConfig) + (*in).DeepCopyInto(*out) + } + if in.SpiderpoolConfigPools != nil { + in, out := &in.SpiderpoolConfigPools, &out.SpiderpoolConfigPools + *out = new(SpiderpoolPools) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderIPvlanCniConfig. +func (in *SpiderIPvlanCniConfig) DeepCopy() *SpiderIPvlanCniConfig { + if in == nil { + return nil + } + out := new(SpiderIPvlanCniConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderIpoibCniConfig) DeepCopyInto(out *SpiderIpoibCniConfig) { + *out = *in + if in.SpiderpoolConfigPools != nil { + in, out := &in.SpiderpoolConfigPools, &out.SpiderpoolConfigPools + *out = new(SpiderpoolPools) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderIpoibCniConfig. +func (in *SpiderIpoibCniConfig) DeepCopy() *SpiderIpoibCniConfig { + if in == nil { + return nil + } + out := new(SpiderIpoibCniConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderMacvlanCniConfig) DeepCopyInto(out *SpiderMacvlanCniConfig) { + *out = *in + if in.Master != nil { + in, out := &in.Master, &out.Master + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.VlanID != nil { + in, out := &in.VlanID, &out.VlanID + *out = new(int32) + **out = **in + } + if in.Bond != nil { + in, out := &in.Bond, &out.Bond + *out = new(BondConfig) + (*in).DeepCopyInto(*out) + } + if in.SpiderpoolConfigPools != nil { + in, out := &in.SpiderpoolConfigPools, &out.SpiderpoolConfigPools + *out = new(SpiderpoolPools) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderMacvlanCniConfig. +func (in *SpiderMacvlanCniConfig) DeepCopy() *SpiderMacvlanCniConfig { + if in == nil { + return nil + } + out := new(SpiderMacvlanCniConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderMultusConfig) DeepCopyInto(out *SpiderMultusConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderMultusConfig. +func (in *SpiderMultusConfig) DeepCopy() *SpiderMultusConfig { + if in == nil { + return nil + } + out := new(SpiderMultusConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderMultusConfig) 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 *SpiderMultusConfigList) DeepCopyInto(out *SpiderMultusConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SpiderMultusConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderMultusConfigList. +func (in *SpiderMultusConfigList) DeepCopy() *SpiderMultusConfigList { + if in == nil { + return nil + } + out := new(SpiderMultusConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderMultusConfigList) 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 *SpiderOvsCniConfig) DeepCopyInto(out *SpiderOvsCniConfig) { + *out = *in + if in.VlanTag != nil { + in, out := &in.VlanTag, &out.VlanTag + *out = new(int32) + **out = **in + } + if in.Trunk != nil { + in, out := &in.Trunk, &out.Trunk + *out = make([]*Trunk, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Trunk) + (*in).DeepCopyInto(*out) + } + } + } + if in.SpiderpoolConfigPools != nil { + in, out := &in.SpiderpoolConfigPools, &out.SpiderpoolConfigPools + *out = new(SpiderpoolPools) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderOvsCniConfig. +func (in *SpiderOvsCniConfig) DeepCopy() *SpiderOvsCniConfig { + if in == nil { + return nil + } + out := new(SpiderOvsCniConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderReservedIP) DeepCopyInto(out *SpiderReservedIP) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderReservedIP. +func (in *SpiderReservedIP) DeepCopy() *SpiderReservedIP { + if in == nil { + return nil + } + out := new(SpiderReservedIP) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderReservedIP) 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 *SpiderReservedIPList) DeepCopyInto(out *SpiderReservedIPList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SpiderReservedIP, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderReservedIPList. +func (in *SpiderReservedIPList) DeepCopy() *SpiderReservedIPList { + if in == nil { + return nil + } + out := new(SpiderReservedIPList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderReservedIPList) 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 *SpiderSRIOVCniConfig) DeepCopyInto(out *SpiderSRIOVCniConfig) { + *out = *in + if in.VlanID != nil { + in, out := &in.VlanID, &out.VlanID + *out = new(int32) + **out = **in + } + if in.MinTxRateMbps != nil { + in, out := &in.MinTxRateMbps, &out.MinTxRateMbps + *out = new(int) + **out = **in + } + if in.MaxTxRateMbps != nil { + in, out := &in.MaxTxRateMbps, &out.MaxTxRateMbps + *out = new(int) + **out = **in + } + if in.SpiderpoolConfigPools != nil { + in, out := &in.SpiderpoolConfigPools, &out.SpiderpoolConfigPools + *out = new(SpiderpoolPools) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderSRIOVCniConfig. +func (in *SpiderSRIOVCniConfig) DeepCopy() *SpiderSRIOVCniConfig { + if in == nil { + return nil + } + out := new(SpiderSRIOVCniConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderSubnet) DeepCopyInto(out *SpiderSubnet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderSubnet. +func (in *SpiderSubnet) DeepCopy() *SpiderSubnet { + if in == nil { + return nil + } + out := new(SpiderSubnet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderSubnet) 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 *SpiderSubnetList) DeepCopyInto(out *SpiderSubnetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SpiderSubnet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderSubnetList. +func (in *SpiderSubnetList) DeepCopy() *SpiderSubnetList { + if in == nil { + return nil + } + out := new(SpiderSubnetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderSubnetList) 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 *SpiderpoolPools) DeepCopyInto(out *SpiderpoolPools) { + *out = *in + if in.IPv4IPPool != nil { + in, out := &in.IPv4IPPool, &out.IPv4IPPool + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.IPv6IPPool != nil { + in, out := &in.IPv6IPPool, &out.IPv6IPPool + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderpoolPools. +func (in *SpiderpoolPools) DeepCopy() *SpiderpoolPools { + if in == nil { + return nil + } + out := new(SpiderpoolPools) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubnetSpec) DeepCopyInto(out *SubnetSpec) { + *out = *in + if in.IPVersion != nil { + in, out := &in.IPVersion, &out.IPVersion + *out = new(int64) + **out = **in + } + if in.IPs != nil { + in, out := &in.IPs, &out.IPs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludeIPs != nil { + in, out := &in.ExcludeIPs, &out.ExcludeIPs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Gateway != nil { + in, out := &in.Gateway, &out.Gateway + *out = new(string) + **out = **in + } + if in.Vlan != nil { + in, out := &in.Vlan, &out.Vlan + *out = new(int64) + **out = **in + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetSpec. +func (in *SubnetSpec) DeepCopy() *SubnetSpec { + if in == nil { + return nil + } + out := new(SubnetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubnetStatus) DeepCopyInto(out *SubnetStatus) { + *out = *in + if in.ControlledIPPools != nil { + in, out := &in.ControlledIPPools, &out.ControlledIPPools + *out = new(string) + **out = **in + } + if in.TotalIPCount != nil { + in, out := &in.TotalIPCount, &out.TotalIPCount + *out = new(int64) + **out = **in + } + if in.AllocatedIPCount != nil { + in, out := &in.AllocatedIPCount, &out.AllocatedIPCount + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetStatus. +func (in *SubnetStatus) DeepCopy() *SubnetStatus { + if in == nil { + return nil + } + out := new(SubnetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Trunk) DeepCopyInto(out *Trunk) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Trunk. +func (in *Trunk) DeepCopy() *Trunk { + if in == nil { + return nil + } + out := new(Trunk) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadEndpointStatus) DeepCopyInto(out *WorkloadEndpointStatus) { + *out = *in + in.Current.DeepCopyInto(&out.Current) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadEndpointStatus. +func (in *WorkloadEndpointStatus) DeepCopy() *WorkloadEndpointStatus { + if in == nil { + return nil + } + out := new(WorkloadEndpointStatus) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/k8s/client/clientset/versioned/clientset.go b/pkg/k8s/client/clientset/versioned/clientset.go index 06a71c391f..193717b391 100644 --- a/pkg/k8s/client/clientset/versioned/clientset.go +++ b/pkg/k8s/client/clientset/versioned/clientset.go @@ -10,6 +10,7 @@ import ( "net/http" spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -18,12 +19,14 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface SpiderpoolV2beta1() spiderpoolv2beta1.SpiderpoolV2beta1Interface + SpiderpoolV2beta2() spiderpoolv2beta2.SpiderpoolV2beta2Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient spiderpoolV2beta1 *spiderpoolv2beta1.SpiderpoolV2beta1Client + spiderpoolV2beta2 *spiderpoolv2beta2.SpiderpoolV2beta2Client } // SpiderpoolV2beta1 retrieves the SpiderpoolV2beta1Client @@ -31,6 +34,11 @@ func (c *Clientset) SpiderpoolV2beta1() spiderpoolv2beta1.SpiderpoolV2beta1Inter return c.spiderpoolV2beta1 } +// SpiderpoolV2beta2 retrieves the SpiderpoolV2beta2Client +func (c *Clientset) SpiderpoolV2beta2() spiderpoolv2beta2.SpiderpoolV2beta2Interface { + return c.spiderpoolV2beta2 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -79,6 +87,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.spiderpoolV2beta2, err = spiderpoolv2beta2.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { @@ -101,6 +113,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.spiderpoolV2beta1 = spiderpoolv2beta1.New(c) + cs.spiderpoolV2beta2 = spiderpoolv2beta2.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go b/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go index d04ca1d2ce..5b0a04bc44 100644 --- a/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go @@ -9,6 +9,8 @@ import ( clientset "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1" fakespiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake" + spiderpoolv2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2" + fakespiderpoolv2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -70,3 +72,8 @@ var ( func (c *Clientset) SpiderpoolV2beta1() spiderpoolv2beta1.SpiderpoolV2beta1Interface { return &fakespiderpoolv2beta1.FakeSpiderpoolV2beta1{Fake: &c.Fake} } + +// SpiderpoolV2beta2 retrieves the SpiderpoolV2beta2Client +func (c *Clientset) SpiderpoolV2beta2() spiderpoolv2beta2.SpiderpoolV2beta2Interface { + return &fakespiderpoolv2beta2.FakeSpiderpoolV2beta2{Fake: &c.Fake} +} diff --git a/pkg/k8s/client/clientset/versioned/fake/register.go b/pkg/k8s/client/clientset/versioned/fake/register.go index 8fee34d5bd..e418bdf666 100644 --- a/pkg/k8s/client/clientset/versioned/fake/register.go +++ b/pkg/k8s/client/clientset/versioned/fake/register.go @@ -6,7 +6,8 @@ package fake import ( - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + spiderpoolv2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -19,6 +20,7 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ spiderpoolv2beta1.AddToScheme, + spiderpoolv2beta2.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/k8s/client/clientset/versioned/scheme/register.go b/pkg/k8s/client/clientset/versioned/scheme/register.go index 03fa279097..fbd7f501e1 100644 --- a/pkg/k8s/client/clientset/versioned/scheme/register.go +++ b/pkg/k8s/client/clientset/versioned/scheme/register.go @@ -6,7 +6,8 @@ package scheme import ( - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + spiderpoolv2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -19,6 +20,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ spiderpoolv2beta1.AddToScheme, + spiderpoolv2beta2.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spiderclaimparameter.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spiderclaimparameter.go index 9e4cf49d8d..37be4d9b9b 100644 --- a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spiderclaimparameter.go +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spiderclaimparameter.go @@ -8,7 +8,7 @@ package fake import ( "context" - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spidercoordinator.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spidercoordinator.go index 247025419d..d6674d1eca 100644 --- a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spidercoordinator.go +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spidercoordinator.go @@ -8,7 +8,7 @@ package fake import ( "context" - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spiderippool.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spiderippool.go index 276c537b27..5f8a50d78a 100644 --- a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spiderippool.go +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spiderippool.go @@ -8,7 +8,7 @@ package fake import ( "context" - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spidermultusconfig.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spidermultusconfig.go index 9f1acdef04..c1dbcc1967 100644 --- a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spidermultusconfig.go +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spidermultusconfig.go @@ -8,7 +8,7 @@ package fake import ( "context" - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spidersubnet.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spidersubnet.go index 04e05e62b7..27c1273dd6 100644 --- a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spidersubnet.go +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake/fake_spidersubnet.go @@ -8,7 +8,7 @@ package fake import ( "context" - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spiderclaimparameter.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spiderclaimparameter.go index a0f647c72d..31d33c250a 100644 --- a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spiderclaimparameter.go +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spiderclaimparameter.go @@ -9,7 +9,7 @@ import ( "context" "time" - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" scheme "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spidercoordinator.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spidercoordinator.go index 503e0b8942..967eaaeb6c 100644 --- a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spidercoordinator.go +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spidercoordinator.go @@ -9,7 +9,7 @@ import ( "context" "time" - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" scheme "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spiderippool.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spiderippool.go index 12cd9dba4f..002c35ff1d 100644 --- a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spiderippool.go +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spiderippool.go @@ -9,7 +9,7 @@ import ( "context" "time" - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" scheme "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spidermultusconfig.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spidermultusconfig.go index e2f54dcc1b..54755daf2a 100644 --- a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spidermultusconfig.go +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spidermultusconfig.go @@ -9,7 +9,7 @@ import ( "context" "time" - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" scheme "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spiderpool.spidernet.io_client.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spiderpool.spidernet.io_client.go index 9b12c2c9af..9b68b1fc8f 100644 --- a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spiderpool.spidernet.io_client.go +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spiderpool.spidernet.io_client.go @@ -8,7 +8,7 @@ package v2beta1 import ( "net/http" - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/scheme" rest "k8s.io/client-go/rest" ) diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spidersubnet.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spidersubnet.go index f129c01d1b..e3328460a1 100644 --- a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spidersubnet.go +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/spidersubnet.go @@ -9,7 +9,7 @@ import ( "context" "time" - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" scheme "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/doc.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/doc.go new file mode 100644 index 0000000000..45c9fc1d01 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/doc.go @@ -0,0 +1,7 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v2beta2 diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/doc.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/doc.go new file mode 100644 index 0000000000..c962f5b29f --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/doc.go @@ -0,0 +1,7 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderclaimparameter.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderclaimparameter.go new file mode 100644 index 0000000000..a059ee3c54 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderclaimparameter.go @@ -0,0 +1,116 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeSpiderClaimParameters implements SpiderClaimParameterInterface +type FakeSpiderClaimParameters struct { + Fake *FakeSpiderpoolV2beta2 + ns string +} + +var spiderclaimparametersResource = v2beta2.SchemeGroupVersion.WithResource("spiderclaimparameters") + +var spiderclaimparametersKind = v2beta2.SchemeGroupVersion.WithKind("SpiderClaimParameter") + +// Get takes name of the spiderClaimParameter, and returns the corresponding spiderClaimParameter object, and an error if there is any. +func (c *FakeSpiderClaimParameters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderClaimParameter, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(spiderclaimparametersResource, c.ns, name), &v2beta2.SpiderClaimParameter{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderClaimParameter), err +} + +// List takes label and field selectors, and returns the list of SpiderClaimParameters that match those selectors. +func (c *FakeSpiderClaimParameters) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderClaimParameterList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(spiderclaimparametersResource, spiderclaimparametersKind, c.ns, opts), &v2beta2.SpiderClaimParameterList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2beta2.SpiderClaimParameterList{ListMeta: obj.(*v2beta2.SpiderClaimParameterList).ListMeta} + for _, item := range obj.(*v2beta2.SpiderClaimParameterList).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 spiderClaimParameters. +func (c *FakeSpiderClaimParameters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(spiderclaimparametersResource, c.ns, opts)) + +} + +// Create takes the representation of a spiderClaimParameter and creates it. Returns the server's representation of the spiderClaimParameter, and an error, if there is any. +func (c *FakeSpiderClaimParameters) Create(ctx context.Context, spiderClaimParameter *v2beta2.SpiderClaimParameter, opts v1.CreateOptions) (result *v2beta2.SpiderClaimParameter, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(spiderclaimparametersResource, c.ns, spiderClaimParameter), &v2beta2.SpiderClaimParameter{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderClaimParameter), err +} + +// Update takes the representation of a spiderClaimParameter and updates it. Returns the server's representation of the spiderClaimParameter, and an error, if there is any. +func (c *FakeSpiderClaimParameters) Update(ctx context.Context, spiderClaimParameter *v2beta2.SpiderClaimParameter, opts v1.UpdateOptions) (result *v2beta2.SpiderClaimParameter, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(spiderclaimparametersResource, c.ns, spiderClaimParameter), &v2beta2.SpiderClaimParameter{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderClaimParameter), err +} + +// Delete takes name of the spiderClaimParameter and deletes it. Returns an error if one occurs. +func (c *FakeSpiderClaimParameters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(spiderclaimparametersResource, c.ns, name, opts), &v2beta2.SpiderClaimParameter{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSpiderClaimParameters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(spiderclaimparametersResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v2beta2.SpiderClaimParameterList{}) + return err +} + +// Patch applies the patch and returns the patched spiderClaimParameter. +func (c *FakeSpiderClaimParameters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderClaimParameter, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(spiderclaimparametersResource, c.ns, name, pt, data, subresources...), &v2beta2.SpiderClaimParameter{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderClaimParameter), err +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidercoordinator.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidercoordinator.go new file mode 100644 index 0000000000..1d25da2223 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidercoordinator.go @@ -0,0 +1,119 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeSpiderCoordinators implements SpiderCoordinatorInterface +type FakeSpiderCoordinators struct { + Fake *FakeSpiderpoolV2beta2 +} + +var spidercoordinatorsResource = v2beta2.SchemeGroupVersion.WithResource("spidercoordinators") + +var spidercoordinatorsKind = v2beta2.SchemeGroupVersion.WithKind("SpiderCoordinator") + +// Get takes name of the spiderCoordinator, and returns the corresponding spiderCoordinator object, and an error if there is any. +func (c *FakeSpiderCoordinators) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderCoordinator, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(spidercoordinatorsResource, name), &v2beta2.SpiderCoordinator{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderCoordinator), err +} + +// List takes label and field selectors, and returns the list of SpiderCoordinators that match those selectors. +func (c *FakeSpiderCoordinators) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderCoordinatorList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(spidercoordinatorsResource, spidercoordinatorsKind, opts), &v2beta2.SpiderCoordinatorList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2beta2.SpiderCoordinatorList{ListMeta: obj.(*v2beta2.SpiderCoordinatorList).ListMeta} + for _, item := range obj.(*v2beta2.SpiderCoordinatorList).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 spiderCoordinators. +func (c *FakeSpiderCoordinators) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(spidercoordinatorsResource, opts)) +} + +// Create takes the representation of a spiderCoordinator and creates it. Returns the server's representation of the spiderCoordinator, and an error, if there is any. +func (c *FakeSpiderCoordinators) Create(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.CreateOptions) (result *v2beta2.SpiderCoordinator, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(spidercoordinatorsResource, spiderCoordinator), &v2beta2.SpiderCoordinator{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderCoordinator), err +} + +// Update takes the representation of a spiderCoordinator and updates it. Returns the server's representation of the spiderCoordinator, and an error, if there is any. +func (c *FakeSpiderCoordinators) Update(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.UpdateOptions) (result *v2beta2.SpiderCoordinator, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(spidercoordinatorsResource, spiderCoordinator), &v2beta2.SpiderCoordinator{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderCoordinator), 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 *FakeSpiderCoordinators) UpdateStatus(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.UpdateOptions) (*v2beta2.SpiderCoordinator, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(spidercoordinatorsResource, "status", spiderCoordinator), &v2beta2.SpiderCoordinator{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderCoordinator), err +} + +// Delete takes name of the spiderCoordinator and deletes it. Returns an error if one occurs. +func (c *FakeSpiderCoordinators) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(spidercoordinatorsResource, name, opts), &v2beta2.SpiderCoordinator{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSpiderCoordinators) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(spidercoordinatorsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2beta2.SpiderCoordinatorList{}) + return err +} + +// Patch applies the patch and returns the patched spiderCoordinator. +func (c *FakeSpiderCoordinators) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderCoordinator, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(spidercoordinatorsResource, name, pt, data, subresources...), &v2beta2.SpiderCoordinator{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderCoordinator), err +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderippool.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderippool.go new file mode 100644 index 0000000000..03fde1a7f8 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderippool.go @@ -0,0 +1,119 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeSpiderIPPools implements SpiderIPPoolInterface +type FakeSpiderIPPools struct { + Fake *FakeSpiderpoolV2beta2 +} + +var spiderippoolsResource = v2beta2.SchemeGroupVersion.WithResource("spiderippools") + +var spiderippoolsKind = v2beta2.SchemeGroupVersion.WithKind("SpiderIPPool") + +// Get takes name of the spiderIPPool, and returns the corresponding spiderIPPool object, and an error if there is any. +func (c *FakeSpiderIPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderIPPool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(spiderippoolsResource, name), &v2beta2.SpiderIPPool{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderIPPool), err +} + +// List takes label and field selectors, and returns the list of SpiderIPPools that match those selectors. +func (c *FakeSpiderIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderIPPoolList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(spiderippoolsResource, spiderippoolsKind, opts), &v2beta2.SpiderIPPoolList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2beta2.SpiderIPPoolList{ListMeta: obj.(*v2beta2.SpiderIPPoolList).ListMeta} + for _, item := range obj.(*v2beta2.SpiderIPPoolList).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 spiderIPPools. +func (c *FakeSpiderIPPools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(spiderippoolsResource, opts)) +} + +// Create takes the representation of a spiderIPPool and creates it. Returns the server's representation of the spiderIPPool, and an error, if there is any. +func (c *FakeSpiderIPPools) Create(ctx context.Context, spiderIPPool *v2beta2.SpiderIPPool, opts v1.CreateOptions) (result *v2beta2.SpiderIPPool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(spiderippoolsResource, spiderIPPool), &v2beta2.SpiderIPPool{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderIPPool), err +} + +// Update takes the representation of a spiderIPPool and updates it. Returns the server's representation of the spiderIPPool, and an error, if there is any. +func (c *FakeSpiderIPPools) Update(ctx context.Context, spiderIPPool *v2beta2.SpiderIPPool, opts v1.UpdateOptions) (result *v2beta2.SpiderIPPool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(spiderippoolsResource, spiderIPPool), &v2beta2.SpiderIPPool{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderIPPool), 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 *FakeSpiderIPPools) UpdateStatus(ctx context.Context, spiderIPPool *v2beta2.SpiderIPPool, opts v1.UpdateOptions) (*v2beta2.SpiderIPPool, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(spiderippoolsResource, "status", spiderIPPool), &v2beta2.SpiderIPPool{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderIPPool), err +} + +// Delete takes name of the spiderIPPool and deletes it. Returns an error if one occurs. +func (c *FakeSpiderIPPools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(spiderippoolsResource, name, opts), &v2beta2.SpiderIPPool{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSpiderIPPools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(spiderippoolsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2beta2.SpiderIPPoolList{}) + return err +} + +// Patch applies the patch and returns the patched spiderIPPool. +func (c *FakeSpiderIPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderIPPool, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(spiderippoolsResource, name, pt, data, subresources...), &v2beta2.SpiderIPPool{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderIPPool), err +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidermultusconfig.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidermultusconfig.go new file mode 100644 index 0000000000..c7c1ae8abe --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidermultusconfig.go @@ -0,0 +1,116 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeSpiderMultusConfigs implements SpiderMultusConfigInterface +type FakeSpiderMultusConfigs struct { + Fake *FakeSpiderpoolV2beta2 + ns string +} + +var spidermultusconfigsResource = v2beta2.SchemeGroupVersion.WithResource("spidermultusconfigs") + +var spidermultusconfigsKind = v2beta2.SchemeGroupVersion.WithKind("SpiderMultusConfig") + +// Get takes name of the spiderMultusConfig, and returns the corresponding spiderMultusConfig object, and an error if there is any. +func (c *FakeSpiderMultusConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderMultusConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(spidermultusconfigsResource, c.ns, name), &v2beta2.SpiderMultusConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderMultusConfig), err +} + +// List takes label and field selectors, and returns the list of SpiderMultusConfigs that match those selectors. +func (c *FakeSpiderMultusConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderMultusConfigList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(spidermultusconfigsResource, spidermultusconfigsKind, c.ns, opts), &v2beta2.SpiderMultusConfigList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2beta2.SpiderMultusConfigList{ListMeta: obj.(*v2beta2.SpiderMultusConfigList).ListMeta} + for _, item := range obj.(*v2beta2.SpiderMultusConfigList).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 spiderMultusConfigs. +func (c *FakeSpiderMultusConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(spidermultusconfigsResource, c.ns, opts)) + +} + +// Create takes the representation of a spiderMultusConfig and creates it. Returns the server's representation of the spiderMultusConfig, and an error, if there is any. +func (c *FakeSpiderMultusConfigs) Create(ctx context.Context, spiderMultusConfig *v2beta2.SpiderMultusConfig, opts v1.CreateOptions) (result *v2beta2.SpiderMultusConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(spidermultusconfigsResource, c.ns, spiderMultusConfig), &v2beta2.SpiderMultusConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderMultusConfig), err +} + +// Update takes the representation of a spiderMultusConfig and updates it. Returns the server's representation of the spiderMultusConfig, and an error, if there is any. +func (c *FakeSpiderMultusConfigs) Update(ctx context.Context, spiderMultusConfig *v2beta2.SpiderMultusConfig, opts v1.UpdateOptions) (result *v2beta2.SpiderMultusConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(spidermultusconfigsResource, c.ns, spiderMultusConfig), &v2beta2.SpiderMultusConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderMultusConfig), err +} + +// Delete takes name of the spiderMultusConfig and deletes it. Returns an error if one occurs. +func (c *FakeSpiderMultusConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(spidermultusconfigsResource, c.ns, name, opts), &v2beta2.SpiderMultusConfig{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSpiderMultusConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(spidermultusconfigsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v2beta2.SpiderMultusConfigList{}) + return err +} + +// Patch applies the patch and returns the patched spiderMultusConfig. +func (c *FakeSpiderMultusConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderMultusConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(spidermultusconfigsResource, c.ns, name, pt, data, subresources...), &v2beta2.SpiderMultusConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderMultusConfig), err +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderpool.spidernet.io_client.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderpool.spidernet.io_client.go new file mode 100644 index 0000000000..90eff61898 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderpool.spidernet.io_client.go @@ -0,0 +1,43 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeSpiderpoolV2beta2 struct { + *testing.Fake +} + +func (c *FakeSpiderpoolV2beta2) SpiderClaimParameters(namespace string) v2beta2.SpiderClaimParameterInterface { + return &FakeSpiderClaimParameters{c, namespace} +} + +func (c *FakeSpiderpoolV2beta2) SpiderCoordinators() v2beta2.SpiderCoordinatorInterface { + return &FakeSpiderCoordinators{c} +} + +func (c *FakeSpiderpoolV2beta2) SpiderIPPools() v2beta2.SpiderIPPoolInterface { + return &FakeSpiderIPPools{c} +} + +func (c *FakeSpiderpoolV2beta2) SpiderMultusConfigs(namespace string) v2beta2.SpiderMultusConfigInterface { + return &FakeSpiderMultusConfigs{c, namespace} +} + +func (c *FakeSpiderpoolV2beta2) SpiderSubnets() v2beta2.SpiderSubnetInterface { + return &FakeSpiderSubnets{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeSpiderpoolV2beta2) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidersubnet.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidersubnet.go new file mode 100644 index 0000000000..ea0f219c99 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidersubnet.go @@ -0,0 +1,119 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeSpiderSubnets implements SpiderSubnetInterface +type FakeSpiderSubnets struct { + Fake *FakeSpiderpoolV2beta2 +} + +var spidersubnetsResource = v2beta2.SchemeGroupVersion.WithResource("spidersubnets") + +var spidersubnetsKind = v2beta2.SchemeGroupVersion.WithKind("SpiderSubnet") + +// Get takes name of the spiderSubnet, and returns the corresponding spiderSubnet object, and an error if there is any. +func (c *FakeSpiderSubnets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderSubnet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(spidersubnetsResource, name), &v2beta2.SpiderSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderSubnet), err +} + +// List takes label and field selectors, and returns the list of SpiderSubnets that match those selectors. +func (c *FakeSpiderSubnets) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderSubnetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(spidersubnetsResource, spidersubnetsKind, opts), &v2beta2.SpiderSubnetList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2beta2.SpiderSubnetList{ListMeta: obj.(*v2beta2.SpiderSubnetList).ListMeta} + for _, item := range obj.(*v2beta2.SpiderSubnetList).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 spiderSubnets. +func (c *FakeSpiderSubnets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(spidersubnetsResource, opts)) +} + +// Create takes the representation of a spiderSubnet and creates it. Returns the server's representation of the spiderSubnet, and an error, if there is any. +func (c *FakeSpiderSubnets) Create(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.CreateOptions) (result *v2beta2.SpiderSubnet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(spidersubnetsResource, spiderSubnet), &v2beta2.SpiderSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderSubnet), err +} + +// Update takes the representation of a spiderSubnet and updates it. Returns the server's representation of the spiderSubnet, and an error, if there is any. +func (c *FakeSpiderSubnets) Update(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.UpdateOptions) (result *v2beta2.SpiderSubnet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(spidersubnetsResource, spiderSubnet), &v2beta2.SpiderSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderSubnet), 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 *FakeSpiderSubnets) UpdateStatus(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.UpdateOptions) (*v2beta2.SpiderSubnet, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(spidersubnetsResource, "status", spiderSubnet), &v2beta2.SpiderSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderSubnet), err +} + +// Delete takes name of the spiderSubnet and deletes it. Returns an error if one occurs. +func (c *FakeSpiderSubnets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(spidersubnetsResource, name, opts), &v2beta2.SpiderSubnet{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSpiderSubnets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(spidersubnetsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2beta2.SpiderSubnetList{}) + return err +} + +// Patch applies the patch and returns the patched spiderSubnet. +func (c *FakeSpiderSubnets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderSubnet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(spidersubnetsResource, name, pt, data, subresources...), &v2beta2.SpiderSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderSubnet), err +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/generated_expansion.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/generated_expansion.go new file mode 100644 index 0000000000..73b7fce5f9 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/generated_expansion.go @@ -0,0 +1,16 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta2 + +type SpiderClaimParameterExpansion interface{} + +type SpiderCoordinatorExpansion interface{} + +type SpiderIPPoolExpansion interface{} + +type SpiderMultusConfigExpansion interface{} + +type SpiderSubnetExpansion interface{} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderclaimparameter.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderclaimparameter.go new file mode 100644 index 0000000000..28ec77cbf6 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderclaimparameter.go @@ -0,0 +1,165 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + "time" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + scheme "github.com/spidernet-io/spiderpool/pkg/k8s/client/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" +) + +// SpiderClaimParametersGetter has a method to return a SpiderClaimParameterInterface. +// A group's client should implement this interface. +type SpiderClaimParametersGetter interface { + SpiderClaimParameters(namespace string) SpiderClaimParameterInterface +} + +// SpiderClaimParameterInterface has methods to work with SpiderClaimParameter resources. +type SpiderClaimParameterInterface interface { + Create(ctx context.Context, spiderClaimParameter *v2beta2.SpiderClaimParameter, opts v1.CreateOptions) (*v2beta2.SpiderClaimParameter, error) + Update(ctx context.Context, spiderClaimParameter *v2beta2.SpiderClaimParameter, opts v1.UpdateOptions) (*v2beta2.SpiderClaimParameter, 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) (*v2beta2.SpiderClaimParameter, error) + List(ctx context.Context, opts v1.ListOptions) (*v2beta2.SpiderClaimParameterList, 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 *v2beta2.SpiderClaimParameter, err error) + SpiderClaimParameterExpansion +} + +// spiderClaimParameters implements SpiderClaimParameterInterface +type spiderClaimParameters struct { + client rest.Interface + ns string +} + +// newSpiderClaimParameters returns a SpiderClaimParameters +func newSpiderClaimParameters(c *SpiderpoolV2beta2Client, namespace string) *spiderClaimParameters { + return &spiderClaimParameters{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the spiderClaimParameter, and returns the corresponding spiderClaimParameter object, and an error if there is any. +func (c *spiderClaimParameters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderClaimParameter, err error) { + result = &v2beta2.SpiderClaimParameter{} + err = c.client.Get(). + Namespace(c.ns). + Resource("spiderclaimparameters"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of SpiderClaimParameters that match those selectors. +func (c *spiderClaimParameters) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderClaimParameterList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2beta2.SpiderClaimParameterList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("spiderclaimparameters"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested spiderClaimParameters. +func (c *spiderClaimParameters) 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("spiderclaimparameters"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a spiderClaimParameter and creates it. Returns the server's representation of the spiderClaimParameter, and an error, if there is any. +func (c *spiderClaimParameters) Create(ctx context.Context, spiderClaimParameter *v2beta2.SpiderClaimParameter, opts v1.CreateOptions) (result *v2beta2.SpiderClaimParameter, err error) { + result = &v2beta2.SpiderClaimParameter{} + err = c.client.Post(). + Namespace(c.ns). + Resource("spiderclaimparameters"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderClaimParameter). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a spiderClaimParameter and updates it. Returns the server's representation of the spiderClaimParameter, and an error, if there is any. +func (c *spiderClaimParameters) Update(ctx context.Context, spiderClaimParameter *v2beta2.SpiderClaimParameter, opts v1.UpdateOptions) (result *v2beta2.SpiderClaimParameter, err error) { + result = &v2beta2.SpiderClaimParameter{} + err = c.client.Put(). + Namespace(c.ns). + Resource("spiderclaimparameters"). + Name(spiderClaimParameter.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderClaimParameter). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the spiderClaimParameter and deletes it. Returns an error if one occurs. +func (c *spiderClaimParameters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("spiderclaimparameters"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *spiderClaimParameters) 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("spiderclaimparameters"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched spiderClaimParameter. +func (c *spiderClaimParameters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderClaimParameter, err error) { + result = &v2beta2.SpiderClaimParameter{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("spiderclaimparameters"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidercoordinator.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidercoordinator.go new file mode 100644 index 0000000000..1d27e6b3f9 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidercoordinator.go @@ -0,0 +1,171 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + "time" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + scheme "github.com/spidernet-io/spiderpool/pkg/k8s/client/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" +) + +// SpiderCoordinatorsGetter has a method to return a SpiderCoordinatorInterface. +// A group's client should implement this interface. +type SpiderCoordinatorsGetter interface { + SpiderCoordinators() SpiderCoordinatorInterface +} + +// SpiderCoordinatorInterface has methods to work with SpiderCoordinator resources. +type SpiderCoordinatorInterface interface { + Create(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.CreateOptions) (*v2beta2.SpiderCoordinator, error) + Update(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.UpdateOptions) (*v2beta2.SpiderCoordinator, error) + UpdateStatus(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.UpdateOptions) (*v2beta2.SpiderCoordinator, 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) (*v2beta2.SpiderCoordinator, error) + List(ctx context.Context, opts v1.ListOptions) (*v2beta2.SpiderCoordinatorList, 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 *v2beta2.SpiderCoordinator, err error) + SpiderCoordinatorExpansion +} + +// spiderCoordinators implements SpiderCoordinatorInterface +type spiderCoordinators struct { + client rest.Interface +} + +// newSpiderCoordinators returns a SpiderCoordinators +func newSpiderCoordinators(c *SpiderpoolV2beta2Client) *spiderCoordinators { + return &spiderCoordinators{ + client: c.RESTClient(), + } +} + +// Get takes name of the spiderCoordinator, and returns the corresponding spiderCoordinator object, and an error if there is any. +func (c *spiderCoordinators) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderCoordinator, err error) { + result = &v2beta2.SpiderCoordinator{} + err = c.client.Get(). + Resource("spidercoordinators"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of SpiderCoordinators that match those selectors. +func (c *spiderCoordinators) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderCoordinatorList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2beta2.SpiderCoordinatorList{} + err = c.client.Get(). + Resource("spidercoordinators"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested spiderCoordinators. +func (c *spiderCoordinators) 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(). + Resource("spidercoordinators"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a spiderCoordinator and creates it. Returns the server's representation of the spiderCoordinator, and an error, if there is any. +func (c *spiderCoordinators) Create(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.CreateOptions) (result *v2beta2.SpiderCoordinator, err error) { + result = &v2beta2.SpiderCoordinator{} + err = c.client.Post(). + Resource("spidercoordinators"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderCoordinator). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a spiderCoordinator and updates it. Returns the server's representation of the spiderCoordinator, and an error, if there is any. +func (c *spiderCoordinators) Update(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.UpdateOptions) (result *v2beta2.SpiderCoordinator, err error) { + result = &v2beta2.SpiderCoordinator{} + err = c.client.Put(). + Resource("spidercoordinators"). + Name(spiderCoordinator.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderCoordinator). + 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 *spiderCoordinators) UpdateStatus(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.UpdateOptions) (result *v2beta2.SpiderCoordinator, err error) { + result = &v2beta2.SpiderCoordinator{} + err = c.client.Put(). + Resource("spidercoordinators"). + Name(spiderCoordinator.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderCoordinator). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the spiderCoordinator and deletes it. Returns an error if one occurs. +func (c *spiderCoordinators) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("spidercoordinators"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *spiderCoordinators) 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(). + Resource("spidercoordinators"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched spiderCoordinator. +func (c *spiderCoordinators) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderCoordinator, err error) { + result = &v2beta2.SpiderCoordinator{} + err = c.client.Patch(pt). + Resource("spidercoordinators"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderippool.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderippool.go new file mode 100644 index 0000000000..821f248b78 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderippool.go @@ -0,0 +1,171 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + "time" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + scheme "github.com/spidernet-io/spiderpool/pkg/k8s/client/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" +) + +// SpiderIPPoolsGetter has a method to return a SpiderIPPoolInterface. +// A group's client should implement this interface. +type SpiderIPPoolsGetter interface { + SpiderIPPools() SpiderIPPoolInterface +} + +// SpiderIPPoolInterface has methods to work with SpiderIPPool resources. +type SpiderIPPoolInterface interface { + Create(ctx context.Context, spiderIPPool *v2beta2.SpiderIPPool, opts v1.CreateOptions) (*v2beta2.SpiderIPPool, error) + Update(ctx context.Context, spiderIPPool *v2beta2.SpiderIPPool, opts v1.UpdateOptions) (*v2beta2.SpiderIPPool, error) + UpdateStatus(ctx context.Context, spiderIPPool *v2beta2.SpiderIPPool, opts v1.UpdateOptions) (*v2beta2.SpiderIPPool, 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) (*v2beta2.SpiderIPPool, error) + List(ctx context.Context, opts v1.ListOptions) (*v2beta2.SpiderIPPoolList, 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 *v2beta2.SpiderIPPool, err error) + SpiderIPPoolExpansion +} + +// spiderIPPools implements SpiderIPPoolInterface +type spiderIPPools struct { + client rest.Interface +} + +// newSpiderIPPools returns a SpiderIPPools +func newSpiderIPPools(c *SpiderpoolV2beta2Client) *spiderIPPools { + return &spiderIPPools{ + client: c.RESTClient(), + } +} + +// Get takes name of the spiderIPPool, and returns the corresponding spiderIPPool object, and an error if there is any. +func (c *spiderIPPools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderIPPool, err error) { + result = &v2beta2.SpiderIPPool{} + err = c.client.Get(). + Resource("spiderippools"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of SpiderIPPools that match those selectors. +func (c *spiderIPPools) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderIPPoolList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2beta2.SpiderIPPoolList{} + err = c.client.Get(). + Resource("spiderippools"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested spiderIPPools. +func (c *spiderIPPools) 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(). + Resource("spiderippools"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a spiderIPPool and creates it. Returns the server's representation of the spiderIPPool, and an error, if there is any. +func (c *spiderIPPools) Create(ctx context.Context, spiderIPPool *v2beta2.SpiderIPPool, opts v1.CreateOptions) (result *v2beta2.SpiderIPPool, err error) { + result = &v2beta2.SpiderIPPool{} + err = c.client.Post(). + Resource("spiderippools"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderIPPool). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a spiderIPPool and updates it. Returns the server's representation of the spiderIPPool, and an error, if there is any. +func (c *spiderIPPools) Update(ctx context.Context, spiderIPPool *v2beta2.SpiderIPPool, opts v1.UpdateOptions) (result *v2beta2.SpiderIPPool, err error) { + result = &v2beta2.SpiderIPPool{} + err = c.client.Put(). + Resource("spiderippools"). + Name(spiderIPPool.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderIPPool). + 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 *spiderIPPools) UpdateStatus(ctx context.Context, spiderIPPool *v2beta2.SpiderIPPool, opts v1.UpdateOptions) (result *v2beta2.SpiderIPPool, err error) { + result = &v2beta2.SpiderIPPool{} + err = c.client.Put(). + Resource("spiderippools"). + Name(spiderIPPool.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderIPPool). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the spiderIPPool and deletes it. Returns an error if one occurs. +func (c *spiderIPPools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("spiderippools"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *spiderIPPools) 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(). + Resource("spiderippools"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched spiderIPPool. +func (c *spiderIPPools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderIPPool, err error) { + result = &v2beta2.SpiderIPPool{} + err = c.client.Patch(pt). + Resource("spiderippools"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go new file mode 100644 index 0000000000..fabd5dc499 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go @@ -0,0 +1,165 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + "time" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + scheme "github.com/spidernet-io/spiderpool/pkg/k8s/client/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" +) + +// SpiderMultusConfigsGetter has a method to return a SpiderMultusConfigInterface. +// A group's client should implement this interface. +type SpiderMultusConfigsGetter interface { + SpiderMultusConfigs(namespace string) SpiderMultusConfigInterface +} + +// SpiderMultusConfigInterface has methods to work with SpiderMultusConfig resources. +type SpiderMultusConfigInterface interface { + Create(ctx context.Context, spiderMultusConfig *v2beta2.SpiderMultusConfig, opts v1.CreateOptions) (*v2beta2.SpiderMultusConfig, error) + Update(ctx context.Context, spiderMultusConfig *v2beta2.SpiderMultusConfig, opts v1.UpdateOptions) (*v2beta2.SpiderMultusConfig, 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) (*v2beta2.SpiderMultusConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v2beta2.SpiderMultusConfigList, 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 *v2beta2.SpiderMultusConfig, err error) + SpiderMultusConfigExpansion +} + +// spiderMultusConfigs implements SpiderMultusConfigInterface +type spiderMultusConfigs struct { + client rest.Interface + ns string +} + +// newSpiderMultusConfigs returns a SpiderMultusConfigs +func newSpiderMultusConfigs(c *SpiderpoolV2beta2Client, namespace string) *spiderMultusConfigs { + return &spiderMultusConfigs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the spiderMultusConfig, and returns the corresponding spiderMultusConfig object, and an error if there is any. +func (c *spiderMultusConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderMultusConfig, err error) { + result = &v2beta2.SpiderMultusConfig{} + err = c.client.Get(). + Namespace(c.ns). + Resource("spidermultusconfigs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of SpiderMultusConfigs that match those selectors. +func (c *spiderMultusConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderMultusConfigList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2beta2.SpiderMultusConfigList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("spidermultusconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested spiderMultusConfigs. +func (c *spiderMultusConfigs) 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("spidermultusconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a spiderMultusConfig and creates it. Returns the server's representation of the spiderMultusConfig, and an error, if there is any. +func (c *spiderMultusConfigs) Create(ctx context.Context, spiderMultusConfig *v2beta2.SpiderMultusConfig, opts v1.CreateOptions) (result *v2beta2.SpiderMultusConfig, err error) { + result = &v2beta2.SpiderMultusConfig{} + err = c.client.Post(). + Namespace(c.ns). + Resource("spidermultusconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderMultusConfig). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a spiderMultusConfig and updates it. Returns the server's representation of the spiderMultusConfig, and an error, if there is any. +func (c *spiderMultusConfigs) Update(ctx context.Context, spiderMultusConfig *v2beta2.SpiderMultusConfig, opts v1.UpdateOptions) (result *v2beta2.SpiderMultusConfig, err error) { + result = &v2beta2.SpiderMultusConfig{} + err = c.client.Put(). + Namespace(c.ns). + Resource("spidermultusconfigs"). + Name(spiderMultusConfig.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderMultusConfig). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the spiderMultusConfig and deletes it. Returns an error if one occurs. +func (c *spiderMultusConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("spidermultusconfigs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *spiderMultusConfigs) 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("spidermultusconfigs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched spiderMultusConfig. +func (c *spiderMultusConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderMultusConfig, err error) { + result = &v2beta2.SpiderMultusConfig{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("spidermultusconfigs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderpool.spidernet.io_client.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderpool.spidernet.io_client.go new file mode 100644 index 0000000000..72f5f631d6 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderpool.spidernet.io_client.go @@ -0,0 +1,114 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "net/http" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type SpiderpoolV2beta2Interface interface { + RESTClient() rest.Interface + SpiderClaimParametersGetter + SpiderCoordinatorsGetter + SpiderIPPoolsGetter + SpiderMultusConfigsGetter + SpiderSubnetsGetter +} + +// SpiderpoolV2beta2Client is used to interact with features provided by the spiderpool.spidernet.io group. +type SpiderpoolV2beta2Client struct { + restClient rest.Interface +} + +func (c *SpiderpoolV2beta2Client) SpiderClaimParameters(namespace string) SpiderClaimParameterInterface { + return newSpiderClaimParameters(c, namespace) +} + +func (c *SpiderpoolV2beta2Client) SpiderCoordinators() SpiderCoordinatorInterface { + return newSpiderCoordinators(c) +} + +func (c *SpiderpoolV2beta2Client) SpiderIPPools() SpiderIPPoolInterface { + return newSpiderIPPools(c) +} + +func (c *SpiderpoolV2beta2Client) SpiderMultusConfigs(namespace string) SpiderMultusConfigInterface { + return newSpiderMultusConfigs(c, namespace) +} + +func (c *SpiderpoolV2beta2Client) SpiderSubnets() SpiderSubnetInterface { + return newSpiderSubnets(c) +} + +// NewForConfig creates a new SpiderpoolV2beta2Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*SpiderpoolV2beta2Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new SpiderpoolV2beta2Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SpiderpoolV2beta2Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &SpiderpoolV2beta2Client{client}, nil +} + +// NewForConfigOrDie creates a new SpiderpoolV2beta2Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *SpiderpoolV2beta2Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new SpiderpoolV2beta2Client for the given RESTClient. +func New(c rest.Interface) *SpiderpoolV2beta2Client { + return &SpiderpoolV2beta2Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v2beta2.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *SpiderpoolV2beta2Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidersubnet.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidersubnet.go new file mode 100644 index 0000000000..9135f2f50f --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidersubnet.go @@ -0,0 +1,171 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + "time" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + scheme "github.com/spidernet-io/spiderpool/pkg/k8s/client/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" +) + +// SpiderSubnetsGetter has a method to return a SpiderSubnetInterface. +// A group's client should implement this interface. +type SpiderSubnetsGetter interface { + SpiderSubnets() SpiderSubnetInterface +} + +// SpiderSubnetInterface has methods to work with SpiderSubnet resources. +type SpiderSubnetInterface interface { + Create(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.CreateOptions) (*v2beta2.SpiderSubnet, error) + Update(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.UpdateOptions) (*v2beta2.SpiderSubnet, error) + UpdateStatus(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.UpdateOptions) (*v2beta2.SpiderSubnet, 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) (*v2beta2.SpiderSubnet, error) + List(ctx context.Context, opts v1.ListOptions) (*v2beta2.SpiderSubnetList, 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 *v2beta2.SpiderSubnet, err error) + SpiderSubnetExpansion +} + +// spiderSubnets implements SpiderSubnetInterface +type spiderSubnets struct { + client rest.Interface +} + +// newSpiderSubnets returns a SpiderSubnets +func newSpiderSubnets(c *SpiderpoolV2beta2Client) *spiderSubnets { + return &spiderSubnets{ + client: c.RESTClient(), + } +} + +// Get takes name of the spiderSubnet, and returns the corresponding spiderSubnet object, and an error if there is any. +func (c *spiderSubnets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderSubnet, err error) { + result = &v2beta2.SpiderSubnet{} + err = c.client.Get(). + Resource("spidersubnets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of SpiderSubnets that match those selectors. +func (c *spiderSubnets) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderSubnetList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2beta2.SpiderSubnetList{} + err = c.client.Get(). + Resource("spidersubnets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested spiderSubnets. +func (c *spiderSubnets) 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(). + Resource("spidersubnets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a spiderSubnet and creates it. Returns the server's representation of the spiderSubnet, and an error, if there is any. +func (c *spiderSubnets) Create(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.CreateOptions) (result *v2beta2.SpiderSubnet, err error) { + result = &v2beta2.SpiderSubnet{} + err = c.client.Post(). + Resource("spidersubnets"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderSubnet). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a spiderSubnet and updates it. Returns the server's representation of the spiderSubnet, and an error, if there is any. +func (c *spiderSubnets) Update(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.UpdateOptions) (result *v2beta2.SpiderSubnet, err error) { + result = &v2beta2.SpiderSubnet{} + err = c.client.Put(). + Resource("spidersubnets"). + Name(spiderSubnet.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderSubnet). + 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 *spiderSubnets) UpdateStatus(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.UpdateOptions) (result *v2beta2.SpiderSubnet, err error) { + result = &v2beta2.SpiderSubnet{} + err = c.client.Put(). + Resource("spidersubnets"). + Name(spiderSubnet.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderSubnet). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the spiderSubnet and deletes it. Returns an error if one occurs. +func (c *spiderSubnets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("spidersubnets"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *spiderSubnets) 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(). + Resource("spidersubnets"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched spiderSubnet. +func (c *spiderSubnets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderSubnet, err error) { + result = &v2beta2.SpiderSubnet{} + err = c.client.Patch(pt). + Resource("spidersubnets"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/k8s/client/informers/externalversions/generic.go b/pkg/k8s/client/informers/externalversions/generic.go index 015301fcb1..36bcd1a7ca 100644 --- a/pkg/k8s/client/informers/externalversions/generic.go +++ b/pkg/k8s/client/informers/externalversions/generic.go @@ -8,7 +8,8 @@ package externalversions import ( "fmt" - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -51,6 +52,18 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v2beta1.SchemeGroupVersion.WithResource("spidersubnets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Spiderpool().V2beta1().SpiderSubnets().Informer()}, nil + // Group=spiderpool.spidernet.io, Version=v2beta2 + case v2beta2.SchemeGroupVersion.WithResource("spiderclaimparameters"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Spiderpool().V2beta2().SpiderClaimParameters().Informer()}, nil + case v2beta2.SchemeGroupVersion.WithResource("spidercoordinators"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Spiderpool().V2beta2().SpiderCoordinators().Informer()}, nil + case v2beta2.SchemeGroupVersion.WithResource("spiderippools"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Spiderpool().V2beta2().SpiderIPPools().Informer()}, nil + case v2beta2.SchemeGroupVersion.WithResource("spidermultusconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Spiderpool().V2beta2().SpiderMultusConfigs().Informer()}, nil + case v2beta2.SchemeGroupVersion.WithResource("spidersubnets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Spiderpool().V2beta2().SpiderSubnets().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/interface.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/interface.go index 0279dd4130..5cde2eef1c 100644 --- a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/interface.go +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/interface.go @@ -8,12 +8,15 @@ package spiderpool import ( internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1" + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2" ) // Interface provides access to each of this group's versions. type Interface interface { // V2beta1 provides access to shared informers for resources in V2beta1. V2beta1() v2beta1.Interface + // V2beta2 provides access to shared informers for resources in V2beta2. + V2beta2() v2beta2.Interface } type group struct { @@ -31,3 +34,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V2beta1() v2beta1.Interface { return v2beta1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V2beta2 returns a new v2beta2.Interface. +func (g *group) V2beta2() v2beta2.Interface { + return v2beta2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spiderclaimparameter.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spiderclaimparameter.go index ef48558ade..fb5a32ee77 100644 --- a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spiderclaimparameter.go +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spiderclaimparameter.go @@ -9,7 +9,7 @@ import ( "context" time "time" - spiderpoolspidernetiov2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolspidernetiov2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" versioned "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1" diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spidercoordinator.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spidercoordinator.go index 2d70a79d72..ee06d08949 100644 --- a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spidercoordinator.go +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spidercoordinator.go @@ -9,7 +9,7 @@ import ( "context" time "time" - spiderpoolspidernetiov2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolspidernetiov2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" versioned "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1" diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spiderippool.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spiderippool.go index 630b842d29..0ca8ae14c2 100644 --- a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spiderippool.go +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spiderippool.go @@ -9,7 +9,7 @@ import ( "context" time "time" - spiderpoolspidernetiov2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolspidernetiov2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" versioned "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1" diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spidermultusconfig.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spidermultusconfig.go index 6bb7ba8a9d..f82dc2328e 100644 --- a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spidermultusconfig.go +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spidermultusconfig.go @@ -9,7 +9,7 @@ import ( "context" time "time" - spiderpoolspidernetiov2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolspidernetiov2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" versioned "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1" diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spidersubnet.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spidersubnet.go index b88eff8a58..ace0dc7aed 100644 --- a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spidersubnet.go +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1/spidersubnet.go @@ -9,7 +9,7 @@ import ( "context" time "time" - spiderpoolspidernetiov2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolspidernetiov2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" versioned "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1" diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/interface.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/interface.go new file mode 100644 index 0000000000..3a670c968f --- /dev/null +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/interface.go @@ -0,0 +1,60 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // SpiderClaimParameters returns a SpiderClaimParameterInformer. + SpiderClaimParameters() SpiderClaimParameterInformer + // SpiderCoordinators returns a SpiderCoordinatorInformer. + SpiderCoordinators() SpiderCoordinatorInformer + // SpiderIPPools returns a SpiderIPPoolInformer. + SpiderIPPools() SpiderIPPoolInformer + // SpiderMultusConfigs returns a SpiderMultusConfigInformer. + SpiderMultusConfigs() SpiderMultusConfigInformer + // SpiderSubnets returns a SpiderSubnetInformer. + SpiderSubnets() SpiderSubnetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// SpiderClaimParameters returns a SpiderClaimParameterInformer. +func (v *version) SpiderClaimParameters() SpiderClaimParameterInformer { + return &spiderClaimParameterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// SpiderCoordinators returns a SpiderCoordinatorInformer. +func (v *version) SpiderCoordinators() SpiderCoordinatorInformer { + return &spiderCoordinatorInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// SpiderIPPools returns a SpiderIPPoolInformer. +func (v *version) SpiderIPPools() SpiderIPPoolInformer { + return &spiderIPPoolInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// SpiderMultusConfigs returns a SpiderMultusConfigInformer. +func (v *version) SpiderMultusConfigs() SpiderMultusConfigInformer { + return &spiderMultusConfigInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// SpiderSubnets returns a SpiderSubnetInformer. +func (v *version) SpiderSubnets() SpiderSubnetInformer { + return &spiderSubnetInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spiderclaimparameter.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spiderclaimparameter.go new file mode 100644 index 0000000000..0f1091c804 --- /dev/null +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spiderclaimparameter.go @@ -0,0 +1,77 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + time "time" + + spiderpoolspidernetiov2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + versioned "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" + internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2" + 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" +) + +// SpiderClaimParameterInformer provides access to a shared informer and lister for +// SpiderClaimParameters. +type SpiderClaimParameterInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2beta2.SpiderClaimParameterLister +} + +type spiderClaimParameterInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSpiderClaimParameterInformer constructs a new informer for SpiderClaimParameter 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 NewSpiderClaimParameterInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSpiderClaimParameterInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSpiderClaimParameterInformer constructs a new informer for SpiderClaimParameter 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 NewFilteredSpiderClaimParameterInformer(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.SpiderpoolV2beta2().SpiderClaimParameters(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SpiderpoolV2beta2().SpiderClaimParameters(namespace).Watch(context.TODO(), options) + }, + }, + &spiderpoolspidernetiov2beta2.SpiderClaimParameter{}, + resyncPeriod, + indexers, + ) +} + +func (f *spiderClaimParameterInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSpiderClaimParameterInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *spiderClaimParameterInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&spiderpoolspidernetiov2beta2.SpiderClaimParameter{}, f.defaultInformer) +} + +func (f *spiderClaimParameterInformer) Lister() v2beta2.SpiderClaimParameterLister { + return v2beta2.NewSpiderClaimParameterLister(f.Informer().GetIndexer()) +} diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidercoordinator.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidercoordinator.go new file mode 100644 index 0000000000..ca6392300e --- /dev/null +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidercoordinator.go @@ -0,0 +1,76 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + time "time" + + spiderpoolspidernetiov2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + versioned "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" + internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2" + 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" +) + +// SpiderCoordinatorInformer provides access to a shared informer and lister for +// SpiderCoordinators. +type SpiderCoordinatorInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2beta2.SpiderCoordinatorLister +} + +type spiderCoordinatorInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewSpiderCoordinatorInformer constructs a new informer for SpiderCoordinator 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 NewSpiderCoordinatorInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSpiderCoordinatorInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredSpiderCoordinatorInformer constructs a new informer for SpiderCoordinator 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 NewFilteredSpiderCoordinatorInformer(client versioned.Interface, 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.SpiderpoolV2beta2().SpiderCoordinators().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SpiderpoolV2beta2().SpiderCoordinators().Watch(context.TODO(), options) + }, + }, + &spiderpoolspidernetiov2beta2.SpiderCoordinator{}, + resyncPeriod, + indexers, + ) +} + +func (f *spiderCoordinatorInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSpiderCoordinatorInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *spiderCoordinatorInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&spiderpoolspidernetiov2beta2.SpiderCoordinator{}, f.defaultInformer) +} + +func (f *spiderCoordinatorInformer) Lister() v2beta2.SpiderCoordinatorLister { + return v2beta2.NewSpiderCoordinatorLister(f.Informer().GetIndexer()) +} diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spiderippool.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spiderippool.go new file mode 100644 index 0000000000..b48d64660b --- /dev/null +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spiderippool.go @@ -0,0 +1,76 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + time "time" + + spiderpoolspidernetiov2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + versioned "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" + internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2" + 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" +) + +// SpiderIPPoolInformer provides access to a shared informer and lister for +// SpiderIPPools. +type SpiderIPPoolInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2beta2.SpiderIPPoolLister +} + +type spiderIPPoolInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewSpiderIPPoolInformer constructs a new informer for SpiderIPPool 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 NewSpiderIPPoolInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSpiderIPPoolInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredSpiderIPPoolInformer constructs a new informer for SpiderIPPool 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 NewFilteredSpiderIPPoolInformer(client versioned.Interface, 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.SpiderpoolV2beta2().SpiderIPPools().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SpiderpoolV2beta2().SpiderIPPools().Watch(context.TODO(), options) + }, + }, + &spiderpoolspidernetiov2beta2.SpiderIPPool{}, + resyncPeriod, + indexers, + ) +} + +func (f *spiderIPPoolInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSpiderIPPoolInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *spiderIPPoolInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&spiderpoolspidernetiov2beta2.SpiderIPPool{}, f.defaultInformer) +} + +func (f *spiderIPPoolInformer) Lister() v2beta2.SpiderIPPoolLister { + return v2beta2.NewSpiderIPPoolLister(f.Informer().GetIndexer()) +} diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go new file mode 100644 index 0000000000..1f4e9a87b2 --- /dev/null +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go @@ -0,0 +1,77 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + time "time" + + spiderpoolspidernetiov2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + versioned "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" + internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2" + 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" +) + +// SpiderMultusConfigInformer provides access to a shared informer and lister for +// SpiderMultusConfigs. +type SpiderMultusConfigInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2beta2.SpiderMultusConfigLister +} + +type spiderMultusConfigInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSpiderMultusConfigInformer constructs a new informer for SpiderMultusConfig 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 NewSpiderMultusConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSpiderMultusConfigInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSpiderMultusConfigInformer constructs a new informer for SpiderMultusConfig 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 NewFilteredSpiderMultusConfigInformer(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.SpiderpoolV2beta2().SpiderMultusConfigs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SpiderpoolV2beta2().SpiderMultusConfigs(namespace).Watch(context.TODO(), options) + }, + }, + &spiderpoolspidernetiov2beta2.SpiderMultusConfig{}, + resyncPeriod, + indexers, + ) +} + +func (f *spiderMultusConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSpiderMultusConfigInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *spiderMultusConfigInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&spiderpoolspidernetiov2beta2.SpiderMultusConfig{}, f.defaultInformer) +} + +func (f *spiderMultusConfigInformer) Lister() v2beta2.SpiderMultusConfigLister { + return v2beta2.NewSpiderMultusConfigLister(f.Informer().GetIndexer()) +} diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidersubnet.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidersubnet.go new file mode 100644 index 0000000000..e75915b852 --- /dev/null +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidersubnet.go @@ -0,0 +1,76 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + time "time" + + spiderpoolspidernetiov2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + versioned "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" + internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2" + 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" +) + +// SpiderSubnetInformer provides access to a shared informer and lister for +// SpiderSubnets. +type SpiderSubnetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2beta2.SpiderSubnetLister +} + +type spiderSubnetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewSpiderSubnetInformer constructs a new informer for SpiderSubnet 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 NewSpiderSubnetInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSpiderSubnetInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredSpiderSubnetInformer constructs a new informer for SpiderSubnet 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 NewFilteredSpiderSubnetInformer(client versioned.Interface, 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.SpiderpoolV2beta2().SpiderSubnets().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SpiderpoolV2beta2().SpiderSubnets().Watch(context.TODO(), options) + }, + }, + &spiderpoolspidernetiov2beta2.SpiderSubnet{}, + resyncPeriod, + indexers, + ) +} + +func (f *spiderSubnetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSpiderSubnetInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *spiderSubnetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&spiderpoolspidernetiov2beta2.SpiderSubnet{}, f.defaultInformer) +} + +func (f *spiderSubnetInformer) Lister() v2beta2.SpiderSubnetLister { + return v2beta2.NewSpiderSubnetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spiderclaimparameter.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spiderclaimparameter.go index b7b5baceff..22174b8f2b 100644 --- a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spiderclaimparameter.go +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spiderclaimparameter.go @@ -6,7 +6,7 @@ package v2beta1 import ( - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spidercoordinator.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spidercoordinator.go index 096a3991f8..b0418bacc6 100644 --- a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spidercoordinator.go +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spidercoordinator.go @@ -6,7 +6,7 @@ package v2beta1 import ( - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spiderippool.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spiderippool.go index 63c665705c..cc9d75b40a 100644 --- a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spiderippool.go +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spiderippool.go @@ -6,7 +6,7 @@ package v2beta1 import ( - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spidermultusconfig.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spidermultusconfig.go index 0bd51dd048..0516aa43a4 100644 --- a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spidermultusconfig.go +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spidermultusconfig.go @@ -6,7 +6,7 @@ package v2beta1 import ( - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spidersubnet.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spidersubnet.go index ad9a9a768f..ccb1ffa469 100644 --- a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spidersubnet.go +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta1/spidersubnet.go @@ -6,7 +6,7 @@ package v2beta1 import ( - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/expansion_generated.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/expansion_generated.go new file mode 100644 index 0000000000..a085f5fe52 --- /dev/null +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/expansion_generated.go @@ -0,0 +1,34 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta2 + +// SpiderClaimParameterListerExpansion allows custom methods to be added to +// SpiderClaimParameterLister. +type SpiderClaimParameterListerExpansion interface{} + +// SpiderClaimParameterNamespaceListerExpansion allows custom methods to be added to +// SpiderClaimParameterNamespaceLister. +type SpiderClaimParameterNamespaceListerExpansion interface{} + +// SpiderCoordinatorListerExpansion allows custom methods to be added to +// SpiderCoordinatorLister. +type SpiderCoordinatorListerExpansion interface{} + +// SpiderIPPoolListerExpansion allows custom methods to be added to +// SpiderIPPoolLister. +type SpiderIPPoolListerExpansion interface{} + +// SpiderMultusConfigListerExpansion allows custom methods to be added to +// SpiderMultusConfigLister. +type SpiderMultusConfigListerExpansion interface{} + +// SpiderMultusConfigNamespaceListerExpansion allows custom methods to be added to +// SpiderMultusConfigNamespaceLister. +type SpiderMultusConfigNamespaceListerExpansion interface{} + +// SpiderSubnetListerExpansion allows custom methods to be added to +// SpiderSubnetLister. +type SpiderSubnetListerExpansion interface{} diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spiderclaimparameter.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spiderclaimparameter.go new file mode 100644 index 0000000000..0e19396309 --- /dev/null +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spiderclaimparameter.go @@ -0,0 +1,86 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta2 + +import ( + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SpiderClaimParameterLister helps list SpiderClaimParameters. +// All objects returned here must be treated as read-only. +type SpiderClaimParameterLister interface { + // List lists all SpiderClaimParameters in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.SpiderClaimParameter, err error) + // SpiderClaimParameters returns an object that can list and get SpiderClaimParameters. + SpiderClaimParameters(namespace string) SpiderClaimParameterNamespaceLister + SpiderClaimParameterListerExpansion +} + +// spiderClaimParameterLister implements the SpiderClaimParameterLister interface. +type spiderClaimParameterLister struct { + indexer cache.Indexer +} + +// NewSpiderClaimParameterLister returns a new SpiderClaimParameterLister. +func NewSpiderClaimParameterLister(indexer cache.Indexer) SpiderClaimParameterLister { + return &spiderClaimParameterLister{indexer: indexer} +} + +// List lists all SpiderClaimParameters in the indexer. +func (s *spiderClaimParameterLister) List(selector labels.Selector) (ret []*v2beta2.SpiderClaimParameter, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.SpiderClaimParameter)) + }) + return ret, err +} + +// SpiderClaimParameters returns an object that can list and get SpiderClaimParameters. +func (s *spiderClaimParameterLister) SpiderClaimParameters(namespace string) SpiderClaimParameterNamespaceLister { + return spiderClaimParameterNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SpiderClaimParameterNamespaceLister helps list and get SpiderClaimParameters. +// All objects returned here must be treated as read-only. +type SpiderClaimParameterNamespaceLister interface { + // List lists all SpiderClaimParameters in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.SpiderClaimParameter, err error) + // Get retrieves the SpiderClaimParameter from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2beta2.SpiderClaimParameter, error) + SpiderClaimParameterNamespaceListerExpansion +} + +// spiderClaimParameterNamespaceLister implements the SpiderClaimParameterNamespaceLister +// interface. +type spiderClaimParameterNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all SpiderClaimParameters in the indexer for a given namespace. +func (s spiderClaimParameterNamespaceLister) List(selector labels.Selector) (ret []*v2beta2.SpiderClaimParameter, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.SpiderClaimParameter)) + }) + return ret, err +} + +// Get retrieves the SpiderClaimParameter from the indexer for a given namespace and name. +func (s spiderClaimParameterNamespaceLister) Get(name string) (*v2beta2.SpiderClaimParameter, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta2.Resource("spiderclaimparameter"), name) + } + return obj.(*v2beta2.SpiderClaimParameter), nil +} diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidercoordinator.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidercoordinator.go new file mode 100644 index 0000000000..41b6866678 --- /dev/null +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidercoordinator.go @@ -0,0 +1,55 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta2 + +import ( + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SpiderCoordinatorLister helps list SpiderCoordinators. +// All objects returned here must be treated as read-only. +type SpiderCoordinatorLister interface { + // List lists all SpiderCoordinators in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.SpiderCoordinator, err error) + // Get retrieves the SpiderCoordinator from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2beta2.SpiderCoordinator, error) + SpiderCoordinatorListerExpansion +} + +// spiderCoordinatorLister implements the SpiderCoordinatorLister interface. +type spiderCoordinatorLister struct { + indexer cache.Indexer +} + +// NewSpiderCoordinatorLister returns a new SpiderCoordinatorLister. +func NewSpiderCoordinatorLister(indexer cache.Indexer) SpiderCoordinatorLister { + return &spiderCoordinatorLister{indexer: indexer} +} + +// List lists all SpiderCoordinators in the indexer. +func (s *spiderCoordinatorLister) List(selector labels.Selector) (ret []*v2beta2.SpiderCoordinator, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.SpiderCoordinator)) + }) + return ret, err +} + +// Get retrieves the SpiderCoordinator from the index for a given name. +func (s *spiderCoordinatorLister) Get(name string) (*v2beta2.SpiderCoordinator, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta2.Resource("spidercoordinator"), name) + } + return obj.(*v2beta2.SpiderCoordinator), nil +} diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spiderippool.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spiderippool.go new file mode 100644 index 0000000000..03f4e278e7 --- /dev/null +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spiderippool.go @@ -0,0 +1,55 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta2 + +import ( + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SpiderIPPoolLister helps list SpiderIPPools. +// All objects returned here must be treated as read-only. +type SpiderIPPoolLister interface { + // List lists all SpiderIPPools in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.SpiderIPPool, err error) + // Get retrieves the SpiderIPPool from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2beta2.SpiderIPPool, error) + SpiderIPPoolListerExpansion +} + +// spiderIPPoolLister implements the SpiderIPPoolLister interface. +type spiderIPPoolLister struct { + indexer cache.Indexer +} + +// NewSpiderIPPoolLister returns a new SpiderIPPoolLister. +func NewSpiderIPPoolLister(indexer cache.Indexer) SpiderIPPoolLister { + return &spiderIPPoolLister{indexer: indexer} +} + +// List lists all SpiderIPPools in the indexer. +func (s *spiderIPPoolLister) List(selector labels.Selector) (ret []*v2beta2.SpiderIPPool, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.SpiderIPPool)) + }) + return ret, err +} + +// Get retrieves the SpiderIPPool from the index for a given name. +func (s *spiderIPPoolLister) Get(name string) (*v2beta2.SpiderIPPool, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta2.Resource("spiderippool"), name) + } + return obj.(*v2beta2.SpiderIPPool), nil +} diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go new file mode 100644 index 0000000000..9206af8610 --- /dev/null +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go @@ -0,0 +1,86 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta2 + +import ( + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SpiderMultusConfigLister helps list SpiderMultusConfigs. +// All objects returned here must be treated as read-only. +type SpiderMultusConfigLister interface { + // List lists all SpiderMultusConfigs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.SpiderMultusConfig, err error) + // SpiderMultusConfigs returns an object that can list and get SpiderMultusConfigs. + SpiderMultusConfigs(namespace string) SpiderMultusConfigNamespaceLister + SpiderMultusConfigListerExpansion +} + +// spiderMultusConfigLister implements the SpiderMultusConfigLister interface. +type spiderMultusConfigLister struct { + indexer cache.Indexer +} + +// NewSpiderMultusConfigLister returns a new SpiderMultusConfigLister. +func NewSpiderMultusConfigLister(indexer cache.Indexer) SpiderMultusConfigLister { + return &spiderMultusConfigLister{indexer: indexer} +} + +// List lists all SpiderMultusConfigs in the indexer. +func (s *spiderMultusConfigLister) List(selector labels.Selector) (ret []*v2beta2.SpiderMultusConfig, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.SpiderMultusConfig)) + }) + return ret, err +} + +// SpiderMultusConfigs returns an object that can list and get SpiderMultusConfigs. +func (s *spiderMultusConfigLister) SpiderMultusConfigs(namespace string) SpiderMultusConfigNamespaceLister { + return spiderMultusConfigNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SpiderMultusConfigNamespaceLister helps list and get SpiderMultusConfigs. +// All objects returned here must be treated as read-only. +type SpiderMultusConfigNamespaceLister interface { + // List lists all SpiderMultusConfigs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.SpiderMultusConfig, err error) + // Get retrieves the SpiderMultusConfig from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2beta2.SpiderMultusConfig, error) + SpiderMultusConfigNamespaceListerExpansion +} + +// spiderMultusConfigNamespaceLister implements the SpiderMultusConfigNamespaceLister +// interface. +type spiderMultusConfigNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all SpiderMultusConfigs in the indexer for a given namespace. +func (s spiderMultusConfigNamespaceLister) List(selector labels.Selector) (ret []*v2beta2.SpiderMultusConfig, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.SpiderMultusConfig)) + }) + return ret, err +} + +// Get retrieves the SpiderMultusConfig from the indexer for a given namespace and name. +func (s spiderMultusConfigNamespaceLister) Get(name string) (*v2beta2.SpiderMultusConfig, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta2.Resource("spidermultusconfig"), name) + } + return obj.(*v2beta2.SpiderMultusConfig), nil +} diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidersubnet.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidersubnet.go new file mode 100644 index 0000000000..a55a7e2e02 --- /dev/null +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidersubnet.go @@ -0,0 +1,55 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta2 + +import ( + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SpiderSubnetLister helps list SpiderSubnets. +// All objects returned here must be treated as read-only. +type SpiderSubnetLister interface { + // List lists all SpiderSubnets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.SpiderSubnet, err error) + // Get retrieves the SpiderSubnet from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2beta2.SpiderSubnet, error) + SpiderSubnetListerExpansion +} + +// spiderSubnetLister implements the SpiderSubnetLister interface. +type spiderSubnetLister struct { + indexer cache.Indexer +} + +// NewSpiderSubnetLister returns a new SpiderSubnetLister. +func NewSpiderSubnetLister(indexer cache.Indexer) SpiderSubnetLister { + return &spiderSubnetLister{indexer: indexer} +} + +// List lists all SpiderSubnets in the indexer. +func (s *spiderSubnetLister) List(selector labels.Selector) (ret []*v2beta2.SpiderSubnet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.SpiderSubnet)) + }) + return ret, err +} + +// Get retrieves the SpiderSubnet from the index for a given name. +func (s *spiderSubnetLister) Get(name string) (*v2beta2.SpiderSubnet, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta2.Resource("spidersubnet"), name) + } + return obj.(*v2beta2.SpiderSubnet), nil +} diff --git a/pkg/manager/spidercliamparameter/spidercliamparameter_webhook.go b/pkg/manager/spidercliamparameter/spidercliamparameter_webhook.go index 01dc4fcefa..2c51d46645 100644 --- a/pkg/manager/spidercliamparameter/spidercliamparameter_webhook.go +++ b/pkg/manager/spidercliamparameter/spidercliamparameter_webhook.go @@ -17,7 +17,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook/admission" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" ) diff --git a/pkg/multuscniconfig/multusconfig_informer.go b/pkg/multuscniconfig/multusconfig_informer.go index 1abab30b15..d148d448cf 100644 --- a/pkg/multuscniconfig/multusconfig_informer.go +++ b/pkg/multuscniconfig/multusconfig_informer.go @@ -28,7 +28,7 @@ import ( spiderpoolcmd "github.com/spidernet-io/spiderpool/cmd/spiderpool/cmd" "github.com/spidernet-io/spiderpool/pkg/constant" "github.com/spidernet-io/spiderpool/pkg/election" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" crdclientset "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions" informers "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1" @@ -418,7 +418,7 @@ func generateNetAttachDef(netAttachName string, multusConf *spiderpoolv2beta1.Sp // SRIOV special annotation anno[constant.ResourceNameAnnot] = multusConfSpec.SriovConfig.ResourceName - if multusConfSpec.SriovConfig.EnableRdma { + if multusConfSpec.SriovConfig.RdmaIsolation { rdmaconf := RdmaNetConf{ Type: "rdma", } diff --git a/pkg/multuscniconfig/multusconfig_mutate.go b/pkg/multuscniconfig/multusconfig_mutate.go index 5967060773..0399500b83 100644 --- a/pkg/multuscniconfig/multusconfig_mutate.go +++ b/pkg/multuscniconfig/multusconfig_mutate.go @@ -7,7 +7,7 @@ import ( coordinator_cmd "github.com/spidernet-io/spiderpool/cmd/coordinator/cmd" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "k8s.io/utils/ptr" ) diff --git a/pkg/multuscniconfig/multusconfig_validate.go b/pkg/multuscniconfig/multusconfig_validate.go index d72a92e401..749eb2e48e 100644 --- a/pkg/multuscniconfig/multusconfig_validate.go +++ b/pkg/multuscniconfig/multusconfig_validate.go @@ -19,7 +19,7 @@ import ( "github.com/spidernet-io/spiderpool/cmd/spiderpool/cmd" "github.com/spidernet-io/spiderpool/pkg/constant" "github.com/spidernet-io/spiderpool/pkg/coordinatormanager" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" ) var ( @@ -110,7 +110,7 @@ func validateCNIConfig(multusConfig *spiderpoolv2beta1.SpiderMultusConfig) *fiel } if injectRdmaResource { - if err := ValidateRdmaResouce(multusConfig.Spec.MacvlanConfig.EnableRdma, multusConfig.Name, multusConfig.Namespace, multusConfig.Spec.MacvlanConfig.RdmaResourceName, multusConfig.Spec.MacvlanConfig.SpiderpoolConfigPools); err != nil { + if err := ValidateRdmaResouce(multusConfig.Spec.MacvlanConfig.RdmaResourceName != "", multusConfig.Name, multusConfig.Namespace, multusConfig.Spec.MacvlanConfig.RdmaResourceName, multusConfig.Spec.MacvlanConfig.SpiderpoolConfigPools); err != nil { return field.Invalid(macvlanConfigField, *multusConfig.Spec.MacvlanConfig, err.Error()) } } @@ -135,7 +135,7 @@ func validateCNIConfig(multusConfig *spiderpoolv2beta1.SpiderMultusConfig) *fiel } if injectRdmaResource { - if err := ValidateRdmaResouce(multusConfig.Spec.IPVlanConfig.EnableRdma, multusConfig.Name, multusConfig.Namespace, multusConfig.Spec.IPVlanConfig.RdmaResourceName, multusConfig.Spec.IPVlanConfig.SpiderpoolConfigPools); err != nil { + if err := ValidateRdmaResouce(multusConfig.Spec.IPVlanConfig.RdmaResourceName != "", multusConfig.Name, multusConfig.Namespace, multusConfig.Spec.IPVlanConfig.RdmaResourceName, multusConfig.Spec.IPVlanConfig.SpiderpoolConfigPools); err != nil { return field.Invalid(ipvlanConfigField, *multusConfig.Spec.IPVlanConfig, err.Error()) } } @@ -166,7 +166,7 @@ func validateCNIConfig(multusConfig *spiderpoolv2beta1.SpiderMultusConfig) *fiel } if injectRdmaResource { - if err := ValidateRdmaResouce(multusConfig.Spec.SriovConfig.EnableRdma, multusConfig.Name, multusConfig.Namespace, multusConfig.Spec.SriovConfig.ResourceName, multusConfig.Spec.SriovConfig.SpiderpoolConfigPools); err != nil { + if err := ValidateRdmaResouce(multusConfig.Spec.SriovConfig.RdmaIsolation, multusConfig.Name, multusConfig.Namespace, multusConfig.Spec.SriovConfig.ResourceName, multusConfig.Spec.SriovConfig.SpiderpoolConfigPools); err != nil { return field.Invalid(sriovConfigField, *multusConfig.Spec.SriovConfig, err.Error()) } } @@ -185,7 +185,7 @@ func validateCNIConfig(multusConfig *spiderpoolv2beta1.SpiderMultusConfig) *fiel } if injectRdmaResource { - if err := ValidateRdmaResouce(true, multusConfig.Name, multusConfig.Namespace, multusConfig.Spec.IbSriovConfig.ResourceName, multusConfig.Spec.IbSriovConfig.SpiderpoolConfigPools); err != nil { + if err := ValidateRdmaResouce(*multusConfig.Spec.IbSriovConfig.RdmaIsolation, multusConfig.Name, multusConfig.Namespace, multusConfig.Spec.IbSriovConfig.ResourceName, multusConfig.Spec.IbSriovConfig.SpiderpoolConfigPools); err != nil { return field.Invalid(ibsriovConfigField, *multusConfig.Spec.IbSriovConfig, err.Error()) } } diff --git a/pkg/multuscniconfig/multusconfig_webhook.go b/pkg/multuscniconfig/multusconfig_webhook.go index 809f1cef59..cf3d8cb3c6 100644 --- a/pkg/multuscniconfig/multusconfig_webhook.go +++ b/pkg/multuscniconfig/multusconfig_webhook.go @@ -17,7 +17,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook/admission" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" ) diff --git a/pkg/multuscniconfig/utils.go b/pkg/multuscniconfig/utils.go index ee8fb0151d..13fb784863 100644 --- a/pkg/multuscniconfig/utils.go +++ b/pkg/multuscniconfig/utils.go @@ -31,8 +31,8 @@ import ( coordinatorcmd "github.com/spidernet-io/spiderpool/cmd/coordinator/cmd" spiderpoolcmd "github.com/spidernet-io/spiderpool/cmd/spiderpool/cmd" "github.com/spidernet-io/spiderpool/pkg/constant" - "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" ) type MacvlanNetConf struct { @@ -230,11 +230,11 @@ func ResourceName(smc *spiderpoolv2beta1.SpiderMultusConfig) string { switch *smc.Spec.CniType { case constant.MacvlanCNI: // For Macvlan CNI, return RDMA resource name if RDMA is enabled - if smc.Spec.MacvlanConfig != nil && smc.Spec.MacvlanConfig.EnableRdma { + if smc.Spec.MacvlanConfig != nil { return smc.Spec.MacvlanConfig.RdmaResourceName } case constant.IPVlanCNI: - if smc.Spec.IPVlanConfig != nil && smc.Spec.IPVlanConfig.EnableRdma { + if smc.Spec.IPVlanConfig != nil { return smc.Spec.IPVlanConfig.RdmaResourceName } case constant.SriovCNI: diff --git a/pkg/podmanager/utils.go b/pkg/podmanager/utils.go index 40b45c6677..4e8fff1399 100644 --- a/pkg/podmanager/utils.go +++ b/pkg/podmanager/utils.go @@ -15,7 +15,7 @@ import ( kubevirtv1 "kubevirt.io/api/core/v1" "github.com/spidernet-io/spiderpool/pkg/constant" - "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/multuscniconfig" ) @@ -181,12 +181,15 @@ func DoValidateRdmaResouce(mc v2beta1.SpiderMultusConfig) error { spec := mc.Spec switch *spec.CniType { case constant.MacvlanCNI: - return multuscniconfig.ValidateRdmaResouce(spec.MacvlanConfig.EnableRdma, mc.Name, mc.Namespace, spec.MacvlanConfig.RdmaResourceName, spec.MacvlanConfig.SpiderpoolConfigPools) + return multuscniconfig.ValidateRdmaResouce(spec.MacvlanConfig.RdmaResourceName != "", mc.Name, mc.Namespace, spec.MacvlanConfig.RdmaResourceName, spec.MacvlanConfig.SpiderpoolConfigPools) case constant.IPVlanCNI: - return multuscniconfig.ValidateRdmaResouce(spec.IPVlanConfig.EnableRdma, mc.Name, mc.Namespace, spec.IPVlanConfig.RdmaResourceName, spec.IPVlanConfig.SpiderpoolConfigPools) + return multuscniconfig.ValidateRdmaResouce(spec.IPVlanConfig.RdmaResourceName != "", mc.Name, mc.Namespace, spec.IPVlanConfig.RdmaResourceName, spec.IPVlanConfig.SpiderpoolConfigPools) case constant.SriovCNI: - return multuscniconfig.ValidateRdmaResouce(spec.SriovConfig.EnableRdma, mc.Name, mc.Namespace, spec.SriovConfig.ResourceName, spec.SriovConfig.SpiderpoolConfigPools) + return multuscniconfig.ValidateRdmaResouce(spec.SriovConfig.RdmaIsolation, mc.Name, mc.Namespace, spec.SriovConfig.ResourceName, spec.SriovConfig.SpiderpoolConfigPools) case constant.IBSriovCNI: + if spec.IbSriovConfig.RdmaIsolation == nil || !*spec.IbSriovConfig.RdmaIsolation { + return fmt.Errorf("spidermultusconfig %s/%s not enable RDMA", mc.Namespace, mc.Name) + } return multuscniconfig.ValidateRdmaResouce(true, mc.Name, mc.Namespace, spec.IbSriovConfig.ResourceName, spec.IbSriovConfig.SpiderpoolConfigPools) case constant.IPoIBCNI: return multuscniconfig.ValidateRdmaResouce(true, mc.Name, mc.Namespace, spec.IpoibConfig.Master, spec.IpoibConfig.SpiderpoolConfigPools) diff --git a/pkg/podmanager/utils_test.go b/pkg/podmanager/utils_test.go index a535a264ee..ea7b559ffe 100644 --- a/pkg/podmanager/utils_test.go +++ b/pkg/podmanager/utils_test.go @@ -7,7 +7,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spidernet-io/spiderpool/pkg/constant" - "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -115,7 +115,6 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To("macvlan"), MacvlanConfig: &v2beta1.SpiderMacvlanCniConfig{ - EnableRdma: true, RdmaResourceName: "spidernet.io/rdma-resource1", SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test1"}, @@ -131,7 +130,6 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To("macvlan"), MacvlanConfig: &v2beta1.SpiderMacvlanCniConfig{ - EnableRdma: true, RdmaResourceName: "spidernet.io/rdma-resource2", SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test1"}, @@ -160,7 +158,6 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To("macvlan"), MacvlanConfig: &v2beta1.SpiderMacvlanCniConfig{ - EnableRdma: true, RdmaResourceName: "spidernet.io/rdma-resource1", }, }, @@ -173,7 +170,6 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To("macvlan"), MacvlanConfig: &v2beta1.SpiderMacvlanCniConfig{ - EnableRdma: true, RdmaResourceName: "spidernet.io/rdma-resource2", SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test1"}, @@ -199,8 +195,7 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To("macvlan"), MacvlanConfig: &v2beta1.SpiderMacvlanCniConfig{ - EnableRdma: false, - RdmaResourceName: "spidernet.io/rdma-resource1", + RdmaResourceName: "", SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test1"}, }, @@ -215,7 +210,6 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To("macvlan"), MacvlanConfig: &v2beta1.SpiderMacvlanCniConfig{ - EnableRdma: true, RdmaResourceName: "spidernet.io/rdma-resource2", SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test1"}, @@ -247,7 +241,6 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To("macvlan"), MacvlanConfig: &v2beta1.SpiderMacvlanCniConfig{ - EnableRdma: true, RdmaResourceName: "spidernet.io/rdma-resource1", SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test1"}, @@ -263,7 +256,6 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To("macvlan"), MacvlanConfig: &v2beta1.SpiderMacvlanCniConfig{ - EnableRdma: true, RdmaResourceName: "spidernet.io/rdma-resource2", SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test1"}, @@ -297,7 +289,6 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To(constant.MacvlanCNI), MacvlanConfig: &v2beta1.SpiderMacvlanCniConfig{ - EnableRdma: true, RdmaResourceName: "rdma-resource", SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test"}, @@ -314,7 +305,6 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To(constant.MacvlanCNI), MacvlanConfig: &v2beta1.SpiderMacvlanCniConfig{ - EnableRdma: false, RdmaResourceName: "", SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test"}, @@ -333,7 +323,6 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To(constant.IPVlanCNI), IPVlanConfig: &v2beta1.SpiderIPvlanCniConfig{ - EnableRdma: true, RdmaResourceName: "rdma-resource", SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test"}, @@ -350,7 +339,6 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To(constant.IPVlanCNI), IPVlanConfig: &v2beta1.SpiderIPvlanCniConfig{ - EnableRdma: false, RdmaResourceName: "", SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test"}, @@ -369,8 +357,8 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To(constant.SriovCNI), SriovConfig: &v2beta1.SpiderSRIOVCniConfig{ - EnableRdma: true, - ResourceName: "rdma-resource", + RdmaIsolation: true, + ResourceName: "rdma-resource", SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test"}, }, @@ -386,8 +374,8 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To(constant.SriovCNI), SriovConfig: &v2beta1.SpiderSRIOVCniConfig{ - EnableRdma: false, - ResourceName: "", + RdmaIsolation: false, + ResourceName: "", SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test"}, }, @@ -405,7 +393,8 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { Spec: v2beta1.MultusCNIConfigSpec{ CniType: ptr.To(constant.IBSriovCNI), IbSriovConfig: &v2beta1.SpiderIBSriovCniConfig{ - ResourceName: "rdma-resource", + ResourceName: "rdma-resource", + RdmaIsolation: ptr.To(true), SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test"}, }, @@ -422,6 +411,7 @@ var _ = Describe("PodManager utils", Label("pod_manager_utils_test"), func() { CniType: ptr.To(constant.IBSriovCNI), IbSriovConfig: &v2beta1.SpiderIBSriovCniConfig{ ResourceName: "", + SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test"}, }, diff --git a/pkg/reservedipmanager/mock/reservedip_manager_mock.go b/pkg/reservedipmanager/mock/reservedip_manager_mock.go index 8adfc58ab1..b8e971dd6f 100644 --- a/pkg/reservedipmanager/mock/reservedip_manager_mock.go +++ b/pkg/reservedipmanager/mock/reservedip_manager_mock.go @@ -13,7 +13,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" types "github.com/spidernet-io/spiderpool/pkg/types" client "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/pkg/reservedipmanager/reservedip_manager.go b/pkg/reservedipmanager/reservedip_manager.go index 54c57251f4..e2c30317b7 100644 --- a/pkg/reservedipmanager/reservedip_manager.go +++ b/pkg/reservedipmanager/reservedip_manager.go @@ -14,7 +14,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" ) diff --git a/pkg/reservedipmanager/reservedip_manager_suite_test.go b/pkg/reservedipmanager/reservedip_manager_suite_test.go index 743a2333ac..13bdee9fd8 100644 --- a/pkg/reservedipmanager/reservedip_manager_suite_test.go +++ b/pkg/reservedipmanager/reservedip_manager_suite_test.go @@ -17,7 +17,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/reservedipmanager" ) diff --git a/pkg/reservedipmanager/reservedip_manager_test.go b/pkg/reservedipmanager/reservedip_manager_test.go index 8a79611eba..355024e07c 100644 --- a/pkg/reservedipmanager/reservedip_manager_test.go +++ b/pkg/reservedipmanager/reservedip_manager_test.go @@ -20,7 +20,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/reservedipmanager" ) diff --git a/pkg/reservedipmanager/reservedip_mutate.go b/pkg/reservedipmanager/reservedip_mutate.go index a55c8e98f2..1e6f4b995e 100644 --- a/pkg/reservedipmanager/reservedip_mutate.go +++ b/pkg/reservedipmanager/reservedip_mutate.go @@ -10,7 +10,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/types" ) diff --git a/pkg/reservedipmanager/reservedip_validate.go b/pkg/reservedipmanager/reservedip_validate.go index 7335b12f54..12af739c84 100644 --- a/pkg/reservedipmanager/reservedip_validate.go +++ b/pkg/reservedipmanager/reservedip_validate.go @@ -11,7 +11,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" ) diff --git a/pkg/reservedipmanager/reservedip_webhook.go b/pkg/reservedipmanager/reservedip_webhook.go index 6d7ebd6bce..7bbd63be6b 100644 --- a/pkg/reservedipmanager/reservedip_webhook.go +++ b/pkg/reservedipmanager/reservedip_webhook.go @@ -16,7 +16,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook/admission" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" ) diff --git a/pkg/reservedipmanager/reservedip_webhook_test.go b/pkg/reservedipmanager/reservedip_webhook_test.go index ed862a14ff..d52dce2659 100644 --- a/pkg/reservedipmanager/reservedip_webhook_test.go +++ b/pkg/reservedipmanager/reservedip_webhook_test.go @@ -19,7 +19,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/reservedipmanager" ) diff --git a/pkg/subnetmanager/subnet_informer.go b/pkg/subnetmanager/subnet_informer.go index 388d38bc93..2759266428 100644 --- a/pkg/subnetmanager/subnet_informer.go +++ b/pkg/subnetmanager/subnet_informer.go @@ -32,7 +32,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/election" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" "github.com/spidernet-io/spiderpool/pkg/ippoolmanager" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" clientset "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions" informers "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1" diff --git a/pkg/subnetmanager/subnet_informer_test.go b/pkg/subnetmanager/subnet_informer_test.go index 6dfac88a87..c2affcfafd 100644 --- a/pkg/subnetmanager/subnet_informer_test.go +++ b/pkg/subnetmanager/subnet_informer_test.go @@ -26,7 +26,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/applicationcontroller/applicationinformers" "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" spiderpoolfake "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/fake" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/subnetmanager" diff --git a/pkg/subnetmanager/subnet_manager.go b/pkg/subnetmanager/subnet_manager.go index a1e2e32f9b..11d9883e58 100644 --- a/pkg/subnetmanager/subnet_manager.go +++ b/pkg/subnetmanager/subnet_manager.go @@ -22,7 +22,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/event" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" "github.com/spidernet-io/spiderpool/pkg/ippoolmanager" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/reservedipmanager" "github.com/spidernet-io/spiderpool/pkg/types" diff --git a/pkg/subnetmanager/subnet_manager_suite_test.go b/pkg/subnetmanager/subnet_manager_suite_test.go index 050f3da3da..93724f0d3f 100644 --- a/pkg/subnetmanager/subnet_manager_suite_test.go +++ b/pkg/subnetmanager/subnet_manager_suite_test.go @@ -22,7 +22,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" electionmock "github.com/spidernet-io/spiderpool/pkg/election/mock" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/metric" reservedipmanagermock "github.com/spidernet-io/spiderpool/pkg/reservedipmanager/mock" "github.com/spidernet-io/spiderpool/pkg/subnetmanager" diff --git a/pkg/subnetmanager/subnet_manager_test.go b/pkg/subnetmanager/subnet_manager_test.go index 63f8c0158b..9c474cb470 100644 --- a/pkg/subnetmanager/subnet_manager_test.go +++ b/pkg/subnetmanager/subnet_manager_test.go @@ -19,7 +19,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/subnetmanager" "github.com/spidernet-io/spiderpool/pkg/types" ) diff --git a/pkg/subnetmanager/subnet_mutate.go b/pkg/subnetmanager/subnet_mutate.go index eea3a2586c..909796bcd8 100644 --- a/pkg/subnetmanager/subnet_mutate.go +++ b/pkg/subnetmanager/subnet_mutate.go @@ -11,7 +11,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/types" ) diff --git a/pkg/subnetmanager/subnet_validate.go b/pkg/subnetmanager/subnet_validate.go index 3fcebad71b..8c7f28765d 100644 --- a/pkg/subnetmanager/subnet_validate.go +++ b/pkg/subnetmanager/subnet_validate.go @@ -14,7 +14,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" "github.com/spidernet-io/spiderpool/pkg/ippoolmanager" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/pkg/utils/convert" ) diff --git a/pkg/subnetmanager/subnet_webhook.go b/pkg/subnetmanager/subnet_webhook.go index b7dafcb42e..76969441fa 100644 --- a/pkg/subnetmanager/subnet_webhook.go +++ b/pkg/subnetmanager/subnet_webhook.go @@ -20,7 +20,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook/admission" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" ) diff --git a/pkg/subnetmanager/subnet_webhook_test.go b/pkg/subnetmanager/subnet_webhook_test.go index abb9ba1976..ded755214d 100644 --- a/pkg/subnetmanager/subnet_webhook_test.go +++ b/pkg/subnetmanager/subnet_webhook_test.go @@ -23,7 +23,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/subnetmanager" "github.com/spidernet-io/spiderpool/pkg/utils/convert" diff --git a/pkg/utils/convert/convert.go b/pkg/utils/convert/convert.go index ad565437e2..9342067ba8 100644 --- a/pkg/utils/convert/convert.go +++ b/pkg/utils/convert/convert.go @@ -16,7 +16,7 @@ import ( "github.com/spidernet-io/spiderpool/api/v1/agent/models" "github.com/spidernet-io/spiderpool/pkg/constant" spiderpoolip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" ) diff --git a/pkg/workloadendpointmanager/utils.go b/pkg/workloadendpointmanager/utils.go index 47272619df..1f447ee242 100644 --- a/pkg/workloadendpointmanager/utils.go +++ b/pkg/workloadendpointmanager/utils.go @@ -4,7 +4,7 @@ package workloadendpointmanager import ( - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" ) func RetrieveIPAllocation(uid, nic string, endpoint *spiderpoolv2beta1.SpiderEndpoint, isStatic bool) *spiderpoolv2beta1.PodIPAllocation { diff --git a/pkg/workloadendpointmanager/utils_test.go b/pkg/workloadendpointmanager/utils_test.go index 68eadb6787..b36cd6e11d 100644 --- a/pkg/workloadendpointmanager/utils_test.go +++ b/pkg/workloadendpointmanager/utils_test.go @@ -13,7 +13,7 @@ import ( "k8s.io/utils/ptr" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/workloadendpointmanager" ) diff --git a/pkg/workloadendpointmanager/workloadendpoint_manager.go b/pkg/workloadendpointmanager/workloadendpoint_manager.go index 22b952479f..3744c9a37b 100644 --- a/pkg/workloadendpointmanager/workloadendpoint_manager.go +++ b/pkg/workloadendpointmanager/workloadendpoint_manager.go @@ -17,7 +17,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/logutils" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/pkg/utils/convert" diff --git a/pkg/workloadendpointmanager/workloadendpoint_manager_suite_test.go b/pkg/workloadendpointmanager/workloadendpoint_manager_suite_test.go index fe8b632b82..0ed91877fd 100644 --- a/pkg/workloadendpointmanager/workloadendpoint_manager_suite_test.go +++ b/pkg/workloadendpointmanager/workloadendpoint_manager_suite_test.go @@ -16,7 +16,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/workloadendpointmanager" ) diff --git a/pkg/workloadendpointmanager/workloadendpoint_manager_test.go b/pkg/workloadendpointmanager/workloadendpoint_manager_test.go index e396f181cd..faaab0dbc8 100644 --- a/pkg/workloadendpointmanager/workloadendpoint_manager_test.go +++ b/pkg/workloadendpointmanager/workloadendpoint_manager_test.go @@ -25,7 +25,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" spiderpooltypes "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/pkg/workloadendpointmanager" ) diff --git a/test/e2e/affinity/affinity_suite_test.go b/test/e2e/affinity/affinity_suite_test.go index 98b9a337aa..baec3ff2e1 100644 --- a/test/e2e/affinity/affinity_suite_test.go +++ b/test/e2e/affinity/affinity_suite_test.go @@ -6,7 +6,7 @@ import ( "testing" e2e "github.com/spidernet-io/e2eframework/framework" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "k8s.io/apimachinery/pkg/runtime" . "github.com/onsi/ginkgo/v2" diff --git a/test/e2e/affinity/affinity_test.go b/test/e2e/affinity/affinity_test.go index 9c80f368a7..2a7af6b882 100644 --- a/test/e2e/affinity/affinity_test.go +++ b/test/e2e/affinity/affinity_test.go @@ -14,7 +14,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/test/e2e/common" ) diff --git a/test/e2e/annotation/annotation_suite_test.go b/test/e2e/annotation/annotation_suite_test.go index e51211f410..85fc1ef0c1 100644 --- a/test/e2e/annotation/annotation_suite_test.go +++ b/test/e2e/annotation/annotation_suite_test.go @@ -5,7 +5,7 @@ package annotation_test import ( "testing" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/test/e2e/annotation/annotation_test.go b/test/e2e/annotation/annotation_test.go index 832a4289af..f1ff436c0a 100644 --- a/test/e2e/annotation/annotation_test.go +++ b/test/e2e/annotation/annotation_test.go @@ -20,7 +20,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" pkgconstant "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/test/e2e/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/test/e2e/assignip/assiginip_suite_test.go b/test/e2e/assignip/assiginip_suite_test.go index ee53b9e901..39757d1abd 100644 --- a/test/e2e/assignip/assiginip_suite_test.go +++ b/test/e2e/assignip/assiginip_suite_test.go @@ -5,7 +5,7 @@ package assignip_test import ( "testing" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/test/e2e/assignip/assignip_test.go b/test/e2e/assignip/assignip_test.go index 6d18c928b8..bee62d7f12 100644 --- a/test/e2e/assignip/assignip_test.go +++ b/test/e2e/assignip/assignip_test.go @@ -14,7 +14,7 @@ import ( corev1 "k8s.io/api/core/v1" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/test/e2e/common" ) diff --git a/test/e2e/common/reservedip.go b/test/e2e/common/reservedip.go index c0f80285a1..38a9d5f66a 100644 --- a/test/e2e/common/reservedip.go +++ b/test/e2e/common/reservedip.go @@ -17,7 +17,7 @@ import ( apitypes "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" ) func CreateReservedIP(f *frame.Framework, ReservedIP *spiderpool.SpiderReservedIP, opts ...client.CreateOption) error { diff --git a/test/e2e/common/spiderpool.go b/test/e2e/common/spiderpool.go index c1ac8b309a..707787f474 100644 --- a/test/e2e/common/spiderpool.go +++ b/test/e2e/common/spiderpool.go @@ -10,7 +10,7 @@ import ( "sync" "time" - v1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/lock" "github.com/spidernet-io/spiderpool/pkg/utils/convert" "k8s.io/client-go/tools/cache" diff --git a/test/e2e/common/spidersubnet.go b/test/e2e/common/spidersubnet.go index faef46f755..d040aa180d 100644 --- a/test/e2e/common/spidersubnet.go +++ b/test/e2e/common/spidersubnet.go @@ -16,7 +16,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/utils/convert" ip "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" . "github.com/onsi/ginkgo/v2" diff --git a/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_suite_test.go b/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_suite_test.go index 4db943ea40..0151e19b99 100644 --- a/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_suite_test.go +++ b/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_suite_test.go @@ -11,7 +11,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" e2e "github.com/spidernet-io/e2eframework/framework" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/test/e2e/common" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_test.go b/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_test.go index f72be43b4e..125b0a364d 100644 --- a/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_test.go +++ b/test/e2e/coordinator/macvlan-overlay-one/macvlan_overlay_one_test.go @@ -26,7 +26,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" pkgconstant "github.com/spidernet-io/spiderpool/pkg/constant" "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/test/e2e/common" corev1 "k8s.io/api/core/v1" diff --git a/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_suite_test.go b/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_suite_test.go index 49913ab443..7fdbfbc1cb 100644 --- a/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_suite_test.go +++ b/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_suite_test.go @@ -10,7 +10,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" e2e "github.com/spidernet-io/e2eframework/framework" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/test/e2e/common" "k8s.io/apimachinery/pkg/runtime" ) diff --git a/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_test.go b/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_test.go index 4377d3033b..ecddfa92aa 100644 --- a/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_test.go +++ b/test/e2e/coordinator/macvlan-underlay-one/macvlan_underlay_one_test.go @@ -21,7 +21,7 @@ import ( pkgconstant "github.com/spidernet-io/spiderpool/pkg/constant" "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/test/e2e/common" corev1 "k8s.io/api/core/v1" diff --git a/test/e2e/ifacer/ifacer_suite_test.go b/test/e2e/ifacer/ifacer_suite_test.go index 42d4b8e2d3..8308e0974c 100644 --- a/test/e2e/ifacer/ifacer_suite_test.go +++ b/test/e2e/ifacer/ifacer_suite_test.go @@ -8,7 +8,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" e2e "github.com/spidernet-io/e2eframework/framework" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "k8s.io/apimachinery/pkg/runtime" ) diff --git a/test/e2e/ifacer/ifacer_test.go b/test/e2e/ifacer/ifacer_test.go index b0a4e1b5d9..d08a36cb45 100644 --- a/test/e2e/ifacer/ifacer_test.go +++ b/test/e2e/ifacer/ifacer_test.go @@ -15,7 +15,7 @@ import ( "github.com/spidernet-io/e2eframework/tools" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/test/e2e/common" ) diff --git a/test/e2e/ippoolcr/ippoolcr_suite_test.go b/test/e2e/ippoolcr/ippoolcr_suite_test.go index b1926f5da6..3d32d7af2b 100644 --- a/test/e2e/ippoolcr/ippoolcr_suite_test.go +++ b/test/e2e/ippoolcr/ippoolcr_suite_test.go @@ -10,7 +10,7 @@ import ( e2e "github.com/spidernet-io/e2eframework/framework" "k8s.io/apimachinery/pkg/runtime" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" ) func TestIppoolCR(t *testing.T) { diff --git a/test/e2e/ippoolcr/ippoolcr_test.go b/test/e2e/ippoolcr/ippoolcr_test.go index 68726b9053..348dd0bcbc 100644 --- a/test/e2e/ippoolcr/ippoolcr_test.go +++ b/test/e2e/ippoolcr/ippoolcr_test.go @@ -20,7 +20,7 @@ import ( "github.com/spidernet-io/e2eframework/tools" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/test/e2e/common" ) diff --git a/test/e2e/kruise/kruise_suite_test.go b/test/e2e/kruise/kruise_suite_test.go index 9a75824f7b..104df3c843 100644 --- a/test/e2e/kruise/kruise_suite_test.go +++ b/test/e2e/kruise/kruise_suite_test.go @@ -9,7 +9,7 @@ import ( . "github.com/onsi/gomega" kruiseapi "github.com/openkruise/kruise-api" e2e "github.com/spidernet-io/e2eframework/framework" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "k8s.io/apimachinery/pkg/runtime" ) diff --git a/test/e2e/kruise/kruise_test.go b/test/e2e/kruise/kruise_test.go index 873574f388..c926f4c326 100644 --- a/test/e2e/kruise/kruise_test.go +++ b/test/e2e/kruise/kruise_test.go @@ -12,7 +12,7 @@ import ( "github.com/spidernet-io/e2eframework/tools" "github.com/spidernet-io/spiderpool/pkg/constant" pkgconstant "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/test/e2e/common" corev1 "k8s.io/api/core/v1" diff --git a/test/e2e/kubevirt/kubevirt_suite_test.go b/test/e2e/kubevirt/kubevirt_suite_test.go index fab12223c3..ac17190784 100644 --- a/test/e2e/kubevirt/kubevirt_suite_test.go +++ b/test/e2e/kubevirt/kubevirt_suite_test.go @@ -17,7 +17,7 @@ import ( kubevirtv1 "kubevirt.io/api/core/v1" k8yaml "sigs.k8s.io/yaml" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/test/e2e/common" ) diff --git a/test/e2e/kubevirt/kubevirt_test.go b/test/e2e/kubevirt/kubevirt_test.go index 2e6991fe74..4457a748d9 100644 --- a/test/e2e/kubevirt/kubevirt_test.go +++ b/test/e2e/kubevirt/kubevirt_test.go @@ -20,7 +20,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/test/e2e/common" ) diff --git a/test/e2e/performance/performance_suite_test.go b/test/e2e/performance/performance_suite_test.go index 40800d4692..4096815ef7 100644 --- a/test/e2e/performance/performance_suite_test.go +++ b/test/e2e/performance/performance_suite_test.go @@ -10,7 +10,7 @@ import ( e2e "github.com/spidernet-io/e2eframework/framework" "k8s.io/apimachinery/pkg/runtime" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" ) func TestPerformance(t *testing.T) { diff --git a/test/e2e/performance/performance_test.go b/test/e2e/performance/performance_test.go index 6bcb7967d3..42db9f0cfc 100644 --- a/test/e2e/performance/performance_test.go +++ b/test/e2e/performance/performance_test.go @@ -7,7 +7,7 @@ import ( "fmt" "time" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/test/e2e/podwebhook/podwebhook_suite_test.go b/test/e2e/podwebhook/podwebhook_suite_test.go index bcae769fc7..e45b42d970 100644 --- a/test/e2e/podwebhook/podwebhook_suite_test.go +++ b/test/e2e/podwebhook/podwebhook_suite_test.go @@ -10,7 +10,7 @@ import ( . "github.com/onsi/gomega" e2e "github.com/spidernet-io/e2eframework/framework" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "k8s.io/apimachinery/pkg/runtime" ) diff --git a/test/e2e/podwebhook/podwebhook_test.go b/test/e2e/podwebhook/podwebhook_test.go index eb9a8ec018..7cff3eebff 100644 --- a/test/e2e/podwebhook/podwebhook_test.go +++ b/test/e2e/podwebhook/podwebhook_test.go @@ -10,7 +10,7 @@ import ( . "github.com/onsi/gomega" "github.com/spidernet-io/spiderpool/pkg/constant" - "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/test/e2e/common" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -53,7 +53,6 @@ var _ = Describe("Podwebhook", func() { CniType: ptr.To(constant.MacvlanCNI), MacvlanConfig: &v2beta1.SpiderMacvlanCniConfig{ Master: []string{common.NIC1}, - EnableRdma: true, RdmaResourceName: "spidernet.io/rdma_resource" + "_" + name, SpiderpoolConfigPools: &v2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test-ipv4-pool"}, diff --git a/test/e2e/reclaim/chaos_test.go b/test/e2e/reclaim/chaos_test.go index 5f49fda47d..a593b731e6 100644 --- a/test/e2e/reclaim/chaos_test.go +++ b/test/e2e/reclaim/chaos_test.go @@ -18,7 +18,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/test/e2e/common" corev1 "k8s.io/api/core/v1" "k8s.io/kubectl/pkg/util/podutils" diff --git a/test/e2e/reclaim/reclaim_suite_test.go b/test/e2e/reclaim/reclaim_suite_test.go index 40fb0352d7..f39ddd2582 100644 --- a/test/e2e/reclaim/reclaim_suite_test.go +++ b/test/e2e/reclaim/reclaim_suite_test.go @@ -5,7 +5,7 @@ package reclaim_test import ( "testing" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/test/e2e/reclaim/reclaim_test.go b/test/e2e/reclaim/reclaim_test.go index dff308e431..b62520b934 100644 --- a/test/e2e/reclaim/reclaim_test.go +++ b/test/e2e/reclaim/reclaim_test.go @@ -24,7 +24,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/nodemanager" "github.com/spidernet-io/spiderpool/pkg/openapi" "github.com/spidernet-io/spiderpool/pkg/utils/convert" diff --git a/test/e2e/reliability/reliability_suite_test.go b/test/e2e/reliability/reliability_suite_test.go index c0b74fae67..efc50cb746 100644 --- a/test/e2e/reliability/reliability_suite_test.go +++ b/test/e2e/reliability/reliability_suite_test.go @@ -6,7 +6,7 @@ import ( "testing" e2e "github.com/spidernet-io/e2eframework/framework" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "k8s.io/apimachinery/pkg/runtime" . "github.com/onsi/ginkgo/v2" diff --git a/test/e2e/reservedip/reservedip_suite_test.go b/test/e2e/reservedip/reservedip_suite_test.go index 1a257227be..aef11b5541 100644 --- a/test/e2e/reservedip/reservedip_suite_test.go +++ b/test/e2e/reservedip/reservedip_suite_test.go @@ -5,7 +5,7 @@ package reservedip_test import ( "testing" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/test/e2e/reservedip/reservedip_test.go b/test/e2e/reservedip/reservedip_test.go index 4e914f953e..87716d2fd5 100644 --- a/test/e2e/reservedip/reservedip_test.go +++ b/test/e2e/reservedip/reservedip_test.go @@ -7,7 +7,7 @@ import ( "encoding/json" "time" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "sigs.k8s.io/controller-runtime/pkg/client" . "github.com/onsi/ginkgo/v2" diff --git a/test/e2e/spiderclaimparameter/spiderclaimparameter_suite_test.go b/test/e2e/spiderclaimparameter/spiderclaimparameter_suite_test.go index aca4fe1d73..03e53fac2d 100644 --- a/test/e2e/spiderclaimparameter/spiderclaimparameter_suite_test.go +++ b/test/e2e/spiderclaimparameter/spiderclaimparameter_suite_test.go @@ -8,7 +8,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" e2e "github.com/spidernet-io/e2eframework/framework" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/test/e2e/common" "k8s.io/api/resource/v1alpha2" diff --git a/test/e2e/spiderclaimparameter/spiderclaimparameter_test.go b/test/e2e/spiderclaimparameter/spiderclaimparameter_test.go index f6c5b78f3c..cf8ec301b8 100644 --- a/test/e2e/spiderclaimparameter/spiderclaimparameter_test.go +++ b/test/e2e/spiderclaimparameter/spiderclaimparameter_test.go @@ -7,7 +7,7 @@ import ( . "github.com/onsi/gomega" "github.com/spidernet-io/spiderpool/pkg/constant" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/test/e2e/common" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/ptr" diff --git a/test/e2e/spidercoordinator/spidercoordinator_suite_test.go b/test/e2e/spidercoordinator/spidercoordinator_suite_test.go index 4778a89c21..e890b89501 100644 --- a/test/e2e/spidercoordinator/spidercoordinator_suite_test.go +++ b/test/e2e/spidercoordinator/spidercoordinator_suite_test.go @@ -15,7 +15,7 @@ import ( "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/test/e2e/common" ) diff --git a/test/e2e/spidercoordinator/spidercoordinator_test.go b/test/e2e/spidercoordinator/spidercoordinator_test.go index a36818310b..df20421c61 100644 --- a/test/e2e/spidercoordinator/spidercoordinator_test.go +++ b/test/e2e/spidercoordinator/spidercoordinator_test.go @@ -18,7 +18,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/constant" "github.com/spidernet-io/spiderpool/pkg/coordinatormanager" "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/test/e2e/common" ) diff --git a/test/e2e/spidermultus/spidermultus_suite_test.go b/test/e2e/spidermultus/spidermultus_suite_test.go index 21e9eada8a..ee259271b2 100644 --- a/test/e2e/spidermultus/spidermultus_suite_test.go +++ b/test/e2e/spidermultus/spidermultus_suite_test.go @@ -10,7 +10,7 @@ import ( e2e "github.com/spidernet-io/e2eframework/framework" "k8s.io/apimachinery/pkg/runtime" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" ) func TestSpiderMultus(t *testing.T) { diff --git a/test/e2e/spidermultus/spidermultus_test.go b/test/e2e/spidermultus/spidermultus_test.go index 07a2c0728f..655eada218 100644 --- a/test/e2e/spidermultus/spidermultus_test.go +++ b/test/e2e/spidermultus/spidermultus_test.go @@ -23,8 +23,8 @@ import ( "k8s.io/utils/ptr" "github.com/spidernet-io/spiderpool/pkg/constant" - "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" - spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/test/e2e/common" ) @@ -546,8 +546,8 @@ var _ = Describe("test spidermultus", Label("SpiderMultusConfig"), func() { Spec: spiderpoolv2beta1.MultusCNIConfigSpec{ CniType: ptr.To(constant.SriovCNI), SriovConfig: &spiderpoolv2beta1.SpiderSRIOVCniConfig{ - ResourceName: "spidernet.io/mellanoxrdma", - EnableRdma: true, + ResourceName: "spidernet.io/mellanoxrdma", + RdmaIsolation: true, }, }, } @@ -778,7 +778,6 @@ var _ = Describe("test spidermultus", Label("SpiderMultusConfig"), func() { CniType: ptr.To(constant.MacvlanCNI), MacvlanConfig: &spiderpoolv2beta1.SpiderMacvlanCniConfig{ Master: []string{common.NIC1}, - EnableRdma: true, RdmaResourceName: "test", SpiderpoolConfigPools: &spiderpoolv2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test"}, @@ -809,8 +808,7 @@ var _ = Describe("test spidermultus", Label("SpiderMultusConfig"), func() { CniType: ptr.To(constant.MacvlanCNI), MacvlanConfig: &spiderpoolv2beta1.SpiderMacvlanCniConfig{ Master: []string{common.NIC1}, - EnableRdma: false, - RdmaResourceName: "test", + RdmaResourceName: "", SpiderpoolConfigPools: &spiderpoolv2beta1.SpiderpoolPools{ IPv4IPPool: []string{"test"}, }, @@ -840,7 +838,6 @@ var _ = Describe("test spidermultus", Label("SpiderMultusConfig"), func() { CniType: ptr.To(constant.MacvlanCNI), MacvlanConfig: &spiderpoolv2beta1.SpiderMacvlanCniConfig{ Master: []string{common.NIC1}, - EnableRdma: true, RdmaResourceName: "test", }, EnableCoordinator: ptr.To(true), diff --git a/test/e2e/subnet/subnet_suite_test.go b/test/e2e/subnet/subnet_suite_test.go index 1fe955d082..116a90e51e 100644 --- a/test/e2e/subnet/subnet_suite_test.go +++ b/test/e2e/subnet/subnet_suite_test.go @@ -5,7 +5,7 @@ package subnet_test import ( "testing" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/test/e2e/subnet/subnet_test.go b/test/e2e/subnet/subnet_test.go index 93e90dcfba..610b475143 100644 --- a/test/e2e/subnet/subnet_test.go +++ b/test/e2e/subnet/subnet_test.go @@ -26,7 +26,7 @@ import ( "github.com/spidernet-io/spiderpool/pkg/applicationcontroller/applicationinformers" "github.com/spidernet-io/spiderpool/pkg/constant" "github.com/spidernet-io/spiderpool/pkg/ip" - spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpool "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" "github.com/spidernet-io/spiderpool/pkg/lock" "github.com/spidernet-io/spiderpool/pkg/types" "github.com/spidernet-io/spiderpool/pkg/utils/convert" diff --git a/tools/k8s-controller-gen/update-controller-gen.sh b/tools/k8s-controller-gen/update-controller-gen.sh index b1a8df736c..1d21bd33c8 100755 --- a/tools/k8s-controller-gen/update-controller-gen.sh +++ b/tools/k8s-controller-gen/update-controller-gen.sh @@ -24,7 +24,10 @@ set -o pipefail # CONST PROJECT_ROOT=$(dirname ${BASH_SOURCE[0]})/../.. CONTROLLER_GEN_TMP_DIR=${CONTROLLER_GEN_TMP_DIR:-${PROJECT_ROOT}/.controller_gen_tmp} -CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${PROJECT_ROOT}; ls -d -1 ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen 2>/dev/null || echo ../controller-gen)} +CODEGEN_PKG=${CODEGEN_PKG:-$( + cd ${PROJECT_ROOT} + ls -d -1 ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen 2>/dev/null || echo ../controller-gen +)} # ENV # Defines the output path for the artifacts controller-gen generates @@ -34,8 +37,6 @@ OUTPUT_TMP_DIR=${OUTPUT_TMP_DIR:-${CONTROLLER_GEN_TMP_DIR}/old} # Defines the output path of the latest artifacts for diffing OUTPUT_DIFF_DIR=${OUTPUT_DIFF_DIR:-${CONTROLLER_GEN_TMP_DIR}/new} - - controller-gen() { go run ${PROJECT_ROOT}/${CODEGEN_PKG}/main.go "$@" } @@ -43,20 +44,25 @@ controller-gen() { manifests_gen() { output_dir=$1 - controller-gen \ - crd rbac:roleName="spiderpool-admin" \ - paths="${PWD}/${PROJECT_ROOT}/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" \ - output:crd:artifacts:config="${output_dir}/crds" \ - output:rbac:artifacts:config="${output_dir}/templates" + for api_version in $(ls ${PWD}/${PROJECT_ROOT}/pkg/k8s/apis/spiderpool.spidernet.io); do + echo "manifests_gen for ${api_version}" + controller-gen \ + crd rbac:roleName="spiderpool-admin" \ + paths="${PWD}/${PROJECT_ROOT}/pkg/k8s/apis/spiderpool.spidernet.io/${api_version}" \ + output:crd:artifacts:config="${output_dir}/crds" \ + output:rbac:artifacts:config="${output_dir}/templates" + done } deepcopy_gen() { tmp_header_file=${CONTROLLER_GEN_TMP_DIR}/boilerplate.go.txt - cat ${PROJECT_ROOT}/tools/spdx-copyright-header.txt | sed -E 's?(.*)?// \1?' > ${tmp_header_file} + cat ${PROJECT_ROOT}/tools/spdx-copyright-header.txt | sed -E 's?(.*)?// \1?' >${tmp_header_file} - controller-gen \ - object:headerFile="${tmp_header_file}" \ - paths="${PWD}/${PROJECT_ROOT}/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + for api_version in $(ls ${PWD}/${PROJECT_ROOT}/pkg/k8s/apis/spiderpool.spidernet.io); do + echo "deepcopy_gen for ${api_version}..." + controller-gen object:headerFile="${tmp_header_file}" \ + paths="${PWD}/${PROJECT_ROOT}/pkg/k8s/apis/spiderpool.spidernet.io/${api_version}" + done } manifests_verify() { @@ -65,7 +71,7 @@ manifests_verify() { mkdir -p ${OUTPUT_TMP_DIR}/crds if [ "$(ls -A ${OUTPUT_BASE_DIR}/crds)" ]; then - cp ${OUTPUT_BASE_DIR}/crds/spiderpool* ${OUTPUT_TMP_DIR}/crds + cp ${OUTPUT_BASE_DIR}/crds/spiderpool* ${OUTPUT_TMP_DIR}/crds fi if [ "$(ls -A ${OUTPUT_BASE_DIR}/templates)" ]; then @@ -79,7 +85,7 @@ manifests_verify() { ret=0 diff -Naupr ${OUTPUT_TMP_DIR} ${OUTPUT_DIFF_DIR} || ret=$? - if [[ $ret -eq 0 ]];then + if [[ $ret -eq 0 ]]; then echo "The Artifacts is up to date." else echo "Error: The Artifacts is out of date! Please run 'make manifests'." @@ -101,19 +107,19 @@ main() { mkdir -p ${CONTROLLER_GEN_TMP_DIR} case ${1:-none} in - manifests) - manifests_gen ${OUTPUT_BASE_DIR} - ;; - deepcopy) - deepcopy_gen - ;; - verify) - manifests_verify - ;; - *|help|-h|--help) - help - ;; + manifests) + manifests_gen ${OUTPUT_BASE_DIR} + ;; + deepcopy) + deepcopy_gen + ;; + verify) + manifests_verify + ;; + * | help | -h | --help) + help + ;; esac } -main "$*" \ No newline at end of file +main "$*"