openshift-ansible: Internal docker registry NFS volume creation fail with "Required value: must specify a volume type"

Description

Unable to deploy OpenShift 3.11 clusters with docker registry backed by NFS storage, broken persistent-volumes.yml content.

Version

Please put the following version information in the code block indicated below.

  • Your ansible version per ansible --version
ansible 2.8.1
  config file = None
  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, Apr  9 2019, 14:30:50) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

For installation was used last changes from release-3.11 branch

  • The output of git describe
openshift-ansible-3.11.123-1-8-ga03b285
Steps To Reproduce
  1. Create inventory file with NFS storage for docker registry:
openshift_hosted_registry_storage_kind=nfs
openshift_hosted_registry_storage_access_modes=['ReadWriteMany']
openshift_hosted_registry_storage_nfs_directory=/exports
openshift_hosted_registry_storage_nfs_options='*(rw,root_squash)'
openshift_hosted_registry_storage_volume_name=registry
openshift_hosted_registry_storage_volume_size=100Gi
  1. Run preparation and install playbooks
Expected Results

Successful OpenShift installation

Observed Results

Installation fails with error:

The PersistentVolume \"registry-volume\" is invalid: spec: Required value: must specify a volume type

fatal: [denis-master-1]: FAILED! => {
    "changed": false, 
    "cmd": [
        "oc", 
        "create", 
        "-f", 
        "/tmp/openshift-ansible-3vGorUB/persistent-volumes.yml", 
        "--config=/tmp/openshift-ansible-3vGorUB/admin.kubeconfig"
    ], 
    "delta": "0:00:00.207853", 
    "end": "2019-06-27 08:11:51.219853", 
    "failed_when_result": true, 
    "invocation": {
        "module_args": {
            "_raw_params": "oc create -f /tmp/openshift-ansible-3vGorUB/persistent-volumes.yml --config=/tmp/openshift-ansible-3vGorUB/admin.kubeconfig\n", 
            "_uses_shell": false, 
            "argv": null, 
            "chdir": null, 
            "creates": null, 
            "executable": null, 
            "removes": null, 
            "stdin": null, 
            "stdin_add_newline": true, 
            "strip_empty_ends": true, 
            "warn": true
        }
    }, 
    "msg": "non-zero return code", 
    "rc": 1, 
    "start": "2019-06-27 08:11:51.012000", 
    "stderr": "The PersistentVolume \"registry-volume\" is invalid: spec: Required value: must specify a volume type", 
    "stderr_lines": [
        "The PersistentVolume \"registry-volume\" is invalid: spec: Required value: must specify a volume type"
    ], 
    "stdout": "", 
    "stdout_lines": []
}

Persistent volumes file:

cat /tmp/openshift-ansible-3vGorUB/persistent-volumes.yml 
---
apiVersion: v1
kind: List
items:
- apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: "registry-volume"
    labels:
  spec:
    capacity:
      storage: "100Gi"
    accessModes: 
    - ReadWriteMany
    claimName: 
      registry-claim
      ...
    claimRef:
      name: registry-claim
      namespace: default

looks like file content is broken

Additional Information

If I remove keys openshift_hosted_registry_storage* from inventory file - installation pass.

Retried installation with openshift_enable_unsupported_configurations=True - same failure message.

OS on nodes: CentOS Linux release 7.6.1810 (Core) Openshift ansible git head hash: a03b28590853da28d1edacb8183c724c943b1acf

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22

Most upvoted comments

Same problem here. Using latest release-3.11 branch. Got error

TASK [openshift_persistent_volumes : Create PersistentVolumes] *****************************************************************************************************
Sunday 14 July 2019  08:00:33 -0700 (0:00:01.002)       0:00:23.333 ***********
fatal: [10.51.4.187]: FAILED! => {"changed": false, "cmd": ["oc", "create", "-f", "/tmp/openshift-ansible-Iol6cCt/persistent-volumes.yml", "--config=/tmp/openshift-ansible-Iol6cCt/admin.kubeconfig"], "delta": "0:00:00.305053", "end": "2019-07-14 08:00:33.900001", "failed_when_result": true, "msg": "non-zero return code", "rc": 1, "start": "2019-07-14 08:00:33.594948", "stderr": "The PersistentVolume \"registry-volume\" is invalid: spec: Required value: must specify a volume type", "stderr_lines": ["The PersistentVolume \"registry-volume\" is invalid: spec: Required value: must specify a volume type"], "stdout": "", "stdout_lines": []}

Content of PV yaml:

[root@tremolo1 openshift-ansible]# cat /tmp/openshift-ansible-Iol6cCt/persistent-volumes.yml
---
apiVersion: v1
kind: List
items:
- apiVersion: v1
  kind: PersistentVolume
  metadata:
    name: "registry-volume"
    labels:
  spec:
    capacity:
      storage: "50Gi"
    accessModes:
    - ReadWriteMany
    claimName:
      registry-claim
      ...
    claimRef:
      name: registry-claim
      namespace: default