diff --git a/aws/efs/README.md b/aws/efs/README.md index f6e8c540133..8d32ac39177 100644 --- a/aws/efs/README.md +++ b/aws/efs/README.md @@ -17,7 +17,7 @@ If you are new to Kubernetes or to PersistentVolumes this quick start will get y wget https://raw.githubusercontent.com/kubernetes-incubator/external-storage/master/aws/efs/deploy/manifest.yaml ``` -- In the configmap section change the `file.system.id:` and `aws.region:` to match the details of the EFS you created. +- In the configmap section change the `file.system.id:` and `aws.region:` to match the details of the EFS you created. Change `dns.name` if you want to mount by your own DNS name and not by AWS's `*file-system-id*.efs.*aws-region*.amazonaws.com`. - In the deployment section change the `server:` to the DNS endpoint of the EFS you created. @@ -113,6 +113,7 @@ Create a configmap containing the [**File system ID**](http://docs.aws.amazon.co $ kubectl create configmap efs-provisioner \ --from-literal=file.system.id=fs-47a2c22e \ --from-literal=aws.region=us-west-2 \ +--from-literal=dns.name="" \ # if you want to mount by your own DNS name and not by AWS's `*file-system-id*.efs.*aws-region*.amazonaws.com`. --from-literal=provisioner.name=example.com/aws-efs ``` @@ -253,7 +254,7 @@ It's not needed but it is helpful if you are going to use your EFS for other thi volumes: - name: pv-volume nfs: - server: {{ efs_file_system_id }}.efs.{{ aws_region }}.amazonaws.com + server: {{ efs_file_system_id }}.efs.{{ aws_region }}.amazonaws.com # or the same value as `dns.name`/DNS_NAME if you want to mount by your own DNS name and not by AWS's `*file-system-id*.efs.*aws-region*.amazonaws.com`. path: / ``` diff --git a/aws/efs/cmd/efs-provisioner/efs-provisioner.go b/aws/efs/cmd/efs-provisioner/efs-provisioner.go index d62c719a609..7d718a5a24f 100644 --- a/aws/efs/cmd/efs-provisioner/efs-provisioner.go +++ b/aws/efs/cmd/efs-provisioner/efs-provisioner.go @@ -43,6 +43,7 @@ const ( provisionerNameKey = "PROVISIONER_NAME" fileSystemIDKey = "FILE_SYSTEM_ID" awsRegionKey = "AWS_REGION" + dnsNameKey = "DNS_NAME" ) type efsProvisioner struct { @@ -64,7 +65,11 @@ func NewEFSProvisioner(client kubernetes.Interface) controller.Provisioner { glog.Fatalf("environment variable %s is not set! Please set it.", awsRegionKey) } - dnsName := getDNSName(fileSystemID, awsRegion) + dnsName := os.Getenv(dnsNameKey) + glog.Errorf("%v", dnsName) + if dnsName == "" { + dnsName = getDNSName(fileSystemID, awsRegion) + } mountpoint, source, err := getMount(dnsName) if err != nil { diff --git a/aws/efs/deploy/configmap.yaml b/aws/efs/deploy/configmap.yaml index 8f5d2c14d50..5a2ac84ad60 100644 --- a/aws/efs/deploy/configmap.yaml +++ b/aws/efs/deploy/configmap.yaml @@ -6,3 +6,4 @@ data: file.system.id: fs-47a2c22e aws.region: us-west-2 provisioner.name: example.com/aws-efs + dns.name: "" diff --git a/aws/efs/deploy/deployment.yaml b/aws/efs/deploy/deployment.yaml index 15e433eae7b..860dd863b7d 100644 --- a/aws/efs/deploy/deployment.yaml +++ b/aws/efs/deploy/deployment.yaml @@ -31,6 +31,12 @@ spec: configMapKeyRef: name: efs-provisioner key: aws.region + - name: DNS_NAME + valueFrom: + configMapKeyRef: + name: efs-provisioner + key: dns.name + optional: true - name: PROVISIONER_NAME valueFrom: configMapKeyRef: diff --git a/aws/efs/deploy/manifest.yaml b/aws/efs/deploy/manifest.yaml index fd36c3d8b51..889a8b2d070 100644 --- a/aws/efs/deploy/manifest.yaml +++ b/aws/efs/deploy/manifest.yaml @@ -7,6 +7,7 @@ data: file.system.id: yourEFSsystemid aws.region: regionyourEFSisin provisioner.name: example.com/aws-efs + dns.name: "" --- kind: Deployment apiVersion: extensions/v1beta1 @@ -35,6 +36,12 @@ spec: configMapKeyRef: name: efs-provisioner key: aws.region + - name: DNS_NAME + valueFrom: + configMapKeyRef: + name: efs-provisioner + key: dns.name + optional: true - name: PROVISIONER_NAME valueFrom: configMapKeyRef: diff --git a/aws/efs/deploy/pod.yaml b/aws/efs/deploy/pod.yaml index 50d80612a3d..9e017abf4e8 100644 --- a/aws/efs/deploy/pod.yaml +++ b/aws/efs/deploy/pod.yaml @@ -25,6 +25,12 @@ spec: configMapKeyRef: name: efs-provisioner key: aws.region + - name: DNS_NAME + valueFrom: + configMapKeyRef: + name: efs-provisioner + key: dns.name + optional: true volumeMounts: - name: pv-volume mountPath: /persistentvolumes