diff --git a/charts/spiderpool/crds/spiderpool.spidernet.io_spiderippools.yaml b/charts/spiderpool/crds/spiderpool.spidernet.io_spiderippools.yaml index 880338cffd..cedcdd05f6 100644 --- a/charts/spiderpool/crds/spiderpool.spidernet.io_spiderippools.yaml +++ b/charts/spiderpool/crds/spiderpool.spidernet.io_spiderippools.yaml @@ -272,7 +272,6 @@ spec: subnet: type: string vlan: - default: 0 description: 'DEPRECATED: Vlan is deprecated.' format: int64 maximum: 4094 diff --git a/charts/spiderpool/crds/spiderpool.spidernet.io_spidersubnets.yaml b/charts/spiderpool/crds/spiderpool.spidernet.io_spidersubnets.yaml index c44aab2165..3a367467b3 100644 --- a/charts/spiderpool/crds/spiderpool.spidernet.io_spidersubnets.yaml +++ b/charts/spiderpool/crds/spiderpool.spidernet.io_spidersubnets.yaml @@ -86,7 +86,6 @@ spec: subnet: type: string vlan: - default: 0 description: 'DEPRECATED: Vlan is deprecated.' format: int64 maximum: 4094 diff --git a/pkg/ippoolmanager/ippool_manager_test.go b/pkg/ippoolmanager/ippool_manager_test.go index bbc293da71..4f6295d020 100644 --- a/pkg/ippoolmanager/ippool_manager_test.go +++ b/pkg/ippoolmanager/ippool_manager_test.go @@ -342,7 +342,6 @@ var _ = Describe("IPPoolManager", Label("ippool_manager_test"), func() { ipVersion := constant.IPv4 allocatedIP := "172.18.40.40/24" gateway := "172.18.40.1" - vlan := int64(0) ip, ipNet, err := net.ParseCIDR(allocatedIP) Expect(err).NotTo(HaveOccurred()) @@ -351,7 +350,6 @@ var _ = Describe("IPPoolManager", Label("ippool_manager_test"), func() { ipPoolT.Spec.Subnet = ipNet.String() ipPoolT.Spec.IPs = append(ipPoolT.Spec.IPs, ip.String()) ipPoolT.Spec.Gateway = pointer.String(gateway) - ipPoolT.Spec.Vlan = pointer.Int64(vlan) err = fakeClient.Create(ctx, ipPoolT) Expect(err).NotTo(HaveOccurred()) @@ -365,7 +363,6 @@ var _ = Describe("IPPoolManager", Label("ippool_manager_test"), func() { Expect(*res.Address).To(Equal(allocatedIP)) Expect(res.IPPool).To(Equal(ipPoolT.Name)) Expect(res.Gateway).To(Equal(gateway)) - Expect(res.Vlan).To(Equal(vlan)) }) It("allocate IP address with kubevirt vm pod", func() { @@ -386,7 +383,6 @@ var _ = Describe("IPPoolManager", Label("ippool_manager_test"), func() { ipPoolT.Spec.Subnet = ipNet.String() ipPoolT.Spec.IPs = append(ipPoolT.Spec.IPs, ip.String()) ipPoolT.Spec.Gateway = pointer.String(gateway) - ipPoolT.Spec.Vlan = pointer.Int64(vlan) err = fakeClient.Create(ctx, ipPoolT) Expect(err).NotTo(HaveOccurred()) @@ -431,7 +427,6 @@ var _ = Describe("IPPoolManager", Label("ippool_manager_test"), func() { ipPoolT.Spec.Subnet = ipNet.String() ipPoolT.Spec.IPs = append(ipPoolT.Spec.IPs, ip.String()) ipPoolT.Spec.Gateway = pointer.String(gateway) - ipPoolT.Spec.Vlan = pointer.Int64(vlan) key, err := cache.MetaNamespaceKeyFunc(podT) Expect(err).NotTo(HaveOccurred()) diff --git a/pkg/ippoolmanager/ippool_webhook_test.go b/pkg/ippoolmanager/ippool_webhook_test.go index aea62c319b..e83baee0c5 100644 --- a/pkg/ippoolmanager/ippool_webhook_test.go +++ b/pkg/ippoolmanager/ippool_webhook_test.go @@ -542,7 +542,6 @@ var _ = Describe("IPPoolWebhook", Label("ippool_webhook_test"), func() { ) subnetT.Spec.Gateway = pointer.String("172.18.50.0") - subnetT.Spec.Vlan = pointer.Int64(50) subnetT.Spec.Routes = []spiderpoolv2beta1.Route{ { Dst: "0.0.0.0/0", @@ -565,7 +564,6 @@ var _ = Describe("IPPoolWebhook", Label("ippool_webhook_test"), func() { Expect(v).To(Equal(subnetName)) Expect(ipPoolT.Spec.Gateway).To(Equal(subnetT.Spec.Gateway)) - Expect(ipPoolT.Spec.Vlan).To(Equal(subnetT.Spec.Vlan)) Expect(ipPoolT.Spec.Routes).To(Equal(subnetT.Spec.Routes)) }) }) @@ -1317,7 +1315,6 @@ var _ = Describe("IPPoolWebhook", Label("ippool_webhook_test"), func() { ) ipPoolT.Spec.ExcludeIPs = append(ipPoolT.Spec.ExcludeIPs, "172.18.40.10") ipPoolT.Spec.Gateway = pointer.String("172.18.40.1") - ipPoolT.Spec.Vlan = pointer.Int64(0) ipPoolT.Spec.Routes = append(ipPoolT.Spec.Routes, spiderpoolv2beta1.Route{ Dst: "192.168.40.0/24", @@ -1359,7 +1356,6 @@ var _ = Describe("IPPoolWebhook", Label("ippool_webhook_test"), func() { ) ipPoolT.Spec.ExcludeIPs = append(ipPoolT.Spec.ExcludeIPs, "abcd:1234::a") ipPoolT.Spec.Gateway = pointer.String("abcd:1234::1") - ipPoolT.Spec.Vlan = pointer.Int64(0) ipPoolT.Spec.Routes = append(ipPoolT.Spec.Routes, spiderpoolv2beta1.Route{ Dst: "fd00:40::/120", @@ -2095,7 +2091,6 @@ var _ = Describe("IPPoolWebhook", Label("ippool_webhook_test"), func() { ipPoolT.Spec.IPVersion = pointer.Int64(constant.IPv4) ipPoolT.Spec.Subnet = "172.18.40.0/24" ipPoolT.Spec.IPs = append(ipPoolT.Spec.IPs, "172.18.40.2-172.18.40.3") - ipPoolT.Spec.Vlan = pointer.Int64(0) newIPPoolT := ipPoolT.DeepCopy() newIPPoolT.Spec.IPs = append(newIPPoolT.Spec.IPs, "172.18.40.10") @@ -2134,7 +2129,6 @@ var _ = Describe("IPPoolWebhook", Label("ippool_webhook_test"), func() { ipPoolT.Spec.IPVersion = pointer.Int64(constant.IPv6) ipPoolT.Spec.Subnet = "abcd:1234::/120" ipPoolT.Spec.IPs = append(ipPoolT.Spec.IPs, "abcd:1234::2-abcd:1234::3") - ipPoolT.Spec.Vlan = pointer.Int64(0) newIPPoolT := ipPoolT.DeepCopy() newIPPoolT.Spec.IPs = append(newIPPoolT.Spec.IPs, "abcd:1234::a") diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1/spiderippool_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1/spiderippool_types.go index 3951798f0a..6886753d64 100644 --- a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1/spiderippool_types.go +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1/spiderippool_types.go @@ -26,7 +26,6 @@ type IPPoolSpec struct { Gateway *string `json:"gateway,omitempty"` // DEPRECATED: Vlan is deprecated. - // +kubebuilder:default=0 // +kubebuilder:validation:Maximum=4094 // +kubebuilder:validation:Minimum=0 // +kubebuilder:validation:Optional diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1/spidersubnet_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1/spidersubnet_types.go index a9459b6da3..00dbd1c2fc 100644 --- a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1/spidersubnet_types.go +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1/spidersubnet_types.go @@ -26,7 +26,6 @@ type SubnetSpec struct { Gateway *string `json:"gateway,omitempty"` // DEPRECATED: Vlan is deprecated. - // +kubebuilder:default=0 // +kubebuilder:validation:Maximum=4094 // +kubebuilder:validation:Minimum=0 // +kubebuilder:validation:Optional diff --git a/pkg/subnetmanager/subnet_manager.go b/pkg/subnetmanager/subnet_manager.go index 431699be20..527d24c16f 100644 --- a/pkg/subnetmanager/subnet_manager.go +++ b/pkg/subnetmanager/subnet_manager.go @@ -143,10 +143,10 @@ func (sm *subnetManager) ReconcileAutoIPPool(ctx context.Context, pool *spiderpo Name: applicationinformers.AutoPoolName(podController.Name, autoPoolProperty.IPVersion, autoPoolProperty.IfName, podController.UID), }, Spec: spiderpoolv2beta1.IPPoolSpec{ - IPVersion: pointer.Int64(autoPoolProperty.IPVersion), - Subnet: subnet.Spec.Subnet, - Gateway: subnet.Spec.Gateway, - Vlan: subnet.Spec.Vlan, + IPVersion: pointer.Int64(autoPoolProperty.IPVersion), + Subnet: subnet.Spec.Subnet, + Gateway: subnet.Spec.Gateway, + //Vlan: subnet.Spec.Vlan, Routes: subnet.Spec.Routes, PodAffinity: ippoolmanager.NewAutoPoolPodAffinity(podController), }, diff --git a/pkg/subnetmanager/subnet_webhook_test.go b/pkg/subnetmanager/subnet_webhook_test.go index 55de118c74..e6ccf0d707 100644 --- a/pkg/subnetmanager/subnet_webhook_test.go +++ b/pkg/subnetmanager/subnet_webhook_test.go @@ -860,7 +860,6 @@ var _ = Describe("SubnetWebhook", Label("subnet_webhook_test"), func() { ) subnetT.Spec.ExcludeIPs = append(subnetT.Spec.ExcludeIPs, "172.18.40.10") subnetT.Spec.Gateway = pointer.String("172.18.40.1") - subnetT.Spec.Vlan = pointer.Int64(0) subnetT.Spec.Routes = append(subnetT.Spec.Routes, spiderpoolv2beta1.Route{ Dst: "192.168.40.0/24", @@ -884,7 +883,6 @@ var _ = Describe("SubnetWebhook", Label("subnet_webhook_test"), func() { ) subnetT.Spec.ExcludeIPs = append(subnetT.Spec.ExcludeIPs, "abcd:1234::a") subnetT.Spec.Gateway = pointer.String("abcd:1234::1") - subnetT.Spec.Vlan = pointer.Int64(0) subnetT.Spec.Routes = append(subnetT.Spec.Routes, spiderpoolv2beta1.Route{ Dst: "fd00:40::/120", @@ -1445,7 +1443,6 @@ var _ = Describe("SubnetWebhook", Label("subnet_webhook_test"), func() { subnetT.Spec.IPVersion = pointer.Int64(constant.IPv4) subnetT.Spec.Subnet = "172.18.40.0/24" subnetT.Spec.IPs = append(subnetT.Spec.IPs, "172.18.40.2-172.18.40.3") - subnetT.Spec.Vlan = pointer.Int64(0) newSubnetT := subnetT.DeepCopy() newSubnetT.Spec.IPs = append(newSubnetT.Spec.IPs, "172.18.40.10") @@ -1467,7 +1464,6 @@ var _ = Describe("SubnetWebhook", Label("subnet_webhook_test"), func() { subnetT.Spec.IPVersion = pointer.Int64(constant.IPv6) subnetT.Spec.Subnet = "abcd:1234::/120" subnetT.Spec.IPs = append(subnetT.Spec.IPs, "abcd:1234::2-abcd:1234::3") - subnetT.Spec.Vlan = pointer.Int64(0) newSubnetT := subnetT.DeepCopy() newSubnetT.Spec.IPs = append(newSubnetT.Spec.IPs, "abcd:1234::a") diff --git a/pkg/utils/convert/convert.go b/pkg/utils/convert/convert.go index 766792d303..c032079e7e 100644 --- a/pkg/utils/convert/convert.go +++ b/pkg/utils/convert/convert.go @@ -245,7 +245,7 @@ func GenIPConfigResult(allocateIP net.IP, nic string, ipPool *spiderpoolv2beta1. IPPool: ipPool.Name, Nic: &nic, Version: ipPool.Spec.IPVersion, - Vlan: *ipPool.Spec.Vlan, + //Vlan: *ipPool.Spec.Vlan, } } diff --git a/test/e2e/annotation/annotation_test.go b/test/e2e/annotation/annotation_test.go index 772c063231..0b857b67b4 100644 --- a/test/e2e/annotation/annotation_test.go +++ b/test/e2e/annotation/annotation_test.go @@ -196,13 +196,9 @@ var _ = Describe("test annotation", Label("annotation"), func() { var ( v4PoolName, v6PoolName string iPv4PoolObj, iPv6PoolObj *spiderpool.SpiderIPPool - ipv4vlan, ipv6vlan = new(types.Vlan), new(types.Vlan) err error ipNum int = 2 ) - // Different VLAN for ipv4 and ipv6 Pool - *ipv4vlan = 10 - *ipv6vlan = 20 // The case relies on a Dual-stack if !frame.Info.IpV6Enabled || !frame.Info.IpV4Enabled { @@ -211,7 +207,6 @@ var _ = Describe("test annotation", Label("annotation"), func() { // Create IPv4Pool and IPv6Pool v4PoolName, iPv4PoolObj = common.GenerateExampleIpv4poolObject(ipNum) - iPv4PoolObj.Spec.Vlan = ipv4vlan GinkgoWriter.Printf("try to create ipv4pool: %v \n", v4PoolName) if frame.Info.SpiderSubnetEnabled { ctx, cancel := context.WithTimeout(context.Background(), common.PodStartTimeout) @@ -223,7 +218,6 @@ var _ = Describe("test annotation", Label("annotation"), func() { Expect(err).NotTo(HaveOccurred(), "failed to create ipv4pool %v \n", v4PoolName) v6PoolName, iPv6PoolObj = common.GenerateExampleIpv6poolObject(ipNum) - iPv6PoolObj.Spec.Vlan = ipv6vlan GinkgoWriter.Printf("try to create ipv6pool: %v \n", v6PoolName) if frame.Info.SpiderSubnetEnabled { ctx, cancel := context.WithTimeout(context.Background(), common.PodStartTimeout) 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 094b7b7ac3..8a34f142c5 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 @@ -526,7 +526,6 @@ var _ = Describe("MacvlanOverlayOne", Label("overlay", "one-nic", "coordinator") v4PoolName, v4PoolObj = common.GenerateExampleIpv4poolObject(1) v4PoolObj.Spec.Subnet = spiderPoolIPv4SubnetVlan200.Spec.Subnet v4PoolObj.Spec.Gateway = spiderPoolIPv4SubnetVlan200.Spec.Gateway - v4PoolObj.Spec.Vlan = spiderPoolIPv4SubnetVlan200.Spec.Vlan // Do not use the gateway address as the conflicting ip, and the use case will remove the IP address in the subsequent steps. // If the gateway address is removed, it will affect the connectivity of other use cases. @@ -558,7 +557,6 @@ var _ = Describe("MacvlanOverlayOne", Label("overlay", "one-nic", "coordinator") v6PoolName, v6PoolObj = common.GenerateExampleIpv6poolObject(1) v6PoolObj.Spec.Subnet = spiderPoolIPv6SubnetVlan200.Spec.Subnet v6PoolObj.Spec.Gateway = spiderPoolIPv6SubnetVlan200.Spec.Gateway - v6PoolObj.Spec.Vlan = spiderPoolIPv6SubnetVlan200.Spec.Vlan // Do not use the gateway address as the conflicting ip, and the use case will remove the IP address in the subsequent steps. // If the gateway address is removed, it will affect the connectivity of other use cases. var v6RandNum int diff --git a/test/e2e/ifacer/ifacer_test.go b/test/e2e/ifacer/ifacer_test.go index 2e85957c8c..9ac45810e5 100644 --- a/test/e2e/ifacer/ifacer_test.go +++ b/test/e2e/ifacer/ifacer_test.go @@ -40,7 +40,6 @@ var _ = Describe("test ifacer", Label("ifacer"), func() { defer cancel() if frame.Info.IpV4Enabled { v4PoolName, iPv4PoolObj = common.GenerateExampleIpv4poolObject(1) - iPv4PoolObj.Spec.Vlan = pointer.Int64(int64(vlanInterface)) if frame.Info.SpiderSubnetEnabled { v4SubnetName, v4SubnetObject = common.GenerateExampleV4SubnetObject(frame, len(frame.Info.KindNodeList)) Expect(v4SubnetObject).NotTo(BeNil()) @@ -54,7 +53,6 @@ var _ = Describe("test ifacer", Label("ifacer"), func() { if frame.Info.IpV6Enabled { v6PoolName, iPv6PoolObj = common.GenerateExampleIpv6poolObject(len(frame.Info.KindNodeList)) - iPv6PoolObj.Spec.Vlan = pointer.Int64(int64(vlanInterface)) if frame.Info.SpiderSubnetEnabled { v6SubnetName, v6SubnetObject = common.GenerateExampleV6SubnetObject(frame, len(frame.Info.KindNodeList)) Expect(v6SubnetObject).NotTo(BeNil()) diff --git a/test/e2e/subnet/subnet_test.go b/test/e2e/subnet/subnet_test.go index 11da49e748..46fe16cf48 100644 --- a/test/e2e/subnet/subnet_test.go +++ b/test/e2e/subnet/subnet_test.go @@ -508,7 +508,6 @@ var _ = Describe("test subnet", Label("subnet"), func() { It("valid fields succeed to create subnet. ", Label("I00001", "I00002", "I00005"), func() { var v4Ipversion, v6Ipversion = new(types.IPVersion), new(types.IPVersion) - var ipv4Vlan, ipv6Vlan = new(types.Vlan), new(types.Vlan) var v4Object, v6Object *spiderpool.SpiderSubnet var v4RouteValue, v6RouteValue []spiderpool.Route @@ -519,9 +518,6 @@ var _ = Describe("test subnet", Label("subnet"), func() { subnetAnno := types.AnnoSubnetItem{} if frame.Info.IpV4Enabled { *v4Ipversion = int64(4) - if i, err := strconv.Atoi(common.GenerateRandomNumber(4094)); err != nil { - *ipv4Vlan = int64(i) - } subnetAnno.IPv4 = []string{v4SubnetName} v4RouteValue = []spiderpool.Route{ { @@ -529,7 +525,6 @@ var _ = Describe("test subnet", Label("subnet"), func() { Gw: ipv4Gw, }, } - v4SubnetObject.Spec.Vlan = ipv4Vlan v4SubnetObject.Spec.Routes = v4RouteValue v4SubnetObject.Spec.Gateway = &ipv4Gw GinkgoWriter.Printf("Specify routes, gateways, etc. and then create subnets %v \n", v4SubnetName) @@ -538,7 +533,6 @@ var _ = Describe("test subnet", Label("subnet"), func() { v4Object, err = common.GetSubnetByName(frame, v4SubnetName) Expect(err).NotTo(HaveOccurred()) Expect(v4Object.Spec.IPVersion).To(Equal(v4Ipversion)) - Expect(v4Object.Spec.Vlan).To(Equal(ipv4Vlan)) Expect(v4Object.Spec.Routes[0].Dst).To(Equal(v4Dst)) Expect(v4Object.Spec.Routes[0].Gw).To(Equal(ipv4Gw)) Expect(v4Object.Spec.Gateway).To(Equal(&ipv4Gw)) @@ -546,9 +540,6 @@ var _ = Describe("test subnet", Label("subnet"), func() { if frame.Info.IpV6Enabled { *v6Ipversion = int64(6) - if i, err := strconv.Atoi(common.GenerateRandomNumber(4094)); err != nil { - *ipv6Vlan = int64(i) - } subnetAnno.IPv6 = []string{v6SubnetName} v6RouteValue = []spiderpool.Route{ { @@ -556,7 +547,6 @@ var _ = Describe("test subnet", Label("subnet"), func() { Gw: ipv6Gw, }, } - v6SubnetObject.Spec.Vlan = ipv6Vlan v6SubnetObject.Spec.Routes = v6RouteValue v6SubnetObject.Spec.Gateway = &ipv6Gw GinkgoWriter.Printf("Specify routes, gateways, etc. and then create subnets %v \n", v6SubnetName) @@ -565,7 +555,6 @@ var _ = Describe("test subnet", Label("subnet"), func() { v6Object, err = common.GetSubnetByName(frame, v6SubnetName) Expect(err).NotTo(HaveOccurred()) Expect(v6Object.Spec.IPVersion).To(Equal(v6Ipversion)) - Expect(v6Object.Spec.Vlan).To(Equal(ipv6Vlan)) Expect(v6Object.Spec.Routes[0].Dst).To(Equal(v6Dst)) Expect(v6Object.Spec.Routes[0].Gw).To(Equal(ipv6Gw)) Expect(v6Object.Spec.Gateway).To(Equal(&ipv6Gw)) @@ -595,7 +584,6 @@ var _ = Describe("test subnet", Label("subnet"), func() { v4poolList, err := common.GetIppoolsInSubnet(frame, v4SubnetName) Expect(err).NotTo(HaveOccurred()) for _, pool := range v4poolList.Items { - Expect(pool.Spec.Vlan).To(Equal(ipv4Vlan)) Expect(pool.Spec.Routes[0].Dst).To(Equal(v4Dst)) Expect(pool.Spec.Routes[0].Gw).To(Equal(ipv4Gw)) Expect(pool.Spec.Gateway).To(Equal(&ipv4Gw)) @@ -674,7 +662,6 @@ var _ = Describe("test subnet", Label("subnet"), func() { GinkgoWriter.Println("Older pools are not affected.") for _, pool := range v4poolList.Items { if pool.Name != v4PoolName { - Expect(pool.Spec.Vlan).To(Equal(ipv4Vlan)) Expect(pool.Spec.Routes[0].Dst).To(Equal(v4Dst)) Expect(pool.Spec.Routes[0].Gw).To(Equal(ipv4Gw)) Expect(pool.Spec.Gateway).To(Equal(&ipv4Gw)) @@ -691,7 +678,6 @@ var _ = Describe("test subnet", Label("subnet"), func() { v6poolList, err := common.GetIppoolsInSubnet(frame, v6SubnetName) Expect(err).NotTo(HaveOccurred()) for _, pool := range v6poolList.Items { - Expect(pool.Spec.Vlan).To(Equal(ipv6Vlan)) Expect(pool.Spec.Routes[0].Dst).To(Equal(v6Dst)) Expect(pool.Spec.Routes[0].Gw).To(Equal(ipv6Gw)) Expect(pool.Spec.Gateway).To(Equal(&ipv6Gw)) @@ -770,7 +756,6 @@ var _ = Describe("test subnet", Label("subnet"), func() { GinkgoWriter.Println("Older pools are not affected.") for _, pool := range v6poolList.Items { if pool.Name != v6PoolName { - Expect(pool.Spec.Vlan).To(Equal(ipv6Vlan)) Expect(pool.Spec.Routes[0].Dst).To(Equal(v6Dst)) Expect(pool.Spec.Routes[0].Gw).To(Equal(ipv6Gw)) Expect(pool.Spec.Gateway).To(Equal(&ipv6Gw))