Description of problem: By default, when openshift_logging_es_pvc_dynamic=true, the logging will use the default storageclass. if there are multiple storageclass. there is no way to deploy logging with non-default storage class. For example: For glusterfs, there are two storageclass, the default storageclass is for glusterfs, the other storageclass is glusterblock. the logging want to deploy with glusterblock while the admin want the other applications use glusterfs. The openshift admin must set glusterblock as default storageclass at first, and change the storageclass back once the deploy complete. If the other applications is deploying same time, it will use the glusterblock wrongly. It is better to use an inventory variable to deploy logging using glusterblock. in this way the cluster admin needn't to change the default storageclass. the candiate variables are openshift_logging_storage_classs, openshift_logging_es_storage_classs, or openshift_logging_es_ops_storage_classs. Version-Release number of selected component (if applicable): 3.7 How reproducible: always Steps to Reproduce: 1) create multiple storageclass, try to deploy logging with non-default storageclass. Actual results: The openshift-admin must change the default storageclass before deploy logging. Expected results: There are some variables to specify the storageclass name
What about this variable: https://github.com/openshift/openshift-ansible/blob/master/roles/openshift_logging_elasticsearch/defaults/main.yml#L34
Jeff, the variable looks good.
Does the use of this variable resolve this issue? Can we close it?
Jeff, Yes, It works.
Jeff, We should fix the error when openshift_logging_es_pvc_storage_class_name is undefined. TASK [openshift_logging_elasticsearch : Creating ES storage template - static] ************************************************************************************************************************************ task path: /root/openshift-ansible/roles/openshift_logging_elasticsearch/tasks/main.yaml:304 fatal: [ec2-35-153-101-95.compute-1.amazonaws.com]: FAILED! => {"failed": true, "msg": "The field 'vars' has an invalid value, which includes an undefined variable. The error was: {{ openshift_logging_es_pvc_storage_class_name }}: 'openshift_logging_es_pvc_storage_class_name' is undefined\n\nThe error appears to have been in '/root/openshift-ansible/roles/openshift_logging_elasticsearch/tasks/main.yaml': line 304, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n # storageclasses with the storageClassName set to \"\" in pvc.j2\n - name: Creating ES storage template - static\n ^ here\n\nexception type: <class 'ansible.errors.AnsibleUndefinedVariable'>\nexception: {{ openshift_logging_es_pvc_storage_class_name }}: 'openshift_logging_es_pvc_storage_class_name' is undefined"} to retry, use: --limit @/root/openshift-ansible/playbooks/openshift-logging/config.retry
if we deploy logging using dynamical provision without openshift_logging_es_pvc_storage_class_name, the following message pop up. ASK [openshift_logging_elasticsearch : Creating ES storage template - static] ************************************************************************************************************************************ fatal: [host-8-241-51.host.centralci.eng.rdu2.redhat.com]: FAILED! => {"failed": true, "msg": "The field 'vars' has an invalid value, which includes an undefined variable. The error was: {{ openshift_logging_es_pvc_storage_class_name }}: 'openshift_logging_es_pvc_storage_class_name' is undefined\n\nThe error appears to have been in '/usr/share/ansible/openshift-ansible/roles/openshift_logging_elasticsearch/tasks/main.yaml': line 330, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n # storageclasses with the storageClassName set to \"\" in pvc.j2\n - name: Creating ES storage template - static\n ^ here\n\nexception type: <class 'ansible.errors.AnsibleUndefinedVariable'>\nexception: {{ openshift_logging_es_pvc_storage_class_name }}: 'openshift_logging_es_pvc_storage_class_name' is undefined"}
https://github.com/openshift/openshift-ansible/pull/6747
https://github.com/openshift/openshift-ansible/pull/6776
Pass with openshift3/ose-ansible/images/v3.7.35-1
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:0636
*** Bug 1561799 has been marked as a duplicate of this bug. ***
AFAICT you still can't specify a storage class for dynamic elasticsearch volume. The output pasted in the BZ report shows this was tested using the static one: """Creating ES storage template - static""" Compare the dynamic one at https://github.com/openshift/openshift-ansible/blob/master/roles/openshift_logging_elasticsearch/tasks/main.yaml#L430-L441 to the static one at https://github.com/openshift/openshift-ansible/blob/master/roles/openshift_logging_elasticsearch/tasks/main.yaml#L417-L428 . Notice the line defining 'storage_class_name' is missing in dynamic. Since the variable isn't there, it can't be passed to the template and you'll get the default storage class. I've submitted two PRs to fix this: https://github.com/openshift/openshift-ansible/pull/8013 - for 3.7 https://github.com/openshift/openshift-ansible/pull/8054 - for master branch
The reason that we don't pass the 'storage_class_name' to the dynamic task is that in order for a PVC to be considered dynamic, it needs to not have a storageClassName field specified.