-
Notifications
You must be signed in to change notification settings - Fork 510
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
Operator crashes when spec.security.modes list is empty #1055
Comments
This issue is being marked stale because it has been open for 60 days with no activity. Please comment if this issue is still affecting you. If there is no change, this issue will be closed in 30 days. |
Remove stale |
@hoyhbx Just a friendly reminder. |
Hi, I'm Dan and I'm the Product Manager for MongoDB's support of Kubernetes. I'm doing some work right now to try and identify how the Community Operator is being used. The Community Operator is something I inherited when I started at MongoDB, but it doesn't get as much attention from us as we'd like and we're trying to understand how it's used in order to establish its future. It will help us prioritize future issues and PRs raised by the community 🙂 Here's a super short survey (it's much easier for us to review all the feedback that way!): https://docs.google.com/forms/d/e/1FAIpQLSfwrwyxBSlUyJ6AmC-eYlgW_3JEdfA48SB2i5--_WpiynMW2w/viewform?usp=sf_link If you'd rather email me instead: [email protected] Thank you in advance! |
What did you do to encounter the bug?
I was trying to create a mongodb cluster by submitting an CR with the field
spec.security.modes
being an empty arraySteps to reproduce the behavior:
spec.security.modes
being an empty array:What did you expect?
The operator should capture that the array is empty and not crash.
What happened instead?
The operator crashes with the following error:
Operator Information
0.7.3
4.4.0
Kubernetes Cluster Information
kubectl version --short --output=yaml
Additional context
When setting the AutoAuthMechanism the operator tries to assign the first authentication mode at the 0th index of the Modes array. Since the array is empty, the index is out of range.
Possible Fix
This issue can ideally be resolved through CRD validation. Currently, only the strings within
Modes
array are being validated.We can include the following marker to validate the minimum length of the
Modes
array:// +kubebuilder:validation:MinItems=1
Alternative Fix
Alternatively, during validation of the AuthModeSpec, in addition to checking for duplicates, we can include an additional check as part of
validateAuthModeSpec
incontrollers/validation/validation.go
:The text was updated successfully, but these errors were encountered: