Bug 1521218

Summary: [RFE] Allow deploy logging with no-default storageclass
Product: OpenShift Container Platform Reporter: Anping Li <anli>
Component: LoggingAssignee: ewolinet
Status: CLOSED ERRATA QA Contact: Anping Li <anli>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.7.1CC: anli, aos-bugs, grodrigu, knakayam, mmckinst, rmeggins
Target Milestone: ---   
Target Release: 3.7.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-05 09:33:10 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 Anping Li 2017-12-06 02:42:29 UTC
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

Comment 2 Anping Li 2017-12-07 01:41:17 UTC
Jeff, the variable looks good.

Comment 3 Jeff Cantrill 2017-12-07 22:19:13 UTC
Does the use of this variable resolve this issue?  Can we close it?

Comment 4 Anping Li 2017-12-08 00:43:34 UTC
Jeff,  Yes, It works.

Comment 5 Anping Li 2017-12-08 08:48:15 UTC
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

Comment 10 Anping Li 2018-01-16 11:33:46 UTC
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"}

Comment 15 Anping Li 2018-02-28 22:47:59 UTC
Pass with openshift3/ose-ansible/images/v3.7.35-1

Comment 19 errata-xmlrpc 2018-04-05 09:33:10 UTC
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

Comment 20 Anping Li 2018-04-19 02:10:48 UTC
*** Bug 1561799 has been marked as a duplicate of this bug. ***

Comment 21 Mark McKinstry 2018-04-19 20:49:54 UTC
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

Comment 22 ewolinet 2018-04-19 21:54:54 UTC
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.