-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Labels
Milestone
Description
Problem statement
Some of the fields in CRD APIs have defaults that are not used because they are enclosed in structs that are used as optional fields.
For example, ControlPlaneTranslationOptions has a field CombinedServicesFromDifferentHTTPRoutes (combinedServicesFromDifferentHTTPRoutes in yaml manifest) which has a default value of "enabled".
This does not have an effect when used in the ControlPlaneOptions as the Translation field because the code marker on the Translation field is +optional and struct tags for it include omitempty.
Proposed solution
Go through all the fields that have defaults and verify if they are used by struct fields that are pointers with omitempty struct tag.
For mentioned issue the solution would be to:
diff --git a/api/gateway-operator/v2beta1/controlplane_types.go b/api/gateway-operator/v2beta1/controlplane_types.go
index fc5b7a805..f44ad3baf 100644
--- a/api/gateway-operator/v2beta1/controlplane_types.go
+++ b/api/gateway-operator/v2beta1/controlplane_types.go
@@ -141,6 +141,7 @@ type ControlPlaneOptions struct {
// Translation defines the configuration for translating Kong configuration.
//
// +optional
+ // +kubebuilder:default={{combinedServicesFromDifferentHTTPRoutes: "enabled", drainSupport: "enabled"}}
Translation *ControlPlaneTranslationOptions `json:"translation,omitempty"`
// ConfigDump defines the options for dumping generated Kong configuration from a diagnostics server.Acceptance criteria
- CRD fields that have defaults are included in enclosing structs defaults.
Reactions are currently unavailable