Skip to content
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

Add the pointer for optional fields. #579

Merged
merged 1 commit into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions apis/v1alpha1/gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ type TLSOverridePolicy struct {
//
// +optional
// +kubebuilder:default=Deny
Certificate TLSRouteOverrideType `json:"certificate,omitempty"`
Certificate *TLSRouteOverrideType `json:"certificate,omitempty"`
}

// GatewayTLSConfig describes a TLS configuration.
Expand Down Expand Up @@ -321,7 +321,7 @@ type GatewayTLSConfig struct {
//
// +optional
// +kubebuilder:default=Terminate
Mode TLSModeType `json:"mode,omitempty"`
Mode *TLSModeType `json:"mode,omitempty"`

// CertificateRef is the reference to Kubernetes object that contain a
// TLS certificate and private key. This certificate MUST be used for
Expand Down Expand Up @@ -353,7 +353,7 @@ type GatewayTLSConfig struct {
//
// +optional
// +kubebuilder:default={certificate:Deny}
RouteOverride TLSOverridePolicy `json:"routeOverride,omitempty"`
RouteOverride *TLSOverridePolicy `json:"routeOverride,omitempty"`

// Options are a list of key/value pairs to give extended options
// to the provider.
Expand Down Expand Up @@ -396,7 +396,7 @@ type RouteBindingSelector struct {
//
// +optional
// +kubebuilder:default={from: Same}
Namespaces RouteNamespaces `json:"namespaces,omitempty"`
Namespaces *RouteNamespaces `json:"namespaces,omitempty"`
// Selector specifies a set of route labels used for selecting
// routes to associate with the Gateway. If this Selector is defined,
// only routes matching the Selector are associated with the Gateway.
Expand Down Expand Up @@ -426,7 +426,7 @@ type RouteBindingSelector struct {
// +kubebuilder:default=networking.x-k8s.io
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
Group string `json:"group,omitempty"`
Group *string `json:"group,omitempty"`
// Kind is the kind of the route resource to select.
//
// Kind MUST correspond to kinds of routes that are compatible with the
Expand Down Expand Up @@ -467,7 +467,7 @@ type RouteNamespaces struct {
//
// +optional
// +kubebuilder:default=Same
From RouteSelectType `json:"from,omitempty"`
From *RouteSelectType `json:"from,omitempty"`

// Selector must be specified when From is set to "Selector". In that case,
// only Routes in Namespaces matching this Selector will be selected by this
Expand All @@ -476,7 +476,7 @@ type RouteNamespaces struct {
// Support: Core
//
// +optional
Selector metav1.LabelSelector `json:"selector,omitempty"`
Selector *metav1.LabelSelector `json:"selector,omitempty"`
}

// GatewayAddress describes an address that can be bound to a Gateway.
Expand All @@ -487,7 +487,7 @@ type GatewayAddress struct {
//
// +optional
// +kubebuilder:default=IPAddress
Type AddressType `json:"type,omitempty"`
Type *AddressType `json:"type,omitempty"`

// Value of the address. The validity of the values will depend
// on the type and support by the controller.
Expand Down
4 changes: 2 additions & 2 deletions apis/v1alpha1/gatewayclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ type ParametersReference struct {
// +kubebuilder:validation:Enum=Cluster;Namespace
// +kubebuilder:default=Cluster
// +optional
Scope string `json:"scope,omitempty"`
Scope *string `json:"scope,omitempty"`

// Namespace is the namespace of the referent.
// This field is required when scope is set to "Namespace" and ignored when
Expand All @@ -114,7 +114,7 @@ type ParametersReference struct {
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +optional
Namespace string `json:"namespace,omitempty"`
Namespace *string `json:"namespace,omitempty"`
}

// GatewayClassConditionType is the type for status conditions on
Expand Down
8 changes: 4 additions & 4 deletions apis/v1alpha1/httproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type HTTPRouteSpec struct {
//
// +optional
// +kubebuilder:default={allow: "SameNamespace"}
Gateways RouteGateways `json:"gateways,omitempty"`
Gateways *RouteGateways `json:"gateways,omitempty"`

// Hostnames defines a set of hostname that should match against
// the HTTP Host header to select a HTTPRoute to process the request.
Expand Down Expand Up @@ -276,7 +276,7 @@ type HTTPPathMatch struct {
//
// +optional
// +kubebuilder:default=Prefix
Type PathMatchType `json:"type,omitempty"`
Type *PathMatchType `json:"type,omitempty"`

// Value of the HTTP path to match against.
//
Expand All @@ -302,7 +302,7 @@ type HTTPHeaderMatch struct {
//
// +optional
// +kubebuilder:default=Exact
Type HeaderMatchType `json:"type,omitempty"`
Type *HeaderMatchType `json:"type,omitempty"`

// Values is a map of HTTP Headers to be matched.
// It MUST contain at least one entry.
Expand Down Expand Up @@ -631,7 +631,7 @@ type HTTPRouteForwardTo struct {
// +kubebuilder:default=1
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=1000000
Weight int32 `json:"weight,omitempty"`
Weight *int32 `json:"weight,omitempty"`

// Filters defined at this-level should be executed if and only if the
// request is being forwarded to the backend defined here.
Expand Down
4 changes: 2 additions & 2 deletions apis/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type RouteGateways struct {
// +optional
// +kubebuilder:validation:Enum=All;FromList;SameNamespace
// +kubebuilder:default=SameNamespace
Allow GatewayAllowType `json:"allow,omitempty"`
Allow *GatewayAllowType `json:"allow,omitempty"`

// GatewayRefs must be specified when Allow is set to "FromList". In that
// case, only Gateways referenced in this list will be allowed to use this
Expand Down Expand Up @@ -163,7 +163,7 @@ type RouteForwardTo struct {
// +kubebuilder:default=1
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=1000000
Weight int32 `json:"weight,omitempty"`
Weight *int32 `json:"weight,omitempty"`
}

// RouteConditionType is a type of condition for a route.
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha1/tcproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type TCPRouteSpec struct {
//
// +optional
// +kubebuilder:default={allow: "SameNamespace"}
Gateways RouteGateways `json:"gateways,omitempty"`
Gateways *RouteGateways `json:"gateways,omitempty"`
}

// TCPRouteStatus defines the observed state of TCPRoute
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha1/tlsroute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type TLSRouteSpec struct {
//
// +optional
// +kubebuilder:default={allow: "SameNamespace"}
Gateways RouteGateways `json:"gateways,omitempty"`
Gateways *RouteGateways `json:"gateways,omitempty"`
}

// TLSRouteStatus defines the observed state of TLSRoute
Expand Down
2 changes: 1 addition & 1 deletion apis/v1alpha1/udproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type UDPRouteSpec struct {
//
// +optional
// +kubebuilder:default={allow: "SameNamespace"}
Gateways RouteGateways `json:"gateways,omitempty"`
Gateways *RouteGateways `json:"gateways,omitempty"`
}

// UDPRouteStatus defines the observed state of UDPRoute.
Expand Down
Loading