-
Notifications
You must be signed in to change notification settings - Fork 532
API cleanup #11606
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: main
Are you sure you want to change the base?
API cleanup #11606
Conversation
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
aggression := ptr.Deref(ir.aggression, "") | ||
if aggression != "" { | ||
aggressionValue, err := strconv.ParseFloat(aggression, 64) |
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.
Use nil checks and add MinLength validations to string values to prevent empty
aggression := ptr.Deref(ir.aggression, "") | |
if aggression != "" { | |
aggressionValue, err := strconv.ParseFloat(aggression, 64) | |
if ir.aggression != nil { | |
aggressionValue, err := strconv.ParseFloat(*ir.aggression, 64) |
@@ -207,7 +207,7 @@ type TLS struct { | |||
|
|||
// The SNI domains that should be considered for TLS connection | |||
// +optional | |||
Sni string `json:"sni,omitempty"` | |||
Sni *string `json:"sni,omitempty"` |
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.
Needs MinLength validation
TLSCertificate *string `json:"tlsCertificate,omitempty"` | ||
|
||
// +optional | ||
TLSKey string `json:"tlsKey,omitempty"` | ||
TLSKey *string `json:"tlsKey,omitempty"` | ||
|
||
// +optional | ||
RootCA string `json:"rootCA,omitempty"` | ||
RootCA *string `json:"rootCA,omitempty"` |
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.
Add MinLength validation
@@ -181,7 +181,7 @@ type AwsLambda struct { | |||
// (alphanumeric plus "-" or "_"), or the special literal "$LATEST". | |||
// +optional | |||
// +kubebuilder:validation:Pattern="^(\\$LATEST|[0-9]+|[A-Za-z0-9-_]{1,128})$" | |||
Qualifier string `json:"qualifier,omitempty"` | |||
Qualifier *string `json:"qualifier,omitempty"` |
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.
We should default this to $LATEST
func buildLambdaARN(in *v1alpha1.AwsBackend, region string) (string, error) {
qualifier := "$LATEST"
if in.Lambda.Qualifier != "" {
qualifier = in.Lambda.Qualifier
}
@@ -42,7 +42,7 @@ type DirectResponseSpec struct { | |||
// | |||
// +kubebuilder:validation:MaxLength=4096 | |||
// +optional | |||
Body string `json:"body,omitempty"` | |||
Body *string `json:"body,omitempty"` |
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.
Add MinLength validation
@@ -124,13 +125,14 @@ func createRateLimitActions(descriptors []v1alpha1.RateLimitDescriptor) ([]*rout | |||
}, | |||
} | |||
case v1alpha1.RateLimitDescriptorEntryTypeHeader: | |||
if entry.Header == "" { | |||
header := ptr.Deref(entry.Header, "") |
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.
Change to nil check and prevent empty header value using MinLength validation
- RBAC roles are generated in [install/helm/kgateway/templates/role.yaml](/install/helm/kgateway/templates/role.yaml) | ||
- Updates the [api/applyconfiguration](/api/applyconfiguration), [pkg/generated](/pkg/generated) and [pkg/client](/pkg/client) folders with kube clients. These are used in plugin initialization and the fake client is used in tests. | ||
|
||
## API guidelines |
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.
Another potential line item: how to handle time related fields. The approach we've been taking is meta.Duration + CEL validation.
Description
Some cleanup in our APIs for consistency:
omitempty
if it wasn't already there+optional
/+required
rather than the kubebuilder markersChange Type
/kind cleanup
Changelog
Additional Notes