Skip to content

Commit d232697

Browse files
authored
Merge pull request #3 from PatrickGhadban/main
Update README and provisioner name
2 parents 8577929 + 7e62e2a commit d232697

File tree

12 files changed

+156
-127
lines changed

12 files changed

+156
-127
lines changed

README.md

Lines changed: 63 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
[![Build Status](https://travis-ci.org/aws/aws-fsx-csi-driver.svg?branch=master)](https://travis-ci.org/aws/aws-fsx-csi-driver)
1+
[![Build Status](https://travis-ci.org/kubernetes-sigs/aws-file-cache-csi-driver.svg?branch=master)](https://travis-ci.org/kubernetes-sigs/aws-fsx-csi-driver)
2+
[![Coverage Status](https://coveralls.io/repos/github/kubernetes-sigs/aws-file-cache-csi-driver/badge.svg?branch=master)](https://coveralls.io/github/kubernetes-sigs/aws-file-cache-csi-driver?branch=master)
3+
[![Go Report Card](https://goreportcard.com/badge/github.com/kubernetes-sigs/aws-file-cache-csi-driver)](https://goreportcard.com/report/github.com/kubernetes-sigs/aws-file-cache-csi-driver)
24

35
**WARNING**: This driver is in pre ALPHA currently. This means that there may potentially be backwards compatible breaking changes moving forward. Do NOT use this driver in a production environment in its current state.
46

@@ -16,91 +18,101 @@ This driver is in alpha stage. Basic volume operations that are functional inclu
1618
|---------------------------------------------------|-------|
1719
| master branch | yes |
1820

19-
### Kubernetes Version Compability Matrix
20-
| AWS File Cache CSI Driver \ Kubernetes Version | v1.17+ |
21-
|---------------------------------------------------|--------|
22-
| master branch | yes |
23-
24-
## Features
21+
### Features
2522
Currently only static provisioning is supported. With static provisioning, a file cache should be created manually, then it could be mounted inside container as a persistence volume (PV) using File Cache CSI Driver.
2623

2724
The following CSI interfaces are implemented:
2825
* Controller Service:
2926
* Node Service: NodePublishVolume, NodeUnpublishVolume, NodeGetCapabilities, NodeGetInfo, NodeGetId
3027
* Identity Service: GetPluginInfo, GetPluginCapabilities, Probe
3128

32-
## Examples
33-
This example shows how to make an Amazon File Cache availble inside container for the application to consume. Before this, get yourself familiar with how to setup kubernetes on AWS and [create an Amazon file cache](https://docs.aws.amazon.com/fsx/latest/FileCacheGuide/getting-started.html). And when creating an Amazon File Cache, make sure it is created inside the same VPC as kuberentes cluster or it is accessible through VPC peering.
29+
## Amazon File Cache CSI Driver on Kubernetes
3430

35-
Once kubernetes cluster and an Amazon File Cache is created, create secret manifest file using [secret.yaml](../deploy/kubernetes/secret.yaml).
31+
---------
32+
The following sections are Kubernetes-specific. If you are a Kubernetes user, use the following for driver features, installation steps and examples.
3633

37-
Then create the secret object:
38-
```sh
39-
kubectl apply -f deploy/kubernetes/secret.yaml
40-
```
34+
### Kubernetes Version Compability Matrix
35+
| AWS File Cache CSI Driver \ Kubernetes Version | v1.24+ |
36+
|---------------------------------------------------|--------|
37+
| master branch | yes |
38+
39+
### Container Images
40+
| File Cache CSI Driver Version | Image |
41+
|-------------------------------|---------------------------------------------------------------|
42+
| master branch | public.ecr.aws/fsx-csi-driver/aws-filecache-csi-driver:latest |
43+
44+
### Features
45+
* Static provisioning - Amazon File Cache needs to be created manually first, then it could be mounted inside container as a volume using the Driver.
46+
* Dynamic provisioning (currently not supported) - uses persistent volume claim (PVC) to let Kubernetes create the Amazon File Cache for you and consumes the volume from inside container.
47+
* Mount options - mount options can be specified in storageclass to define how the volume should be mounted.
4148

42-
Deploy the Amazon file cache CSI driver:
49+
**Notes**:
50+
* For dynamically provisioned volumes, only one subnet is allowed inside a storageclass's `parameters.subnetId`. This is a [limitation](https://docs.aws.amazon.com/fsx/latest/APIReference/API_FileCacheCreating.html#FSx-Type-FileCacheCreating-SubnetIds) that is enforced by Amazon File Cache.
51+
52+
### Installation
53+
#### Set up driver permission
54+
The driver requires IAM permission to talk to Amazon File Cache service to create/delete the filecache on user's behalf. There are several methods to grant driver IAM permission:
55+
* Using secret object - create an IAM user with proper permission, put that user's credentials in [secret manifest](../deploy/kubernetes/secret.yaml) then deploy the secret.
4356

4457
```sh
45-
kubectl apply -k deploy/kubernetes/base/
58+
curl https://raw.githubusercontent.com/kubernetes-sigs/aws-file-cache-csi-driver/master/deploy/kubernetes/secret.yaml > secret.yaml
59+
# Edit the secret with user credentials
60+
kubectl apply -f secret.yaml
4661
```
4762

48-
Edit the [persistence volume manifest file](../examples/kubernetes/static_provisioning/specs/pv.yaml):
63+
* Using worker node instance profile - grant all the worker nodes with proper permission by attach policy to the instance profile of the worker.
4964
```sh
50-
apiVersion: v1
51-
kind: PersistentVolume
52-
metadata:
53-
name: fc-pv
54-
spec:
55-
capacity:
56-
storage: 1200Gi
57-
volumeMode: FileCache
58-
accessModes:
59-
- ReadWriteOnce
60-
persistentVolumeReclaimPolicy: Recycle
61-
storageClassName: fc-sc
62-
csi:
63-
driver: file.cache.csi.aws.com
64-
volumeHandle: [FileCacheId]
65-
volumeAttributes:
66-
dnsname: [DNSName]
65+
`kubectl annotate serviceaccount -n kube-system file-cache-csi-controller-sa \
66+
eks.amazonaws.com/role-arn=arn:aws:iam::111111111111:role/AmazonEKSFileCacheCSIDriverFullAccess --overwrite=true
6767
```
68-
Replace `volumeHandle` with `FileCacheId` and `dnsname` with `DNSName`. You can get both `FileCacheId` and `DNSName` using AWS CLI:
6968

69+
70+
#### Deploy driver
7071
```sh
71-
aws fsx describe-file-caches
72+
kubectl apply -k deploy/kubernetes/base/
7273
```
7374

74-
Then create PV, persistence volume claim (PVC) and storage class:
75+
TODO: Add helm installation option
7576
```sh
76-
kubectl apply -f examples/kubernetes/dynamic_provisioning/specs/storageclass.yaml
77-
kubectl apply -f examples/kubernetes/dynamic_provisioning/specs/pv.yaml
78-
kubectl apply -f examples/kubernetes/dynamic_provisioning/specs/claim.yaml
79-
kubectl apply -f examples/kubernetes/dynamic_provisioning/specs/pod.yaml
77+
8078
```
8179

82-
After objects are created, verify that pod is running:
8380

84-
```sh
85-
kubectl get pods
86-
```
8781

88-
Make sure data is written onto Amazon File Cache:
8982

90-
```sh
91-
kubectl exec -ti fc-app -- df -h
92-
kubectl exec -it fc-app -- ls /data
93-
```
83+
84+
------------------
85+
86+
87+
### Examples
88+
Before the example, you need to:
89+
* Get yourself familiar with how to setup Kubernetes on AWS and [create Anmazon File Cache](https://docs.aws.amazon.com/fsx/latest/FileCacheGuide/getting-started.html) if you are using static provisioning.
90+
* When creating Amazon File Cache, make sure its VPC is accessible from Kuberenetes cluster's VPC and network traffic is allowed by security group.
91+
* For FSx for Lustre VPC, you can either create an Amazon File Cache inside the same VPC as Kubernetes cluster or using VPC peering.
92+
* For security group, make sure port 988 is allowed for the security groups that are attached the lustre filesystem ENI.
93+
* Install Amazon File Cache CSI driver following the [Installation](README.md#Installation) steps.
94+
95+
#### Example Links
96+
* [Static provisioning](examples/kubernetes/static_provisioning/README.md)
97+
* [Dynamic provisioning](examples/kubernetes/dynamic_provisioning/README.md)
98+
* [Accessing the filesystem from multiple pods](examples/kubernetes/multiple_pods/README.md)
9499
95100
## Development
101+
102+
----
96103
Please go through [CSI Spec](https://github.com/container-storage-interface/spec/blob/master/spec.md) and [General CSI driver development guideline](https://kubernetes-csi.github.io/docs/Development.html) to get some basic understanding of CSI driver before you start.
97104
98105
### Requirements
99-
* Golang 1.9+
106+
* Golang 1.19.0+
107+
108+
### Dependency
109+
Dependencies are managed through go module. To build the project, first turn on go mod using `export GO111MODULE=on`, to build the project run: `make`
100110
101111
### Testing
102112
To execute all unit tests, run: `make test`
103113
104114
## License
115+
116+
----
105117
This library is licensed under the Apache 2.0 License.
106118

deploy/kubernetes/base/csidriver.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
apiVersion: storage.k8s.io/v1
44
kind: CSIDriver
55
metadata:
6-
name: file.cache.csi.aws.com
6+
name: filecache.csi.aws.com
77
spec:
88
attachRequired: false

deploy/kubernetes/base/node-daemonset.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ spec:
6969
- name: ADDRESS
7070
value: /csi/csi.sock
7171
- name: DRIVER_REG_SOCK_PATH
72-
value: /var/lib/kubelet/plugins/file.cache.csi.aws.com/csi.sock
72+
value: /var/lib/kubelet/plugins/filecache.csi.aws.com/csi.sock
7373
- name: KUBE_NODE_NAME
7474
valueFrom:
7575
fieldRef:
@@ -99,5 +99,5 @@ spec:
9999
type: Directory
100100
- name: plugin-dir
101101
hostPath:
102-
path: /var/lib/kubelet/plugins/file.cache.csi.aws.com/
102+
path: /var/lib/kubelet/plugins/filecache.csi.aws.com/
103103
type: DirectoryOrCreate

examples/kubernetes/dynamic_provisioning/README.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,45 @@
11
## Dynamic Provisioning Example
2+
3+
---
4+
25
*~Not yet supported~*
36

4-
This example shows how to create an Amazon File Cache using persistence volume claim (PVC) and consumes it from a pod.
7+
This example shows how to create an Amazon File Cache using persistence volume claim (PVC) and consumes it from a pod. Please see the [CreateFileCache API Reference](https://docs.aws.amazon.com/fsx/latest/APIReference/API_CreateFileCache.html#FSx-CreateFileCache-request-DataRepositoryAssociations) for more information.
58

69

7-
### Edit [StorageClass](./specs/storageclass.yaml)
10+
### Edit [StorageClass](specs/storageclass.yaml)
811
```sh
912
kind: StorageClass
1013
apiVersion: storage.k8s.io/v1
1114
metadata:
1215
name: fc-sc
13-
provisioner: file.cache.csi.aws.com
16+
provisioner: filecache.csi.aws.com
1417
parameters:
15-
subnetId: subnet-0eabfaa81fb22bcaf
16-
securityGroupIds: sg-068000ccf82dfba88
17-
dataRepositoryAssociations: "fileCachePath=/ns1/,dataRepositoryPath=nfs://10.0.92.69/fsx/"
18+
subnetId: [SubnetId]
19+
securityGroupIds: [SecurityGroupId]
20+
dataRepositoryAssociations: [DataRepositoryAssociations]
21+
kmsKeyId: [KmsKeyId]
22+
copyTagsToDataRepositoryAssociations: "false"
1823
fileCacheType: "LUSTRE"
1924
fileCacheTypeVersion: "2.12"
20-
LustreConfiguration: "{DeploymentType=CACHE_1,MetadataConfiguration=2400,perUnitStorageThroughput=1000}"
21-
weeklyMaintenanceStartTime: "6:00:00"
25+
LustreConfiguration: "DeploymentType=CACHE_1,PerUnitStorageThroughput=1000,MetadataConfiguration={StorageCapacity=2400}"
26+
weeklyMaintenanceStartTime: "d:HH:MM"
2227
extraTags: "Tag1=Value1,Tag2=Value2"
2328
```
29+
*Update the parameters not marked as optional below.*
30+
2431
* subnetId - The subnet ID that the Amazon File Cache should be created inside.
25-
* securityGroupIds - A comma separated list of security group IDs that should be attached to the filecache
26-
* dataRepositoryAssociations - A list of IDs of data repository associations that are associated with this cache.
32+
* securityGroupIds - A comma separated list of security group IDs that should be attached to the file cache.
33+
* dataRepositoryAssociations - A space separated ist of up to 8 configurations for data repository associations (DRAs) to be created during the cache creation. The DRAs link the cache to either an Amazon S3 data repository or a Network File System (NFS) data repository that supports the NFSv3 protocol. Please see [DataRepositoryAssociations](https://docs.aws.amazon.com/fsx/latest/APIReference/API_CreateFileCache.html#FSx-CreateFileCache-request-DataRepositoryAssociations) for the File Cache DRA configurations requirements.
34+
* copyTagsToDataRepositoryAssociations - A boolean flag indicating whether tags for the cache should be copied to data repository associations. This value defaults to false.
2735
* fileCacheType (Optional) - The type of cache, which must be LUSTRE.
2836
* fileCacheTypeVersion (Optional) - The Lustre version of the cache, which must be 2.12.
29-
* LustreConfiguration (Optional) - The configuration for the Amazon File Cache resource, please view [FileCacheLustreConfiguration](https://docs.aws.amazon.com/fsx/latest/APIReference/API_FileCacheLustreConfiguration.html) for more details on the contents.
3037
* weeklyMaintenanceStartTime (Optional) - The preferred start time to perform weekly maintenance, formatted d:HH:MM in the UTC time zone, where d is the weekday number, from 1 through 7, beginning with Monday and ending with Sunday. The default value is "7:09:00" (Sunday 09:00 UTC)
38+
* kmsKeyId (Optional) - Specifies the ID of the Key Management Service (KMS) key to use for encrypting data on an Amazon File Cache. If a KmsKeyId isn't specified, the Amazon FSx-managed KMS key for your account is used.
39+
* LustreConfiguration (Optional) - The configuration for the Amazon File Cache resource, please view [FileCacheLustreConfiguration](https://docs.aws.amazon.com/fsx/latest/APIReference/API_FileCacheLustreConfiguration.html) for more details on the contents.
40+
* DeploymentType - Specifies the cache deployment type, which must be CACHE_1
41+
* PerUnitStorageThroughput - Provisions the amount of read and write throughput for each 1 tebibyte (TiB) of cache storage capacity, in MB/s/TiB. The only supported value is 1000.
42+
* MetadataConfiguration - The configuration for a Lustre MDT (Metadata Target) storage volume. The storage capacity of the Lustre MDT (Metadata Target) storage volume in gibibytes (GiB). The only supported value is 2400 GiB.
3143
* extraTags (Optional) - Tags that will be set on the FSx resource created in AWS, in the form of a comma separated list with each tag delimited by an equals sign (example - "Tag1=Value1,Tag2=Value2") . Default is a single tag with CSIVolumeName as the key and the generated volume name as it's value.
3244

3345
### Edit [Persistent Volume Claim Spec](./specs/claim.yaml)
@@ -44,7 +56,7 @@ spec:
4456
requests:
4557
storage: 1200Gi
4658
```
47-
Update `spec.resource.requests.storage` with the storage capacity to request. The storage capacity value will be rounded up to 1200 GiB, 2400 GiB, or a multiple of 3600 GiB for SSD. If the storageType is specified as HDD, the storage capacity will be rounded up to 6000 GiB or a multiple of 6000 GiB if the perUnitStorageThroughput is 12, or rounded up to 1800 or a multiple of 1800 if the perUnitStorageThroughput is 40.
59+
*Update `spec.resource.requests.storage` with the storage capacity to request. The storage capacity value will be rounded up to 1200 GiB, 2400 GiB, or a multiple of 2400 GiB.*
4860

4961
### Deploy the Application
5062
Create PVC, storageclass and the pod that consumes the PV:
@@ -64,5 +76,5 @@ After the objects are created, verify that pod is running:
6476
Also verify that data is written onto Amazon File Cache:
6577

6678
```sh
67-
>> kubectl exec -ti fsx-app -- tail -f /data/out.txt
79+
>> kubectl exec -ti fc-app -- tail -f /data/out.txt
6880
```

examples/kubernetes/dynamic_provisioning/specs/pv.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

examples/kubernetes/dynamic_provisioning/specs/storageclass.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ kind: StorageClass
22
apiVersion: storage.k8s.io/v1
33
metadata:
44
name: fc-sc
5-
provisioner: file.cache.csi.aws.com
5+
provisioner: filecache.csi.aws.com
66
parameters:
7-
subnetId: subnet-0eabfaa81fb22bcaf
8-
securityGroupIds: sg-068000ccf82dfba88
9-
dataRepositoryAssociations: "fileCachePath=/ns1/,dataRepositoryPath=nfs://10.0.92.69/fsx/"
10-
fileCacheType: "Lustre"
7+
subnetId: "subnet-0d7b5e117ad7b4961"
8+
securityGroupIds: "sg-05a37bfe01467059"
9+
dataRepositoryAssociations: "FileCachePath=/ns1/,DataRepositoryPath=nfs://10.0.92.69/fsx/,NFS={Version=NFS3} FileCachePath=/ns2/,DataRepositoryPath=nfs://19.12.12.12/fsx/,NFS={Version=NFS3}"
10+
fileCacheType(Optional): "Lustre"
1111
fileCacheTypeVersion(Optional): "2.12"
12-
weeklyMaintenanceStartTime: "6:00:00"
13-
LustreConfiguration: "{DeploymentType=CACHE_1,MetadataConfiguration=2400,perUnitStorageThroughput=1000}"
14-
extraTags: "Tag1=Value1,Tag2=Value2"
12+
weeklyMaintenanceStartTime(Optional): "7:09:00"
13+
LustreConfiguration(Optional): "DeploymentType=CACHE_1,PerUnitStorageThroughput=1000,MetadataConfiguration={StorageCapacity=2400}"
1514
mountOptions:
1615
- flock

0 commit comments

Comments
 (0)