Skip to content

Commit c7835a4

Browse files
authored
Merge pull request #579 from Hyzhou/master
Add the pointer for optional fields.
2 parents e2b572b + fe4edd5 commit c7835a4

8 files changed

+122
-30
lines changed

apis/v1alpha1/gateway_types.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ type TLSOverridePolicy struct {
293293
//
294294
// +optional
295295
// +kubebuilder:default=Deny
296-
Certificate TLSRouteOverrideType `json:"certificate,omitempty"`
296+
Certificate *TLSRouteOverrideType `json:"certificate,omitempty"`
297297
}
298298

299299
// GatewayTLSConfig describes a TLS configuration.
@@ -321,7 +321,7 @@ type GatewayTLSConfig struct {
321321
//
322322
// +optional
323323
// +kubebuilder:default=Terminate
324-
Mode TLSModeType `json:"mode,omitempty"`
324+
Mode *TLSModeType `json:"mode,omitempty"`
325325

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

358358
// Options are a list of key/value pairs to give extended options
359359
// to the provider.
@@ -396,7 +396,7 @@ type RouteBindingSelector struct {
396396
//
397397
// +optional
398398
// +kubebuilder:default={from: Same}
399-
Namespaces RouteNamespaces `json:"namespaces,omitempty"`
399+
Namespaces *RouteNamespaces `json:"namespaces,omitempty"`
400400
// Selector specifies a set of route labels used for selecting
401401
// routes to associate with the Gateway. If this Selector is defined,
402402
// only routes matching the Selector are associated with the Gateway.
@@ -426,7 +426,7 @@ type RouteBindingSelector struct {
426426
// +kubebuilder:default=networking.x-k8s.io
427427
// +kubebuilder:validation:MinLength=1
428428
// +kubebuilder:validation:MaxLength=253
429-
Group string `json:"group,omitempty"`
429+
Group *string `json:"group,omitempty"`
430430
// Kind is the kind of the route resource to select.
431431
//
432432
// Kind MUST correspond to kinds of routes that are compatible with the
@@ -467,7 +467,7 @@ type RouteNamespaces struct {
467467
//
468468
// +optional
469469
// +kubebuilder:default=Same
470-
From RouteSelectType `json:"from,omitempty"`
470+
From *RouteSelectType `json:"from,omitempty"`
471471

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

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

492492
// Value of the address. The validity of the values will depend
493493
// on the type and support by the controller.

apis/v1alpha1/gatewayclass_types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ type ParametersReference struct {
105105
// +kubebuilder:validation:Enum=Cluster;Namespace
106106
// +kubebuilder:default=Cluster
107107
// +optional
108-
Scope string `json:"scope,omitempty"`
108+
Scope *string `json:"scope,omitempty"`
109109

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

120120
// GatewayClassConditionType is the type for status conditions on

apis/v1alpha1/httproute_types.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type HTTPRouteSpec struct {
5252
//
5353
// +optional
5454
// +kubebuilder:default={allow: "SameNamespace"}
55-
Gateways RouteGateways `json:"gateways,omitempty"`
55+
Gateways *RouteGateways `json:"gateways,omitempty"`
5656

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

281281
// Value of the HTTP path to match against.
282282
//
@@ -302,7 +302,7 @@ type HTTPHeaderMatch struct {
302302
//
303303
// +optional
304304
// +kubebuilder:default=Exact
305-
Type HeaderMatchType `json:"type,omitempty"`
305+
Type *HeaderMatchType `json:"type,omitempty"`
306306

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

636636
// Filters defined at this-level should be executed if and only if the
637637
// request is being forwarded to the backend defined here.

apis/v1alpha1/shared_types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ type RouteGateways struct {
6363
// +optional
6464
// +kubebuilder:validation:Enum=All;FromList;SameNamespace
6565
// +kubebuilder:default=SameNamespace
66-
Allow GatewayAllowType `json:"allow,omitempty"`
66+
Allow *GatewayAllowType `json:"allow,omitempty"`
6767

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

169169
// RouteConditionType is a type of condition for a route.

apis/v1alpha1/tcproute_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type TCPRouteSpec struct {
4848
//
4949
// +optional
5050
// +kubebuilder:default={allow: "SameNamespace"}
51-
Gateways RouteGateways `json:"gateways,omitempty"`
51+
Gateways *RouteGateways `json:"gateways,omitempty"`
5252
}
5353

5454
// TCPRouteStatus defines the observed state of TCPRoute

apis/v1alpha1/tlsroute_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ type TLSRouteSpec struct {
5353
//
5454
// +optional
5555
// +kubebuilder:default={allow: "SameNamespace"}
56-
Gateways RouteGateways `json:"gateways,omitempty"`
56+
Gateways *RouteGateways `json:"gateways,omitempty"`
5757
}
5858

5959
// TLSRouteStatus defines the observed state of TLSRoute

apis/v1alpha1/udproute_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type UDPRouteSpec struct {
4848
//
4949
// +optional
5050
// +kubebuilder:default={allow: "SameNamespace"}
51-
Gateways RouteGateways `json:"gateways,omitempty"`
51+
Gateways *RouteGateways `json:"gateways,omitempty"`
5252
}
5353

5454
// UDPRouteStatus defines the observed state of UDPRoute.

0 commit comments

Comments
 (0)