Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
vdhanan authored Feb 23, 2021
2 parents 41a980b + 69535ad commit 1350e77
Show file tree
Hide file tree
Showing 14 changed files with 335 additions and 156 deletions.
2 changes: 1 addition & 1 deletion charts/aws-ebs-csi-driver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "0.9.0"
name: aws-ebs-csi-driver
description: A Helm chart for AWS EBS CSI Driver
version: 0.9.7
version: 0.10.0
kubeVersion: ">=1.17.0-0"
home: https://github.com/kubernetes-sigs/aws-ebs-csi-driver
sources:
Expand Down
6 changes: 6 additions & 0 deletions charts/aws-ebs-csi-driver/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ spec:
{{- with .Values.resources }}
resources: {{ toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{- range .Values.imagePullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
volumes:
- name: socket-dir
emptyDir: {}
6 changes: 6 additions & 0 deletions charts/aws-ebs-csi-driver/templates/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ spec:
resources: {{ toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{- range .Values.imagePullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
volumes:
- name: kubelet-dir
hostPath:
Expand Down
6 changes: 6 additions & 0 deletions charts/aws-ebs-csi-driver/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ spec:
args:
- --v=5
- --leader-election=false
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{- range .Values.imagePullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
{{- end }}
8 changes: 7 additions & 1 deletion charts/aws-ebs-csi-driver/templates/storageclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: {{ .name }}
{{- if .annotations }}
annotations: {{- .annotations | toYaml | trim | nindent 4 }}
{{- end }}
{{- if .labels }}
labels: {{- .labels | toYaml | trim | nindent 4 }}
{{- end }}
provisioner: ebs.csi.aws.com
{{ omit (dict "volumeBindingMode" "WaitForFirstConsumer" | merge .) "name" | toYaml }}
{{ omit (dict "volumeBindingMode" "WaitForFirstConsumer" | merge .) "name" "annotations" "labels" | toYaml }}
{{- end }}
8 changes: 7 additions & 1 deletion charts/aws-ebs-csi-driver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fullnameOverride: ""
podAnnotations: {}

# True if enable volume scheduling for dynamic volume provisioning
enableVolumeScheduling: false
enableVolumeScheduling: true

# True if enable volume resizing
enableVolumeResizing: false
Expand Down Expand Up @@ -114,6 +114,12 @@ serviceAccount:
storageClasses: []
# Add StorageClass resources like:
# - name: ebs-sc
# # annotation metadata
# annotations:
# storageclass.kubernetes.io/is-default-class: "true"
# # label metadata
# labels:
# my-label-is: supercool
# # defaults to WaitForFirstConsumer
# volumeBindingMode: WaitForFirstConsumer
# # defaults to Delete
Expand Down
2 changes: 1 addition & 1 deletion hack/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
IMAGE_NAME=${IMAGE_NAME:-${AWS_ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com/${DRIVER_NAME}}
IMAGE_TAG=${IMAGE_TAG:-${TEST_ID}}

K8S_VERSION=${K8S_VERSION:-1.18.10}
K8S_VERSION=${K8S_VERSION:-1.18.16}
KOPS_VERSION=${KOPS_VERSION:-1.18.2}
KOPS_STATE_FILE=${KOPS_STATE_FILE:-s3://k8s-kops-csi-e2e}
KOPS_FEATURE_GATES_FILE=${KOPS_FEATURE_GATES_FILE:-./hack/feature-gates.yaml}
Expand Down
10 changes: 10 additions & 0 deletions pkg/driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
csi "github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/protobuf/ptypes"
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud"
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/internal"
"github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/util"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down Expand Up @@ -56,6 +57,7 @@ var (
// controllerService represents the controller service of CSI driver
type controllerService struct {
cloud cloud.Cloud
inFlight *internal.InFlight
driverOptions *DriverOptions
}

Expand Down Expand Up @@ -87,6 +89,7 @@ func newControllerService(driverOptions *DriverOptions) controllerService {

return controllerService{
cloud: cloud,
inFlight: internal.NewInFlight(),
driverOptions: driverOptions,
}
}
Expand Down Expand Up @@ -201,6 +204,13 @@ func (d *controllerService) CreateVolume(ctx context.Context, req *csi.CreateVol
return newCreateVolumeResponse(disk), nil
}

// check if a request is already in-flight because the CreateVolume API is not idempotent
if ok := d.inFlight.Insert(req.String()); !ok {
msg := fmt.Sprintf("Create volume request for %s is already in progress", volName)
return nil, status.Error(codes.Aborted, msg)
}
defer d.inFlight.Delete(req.String())

// create a new volume
zone := pickAvailabilityZone(req.GetAccessibilityRequirements())
outpostArn := getOutpostArn(req.GetAccessibilityRequirements())
Expand Down
Loading

0 comments on commit 1350e77

Please sign in to comment.