From c23c39e9fb2b0e181f37c6903c7706e2d69363fa Mon Sep 17 00:00:00 2001 From: dove0012 <dove0012@163.com> Date: Tue, 12 Nov 2024 09:16:05 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=8D=87=E7=BA=A7containerservice/armconta?= =?UTF-8?q?inerservice=E5=8C=85=E5=88=B0v3=E7=89=88=E6=9C=AC=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=9B=86=E7=BE=A4=E7=BD=91=E7=BB=9C=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=B8=8D=E6=94=AF=E6=8C=81cni=20overlay=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bcs-services/bcs-cluster-manager/go.mod | 6 ++- .../internal/cloudprovider/azure/api/aks.go | 2 +- .../cloudprovider/azure/api/convert.go | 2 +- .../cloudprovider/azure/api/interface.go | 2 +- .../cloudprovider/azure/api/node_group.go | 2 +- .../internal/cloudprovider/azure/api/utils.go | 45 ++++++++++--------- .../cloudprovider/azure/api/utils_test.go | 2 +- .../internal/cloudprovider/azure/cloud.go | 2 +- .../internal/cloudprovider/azure/nodegroup.go | 2 +- .../azure/tasks/createCluster.go | 19 +++++--- .../azure/tasks/createNodeGroup.go | 2 +- .../azure/tasks/updateDesiredNodes.go | 2 +- 12 files changed, 50 insertions(+), 38 deletions(-) diff --git a/bcs-services/bcs-cluster-manager/go.mod b/bcs-services/bcs-cluster-manager/go.mod index ec9717028d..e37ca2ae65 100644 --- a/bcs-services/bcs-cluster-manager/go.mod +++ b/bcs-services/bcs-cluster-manager/go.mod @@ -14,7 +14,6 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice v1.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.1.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0 @@ -72,6 +71,11 @@ require ( sigs.k8s.io/aws-iam-authenticator v0.6.17 ) +require ( + github.com/Azure/azure-sdk-for-go/profile/p20200901 v0.1.1 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v3 v3.0.0 +) + require ( cloud.google.com/go v0.112.0 // indirect cloud.google.com/go/compute v1.23.3 // indirect diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/aks.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/aks.go index 972d9f3f46..2aa3a46a29 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/aks.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/aks.go @@ -18,7 +18,7 @@ import ( "strings" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v3" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" "github.com/pkg/errors" diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/convert.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/convert.go index ac0068c0be..d608c1c841 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/convert.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/convert.go @@ -17,7 +17,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v3" "github.com/pkg/errors" proto "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-manager/api/clustermanager" diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/interface.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/interface.go index c5abbe7163..11998d5303 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/interface.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/interface.go @@ -16,7 +16,7 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v3" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" proto "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-manager/api/clustermanager" diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/node_group.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/node_group.go index 551d9ceb98..0411aaf437 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/node_group.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/node_group.go @@ -15,7 +15,7 @@ package api import ( "context" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v3" "github.com/pkg/errors" proto "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-manager/api/clustermanager" diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/utils.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/utils.go index a264bdec53..fe80cc336d 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/utils.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/utils.go @@ -20,9 +20,10 @@ import ( "strconv" "strings" + "github.com/Azure/azure-sdk-for-go/profile/p20200901/resourcemanager/containerservice/armcontainerservice" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + armcontainerservicev3 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v3" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" "github.com/Tencent/bk-bcs/bcs-common/common/blog" @@ -35,11 +36,11 @@ import ( // bcs nodeGroup 转换为 aks agentPool type nodeGroupToPool struct { group *proto.NodeGroup - pool *armcontainerservice.AgentPool + pool *armcontainerservicev3.AgentPool } // newNodeGroupToAgentPoolConverter create nodeGroupToPool -func newNodeGroupToAgentPoolConverter(group *proto.NodeGroup, pool *armcontainerservice.AgentPool) *nodeGroupToPool { +func newNodeGroupToAgentPoolConverter(group *proto.NodeGroup, pool *armcontainerservicev3.AgentPool) *nodeGroupToPool { return &nodeGroupToPool{ group: group, pool: pool, @@ -49,7 +50,7 @@ func newNodeGroupToAgentPoolConverter(group *proto.NodeGroup, pool *armcontainer // convert 转换 func (c *nodeGroupToPool) convert() { if c.pool.Properties == nil { - c.pool.Properties = new(armcontainerservice.ManagedClusterAgentPoolProfileProperties) + c.pool.Properties = new(armcontainerservicev3.ManagedClusterAgentPoolProfileProperties) } properties := c.pool.Properties // 以下为必填参数 @@ -65,7 +66,7 @@ func (c *nodeGroupToPool) convert() { // 设置节点池大小 properties.Count = to.Ptr(int32(c.group.AutoScaling.DesiredSize)) // 设置节点池为用户模式 - properties.Mode = to.Ptr(armcontainerservice.AgentPoolModeUser) + properties.Mode = to.Ptr(armcontainerservicev3.AgentPoolModeUser) // 设置Azure节点池的弹性伸缩 properties.EnableAutoScaling = to.Ptr(false) // 是否分配公网IP @@ -108,7 +109,7 @@ func (c *nodeGroupToPool) setScalingMode() { return } found := false - for _, mode := range armcontainerservice.PossibleScaleDownModeValues() { + for _, mode := range armcontainerservicev3.PossibleScaleDownModeValues() { if string(mode) == asg.ScalingMode { found = true break @@ -117,19 +118,19 @@ func (c *nodeGroupToPool) setScalingMode() { if !found { return } - c.pool.Properties.ScaleDownMode = to.Ptr(armcontainerservice.ScaleDownMode(asg.ScalingMode)) + c.pool.Properties.ScaleDownMode = to.Ptr(armcontainerservicev3.ScaleDownMode(asg.ScalingMode)) } // setOSDiskType 设置系统盘类型 func (c *nodeGroupToPool) setOSDiskType() { // 默认 使用托管类型(Managed) - c.pool.Properties.OSDiskType = to.Ptr(armcontainerservice.OSDiskTypeManaged) + c.pool.Properties.OSDiskType = to.Ptr(armcontainerservicev3.OSDiskTypeManaged) lc := c.group.LaunchTemplate if lc.SystemDisk == nil || len(lc.SystemDisk.DiskType) == 0 { return } found := false - for _, osDiskType := range armcontainerservice.PossibleOSDiskTypeValues() { + for _, osDiskType := range armcontainerservicev3.PossibleOSDiskTypeValues() { if string(osDiskType) == lc.SystemDisk.DiskType { found = true break @@ -138,7 +139,7 @@ func (c *nodeGroupToPool) setOSDiskType() { if !found { return } - c.pool.Properties.OSDiskType = to.Ptr(armcontainerservice.OSDiskType(lc.SystemDisk.DiskType)) + c.pool.Properties.OSDiskType = to.Ptr(armcontainerservicev3.OSDiskType(lc.SystemDisk.DiskType)) } // setOSDiskSizeGB 设置系统盘大小 @@ -165,14 +166,14 @@ func (c *nodeGroupToPool) setOSDiskSizeGB() { func (c *nodeGroupToPool) setOSAndInstanceType() { nodeOS := c.group.NodeOS // 默认系统类型为linux - c.pool.Properties.OSType = to.Ptr(armcontainerservice.OSTypeLinux) + c.pool.Properties.OSType = to.Ptr(armcontainerservicev3.OSTypeLinux) if strings.Contains(nodeOS, winTypeOS) { - c.pool.Properties.OSType = to.Ptr(armcontainerservice.OSTypeWindows) + c.pool.Properties.OSType = to.Ptr(armcontainerservicev3.OSTypeWindows) } // 默认OS为Ubuntu - c.pool.Properties.OSSKU = to.Ptr(armcontainerservice.OSSKUUbuntu) + c.pool.Properties.OSSKU = to.Ptr(armcontainerservicev3.OSSKUUbuntu) if c.group.LaunchTemplate != nil && c.group.LaunchTemplate.ImageInfo != nil { - c.pool.Properties.OSSKU = to.Ptr(armcontainerservice.OSSKU(c.group.LaunchTemplate.ImageInfo.ImageName)) + c.pool.Properties.OSSKU = to.Ptr(armcontainerservicev3.OSSKU(c.group.LaunchTemplate.ImageInfo.ImageName)) } if c.group.LaunchTemplate != nil { c.pool.Properties.VMSize = to.Ptr(c.group.LaunchTemplate.InstanceType) @@ -306,14 +307,14 @@ func (c *nodeGroupToPool) regexpMaxPods(kp string) int32 { // poolToNodeGroup AKS agentPool 转换为 BCS NodeGroup type poolToNodeGroup struct { group *proto.NodeGroup - pool *armcontainerservice.AgentPool - properties *armcontainerservice.ManagedClusterAgentPoolProfileProperties + pool *armcontainerservicev3.AgentPool + properties *armcontainerservicev3.ManagedClusterAgentPoolProfileProperties } // newPoolToNodeGroupConverter create poolToNodeGroup -func newPoolToNodeGroupConverter(pool *armcontainerservice.AgentPool, group *proto.NodeGroup) *poolToNodeGroup { +func newPoolToNodeGroupConverter(pool *armcontainerservicev3.AgentPool, group *proto.NodeGroup) *poolToNodeGroup { if pool.Properties == nil { - pool.Properties = new(armcontainerservice.ManagedClusterAgentPoolProfileProperties) + pool.Properties = new(armcontainerservicev3.ManagedClusterAgentPoolProfileProperties) } return &poolToNodeGroup{ group: group, @@ -408,9 +409,9 @@ func (c *poolToNodeGroup) setScaleDownMode() { return } switch *mode { - case armcontainerservice.ScaleDownModeDelete: + case armcontainerservicev3.ScaleDownModeDelete: asg.ScalingMode = "CLASSIC_SCALING" - case armcontainerservice.ScaleDownModeDeallocate: + case armcontainerservicev3.ScaleDownModeDeallocate: asg.ScalingMode = "WAKE_UP_STOPPED_SCALING" } } @@ -1496,12 +1497,12 @@ func SetImageReferenceNull(set *armcompute.VirtualMachineScaleSet) { } // SetAgentPoolFromNodeGroup 更新pool,只允许设置tag、vm、label、taint -func SetAgentPoolFromNodeGroup(group *proto.NodeGroup, pool *armcontainerservice.AgentPool) { +func SetAgentPoolFromNodeGroup(group *proto.NodeGroup, pool *armcontainerservicev3.AgentPool) { if group == nil || pool == nil { return } if pool.Properties == nil { - pool.Properties = new(armcontainerservice.ManagedClusterAgentPoolProfileProperties) + pool.Properties = new(armcontainerservicev3.ManagedClusterAgentPoolProfileProperties) } pool.Properties.Tags = make(map[string]*string) for k := range group.Tags { diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/utils_test.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/utils_test.go index 35f8aeee60..fb803a3eab 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/utils_test.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/api/utils_test.go @@ -20,7 +20,7 @@ import ( "time" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v3" proto "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-manager/api/clustermanager" ) diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/cloud.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/cloud.go index 2c80914948..1edc37675f 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/cloud.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/cloud.go @@ -18,7 +18,7 @@ import ( "fmt" "sync" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v3" "github.com/Tencent/bk-bcs/bcs-common/common/blog" proto "github.com/Tencent/bk-bcs/bcs-services/bcs-cluster-manager/api/clustermanager" diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/nodegroup.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/nodegroup.go index 5c4d3178c9..55b0794e80 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/nodegroup.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/nodegroup.go @@ -21,7 +21,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v3" "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-common/pkg/odm/operator" "github.com/pkg/errors" diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createCluster.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createCluster.go index 5b577e5c51..edacc65266 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createCluster.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createCluster.go @@ -24,7 +24,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v3" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/avast/retry-go" @@ -240,11 +240,18 @@ func generateCreateClusterRequest(info *cloudprovider.CloudDependBasicInfo, grou NetworkProfile: &armcontainerservice.NetworkProfile{ NetworkPlugin: to.Ptr(armcontainerservice.NetworkPluginAzure), NetworkPolicy: to.Ptr(armcontainerservice.NetworkPolicyCalico), - PodCidr: to.Ptr(cluster.NetworkSettings.ClusterIPv4CIDR), - ServiceCidr: to.Ptr(cluster.NetworkSettings.ServiceIPv4CIDR), // nolint - DNSServiceIP: to.Ptr(genDNSServiceIP(cluster.NetworkSettings.ServiceIPv4CIDR)), // nolint - ServiceCidrs: []*string{to.Ptr(cluster.NetworkSettings.ServiceIPv4CIDR)}, // nolint - PodCidrs: []*string{to.Ptr(cluster.NetworkSettings.ClusterIPv4CIDR)}, // nolint + NetworkPluginMode: func() *armcontainerservice.NetworkPluginMode { + if cluster.ClusterAdvanceSettings.NetworkType == common.AzureCniOverlay { + return to.Ptr(armcontainerservice.NetworkPluginModeOverlay) + } + + return to.Ptr(armcontainerservice.NetworkPluginMode("")) + }(), + PodCidr: to.Ptr(cluster.NetworkSettings.ClusterIPv4CIDR), + ServiceCidr: to.Ptr(cluster.NetworkSettings.ServiceIPv4CIDR), // nolint + DNSServiceIP: to.Ptr(genDNSServiceIP(cluster.NetworkSettings.ServiceIPv4CIDR)), // nolint + ServiceCidrs: []*string{to.Ptr(cluster.NetworkSettings.ServiceIPv4CIDR)}, // nolint + PodCidrs: []*string{to.Ptr(cluster.NetworkSettings.ClusterIPv4CIDR)}, // nolint }, ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ ClientID: to.Ptr(info.CmOption.Account.ClientID), // nolint diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createNodeGroup.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createNodeGroup.go index 581387463e..b68ce0e850 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createNodeGroup.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createNodeGroup.go @@ -18,7 +18,7 @@ import ( "strconv" "time" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v3" "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/pkg/errors" diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/updateDesiredNodes.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/updateDesiredNodes.go index 18e1b7d86b..6a5198b427 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/updateDesiredNodes.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/updateDesiredNodes.go @@ -21,7 +21,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v3" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" "github.com/Tencent/bk-bcs/bcs-common/common/blog" "github.com/Tencent/bk-bcs/bcs-common/pkg/odm/operator" From 54112fdc2a705ebc25a326b19b2b2d17754bb674 Mon Sep 17 00:00:00 2001 From: dove0012 <dove0012@163.com> Date: Fri, 22 Nov 2024 16:29:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BD=BF=E7=94=A8cni=20o?= =?UTF-8?q?verlay=E6=8F=92=E4=BB=B6=E5=89=8D=E7=AB=AF=E4=B8=8D=E4=BC=A0pod?= =?UTF-8?q?=20cidr=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../internal/cloudprovider/azure/tasks/createCluster.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createCluster.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createCluster.go index 1daecfcd20..0bc3a4ae50 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createCluster.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createCluster.go @@ -253,7 +253,7 @@ func generateCreateClusterRequest(info *cloudprovider.CloudDependBasicInfo, grou ServiceCidr: to.Ptr(cluster.NetworkSettings.ServiceIPv4CIDR), // nolint DNSServiceIP: to.Ptr(genDNSServiceIP(cluster.NetworkSettings.ServiceIPv4CIDR)), // nolint ServiceCidrs: []*string{to.Ptr(cluster.NetworkSettings.ServiceIPv4CIDR)}, // nolint - PodCidrs: []*string{to.Ptr(cluster.NetworkSettings.ClusterIPv4CIDR)}, // nolint + //PodCidrs: []*string{to.Ptr(cluster.NetworkSettings.ClusterIPv4CIDR)}, // nolint }, ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{ ClientID: to.Ptr(info.CmOption.Account.ClientID), // nolint From a627217935c2f89f17469096ac1bbfb4ab4e83e3 Mon Sep 17 00:00:00 2001 From: dove0012 <dove0012@163.com> Date: Fri, 22 Nov 2024 17:14:48 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgolangci-lint=E8=A7=84?= =?UTF-8?q?=E8=8C=83=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../internal/actions/thirdparty/project_quota.go | 2 +- .../cloudprovider/azure/tasks/createCluster.go | 2 +- .../internal/cloudprovider/ladder/nodegroup.go | 10 ++++------ .../cloudprovider/qcloud-public/nodegroupmgr.go | 1 - .../internal/remote/cmdb/types.go | 16 ++++++++-------- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/bcs-services/bcs-cluster-manager/internal/actions/thirdparty/project_quota.go b/bcs-services/bcs-cluster-manager/internal/actions/thirdparty/project_quota.go index c7d6b0d84a..cc66e3abed 100644 --- a/bcs-services/bcs-cluster-manager/internal/actions/thirdparty/project_quota.go +++ b/bcs-services/bcs-cluster-manager/internal/actions/thirdparty/project_quota.go @@ -42,7 +42,7 @@ type GetProjectResourceQuotaUsageAction struct { groups []cmproto.NodeGroup - regionInsTypes map[string][]string + regionInsTypes map[string][]string // nolint } // NewGetProjectResourceQuotaUsageAction create action diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createCluster.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createCluster.go index 0bc3a4ae50..5e8b04e7e5 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createCluster.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/azure/tasks/createCluster.go @@ -168,7 +168,7 @@ func createAKSCluster(ctx context.Context, info *cloudprovider.CloudDependBasicI } // generateCreateClusterRequest generate create cluster request -func generateCreateClusterRequest(info *cloudprovider.CloudDependBasicInfo, groups []*proto.NodeGroup) ( +func generateCreateClusterRequest(info *cloudprovider.CloudDependBasicInfo, groups []*proto.NodeGroup) ( // nolint *armcontainerservice.ManagedCluster, error) { cluster := info.Cluster if cluster.NetworkSettings == nil { diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/ladder/nodegroup.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/ladder/nodegroup.go index e9ddc92671..6d2e433670 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/ladder/nodegroup.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/ladder/nodegroup.go @@ -371,7 +371,7 @@ func (ng *NodeGroup) SwitchAutoScalingOptionStatus(scalingOption *proto.ClusterA } // GetProjectCaResourceQuota get project ca resource quota -func (ng *NodeGroup) GetProjectCaResourceQuota(groups []proto.NodeGroup, +func (ng *NodeGroup) GetProjectCaResourceQuota(groups []proto.NodeGroup, // nolint opt *cloudprovider.CommonOption) ([]*proto.ProjectAutoscalerQuota, error) { // 仅统计CA云梯资源 & 获取项目下所有节点池的资源使用情况 & 资源quota情况 @@ -398,8 +398,6 @@ func (ng *NodeGroup) GetProjectCaResourceQuota(groups []proto.NodeGroup, filterGroups = append(filterGroups, groups[i]) } - - var ( lock = sync.Mutex{} insZoneQuota = make(map[string]map[string]*proto.ProjectAutoscalerQuota, 0) @@ -459,7 +457,9 @@ func (ng *NodeGroup) GetProjectCaResourceQuota(groups []proto.NodeGroup, } } else { insZoneQuota[group.GetLaunchTemplate().GetInstanceType()][zone].Used += uint32(num) - insZoneQuota[group.GetLaunchTemplate().GetInstanceType()][zone].GroupIds = append(insZoneQuota[group.GetLaunchTemplate().GetInstanceType()][zone].GroupIds, group.GetNodeGroupID()) + insZoneQuota[group.GetLaunchTemplate().GetInstanceType()][zone].GroupIds = append( + insZoneQuota[group.GetLaunchTemplate().GetInstanceType()][zone].GroupIds, + group.GetNodeGroupID()) } } @@ -478,8 +478,6 @@ func (ng *NodeGroup) GetProjectCaResourceQuota(groups []proto.NodeGroup, } } lock.Unlock() - - return }(filterGroups[i]) } barrier.Wait() diff --git a/bcs-services/bcs-cluster-manager/internal/cloudprovider/qcloud-public/nodegroupmgr.go b/bcs-services/bcs-cluster-manager/internal/cloudprovider/qcloud-public/nodegroupmgr.go index f554f69838..82ac0864d9 100644 --- a/bcs-services/bcs-cluster-manager/internal/cloudprovider/qcloud-public/nodegroupmgr.go +++ b/bcs-services/bcs-cluster-manager/internal/cloudprovider/qcloud-public/nodegroupmgr.go @@ -920,4 +920,3 @@ func (ng *NodeGroup) GetProjectCaResourceQuota(groups []proto.NodeGroup, opt *cloudprovider.CommonOption) ([]*proto.ProjectAutoscalerQuota, error) { return nil, nil } - diff --git a/bcs-services/bcs-cluster-manager/internal/remote/cmdb/types.go b/bcs-services/bcs-cluster-manager/internal/remote/cmdb/types.go index 5bb957855d..3182dface6 100644 --- a/bcs-services/bcs-cluster-manager/internal/remote/cmdb/types.go +++ b/bcs-services/bcs-cluster-manager/internal/remote/cmdb/types.go @@ -105,9 +105,9 @@ func (c Condition) String() string { } var ( - and Condition = "AND" - or Condition = "OR" - in Condition = "IN"// nolint + and Condition = "AND" // nolint + or Condition = "OR" // nolint + in Condition = "IN" // nolint ) // Page page @@ -297,11 +297,11 @@ type HostDetailData struct { } const ( - keyBizID = "BsiId" - keySvrIP = "SvrIp" - methodBusiness = "Business" - methodServer = "Server" - methodBusinessRaw = "BusinessRaw" + keyBizID = "BsiId" // nolint + keySvrIP = "SvrIp" // nolint + methodBusiness = "Business" // nolint + methodServer = "Server" // nolint + methodBusinessRaw = "BusinessRaw" // nolint ) // BizInfo business id info