Bug 1836818

Summary: csisnapshotcontrollers.operator.openshift.io api should validate the .spec.logLevel and .spec.operatorLogLevel field
Product: OpenShift Container Platform Reporter: Qin Ping <piqin>
Component: StorageAssignee: Jan Safranek <jsafrane>
Storage sub component: Operators QA Contact: Qin Ping <piqin>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: unspecified CC: aos-bugs, jsafrane
Version: 4.5   
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 16:00:11 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 Qin Ping 2020-05-18 09:00:55 UTC
Description of problem:
Now for the csisnapshotcontrollers.spec.logLevel and .spec.operatorLogLevel, we can set any string here. Seems we only support coarse grained logging choices, such as: Normal/Debug/Trace/TraceAll

Version-Release number of selected component (if applicable):
$ oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.5.0-0.nightly-2020-05-17-235851   True        False         3h27m   Cluster version is 4.5.0-0.nightly-2020-05-17-235851


How reproducible:
Always

Steps to Reproduce:
1. Lanch a 4.5 OCP cluster
2. Check the csisnapshotcontroller api
$ oc explain csisnapshotcontrollers.spec.logLevel
3. oc patch csisnapshotcontrollers cluster -p '{"spec": {"logLevel": "testerror"}}' --type=merge
4. check the logLevel with cmd: oc get csisnapshotcontrollers cluster -ojson|jq .spec.logLevel

Actual results:
$ oc explain csisnapshotcontrollers.spec.logLevel
KIND:     CSISnapshotController
VERSION:  operator.openshift.io/v1

FIELD:    logLevel <string>

DESCRIPTION:
     logLevel is an intent based logging for an overall component. It does not
     give fine grained control, but it is a simple way to manage coarse grained
     logging choices that operators have to interpret for their operands.

$ oc get csisnapshotcontrollers cluster -ojson|jq .spec.logLevel
"testerror"

$ oc -n openshift-cluster-storage-operator exec csi-snapshot-controller-67645bbd9d-fg69v -- ps -aux|grep snapshot
1000500+       1  0.0  0.0 133324 26724 ?        Ssl  07:45   0:00 /usr/bin/snapshot-controller --v=2 --leader-election=true


Expected results:
run oc explain cmd, can get the valid logLevels and operatorLogLevels.
patch cmd failed, and returned clear err msg.


Master Log:

Node Log (of failed PODs):

PV Dump:

PVC Dump:

StorageClass Dump (if StorageClass used by PV/PVC):

Additional info:

Comment 4 Qin Ping 2020-06-05 02:11:05 UTC
Checked this PR is not included in the `release-4.5` branch, so can not verify it in 4.5.0.

Verified it with 4.6.0-0.ci-2020-06-03-191434, so marked this as verified and change the targetrelease to 4.6.0

Comment 8 errata-xmlrpc 2020-10-27 16:00:11 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 (OpenShift Container Platform 4.6 GA Images), 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-2020:4196