Skip to content

Commit 0a6bdf5

Browse files
authored
Merge pull request #1560 from mowangdk/feature/support_lingjun_ebs_volume_count
Add max ebs volume count for lingjun node
2 parents 46b9226 + 7ec2ffd commit 0a6bdf5

File tree

204 files changed

+9287
-1038
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+9287
-1038
lines changed

docs/ram-policies/disk/node.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
"ecs:ListTagResources",
1818
"ecs:RemoveTags",
1919
"ecs:TagResources",
20-
"ecs:UntagResources"
20+
"ecs:UntagResources",
21+
"eflo:DescribeNode",
22+
"eflo:DescribeNodeType"
2123
],
2224
"Resource": [
2325
"*"

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ go 1.24.0
44

55
require (
66
github.com/alibabacloud-go/darabonba-openapi v0.1.16
7-
github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.12
8-
github.com/alibabacloud-go/eflo-controller-20221215/v2 v2.7.0
7+
github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.13
8+
github.com/alibabacloud-go/eflo-controller-20221215/v3 v3.0.0
99
github.com/alibabacloud-go/ens-20171110/v3 v3.0.2
1010
github.com/alibabacloud-go/nas-20170626/v4 v4.1.2
11-
github.com/alibabacloud-go/tea v1.3.12
11+
github.com/alibabacloud-go/tea v1.3.13
1212
github.com/aliyun/alibaba-cloud-sdk-go v1.63.107
1313
github.com/aliyun/credentials-go v1.4.8
1414
github.com/container-storage-interface/spec v1.10.0

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ github.com/alibabacloud-go/darabonba-map v0.0.2 h1:qvPnGB4+dJbJIxOOfawxzF3hzMnIp
3131
github.com/alibabacloud-go/darabonba-map v0.0.2/go.mod h1:28AJaX8FOE/ym8OUFWga+MtEzBunJwQGceGQlvaPGPc=
3232
github.com/alibabacloud-go/darabonba-openapi v0.1.16 h1:f6ZspWKTBurQzyLpZKMVxO51HAePY8aedicwuX3+E20=
3333
github.com/alibabacloud-go/darabonba-openapi v0.1.16/go.mod h1:ZjyqRbbZOaUBSh7keeH8VQN/BzCPvxCQwMuJGDdbmXQ=
34-
github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.11/go.mod h1:ue0+WkdPxpCB2JP3iaG4Iawayxp72kyT5uDbozQKaW8=
35-
github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.12 h1:e2yCrhtWd6Qcsy4he2OL+jIAU+93Lx9OcLlPRoFLT1w=
3634
github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.12/go.mod h1:f2wDpbM7hK9SvLIH09zSKVU1TsyemUNOqErMscMMl7c=
35+
github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.13 h1:Q00FU3H94Ts0ZIHDmY+fYGgB7dV9D/YX6FGsgorQPgw=
36+
github.com/alibabacloud-go/darabonba-openapi/v2 v2.1.13/go.mod h1:lxFGfobinVsQ49ntjpgWghXmIF0/Sm4+wvBJ1h5RtaE=
3737
github.com/alibabacloud-go/darabonba-signature-util v0.0.7 h1:UzCnKvsjPFzApvODDNEYqBHMFt1w98wC7FOo0InLyxg=
3838
github.com/alibabacloud-go/darabonba-signature-util v0.0.7/go.mod h1:oUzCYV2fcCH797xKdL6BDH8ADIHlzrtKVjeRtunBNTQ=
3939
github.com/alibabacloud-go/darabonba-string v1.0.0/go.mod h1:93cTfV3vuPhhEwGGpKKqhVW4jLe7tDpo3LUM0i0g6mA=
@@ -43,8 +43,8 @@ github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68/go.mod h1:6p
4343
github.com/alibabacloud-go/debug v1.0.0/go.mod h1:8gfgZCCAC3+SCzjWtY053FrOcd4/qlH6IHTI4QyICOc=
4444
github.com/alibabacloud-go/debug v1.0.1 h1:MsW9SmUtbb1Fnt3ieC6NNZi6aEwrXfDksD4QA6GSbPg=
4545
github.com/alibabacloud-go/debug v1.0.1/go.mod h1:8gfgZCCAC3+SCzjWtY053FrOcd4/qlH6IHTI4QyICOc=
46-
github.com/alibabacloud-go/eflo-controller-20221215/v2 v2.7.0 h1:gWbU9RrpLn+YwRCiWMOL/2UgKmuZ3Xqa6SWPV0t25u4=
47-
github.com/alibabacloud-go/eflo-controller-20221215/v2 v2.7.0/go.mod h1:9mZf3f2MQl8jEVX7CPBp0wD8Uxh6ifCyWqRZvtqfnA8=
46+
github.com/alibabacloud-go/eflo-controller-20221215/v3 v3.0.0 h1:pZLIXOMPzHy49K891UCgwC4ihgoUYnTwvK4VIExkwzs=
47+
github.com/alibabacloud-go/eflo-controller-20221215/v3 v3.0.0/go.mod h1:SKN9dFS7vtPV1hfeLYE0iu4lB8OiFWz/4lq6FRkdapc=
4848
github.com/alibabacloud-go/endpoint-util v1.1.0 h1:r/4D3VSw888XGaeNpP994zDUaxdgTSHBbVfZlzf6b5Q=
4949
github.com/alibabacloud-go/endpoint-util v1.1.0/go.mod h1:O5FuCALmCKs2Ff7JFJMudHs0I5EBgecXXxZRyswlEjE=
5050
github.com/alibabacloud-go/ens-20171110/v3 v3.0.2 h1:MOcjqAf7cACXaPKAv37WMjp7zHARcrdmGQm08PYiiPM=
@@ -63,9 +63,9 @@ github.com/alibabacloud-go/tea v1.1.11/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/Ke
6363
github.com/alibabacloud-go/tea v1.1.17/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A=
6464
github.com/alibabacloud-go/tea v1.1.20/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A=
6565
github.com/alibabacloud-go/tea v1.2.2/go.mod h1:CF3vOzEMAG+bR4WOql8gc2G9H3EkH3ZLAQdpmpXMgwk=
66-
github.com/alibabacloud-go/tea v1.3.11/go.mod h1:A560v/JTQ1n5zklt2BEpurJzZTI8TUT+Psg2drWlxRg=
67-
github.com/alibabacloud-go/tea v1.3.12 h1:ir2Io80UlBy1JHf7t+uCTxmaGQtiEta1WpV29NGJTkE=
6866
github.com/alibabacloud-go/tea v1.3.12/go.mod h1:A560v/JTQ1n5zklt2BEpurJzZTI8TUT+Psg2drWlxRg=
67+
github.com/alibabacloud-go/tea v1.3.13 h1:WhGy6LIXaMbBM6VBYcsDCz6K/TPsT1Ri2hPmmZffZ94=
68+
github.com/alibabacloud-go/tea v1.3.13/go.mod h1:A560v/JTQ1n5zklt2BEpurJzZTI8TUT+Psg2drWlxRg=
6969
github.com/alibabacloud-go/tea-utils v1.3.1/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE=
7070
github.com/alibabacloud-go/tea-utils v1.4.3 h1:8SzwmmRrOnQ09Hf5a9GyfJc0d7Sjv6fmsZoF4UDbFjo=
7171
github.com/alibabacloud-go/tea-utils v1.4.3/go.mod h1:KNcT0oXlZZxOXINnZBs6YvgOd5aYp9U67G+E3R8fcQw=

pkg/bmcpfs/controllerserver.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"strings"
2525

2626
openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
27-
efloclient "github.com/alibabacloud-go/eflo-controller-20221215/v2/client"
27+
efloclient "github.com/alibabacloud-go/eflo-controller-20221215/v3/client"
2828
nasclient "github.com/alibabacloud-go/nas-20170626/v4/client"
2929
"github.com/alibabacloud-go/tea/tea"
3030
alicred_old "github.com/aliyun/credentials-go/credentials"
@@ -122,6 +122,7 @@ func (cs *controllerServer) ControllerPublishVolume(ctx context.Context, req *cs
122122
if req.VolumeContext[_vpcMountTarget] == "" {
123123
return nil, status.Errorf(codes.InvalidArgument, "missing %q config in volume context as vsc mountpoint not supported", _vpcMountTarget)
124124
}
125+
klog.InfoS("ControllerPublishVolume: vsc mountpoint not supported, switch to vpc mountpoint", "nodeId", req.NodeId, "mt", mt)
125126
return &csi.ControllerPublishVolumeResponse{
126127
PublishContext: map[string]string{
127128
_networkType: networkTypeVPC,

pkg/bmcpfs/internal/vsc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"sync"
2525
"time"
2626

27-
efloclient "github.com/alibabacloud-go/eflo-controller-20221215/v2/client"
27+
efloclient "github.com/alibabacloud-go/eflo-controller-20221215/v3/client"
2828
nasclient "github.com/alibabacloud-go/nas-20170626/v4/client"
2929
"github.com/alibabacloud-go/tea/tea"
3030
"golang.org/x/time/rate"

pkg/cloud/eflointerface.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package cloud
2+
3+
import (
4+
eflo "github.com/alibabacloud-go/eflo-controller-20221215/v3/client"
5+
)
6+
7+
type EFLOInterface interface {
8+
DescribeNodeType(req *eflo.DescribeNodeTypeRequest) (*eflo.DescribeNodeTypeResponse, error)
9+
DescribeNode(request *eflo.DescribeNodeRequest) (*eflo.DescribeNodeResponse, error)
10+
}

pkg/cloud/eflomock.go

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/disk/disk.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"strings"
2323
"time"
2424

25+
efloclient "github.com/alibabacloud-go/eflo-controller-20221215/v3/client"
2526
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
2627
snapClientset "github.com/kubernetes-csi/external-snapshotter/client/v8/clientset/versioned"
2728
"github.com/kubernetes-sigs/alibaba-cloud-csi-driver/pkg/cloud/metadata"
@@ -68,6 +69,7 @@ type DISK struct {
6869
// GlobalConfig save global values for plugin
6970
type GlobalConfig struct {
7071
EcsClient *ecs.Client
72+
EfloClient *efloclient.Client
7173
Region string
7274
NodeID string
7375
DiskTagEnable bool
@@ -126,6 +128,11 @@ func NewDriver(m metadata.MetadataProvider, endpoint string, serviceType utils.S
126128
}
127129
client := newEcsClient(metadata.MustGet(m, metadata.RegionID), credentials.V1ProviderAdaptor(cred))
128130
GlobalConfigVar.EcsClient = client
131+
efloClient, err := newEfloClient(metadata.MustGet(m, metadata.RegionID))
132+
if err != nil {
133+
klog.Fatalf("Error building eflo client: %s", err.Error())
134+
}
135+
GlobalConfigVar.EfloClient = efloClient
129136

130137
// Create GRPC servers
131138
var servers common.Servers

pkg/disk/nodeserver.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,19 +829,24 @@ func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoReque
829829
return node, err
830830
}
831831

832+
lingjunID := getLingjunNodeID()
833+
832834
c := GlobalConfigVar.EcsClient
835+
efloc := GlobalConfigVar.EfloClient
833836
if maxVolumesNum == 0 {
834-
maxVolumesNum, err = getVolumeCountFromOpenAPI(getNode, c, ns.metadata, utilsio.RealDevTmpFS{})
837+
maxVolumesNum, err = getVolumeCountFromOpenAPI(getNode, c, efloc, ns.metadata, utilsio.RealDevTmpFS{}, lingjunID)
835838
} else {
836839
node, err = getNode()
837840
}
838841
if err != nil {
839842
return nil, err
840843
}
844+
841845
var diskTypes []string
842846
if !GlobalConfigVar.DiskAllowAllType {
843847
// If it's a Lingjun node, reuse Lingjun detection and report configured supported types
844-
if isLingjunNode(node) {
848+
if lingjunID != "" {
849+
klog.InfoS("lingjun node detected", "lingjunID", lingjunID)
845850
ebsCategory := os.Getenv("EBS_CATEGORY_LINGJUN_SUPPORTED")
846851
// Prefer values parsed from kube-system/csi-plugin configmap
847852
diskTypes = parseLingjunNodeDiskTypes(ebsCategory)
@@ -886,6 +891,14 @@ func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoReque
886891
segments[v1.LabelTopologyZone] = metadata.MustGet(ns.metadata, metadata.ZoneID)
887892
}
888893

894+
// disable disk allocation when maxVolumesNum is 0
895+
// events:
896+
// Warning ProvisioningFailed diskplugin.csi.alibabacloud.com_csi-provisioner
897+
// failed to provision volume with StorageClass "alicloud-disk-essd": error generating accessibility requirements: no available topology found
898+
if maxVolumesNum == 0 {
899+
segments = map[string]string{}
900+
}
901+
889902
return &csi.NodeGetInfoResponse{
890903
NodeId: ns.NodeID,
891904
MaxVolumesPerNode: int64(maxVolumesNum),

0 commit comments

Comments
 (0)