Bug 1548163 - RFE - Cannot use vsphere volume for registry during installation
Summary: RFE - Cannot use vsphere volume for registry during installation
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 3.9.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 3.10.0
Assignee: davis phillips
QA Contact: Gan Huang
URL:
Whiteboard:
Depends On: 1572873 1586366 1588281
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-22 21:05 UTC by davis phillips
Modified: 2018-07-31 12:59 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
The registry can now be deployed using vSphere storage backend by configuring the following variables. openshift_hosted_registry_storage_kind=vsphere openshift_hosted_registry_storage_access_modes=['ReadWriteOnce'] openshift_hosted_registry_storage_annotations=['volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/vsphere-volume']
Clone Of:
Environment:
Last Closed: 2018-07-31 12:59:59 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description davis phillips 2018-02-22 21:05:29 UTC
Description of problem:
Cannot use openshift_hosted_registry_storage_kind var to install to a vsphere-volume

Version-Release number of the following components:
rpm -q openshift-ansible
rpm -q ansible
ansible-2.4.1.0-1.el7.noarch

ansible --version
[root@ose3-ansible-37 openshift-ansible]# ansible --version
ansible 2.4.1.0
  config file = /root/git/openshift-ansible-contrib-3.7/reference-architecture/vmware-ansible/openshift-ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, May  3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]

Comment 1 davis phillips 2018-02-23 14:03:09 UTC
Proposed PR: https://github.com/openshift/openshift-ansible/pull/7254

Comment 2 Scott Dodson 2018-05-25 12:22:38 UTC
In openshift-ansible-3.10.0-0.48.0

Comment 3 davis phillips 2018-06-05 15:53:40 UTC
Documentation PR - https://github.com/openshift/openshift-docs/pull/9855

Comment 4 Gan Huang 2018-06-13 08:53:58 UTC
Tested in openshift-ansible-3.10.0-0.67.0.git.107.1bd1f01.el7.noarch.rpm

The pvc is on pending status because the `storageClassName` is empty. We should remove the parameter if no particular storage class defined.

# oc get pvc -o yaml
apiVersion: v1
items:
- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    annotations:
      volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/vsphere-volume
    creationTimestamp: 2018-06-13T07:47:58Z
    finalizers:
    - kubernetes.io/pvc-protection
    name: regpv-claim
    namespace: default
    resourceVersion: "3761"
    selfLink: /api/v1/namespaces/default/persistentvolumeclaims/regpv-claim
    uid: 1760fe1e-6ede-11e8-8ef7-0050569f947a
  spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 5G
    storageClassName: ""
  status:
    phase: Pending
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

Comment 5 davis phillips 2018-06-19 17:06:14 UTC
Hey Gan,

The persistent volume claim template checks for claim.storageClass. 

https://github.com/openshift/openshift-ansible/blob/release-3.10/roles/openshift_persistent_volumes/templates/persistent-volume-claim.yml.j2#L21-L23

Perhaps we should also check to see if the var is len > 0.

Can I see your inventory file for testing this?

Comment 6 davis phillips 2018-06-19 17:53:35 UTC
Looks like I traced it down with this:

https://github.com/dav1x/openshift-ansible/blob/f39bf7ee86004bf67c8f3cad41f6e06fc241d304/roles/lib_utils/action_plugins/generate_pv_pvcs_list.py#L129-L130

Although that var test wasn't a part of my PR. 

>>> tmpl = """{% if sc|length <= 0 %} {{sc|length}} is <= 0{% else %} {{sc|length}} > 0{% endif %}"""
>>> template = Template(tmpl)
>>> print template.render({"sc": ""})
 0 is <= 0
>>> print template.render({"sc": "dynamic"})
 7 > 0

Here is a PR to address:
https://github.com/openshift/openshift-ansible/pull/8854

Comment 7 davis phillips 2018-06-19 17:53:45 UTC
Looks like I traced it down with this:

https://github.com/dav1x/openshift-ansible/blob/f39bf7ee86004bf67c8f3cad41f6e06fc241d304/roles/lib_utils/action_plugins/generate_pv_pvcs_list.py#L129-L130

Although that var test wasn't a part of my PR. 

>>> tmpl = """{% if sc|length <= 0 %} {{sc|length}} is <= 0{% else %} {{sc|length}} > 0{% endif %}"""
>>> template = Template(tmpl)
>>> print template.render({"sc": ""})
 0 is <= 0
>>> print template.render({"sc": "dynamic"})
 7 > 0

Here is a PR to address:
https://github.com/openshift/openshift-ansible/pull/8854

Comment 8 Scott Dodson 2018-06-19 19:26:47 UTC
https://github.com/openshift/openshift-ansible/pull/8858 for release-3.10

Comment 9 Scott Dodson 2018-06-25 15:16:58 UTC
In openshift-ansible-3.10.2-1 and later

Comment 10 Gan Huang 2018-06-26 04:57:55 UTC
Verified in openshift-ansible-3.10.8-1.git.230.830efc0.el7.noarch.rpm

My inventory file:
# cat inventory
<--snip-->
openshift_cloudprovider_kind=vsphere
openshift_cloudprovider_vsphere_username=xxxx
openshift_cloudprovider_vsphere_password=xxxx
openshift_cloudprovider_vsphere_host=10.66.xx.xx
openshift_cloudprovider_vsphere_datacenter=Datacenter
openshift_cloudprovider_vsphere_datastore=datastore1

openshift_hosted_registry_storage_kind=vsphere
openshift_hosted_registry_storage_access_modes=["ReadWriteOnce"]
openshift_hosted_registry_storage_annotations=["volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/vsphere-volume"]


Note You need to log in before you can comment on or make changes to this bug.