-
Notifications
You must be signed in to change notification settings - Fork 541
OCPBUGS-45295: Make plugins name array items unique #2117
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,15 +55,22 @@ type ConsoleSpec struct { | |
// +optional | ||
Route ConsoleConfigRoute `json:"route"` | ||
// plugins defines a list of enabled console plugin names. | ||
// +listType=atomic | ||
// +kubebuilder:validation:MaxItems=64 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was the number 64 chosen? Is it possible for there to be existing instances of this resource with more than 64 items? |
||
// +kubebuilder:validation:XValidation:rule="self.all(x, self.exists_one(y, x == y))",message="each plugin name must be unique" | ||
// +optional | ||
Plugins []string `json:"plugins,omitempty"` | ||
Plugins []PluginName `json:"plugins,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When did this API ship? Is there a finite, enumerable list of plugins, that we as RH control? What happens if the list is not already completely unique? Have you tested this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no its not an enum cause it would be hard to keep track of plugins since they could be provided by 3rd party.
so console-operator is already taking care of it programatically and makes the set of enabled plugins unique. The issue is mainly in this array, which can cause confusion, when adding plugins with the same name. |
||
// ingress allows to configure the alternative ingress for the console. | ||
// This field is intended for clusters without ingress capability, | ||
// where access to routes is not possible. | ||
// +optional | ||
Ingress Ingress `json:"ingress"` | ||
} | ||
|
||
// +kubebuilder:validation:MaxLength=128 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was a max length of 128 chosen? Are there any plugins we are aware of that might be cutting it close to that 128 character limit? Where are plugin names derived from? |
||
// +kubebuilder:validation:Pattern=^[a-zA-Z0-9-]+$ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A couple things:
|
||
type PluginName string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs godoc with some more information about the type and the validations on it. Good guideline for writing human readable go doc can be found here: https://github.com/openshift/enhancements/blob/master/dev-guide/api-conventions.md#write-user-readable-documentation-in-godoc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's make sure that the detailed documentation ends up on the field itself, rather than the type alias. The CRD schema will pick up godoc from the field, but sadly not the type alias. |
||
|
||
// ConsoleConfigRoute holds information on external route access to console. | ||
// DEPRECATED | ||
type ConsoleConfigRoute struct { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While updating the constraints for this field, it would be good to update the godoc as well to explain in prose what validations exist for this field. Users can't see the markers when using something like
oc/kubectl explain
so it is helpful to spell it out for them in the godoc.https://github.com/openshift/enhancements/blob/master/dev-guide/api-conventions.md#write-user-readable-documentation-in-godoc is a good place to start when thinking about what to include in the godoc