Skip to content

Commit

Permalink
Merge pull request #334 from jacobwolfaws/release-0.10
Browse files Browse the repository at this point in the history
Cherry-picking commits from master
  • Loading branch information
k8s-ci-robot authored Jun 22, 2023
2 parents dc97e0a + 35abe3e commit 307682f
Show file tree
Hide file tree
Showing 23 changed files with 182 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bug report
about: Create a report to help us improve EBS CSI Driver
about: Create a report to help us improve the FSx for Lustre CSI Driver
labels:

---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ spec:
{{- with .Values.controller.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
hostNetwork: true
serviceAccountName: {{ .Values.controller.serviceAccount.name }}
priorityClassName: system-cluster-critical
tolerations:
Expand Down Expand Up @@ -66,6 +65,10 @@ spec:
name: aws-secret
key: access_key
optional: true
{{- with .Values.controller.region }}
- name: AWS_REGION
value: {{ . }}
{{- end }}
volumeMounts:
- name: socket-dir
mountPath: /var/lib/csi/sockets/pluginproxy/
Expand Down
1 change: 0 additions & 1 deletion charts/aws-fsx-csi-driver/templates/node-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ spec:
{{- with .Values.node.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
hostNetwork: true
dnsPolicy: {{ .Values.node.dnsPolicy }}
{{- with .Values.node.dnsConfig }}
dnsConfig: {{- toYaml . | nindent 8 }}
Expand Down
13 changes: 9 additions & 4 deletions charts/aws-fsx-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ sidecars:
livenessProbe:
image:
repository: public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe
tag: v2.10.0-eks-1-26-9
tag: v2.10.0-eks-1-27-5
pullPolicy: IfNotPresent
resources: {}
nodeDriverRegistrar:
image:
repository: public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar
tag: v2.8.0-eks-1-26-9
tag: v2.8.0-eks-1-27-5
pullPolicy: IfNotPresent
logLevel: 2
resources: {}
provisioner:
image:
repository: public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner
tag: v3.5.0-eks-1-26-9
tag: v3.5.0-eks-1-27-5
pullPolicy: IfNotPresent
logLevel: 2
resources: {}
resizer:
image:
repository: public.ecr.aws/eks-distro/kubernetes-csi/external-resizer
tag: v1.8.0-eks-1-26-9
tag: v1.8.0-eks-1-27-5
pullPolicy: IfNotPresent
logLevel: 2
resources: {}
Expand All @@ -54,6 +54,11 @@ controller:
annotations: {}
logLevel: 2
podAnnotations: {}
# AWS region to use. If not specified then the region will be looked up via the AWS EC2 metadata
# service.
# ---
# region: us-east-1
region:
tolerations:
- key: CriticalAddonsOnly
operator: Exists
Expand Down
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func main() {
drv, err := driver.NewDriver(
driver.WithEndpoint(options.ServerOptions.Endpoint),
driver.WithMode(options.ServerOptions.DriverMode),
driver.WithExtraTags(options.ControllerOptions.ExtraTags),
)

if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions cmd/options/controller_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import (

// ControllerOptions contains options and configuration settings for the controller service.
type ControllerOptions struct {
// ExtraTags is a map of tags that will be attached to each dynamically provisioned resource.
ExtraTags string
}

func (s *ControllerOptions) AddFlags(fs *flag.FlagSet) {
fs.StringVar(&s.ExtraTags, "extra-tags", "", "Extra tags to attach to each dynamically provisioned resource. It is a comma separated list of key value pairs like '<key1>=<value1>,<key2>=<value2>'")
}
7 changes: 3 additions & 4 deletions deploy/kubernetes/base/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ spec:
spec:
nodeSelector:
kubernetes.io/os: linux
hostNetwork: true
serviceAccountName: fsx-csi-controller-sa
priorityClassName: system-cluster-critical
tolerations:
Expand Down Expand Up @@ -73,7 +72,7 @@ spec:
periodSeconds: 2
failureThreshold: 5
- name: csi-provisioner
image: public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner:v3.5.0-eks-1-26-9
image: public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner:v3.5.0-eks-1-27-5
args:
- --csi-address=$(ADDRESS)
- --v=2
Expand All @@ -87,7 +86,7 @@ spec:
- name: socket-dir
mountPath: /var/lib/csi/sockets/pluginproxy/
- name: csi-resizer
image: public.ecr.aws/eks-distro/kubernetes-csi/external-resizer:v1.8.0-eks-1-26-9
image: public.ecr.aws/eks-distro/kubernetes-csi/external-resizer:v1.8.0-eks-1-27-5
args:
- --csi-address=$(ADDRESS)
- --v=2
Expand All @@ -100,7 +99,7 @@ spec:
- name: socket-dir
mountPath: /var/lib/csi/sockets/pluginproxy/
- name: liveness-probe
image: public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe:v2.10.0-eks-1-26-9
image: public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe:v2.10.0-eks-1-27-5
args:
- --csi-address=/csi/csi.sock
- --health-port=9910
Expand Down
5 changes: 2 additions & 3 deletions deploy/kubernetes/base/node-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ spec:
spec:
nodeSelector:
kubernetes.io/os: linux
hostNetwork: true
dnsPolicy: ClusterFirst
serviceAccountName: fsx-csi-node-sa
priorityClassName: system-node-critical
Expand Down Expand Up @@ -62,7 +61,7 @@ spec:
periodSeconds: 2
failureThreshold: 5
- name: node-driver-registrar
image: public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar:v2.8.0-eks-1-26-9
image: public.ecr.aws/eks-distro/kubernetes-csi/node-driver-registrar:v2.8.0-eks-1-27-5
imagePullPolicy: IfNotPresent
args:
- --csi-address=$(ADDRESS)
Expand All @@ -83,7 +82,7 @@ spec:
- name: registration-dir
mountPath: /registration
- name: liveness-probe
image: public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe:v2.10.0-eks-1-26-9
image: public.ecr.aws/eks-distro/kubernetes-csi/livenessprobe:v2.10.0-eks-1-27-5
imagePullPolicy: IfNotPresent
args:
- --csi-address=/csi/csi.sock
Expand Down
9 changes: 5 additions & 4 deletions docs/options.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Driver Options
There are a couple of driver options that can be passed as arguments when starting the driver container.

| Option argument | value sample | default | Description |
|-----------------------------|---------------------------------------------------|-----------------------------------------------------|---------------------|
| endpoint | tcp://127.0.0.1:10000/ | unix:///var/lib/csi/sockets/pluginproxy/csi.sock | The socket on which the driver will listen for CSI RPCs|
| logging-format | json | text | Sets the log format. Permitted formats: text, json|
| Option argument | value sample | default | Description |
|-----------------------------|---------------------------------------------------|-----------------------------------------------------|---------------------------------------------------------------------------------------------|
| endpoint | tcp://127.0.0.1:10000/ | unix:///var/lib/csi/sockets/pluginproxy/csi.sock | The socket on which the driver will listen for CSI RPCs |
| extra-tags | key1=value1,key2=value2 | | Tags specified in the controller spec are attached to each dynamically provisioned resource |
| logging-format | json | text | Sets the log format. Permitted formats: text, json |
2 changes: 1 addition & 1 deletion examples/kubernetes/dynamic_provisioning/specs/pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
containers:
- name: app
image: centos
image: amazonlinux:2
command: ["/bin/sh"]
args: ["-c", "while true; do echo $(date -u) >> /data/out.txt; sleep 5; done"]
volumeMounts:
Expand Down
2 changes: 1 addition & 1 deletion examples/kubernetes/dynamic_provisioning_s3/specs/pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
lifecycle:
postStart:
exec:
command: ["amazon-linux-extras", "install", "lustre2.10", "-y"]
command: ["amazon-linux-extras", "install", "lustre", "-y"]
volumeMounts:
- name: persistent-storage
mountPath: /data
Expand Down
6 changes: 3 additions & 3 deletions examples/kubernetes/max_cache_tuning/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ metadata:
spec:
initContainers:
- name: set-lustre-cache
image: public.ecr.aws/fsx-csi-driver/aws-fsx-csi-driver:v0.9.0
image: amazonlinux:2
command: ["/bin/sh","-c"]
args: ["amazon-linux-extras install lustre -y && /sbin/lctl set_param llite.*.max_cached_mb=32"]
securityContext:
privileged: true
command: ["/sbin/lctl"]
args: ["set_param", "llite.*.max_cached_mb=32"]
containers:
- name: app
image: amazonlinux:2
Expand Down
6 changes: 3 additions & 3 deletions examples/kubernetes/max_cache_tuning/specs/pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ metadata:
spec:
initContainers:
- name: set-lustre-cache
image: public.ecr.aws/fsx-csi-driver/aws-fsx-csi-driver:v0.9.0
image: amazonlinux:2
command: ["/bin/sh","-c"]
args: ["amazon-linux-extras install lustre -y && /sbin/lctl set_param llite.*.max_cached_mb=32"]
securityContext:
privileged: true
command: ["/sbin/lctl"]
args: ["set_param", "llite.*.max_cached_mb=32"]
containers:
- name: app
image: amazonlinux:2
Expand Down
2 changes: 1 addition & 1 deletion examples/kubernetes/multiple_pods/specs/pod1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
containers:
- name: app1
image: centos
image: amazonlinux:2
command: ["/bin/sh"]
args: ["-c", "while true; do echo $(date -u) >> /data/out1.txt; sleep 5; done"]
volumeMounts:
Expand Down
2 changes: 1 addition & 1 deletion examples/kubernetes/multiple_pods/specs/pod2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
containers:
- name: app2
image: busybox
image: amazonlinux:2
command: ["/bin/sh"]
args: ["-c", "while true; do echo $(date -u) >> /data/out2.txt; sleep 5; done"]
volumeMounts:
Expand Down
2 changes: 1 addition & 1 deletion examples/kubernetes/static_provisioning/specs/pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
containers:
- name: app
image: centos
image: amazonlinux:2
command: ["/bin/sh"]
args: ["-c", "while true; do echo $(date -u) >> /data/out.txt; sleep 5; done"]
volumeMounts:
Expand Down
3 changes: 2 additions & 1 deletion hack/kops-patch-node.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
spec:
image: 137112412989/amzn2-ami-hvm-2.0.20210525.0-x86_64-gp2
image: 137112412989/amzn2-ami-hvm-2.0.20220218.3-x86_64-gp2

16 changes: 2 additions & 14 deletions pkg/cloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ func (c *cloud) CreateFileSystem(ctx context.Context, volumeName string, fileSys

output, err := c.fsx.CreateFileSystemWithContext(ctx, input)
if err != nil {
if isIncompatibleParameter(err) {
return nil, ErrFsExistsDiffSize
}
return nil, fmt.Errorf("CreateFileSystem failed: %v", err)
}

Expand Down Expand Up @@ -338,7 +335,7 @@ func (c *cloud) WaitForFileSystemAvailable(ctx context.Context, fileSystemId str
if err != nil {
return true, err
}
klog.V(2).Infof("WaitForFileSystemAvailable filesystem %q status is: %q", fileSystemId, *fs.Lifecycle)
klog.V(2).InfoS("WaitForFileSystemAvailable", "filesystem", fileSystemId, "status", *fs.Lifecycle)
switch *fs.Lifecycle {
case "AVAILABLE":
return true, nil
Expand All @@ -361,7 +358,7 @@ func (c *cloud) WaitForFileSystemResize(ctx context.Context, fileSystemId string
return true, err
}

klog.V(2).Infof("WaitForFileSystemResize filesystem %q update status is: %q", fileSystemId, *updateAction.Status)
klog.V(2).InfoS("WaitForFileSystemResize", "filesystem", fileSystemId, "update status", *updateAction.Status)
switch *updateAction.Status {
case "PENDING", "IN_PROGRESS":
// The resizing workflow has not completed
Expand Down Expand Up @@ -433,15 +430,6 @@ func isFileSystemNotFound(err error) bool {
return false
}

func isIncompatibleParameter(err error) bool {
if awsErr, ok := err.(awserr.Error); ok {
if awsErr.Code() == fsx.ErrCodeIncompatibleParameterError {
return true
}
}
return false
}

// isBadRequestUpdateInProgress identifies an error returned from the FSx API as a BadRequest with an "update already
// in progress" message.
func isBadRequestUpdateInProgress(err error) bool {
Expand Down
28 changes: 18 additions & 10 deletions pkg/driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func newControllerService(driverOptions *DriverOptions) controllerService {
}
}
func (d *controllerService) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
klog.V(4).Infof("CreateVolume: called with args %#v", req)
klog.V(4).InfoS("CreateVolume: called", "args", *req)
volName := req.GetName()
if len(volName) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume name not provided")
Expand Down Expand Up @@ -213,10 +213,18 @@ func (d *controllerService) CreateVolume(ctx context.Context, req *csi.CreateVol
fsOptions.CapacityGiB = util.RoundUpVolumeSize(capRange.GetRequiredBytes(), fsOptions.DeploymentType, fsOptions.StorageType, fsOptions.PerUnitStorageThroughput)
}

var tagArray []string
optionsTags := d.driverOptions.extraTags

if optionsTags != "" {
tagArray = strings.Split(optionsTags, ",")
}

if val, ok := volumeParams[volumeParamsExtraTags]; ok {
extraTags := strings.Split(val, ",")
fsOptions.ExtraTags = extraTags
tagArray = append(tagArray, extraTags...)
}
fsOptions.ExtraTags = tagArray

fs, err := d.cloud.CreateFileSystem(ctx, volName, fsOptions)
if err != nil {
Expand All @@ -237,7 +245,7 @@ func (d *controllerService) CreateVolume(ctx context.Context, req *csi.CreateVol
}

func (d *controllerService) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {
klog.V(4).Infof("DeleteVolume: called with args: %#v", req)
klog.V(4).InfoS("DeleteVolume: called", "args", *req)
volumeID := req.GetVolumeId()
if len(volumeID) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume ID not provided")
Expand All @@ -252,7 +260,7 @@ func (d *controllerService) DeleteVolume(ctx context.Context, req *csi.DeleteVol

if err := d.cloud.DeleteFileSystem(ctx, volumeID); err != nil {
if err == cloud.ErrNotFound {
klog.V(4).Infof("DeleteVolume: volume not found, returning with success")
klog.V(4).InfoS("DeleteVolume: volume not found, returning with success")
return &csi.DeleteVolumeResponse{}, nil
}
return nil, status.Errorf(codes.Internal, "Could not delete volume ID %q: %v", volumeID, err)
Expand All @@ -269,7 +277,7 @@ func (d *controllerService) ControllerUnpublishVolume(ctx context.Context, req *
}

func (d *controllerService) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
klog.V(4).Infof("ControllerGetCapabilities: called with args %#v", req)
klog.V(4).InfoS("ControllerGetCapabilities: called", "args", *req)
var caps []*csi.ControllerServiceCapability
for _, cap := range controllerCaps {
c := &csi.ControllerServiceCapability{
Expand All @@ -285,17 +293,17 @@ func (d *controllerService) ControllerGetCapabilities(ctx context.Context, req *
}

func (d *controllerService) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error) {
klog.V(4).Infof("GetCapacity: called with args %#v", req)
klog.V(4).InfoS("GetCapacity: called", "args", *req)
return nil, status.Error(codes.Unimplemented, "")
}

func (d *controllerService) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {
klog.V(4).Infof("ListVolumes: called with args %#v", req)
klog.V(4).InfoS("ListVolumes: called", "args", *req)
return nil, status.Error(codes.Unimplemented, "")
}

func (d *controllerService) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) {
klog.V(4).Infof("ValidateVolumeCapabilities: called with args %#v", req)
klog.V(4).InfoS("ValidateVolumeCapabilities: called", "args", *req)
volumeID := req.GetVolumeId()
if len(volumeID) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume ID not provided")
Expand Down Expand Up @@ -361,7 +369,7 @@ func (d *controllerService) ListSnapshots(ctx context.Context, req *csi.ListSnap
}

func (d *controllerService) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error) {
klog.V(4).Infof("ControllerExpandVolume: called with args %+v", *req)
klog.V(4).InfoS("ControllerExpandVolume: called", "args", *req)
volumeID := req.GetVolumeId()
if len(volumeID) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume ID not provided")
Expand Down Expand Up @@ -389,7 +397,7 @@ func (d *controllerService) ControllerExpandVolume(ctx context.Context, req *csi
}
if newSizeGiB <= fs.CapacityGiB {
// Current capacity is sufficient to satisfy the request
klog.V(4).Infof("ControllerExpandVolume: current filesystem capacity of %d GiB matches or exceeds requested storage capacity of %d GiB, returning with success", fs.CapacityGiB, newSizeGiB)
klog.V(4).InfoS("ControllerExpandVolume: current filesystem capacity matches or exceeds requested storage capacity, returning with success", "current capacity", fs.CapacityGiB, "requested capacity", newSizeGiB)
return &csi.ControllerExpandVolumeResponse{
CapacityBytes: util.GiBToBytes(fs.CapacityGiB),
NodeExpansionRequired: false,
Expand Down
Loading

0 comments on commit 307682f

Please sign in to comment.