Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,021 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ import ( | |
) | ||
|
||
const ( | ||
driverName = "fsx.csi.aws.com" | ||
DriverName = "fsx.csi.aws.com" | ||
) | ||
|
||
var ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/aws/aws-k8s-tester/e2e/tester" | ||
) | ||
|
||
func main() { | ||
tester.Start() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
cluster: | ||
kops: | ||
stateFile: s3://k8s-kops-csi-e2e | ||
zones: us-west-2a | ||
nodeCount: 3 | ||
nodeSize: c5.large | ||
kubernetesVersion: 1.15.3 | ||
featureGates: |2 | ||
kubeAPIServer: | ||
featureGates: | ||
CSIDriverRegistry: "true" | ||
CSINodeInfo: "true" | ||
CSIBlockVolume: "true" | ||
CSIMigration: "true" | ||
CSIMigrationAWS: "true" | ||
ExpandCSIVolumes: "true" | ||
VolumeSnapshotDataSource: "true" | ||
CSIInlineVolume: "true" | ||
kubeControllerManager: | ||
featureGates: | ||
CSIDriverRegistry: "true" | ||
CSINodeInfo: "true" | ||
CSIBlockVolume: "true" | ||
CSIMigration: "true" | ||
CSIMigrationAWS: "true" | ||
ExpandCSIVolumes: "true" | ||
CSIInlineVolume: "true" | ||
kubelet: | ||
featureGates: | ||
CSIDriverRegistry: "true" | ||
CSINodeInfo: "true" | ||
CSIBlockVolume: "true" | ||
CSIMigration: "true" | ||
CSIMigrationAWS: "true" | ||
ExpandCSIVolumes: "true" | ||
CSIInlineVolume: "true" | ||
iamPolicies: |2 | ||
additionalPolicies: | ||
node: | | ||
[ | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"iam:CreateServiceLinkedRole", | ||
"iam:AttachRolePolicy", | ||
"iam:PutRolePolicy" | ||
], | ||
"Resource": "arn:aws:iam::*:role/aws-service-role/s3.data-source.lustre.fsx.amazonaws.com/*" | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:*", | ||
"fsx:*" | ||
], | ||
"Resource": ["*"] | ||
} | ||
] | ||
build: | | ||
eval $(aws ecr get-login --region us-west-2 --no-include-email) | ||
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) | ||
IMAGE_TAG={{TEST_ID}} | ||
IMAGE_NAME=$AWS_ACCOUNT_ID.dkr.ecr.us-west-2.amazonaws.com/aws-fsx-csi-driver | ||
docker build -t $IMAGE_NAME:$IMAGE_TAG . | ||
docker push $IMAGE_NAME:$IMAGE_TAG | ||
install: | | ||
echo "Deploying driver" | ||
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) | ||
IMAGE_TAG={{TEST_ID}} | ||
IMAGE_NAME=$AWS_ACCOUNT_ID.dkr.ecr.us-west-2.amazonaws.com/aws-fsx-csi-driver | ||
sed -i'' "s,amazon/aws-fsx-csi-driver:latest,$IMAGE_NAME:$IMAGE_TAG," deploy/kubernetes/manifest.yaml | ||
kubectl apply -f deploy/kubernetes/manifest.yaml | ||
uninstall: | | ||
echo "Removing driver" | ||
kubectl delete -f deploy/kubernetes/manifest.yaml | ||
test: | | ||
export KUBECONFIG=$HOME/.kube/config | ||
cluster_name=test-cluster-{{TEST_ID}}.k8s.local | ||
cd tests/e2e | ||
go test ./ -v -timeout 0 --cluster-name=$cluster_name --region=us-west-2 --report-dir=$ARTIFACTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
Copyright 2018 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package e2e | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/aws/aws-sdk-go/service/ec2" | ||
) | ||
|
||
func getNodeInstance(clusterName string) (*ec2.Instance, error) { | ||
config := &aws.Config{ | ||
Region: region, | ||
} | ||
nodeName := fmt.Sprintf("nodes.%s", clusterName) | ||
svc := ec2.New(session.Must(session.NewSession(config))) | ||
request := &ec2.DescribeInstancesInput{ | ||
Filters: []*ec2.Filter{ | ||
{ | ||
Name: aws.String("tag:Name"), | ||
Values: []*string{aws.String(nodeName)}, | ||
}, | ||
}, | ||
} | ||
|
||
instances := []*ec2.Instance{} | ||
response, err := svc.DescribeInstances(request) | ||
if err != nil { | ||
return nil, err | ||
} | ||
for _, reservation := range response.Reservations { | ||
instances = append(instances, reservation.Instances...) | ||
} | ||
|
||
return instances[0], nil | ||
} | ||
|
||
func getSecurityGroupIds(node *ec2.Instance) []string { | ||
groups := []string{} | ||
for _, sg := range node.SecurityGroups { | ||
groups = append(groups, *sg.GroupId) | ||
} | ||
return groups | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package driver | ||
|
||
import ( | ||
"k8s.io/api/core/v1" | ||
storagev1 "k8s.io/api/storage/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
type PVTestDriver interface { | ||
DynamicPVTestDriver | ||
} | ||
|
||
// DynamicPVTestDriver represents an interface for a CSI driver that supports DynamicPV | ||
type DynamicPVTestDriver interface { | ||
// GetDynamicProvisionStorageClass returns a StorageClass dynamic provision Persistent Volume | ||
GetDynamicProvisionStorageClass(parameters map[string]string, mountOptions []string, reclaimPolicy *v1.PersistentVolumeReclaimPolicy, bindingMode *storagev1.VolumeBindingMode, allowedTopologyValues []string, namespace string) *storagev1.StorageClass | ||
} | ||
|
||
func getStorageClass( | ||
generateName string, | ||
provisioner string, | ||
parameters map[string]string, | ||
mountOptions []string, | ||
reclaimPolicy *v1.PersistentVolumeReclaimPolicy, | ||
bindingMode *storagev1.VolumeBindingMode, | ||
allowedTopologies []v1.TopologySelectorTerm, | ||
) *storagev1.StorageClass { | ||
if reclaimPolicy == nil { | ||
defaultReclaimPolicy := v1.PersistentVolumeReclaimDelete | ||
reclaimPolicy = &defaultReclaimPolicy | ||
} | ||
if bindingMode == nil { | ||
defaultBindingMode := storagev1.VolumeBindingImmediate | ||
bindingMode = &defaultBindingMode | ||
} | ||
return &storagev1.StorageClass{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
GenerateName: generateName, | ||
}, | ||
Provisioner: provisioner, | ||
Parameters: parameters, | ||
MountOptions: mountOptions, | ||
ReclaimPolicy: reclaimPolicy, | ||
VolumeBindingMode: bindingMode, | ||
AllowedTopologies: allowedTopologies, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package driver | ||
|
||
import ( | ||
"fmt" | ||
|
||
fsxcsidriver "github.com/kubernetes-sigs/aws-fsx-csi-driver/pkg/driver" | ||
"k8s.io/api/core/v1" | ||
storagev1 "k8s.io/api/storage/v1" | ||
) | ||
|
||
// Implement PVTestDriver interface | ||
type fsxCSIDriver struct { | ||
driverName string | ||
} | ||
|
||
// InitFSxCSIDriver returns fsxCSIDriver that implements DynamicPVTestDriver interface | ||
func InitFSxCSIDriver() PVTestDriver { | ||
return &fsxCSIDriver{ | ||
driverName: fsxcsidriver.DriverName, | ||
} | ||
} | ||
|
||
func (d *fsxCSIDriver) GetDynamicProvisionStorageClass(parameters map[string]string, mountOptions []string, reclaimPolicy *v1.PersistentVolumeReclaimPolicy, bindingMode *storagev1.VolumeBindingMode, allowedTopologyValues []string, namespace string) *storagev1.StorageClass { | ||
provisioner := d.driverName | ||
generateName := fmt.Sprintf("%s-%s-dynamic-sc-", namespace, provisioner) | ||
allowedTopologies := []v1.TopologySelectorTerm{} | ||
return getStorageClass(generateName, provisioner, parameters, mountOptions, reclaimPolicy, bindingMode, allowedTopologies) | ||
} |
Oops, something went wrong.