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)]
Proposed PR: https://github.com/openshift/openshift-ansible/pull/7254
In openshift-ansible-3.10.0-0.48.0
Documentation PR - https://github.com/openshift/openshift-docs/pull/9855
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: ""
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?
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
https://github.com/openshift/openshift-ansible/pull/8858 for release-3.10
In openshift-ansible-3.10.2-1 and later
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"]