Skip to content

Commit 21163c4

Browse files
authored
Merge pull request kubernetes-sigs#441 from nppietra/update-dependencies
Update e2e test dependencies - Kubernetes, Ginkgo, pinned AMI, eksctl
2 parents 229d555 + 3588608 commit 21163c4

File tree

4,680 files changed

+621
-1730455
lines changed

Some content is hidden

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

4,680 files changed

+621
-1730455
lines changed

Dockerfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,34 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
ARG AL_VERSION=al23
1516
FROM --platform=$BUILDPLATFORM golang:1.24 as builder
1617
WORKDIR /go/src/github.com/kubernetes-sigs/aws-fsx-csi-driver
18+
COPY go.* .
19+
RUN go mod download
1720
COPY . .
1821
ARG TARGETOS
1922
ARG TARGETARCH
2023
RUN OS=$TARGETOS ARCH=$TARGETARCH make $TARGETOS/$TARGETARCH
2124

2225
# https://github.com/aws/eks-distro-build-tooling/blob/main/eks-distro-base/Dockerfile.minimal-base-csi-ebs#L36
23-
FROM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-csi-ebs-builder:latest-al2 as rpm-installer
24-
26+
FROM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-csi-ebs-builder:latest-${AL_VERSION} as rpm-installer
27+
ARG AL_VERSION
2528
# shallow install systemd and the kernel which are not needed in the final container image
2629
# since lustre is not run as a systemd service and the kernel module is node loaded via the container
2730
# to avoid pulling in a large tree of unnecessary dependencies
2831
RUN set -x && \
2932
enable_extra lustre && \
30-
clean_install "kernel systemd" true true && \
31-
clean_install lustre-client && \
33+
clean_install "kernel systemd" true true; \
34+
if [[ "${AL_VERSION}" == "al23" ]]; then \
35+
clean_install lustre-client; \
36+
else \
37+
clean_install lustre; \
38+
fi; \
3239
remove_package "kernel systemd" true && \
3340
cleanup "fsx-csi"
3441

35-
FROM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-csi-ebs:latest-al2 AS linux-amazon
42+
FROM public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-csi-ebs:latest-${AL_VERSION} AS linux-amazon
3643

3744
COPY --from=rpm-installer /newroot /
3845

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ word-hyphen = $(word $2,$(subst -, ,$1))
5353
.PHONY: linux/$(ARCH) bin/aws-fsx-csi-driver
5454
linux/$(ARCH): bin/aws-fsx-csi-driver
5555
bin/aws-fsx-csi-driver: | bin
56-
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -ldflags ${LDFLAGS} -o bin/aws-fsx-csi-driver ./cmd/
56+
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -mod=mod -ldflags ${LDFLAGS} -o bin/aws-fsx-csi-driver ./cmd/
5757

5858
.PHONY: all
5959
all: all-image-docker
@@ -89,6 +89,7 @@ image: .image-$(TAG)-$(OS)-$(ARCH)-$(OSVERSION)
8989
-t=$(IMAGE):$(TAG)-$(OS)-$(ARCH)-$(OSVERSION) \
9090
--build-arg=GOPROXY=$(GOPROXY) \
9191
--build-arg=VERSION=$(VERSION) \
92+
--build-arg=AL_VERSION=$(AL_VERSION) \
9293
`./hack/provenance` \
9394
.
9495
touch $@

hack/e2e/ecr.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function ecr_build_and_push() {
1818
set -e
1919
loudecho "Building and pushing test driver image to ${IMAGE_NAME}:${IMAGE_TAG}"
2020
aws ecr get-login-password --region "${REGION}" | docker login --username AWS --password-stdin "${AWS_ACCOUNT_ID}".dkr.ecr."${REGION}".amazonaws.com
21-
IMAGE=${IMAGE_NAME} TAG=${IMAGE_TAG} OS=linux ARCH=amd64 OSVERSION=amazon make image
21+
IMAGE=${IMAGE_NAME} TAG=${IMAGE_TAG} OS=linux ARCH=amd64 OSVERSION=amazon AL_VERSION="al23" make image
2222
docker tag "${IMAGE_NAME}":"${IMAGE_TAG}"-linux-amd64-amazon "${IMAGE_NAME}":"${IMAGE_TAG}"
2323
docker push "${IMAGE_NAME}":"${IMAGE_TAG}"
2424
fi

hack/e2e/kops.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function kops_create_cluster() {
3535
KOPS_PATCH_FILE=${10}
3636
KOPS_PATCH_NODE_FILE=${11}
3737
KOPS_STATE_FILE=${12}
38+
AMI_ID=${13}
3839

3940
generate_ssh_key "${SSH_KEY_PATH}"
4041

@@ -48,6 +49,7 @@ function kops_create_cluster() {
4849
--zones "${ZONES}" \
4950
--node-count="${NODE_COUNT}" \
5051
--node-size="${INSTANCE_TYPE}" \
52+
--image="${AMI_ID}" \
5153
--kubernetes-version="${K8S_VERSION}" \
5254
--dry-run \
5355
-o yaml \

hack/e2e/run.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,18 @@ IMAGE_TAG=${IMAGE_TAG:-${TEST_ID}}
4949

5050
# kops: must include patch version (e.g. 1.19.1)
5151
# eksctl: mustn't include patch version (e.g. 1.19)
52-
K8S_VERSION_KOPS=${K8S_VERSION_KOPS:-${K8S_VERSION:-1.23.0}}
53-
K8S_VERSION_EKSCTL=${K8S_VERSION_EKSCTL:-${K8S_VERSION:-1.23}}
52+
K8S_VERSION_KOPS=${K8S_VERSION_KOPS:-${K8S_VERSION:-1.32.0}}
53+
K8S_VERSION_EKSCTL=${K8S_VERSION_EKSCTL:-${K8S_VERSION:-1.32}}
5454

55-
KOPS_VERSION=${KOPS_VERSION:-1.23.1}
55+
KOPS_VERSION=${KOPS_VERSION:-1.32.0}
5656
KOPS_STATE_FILE=${KOPS_STATE_FILE:-s3://k8s-kops-csi-shared-e2e}
5757
KOPS_PATCH_FILE=${KOPS_PATCH_FILE:-./hack/kops-patch.yaml}
5858
KOPS_PATCH_NODE_FILE=${KOPS_PATCH_NODE_FILE:-./hack/kops-patch-node.yaml}
5959

60-
EKSCTL_VERSION=${EKSCTL_VERSION:-0.133.0}
60+
AMI_PARAMETER=${AMI_PARAMETER:-/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64}
61+
AMI_ID=$(aws ssm get-parameters --names ${AMI_PARAMETER} --region ${AWS_REGION} --query 'Parameters[0].Value' --output text)
62+
63+
EKSCTL_VERSION=${EKSCTL_VERSION:-0.208.0}
6164
EKSCTL_PATCH_FILE=${EKSCTL_PATCH_FILE:-./hack/eksctl-patch.yaml}
6265
EKSCTL_ADMIN_ROLE=${EKSCTL_ADMIN_ROLE:-}
6366

@@ -99,7 +102,7 @@ loudecho "Installing ginkgo to ${BIN_DIR}"
99102
GINKGO_BIN=${BIN_DIR}/ginkgo
100103
if [[ ! -e ${GINKGO_BIN} ]]; then
101104
pushd /tmp
102-
GOPATH=${TEST_DIR} GOBIN=${BIN_DIR} GO111MODULE=on go install github.com/onsi/ginkgo/ginkgo@v1.12.0
105+
GOPATH=${TEST_DIR} GOBIN=${BIN_DIR} GO111MODULE=on go install github.com/onsi/ginkgo/v2/ginkgo@v2.21.0
103106
popd
104107
fi
105108

@@ -121,7 +124,8 @@ if [[ "${CLUSTER_TYPE}" == "kops" ]]; then
121124
"$KUBECONFIG" \
122125
"$KOPS_PATCH_FILE" \
123126
"$KOPS_PATCH_NODE_FILE" \
124-
"$KOPS_STATE_FILE"
127+
"$KOPS_STATE_FILE" \
128+
"$AMI_ID"
125129
if [[ $? -ne 0 ]]; then
126130
exit 1
127131
fi
@@ -177,7 +181,7 @@ eval "EXPANDED_TEST_EXTRA_FLAGS=$TEST_EXTRA_FLAGS"
177181
set -x
178182
set +e
179183
pushd "${TEST_PATH}"
180-
${GINKGO_BIN} -p -nodes="${GINKGO_NODES}" -v --focus="${GINKGO_FOCUS}" --skip="${GINKGO_SKIP}" ./... -- -kubeconfig="${KUBECONFIG}" -report-dir="${ARTIFACTS}" -gce-zone="${FIRST_ZONE}" "${EXPANDED_TEST_EXTRA_FLAGS}"
184+
${GINKGO_BIN} -timeout 24h -p -nodes="${GINKGO_NODES}" -v --focus="${GINKGO_FOCUS}" --skip="${GINKGO_SKIP}" ./... -- -kubeconfig="${KUBECONFIG}" -report-dir="${ARTIFACTS}" -gce-zone="${FIRST_ZONE}" "${EXPANDED_TEST_EXTRA_FLAGS}"
181185
TEST_PASSED=$?
182186
set -e
183187
set +x

hack/kops-patch-node.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
spec:
2-
image: 137112412989/amzn2-ami-kernel-5.10-hvm-2.0.20240412.0-x86_64-gp2
32
instanceMetadata:
43
httpPutResponseHopLimit: 3

tester/e2e-test-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ uninstall: |
6565
helm delete aws-fsx-csi-driver --namespace kube-system
6666
6767
test: |
68-
go install github.com/onsi/ginkgo/ginkgo
68+
go install github.com/onsi/ginkgo/v2/ginkgo
6969
export KUBECONFIG=$HOME/.kube/config
7070
cluster_name=test-cluster-{{TEST_ID}}.k8s.local
7171
skip="\[Disruptive\]\
7272
|subPath.should.be.able.to.unmount.after.the.subpath.directory.is.deleted\
7373
|should.not.mount./.map.unused.volumes.in.a.pod"
74-
ginkgo -p -nodes=8 -skip=$skip -v ./tests/e2e -- --cluster-name=$cluster_name --region=us-west-2 --report-dir=$ARTIFACTS
74+
ginkgo -timeout 24h -p -nodes=8 -skip=$skip -v ./tests/e2e -- --cluster-name=$cluster_name --region=us-west-2 --report-dir=$ARTIFACTS

tests/e2e/cloud.go

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,53 @@ limitations under the License.
1515
package e2e
1616

1717
import (
18+
"context"
1819
"fmt"
1920

20-
"github.com/aws/aws-sdk-go/aws"
21-
"github.com/aws/aws-sdk-go/aws/session"
22-
"github.com/aws/aws-sdk-go/service/ec2"
23-
"github.com/aws/aws-sdk-go/service/s3"
21+
"github.com/aws/aws-sdk-go-v2/aws"
22+
"github.com/aws/aws-sdk-go-v2/config"
23+
"github.com/aws/aws-sdk-go-v2/service/ec2"
24+
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
25+
"github.com/aws/aws-sdk-go-v2/service/s3"
26+
"github.com/aws/aws-sdk-go-v2/service/s3/types"
2427
fsx "sigs.k8s.io/aws-fsx-csi-driver/pkg/cloud"
2528
)
2629

2730
type cloud struct {
28-
ec2client *ec2.EC2
29-
s3client *s3.S3
31+
ec2client *ec2.Client
32+
s3client *s3.Client
3033
fsx.Cloud
3134
}
3235

3336
func NewCloud(region string) *cloud {
34-
config := &aws.Config{
35-
Region: aws.String(region),
37+
config, _ := config.LoadDefaultConfig(context.Background(), config.WithRegion(region))
38+
39+
c, err := fsx.NewCloud(region)
40+
if err != nil {
41+
fmt.Sprintf("could not get NewCloud: %v", err)
42+
return nil
3643
}
37-
sess := session.Must(session.NewSession(config))
3844

3945
return &cloud{
40-
ec2.New(sess),
41-
s3.New(sess),
42-
fsx.NewCloud(region),
46+
ec2.NewFromConfig(config),
47+
s3.NewFromConfig(config),
48+
c,
4349
}
4450
}
4551

46-
func (c *cloud) getNodeInstance(clusterName string) (*ec2.Instance, error) {
52+
func (c *cloud) getNodeInstance(clusterName string) (*ec2types.Instance, error) {
4753
request := &ec2.DescribeInstancesInput{
48-
Filters: []*ec2.Filter{
54+
Filters: []ec2types.Filter{
4955
{
5056
Name: aws.String("tag:KubernetesCluster"),
51-
Values: []*string{aws.String(clusterName)},
57+
Values: []string{clusterName},
5258
},
5359
},
5460
}
5561

56-
instances := []*ec2.Instance{}
57-
response, err := c.ec2client.DescribeInstances(request)
62+
instances := []ec2types.Instance{}
63+
ctx := context.Background()
64+
response, err := c.ec2client.DescribeInstances(ctx, request)
5865
if err != nil {
5966
return nil, err
6067
}
@@ -66,15 +73,19 @@ func (c *cloud) getNodeInstance(clusterName string) (*ec2.Instance, error) {
6673
return nil, fmt.Errorf("no instances in cluster %q found", clusterName)
6774
}
6875

69-
return instances[0], nil
76+
return &instances[0], nil
7077
}
7178

72-
func (c *cloud) createS3Bucket(name string) error {
79+
func (c *cloud) createS3Bucket(name string, region string) error {
7380
request := &s3.CreateBucketInput{
7481
Bucket: aws.String(name),
82+
CreateBucketConfiguration: &types.CreateBucketConfiguration{
83+
LocationConstraint: types.BucketLocationConstraint(region),
84+
},
7585
}
7686

77-
_, err := c.s3client.CreateBucket(request)
87+
ctx := context.Background()
88+
_, err := c.s3client.CreateBucket(ctx, request)
7889
if err != nil {
7990
return err
8091
}
@@ -86,14 +97,15 @@ func (c *cloud) deleteS3Bucket(name string) error {
8697
Bucket: aws.String(name),
8798
}
8899

89-
_, err := c.s3client.DeleteBucket(request)
100+
ctx := context.Background()
101+
_, err := c.s3client.DeleteBucket(ctx, request)
90102
if err != nil {
91103
return err
92104
}
93105
return nil
94106
}
95107

96-
func getSecurityGroupIds(node *ec2.Instance) []string {
108+
func getSecurityGroupIds(node *ec2types.Instance) []string {
97109
groups := []string{}
98110
for _, sg := range node.SecurityGroups {
99111
groups = append(groups, *sg.GroupId)

tests/e2e/conformance_test.go

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ import (
1818
"context"
1919
"fmt"
2020

21-
. "github.com/onsi/ginkgo"
21+
. "github.com/onsi/ginkgo/v2"
2222
v1 "k8s.io/api/core/v1"
2323
"k8s.io/apimachinery/pkg/util/sets"
2424
"k8s.io/kubernetes/test/e2e/framework"
2525
storageframework "k8s.io/kubernetes/test/e2e/storage/framework"
2626
"k8s.io/kubernetes/test/e2e/storage/testsuites"
27-
"k8s.io/kubernetes/test/e2e/storage/utils"
2827
fsx "sigs.k8s.io/aws-fsx-csi-driver/pkg/cloud"
2928
fsxcsidriver "sigs.k8s.io/aws-fsx-csi-driver/pkg/driver"
3029
)
@@ -35,8 +34,7 @@ type fsxVolume struct {
3534
dnsName string
3635
}
3736

38-
func (v *fsxVolume) DeleteVolume() {
39-
ctx := context.Background()
37+
func (v *fsxVolume) DeleteVolume(ctx context.Context) {
4038
err := v.c.DeleteFileSystem(ctx, v.fileSystemId)
4139
if err != nil {
4240
Fail(fmt.Sprintf("failed to delete filesystem %s", err))
@@ -72,21 +70,15 @@ func (e *fsxDriver) GetDriverInfo() *storageframework.DriverInfo {
7270

7371
func (e *fsxDriver) SkipUnsupportedTest(storageframework.TestPattern) {}
7472

75-
func (e *fsxDriver) PrepareTest(f *framework.Framework) (*storageframework.PerTestConfig, func()) {
76-
By("PrepareTest")
77-
cancelPodLogs := utils.StartPodLogs(f, f.Namespace)
78-
73+
func (e *fsxDriver) PrepareTest(ctx context.Context, f *framework.Framework) *storageframework.PerTestConfig {
7974
return &storageframework.PerTestConfig{
80-
Driver: e,
81-
Prefix: "fsx",
82-
Framework: f,
83-
}, func() {
84-
By("Cleaning up FSx CSI driver")
85-
cancelPodLogs()
86-
}
75+
Driver: e,
76+
Prefix: "fsx",
77+
Framework: f,
78+
}
8779
}
8880

89-
func (e *fsxDriver) CreateVolume(config *storageframework.PerTestConfig, volType storageframework.TestVolType) storageframework.TestVolume {
81+
func (e *fsxDriver) CreateVolume(ctx context.Context, config *storageframework.PerTestConfig, volType storageframework.TestVolType) storageframework.TestVolume {
9082
c := NewCloud(*region)
9183
instance, err := c.getNodeInstance(*clusterName)
9284
if err != nil {
@@ -95,11 +87,11 @@ func (e *fsxDriver) CreateVolume(config *storageframework.PerTestConfig, volType
9587
securityGroupIds := getSecurityGroupIds(instance)
9688
subnetId := *instance.SubnetId
9789

98-
ctx := context.Background()
9990
options := &fsx.FileSystemOptions{
100-
CapacityGiB: 3600,
101-
SubnetId: subnetId,
102-
SecurityGroupIds: securityGroupIds,
91+
CapacityGiB: 3600,
92+
SubnetId: subnetId,
93+
SecurityGroupIds: securityGroupIds,
94+
FileSystemTypeVersion: "2.15",
10395
}
10496
ns := config.Framework.Namespace.Name
10597
volumeName := fmt.Sprintf("fsx-e2e-test-volume-%s", ns)
@@ -182,7 +174,10 @@ var csiTestSuites = []func() storageframework.TestSuite{
182174

183175
var _ = Describe("FSx CSI Driver Conformance", func() {
184176
driver := InitFSxCSIDriver()
185-
Context(storageframework.GetDriverNameWithFeatureTags(driver), func() {
177+
178+
args := storageframework.GetDriverNameWithFeatureTags(driver)
179+
args = append(args, func() {
186180
storageframework.DefineTestSuites(driver, csiTestSuites)
187181
})
182+
framework.Context(args...)
188183
})

0 commit comments

Comments
 (0)