Bug 1272010

Summary: openshift does not use the "region" defined in the pv file to get the volume attached to the node for aws ebs volume
Product: OKD Reporter: Chao Yang <chaoyang>
Component: StorageAssignee: Mark Turansky <mturansk>
Status: CLOSED NOTABUG QA Contact: Liang Xia <lxia>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.xCC: aos-bugs, swagiaal, xtian
Target Milestone: ---Keywords: NeedsTestCase
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-28 17:52:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Chao Yang 2015-10-15 09:33:16 UTC
Description of problem:
openshift does not check the region in the pv json file for aws ebs volume 

Version-Release number of selected component (if applicable):
oc v1.0.6-328-gdf1f19e
kubernetes v1.1.0-alpha.1-653-g86b4e77

How reproducible:
always

Steps to Reproduce:
1.create an instance in region "us-east-1d"
2.create a volume in region "us-east-1d"
3.create a pv with wrong region 
kind: PersistentVolume
apiVersion: v1
metadata:
  name: pv-ebs-readonly
  labels:
    type: local
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  awsElasticBlockStore:
    volumeID: "aws://xxx/vol-812e4e7b"
    fstype: ext3
    readOnly: true
4. create a pvc
{
    "apiVersion": "v1",
    "kind": "PersistentVolumeClaim",
    "metadata": {
        "name": "ebs-readonly"
    },
    "spec": {
        "accessModes": [ "ReadWriteOnce" ],
        "resources": {
            "requests": {
                "storage": "5Gi"
            }
        }
   }
}
~ 
5.
[root@ip-172-18-0-100 ~]# oc get pv
NAME              LABELS       CAPACITY   ACCESSMODES   STATUS    CLAIM                  REASON    AGE
pv-ebs-readonly   type=local   10Gi       RWO           Bound     default/ebs-readonly             6m

6. create a pod using the pvc, the pod is running
kind: Pod
apiVersion: v1
metadata:
  name: mypod2-readonly
  labels:
    name: frontendhttp
spec:
  containers:
    - name: myfrontend
      image: jhou/hello-openshift
      ports:
        - containerPort: 80
          name: "http-server"
      volumeMounts:
      - mountPath: "/tmp"
        name: aws2
  volumes:
    - name: aws2
      persistentVolumeClaim:
        claimName: ebs-readonly
7.[root@ip-172-18-0-100 ~]# mount | grep xxx
/dev/xvdg on /root/openshift.local.volumes/plugins/kubernetes.io/aws-ebs/mounts/aws/xxx/vol-812e4e7b type ext3 (rw,relatime,seclabel,data=ordered)
Actual results:
openshift does not verify the region in the pv file 

Expected results:
openshift should using the region defined in the pv file to get the volume attached to the node

Additional info:

Comment 1 Mark Turansky 2015-10-28 17:52:12 UTC
The current requirement is that EBS volumes and the host VM run in the same region.  A PV does not define a region for a volume.

Closing this issue as "not a bug".

Comment 2 Sami Wagiaalla 2015-10-28 18:01:04 UTC
Actually the ebs does not need the region all together and volumes in a different region cannot be mounted. So there is not much point in using the format "aws://<region>/<vol-id>"

In fact if you specify just <vol-id> it will work. I tried to remove the other format here: https://github.com/kubernetes/kubernetes/pull/10181 but it was kept so as not to invalidate existing examples.