Skip to content

Commit 48384f8

Browse files
committed
Allow the plugins to be public
1 parent 1a3db16 commit 48384f8

File tree

9 files changed

+44
-45
lines changed

9 files changed

+44
-45
lines changed

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ require (
1818
github.com/kubernetes-csi/csi-test/v5 v5.4.0
1919
github.com/prometheus/client_golang v1.23.2
2020
github.com/prometheus/common v0.67.5
21-
github.com/samber/lo v1.52.0
2221
github.com/spf13/pflag v1.0.10
2322
github.com/stretchr/testify v1.11.1
2423
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.64.0

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,6 @@ github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05Zp
210210
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
211211
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
212212
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
213-
github.com/samber/lo v1.52.0 h1:Rvi+3BFHES3A8meP33VPAxiBZX/Aws5RxrschYGjomw=
214-
github.com/samber/lo v1.52.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
215213
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
216214
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
217215
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=

pkg/driver/controller.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/internal"
3636
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/util"
3737
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/util/template"
38-
"github.com/samber/lo"
3938
"google.golang.org/grpc/codes"
4039
"google.golang.org/grpc/status"
4140
"google.golang.org/protobuf/types/known/timestamppb"
@@ -1210,7 +1209,7 @@ func newCreateVolumeResponse(disk *cloud.Disk, ctx map[string]string) *csi.Creat
12101209
}
12111210

12121211
segments := map[string]string{WellKnownZoneTopologyKey: disk.AvailabilityZone}
1213-
lo.Assign(segments, util.GetNodeSegments())
1212+
maps.Copy(segments, util.GetNodeSegments())
12141213

12151214
arn, err := arn.Parse(disk.OutpostArn)
12161215

pkg/driver/controller_test.go

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"errors"
2222
"fmt"
23+
"maps"
2324
"math/rand"
2425
"reflect"
2526
"strings"
@@ -36,7 +37,6 @@ import (
3637
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/internal"
3738
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/testutil"
3839
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/util"
39-
"github.com/samber/lo"
4040
"github.com/stretchr/testify/assert"
4141
"github.com/stretchr/testify/require"
4242
"google.golang.org/grpc/codes"
@@ -172,19 +172,21 @@ func TestCreateVolume(t *testing.T) {
172172
},
173173
},
174174
}
175+
expectedSegments := map[string]string{
176+
WellKnownZoneTopologyKey: expZone,
177+
AwsAccountIDKey: outpostArn.AccountID,
178+
AwsOutpostIDKey: outpostArn.Resource,
179+
AwsRegionKey: outpostArn.Region,
180+
AwsPartitionKey: outpostArn.Partition,
181+
}
182+
maps.Copy(expectedSegments, util.GetNodeSegments())
175183
expVol := &csi.Volume{
176184
CapacityBytes: stdVolSize,
177185
VolumeId: "vol-test",
178186
VolumeContext: map[string]string{},
179187
AccessibleTopology: []*csi.Topology{
180188
{
181-
Segments: lo.Assign(map[string]string{
182-
WellKnownZoneTopologyKey: expZone,
183-
AwsAccountIDKey: outpostArn.AccountID,
184-
AwsOutpostIDKey: outpostArn.Resource,
185-
AwsRegionKey: outpostArn.Region,
186-
AwsPartitionKey: outpostArn.Partition,
187-
}, util.GetNodeSegments()),
189+
Segments: expectedSegments,
188190
},
189191
},
190192
}
@@ -658,15 +660,17 @@ func TestCreateVolume(t *testing.T) {
658660
},
659661
},
660662
}
663+
expectedSegments := map[string]string{
664+
WellKnownZoneTopologyKey: expZone,
665+
}
666+
maps.Copy(expectedSegments, util.GetNodeSegments())
661667
expVol := &csi.Volume{
662668
CapacityBytes: stdVolSize,
663669
VolumeId: "vol-test",
664670
VolumeContext: map[string]string{},
665671
AccessibleTopology: []*csi.Topology{
666672
{
667-
Segments: lo.Assign(map[string]string{
668-
WellKnownZoneTopologyKey: expZone,
669-
}, util.GetNodeSegments()),
673+
Segments: expectedSegments,
670674
},
671675
},
672676
}
@@ -2169,15 +2173,17 @@ func TestCreateVolume(t *testing.T) {
21692173
},
21702174
},
21712175
}
2176+
expectedSegments := map[string]string{
2177+
WellKnownZoneTopologyKey: expZone,
2178+
}
2179+
maps.Copy(expectedSegments, util.GetNodeSegments())
21722180
expVol := &csi.Volume{
21732181
CapacityBytes: stdVolSize,
21742182
VolumeId: "vol-test",
21752183
VolumeContext: map[string]string{},
21762184
AccessibleTopology: []*csi.Topology{
21772185
{
2178-
Segments: lo.Assign(map[string]string{
2179-
WellKnownZoneTopologyKey: expZone,
2180-
}, util.GetNodeSegments()),
2186+
Segments: expectedSegments,
21812187
},
21822188
},
21832189
}

pkg/driver/node.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"encoding/json"
2222
"fmt"
23+
"maps"
2324
"os"
2425
"path/filepath"
2526
"runtime"
@@ -34,7 +35,6 @@ import (
3435
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/internal"
3536
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/mounter"
3637
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/util"
37-
"github.com/samber/lo"
3838
"google.golang.org/grpc/codes"
3939
"google.golang.org/grpc/status"
4040
corev1 "k8s.io/api/core/v1"
@@ -616,7 +616,7 @@ func (d *NodeService) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoReque
616616
WellKnownZoneTopologyKey: zone,
617617
OSTopologyKey: osType,
618618
}
619-
lo.Assign(segments, util.GetNodeSegments())
619+
maps.Copy(segments, util.GetNodeSegments())
620620

621621
outpostArn := d.metadata.GetOutpostArn()
622622

pkg/driver/node_test.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package driver
2121
import (
2222
"context"
2323
"errors"
24+
"maps"
2425
"reflect"
2526
"runtime"
2627
"strings"
@@ -34,7 +35,6 @@ import (
3435
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/internal"
3536
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/mounter"
3637
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/util"
37-
"github.com/samber/lo"
3838
"google.golang.org/grpc/codes"
3939
"google.golang.org/grpc/status"
4040
corev1 "k8s.io/api/core/v1"
@@ -2055,6 +2055,22 @@ func TestNodeGetCapabilities(t *testing.T) {
20552055
}
20562056

20572057
func TestNodeGetInfo(t *testing.T) {
2058+
expectedSegments := map[string]string{
2059+
ZoneTopologyKey: "us-west-2a",
2060+
WellKnownZoneTopologyKey: "us-west-2a",
2061+
OSTopologyKey: runtime.GOOS,
2062+
}
2063+
maps.Copy(expectedSegments, util.GetNodeSegments())
2064+
expectedSegmentsWithAWSKeys := map[string]string{
2065+
ZoneTopologyKey: "us-west-2a",
2066+
WellKnownZoneTopologyKey: "us-west-2a",
2067+
OSTopologyKey: runtime.GOOS,
2068+
AwsRegionKey: "us-west-2",
2069+
AwsPartitionKey: "aws",
2070+
AwsAccountIDKey: "123456789012",
2071+
AwsOutpostIDKey: "op-1234567890abcdef0",
2072+
}
2073+
maps.Copy(expectedSegmentsWithAWSKeys, util.GetNodeSegments())
20582074
testCases := []struct {
20592075
name string
20602076
metadataMock func(ctrl *gomock.Controller) *metadata.MockMetadataService
@@ -2073,11 +2089,7 @@ func TestNodeGetInfo(t *testing.T) {
20732089
expectedResp: &csi.NodeGetInfoResponse{
20742090
NodeId: "i-1234567890abcdef0",
20752091
AccessibleTopology: &csi.Topology{
2076-
Segments: lo.Assign(map[string]string{
2077-
ZoneTopologyKey: "us-west-2a",
2078-
WellKnownZoneTopologyKey: "us-west-2a",
2079-
OSTopologyKey: runtime.GOOS,
2080-
}, util.GetNodeSegments()),
2092+
Segments: expectedSegments,
20812093
},
20822094
},
20832095
},
@@ -2095,11 +2107,7 @@ func TestNodeGetInfo(t *testing.T) {
20952107
expectedResp: &csi.NodeGetInfoResponse{
20962108
NodeId: "i-1234567890abcdef0",
20972109
AccessibleTopology: &csi.Topology{
2098-
Segments: lo.Assign(map[string]string{
2099-
ZoneTopologyKey: "us-west-2a",
2100-
WellKnownZoneTopologyKey: "us-west-2a",
2101-
OSTopologyKey: runtime.GOOS,
2102-
}, util.GetNodeSegments()),
2110+
Segments: expectedSegments,
21032111
},
21042112
},
21052113
},
@@ -2122,15 +2130,7 @@ func TestNodeGetInfo(t *testing.T) {
21222130
expectedResp: &csi.NodeGetInfoResponse{
21232131
NodeId: "i-1234567890abcdef0",
21242132
AccessibleTopology: &csi.Topology{
2125-
Segments: lo.Assign(map[string]string{
2126-
ZoneTopologyKey: "us-west-2a",
2127-
WellKnownZoneTopologyKey: "us-west-2a",
2128-
OSTopologyKey: runtime.GOOS,
2129-
AwsRegionKey: "us-west-2",
2130-
AwsPartitionKey: "aws",
2131-
AwsAccountIDKey: "123456789012",
2132-
AwsOutpostIDKey: "op-1234567890abcdef0",
2133-
}, util.GetNodeSegments()),
2133+
Segments: expectedSegmentsWithAWSKeys,
21342134
},
21352135
},
21362136
},

pkg/plugin/plugin_common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ type EbsCsiPlugin interface {
7171
// GetDriverName replaces the driver name in use (normally "ebs.csi.aws.com")
7272
// This function can be called before Init and should not depend on it
7373
GetDriverName() string
74-
// GetSegments provides addational segments to be added as part of the driver and controllers
74+
// GetSegments provides additional segments to be added as part of the driver and controllers
7575
GetNodeSegments() map[string]string
7676
}
7777

tests/e2e/go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ require (
9393
github.com/prometheus/common v0.67.5 // indirect
9494
github.com/prometheus/procfs v0.19.2 // indirect
9595
github.com/robfig/cron/v3 v3.0.1 // indirect
96-
github.com/samber/lo v1.52.0 // indirect
9796
github.com/spf13/cobra v1.10.2 // indirect
9897
github.com/spf13/pflag v1.0.10 // indirect
9998
github.com/stoewer/go-strcase v1.3.1 // indirect

tests/e2e/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,6 @@ github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWN
382382
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
383383
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
384384
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
385-
github.com/samber/lo v1.52.0 h1:Rvi+3BFHES3A8meP33VPAxiBZX/Aws5RxrschYGjomw=
386-
github.com/samber/lo v1.52.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
387385
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
388386
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
389387
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=

0 commit comments

Comments
 (0)