-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: runtime panic when storage
param is empty
#887
Conversation
Signed-off-by: Teo <[email protected]>
In my opinion, there's no need to perform a nil check on this non-exported function. We have control over it, and we know that |
Tho if you deploy a RedisCluster resource without specifying the storage parameter you do face an unmanaged nil reference exception which is hard to frame for somebody that is not at hands with the codebase. IMO it should be managed or Storage needs to have defaults |
I understand you. You could set default value in https://github.com/OT-CONTAINER-KIT/redis-operator/blob/master/api/v1beta2/rediscluster_default.go |
storage
param is emptystorage
param is empty
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #887 +/- ##
==========================================
+ Coverage 35.20% 39.56% +4.36%
==========================================
Files 19 19
Lines 3213 2674 -539
==========================================
- Hits 1131 1058 -73
+ Misses 2015 1543 -472
- Partials 67 73 +6 ☔ View full report in Codecov by Sentry. |
Hi @drivebyer , I reproduced the same issue on redis standalone, probably there is on other resources as well. was this fixed for every resource or just locally for cluster?
|
* fix runtime panic when storage param is empty Signed-off-by: Teo <[email protected]> * Update redis-cluster.go * remove blank * Update redis-cluster.go --------- Signed-off-by: Teo <[email protected]> Co-authored-by: yangw <[email protected]> Signed-off-by: Matt Robinson <[email protected]>
The
nil
checks infunc generateRedisClusterParams
are ran beforecr.Spec.Storage.$
is referenced, hence causing a runtime panic when the `storage field isn't defined in the manifest.nil
checks on objects before initializing thestatefulSetParameters
structcr.Spec.Storage
failsnil
check, it initializes it to a new instance of redisv1beta2.Storage{}Type of change
Checklist
Additional Context