Skip to content

Commit 3e1bb92

Browse files
authored
add loudbalancer and route type for grpc server (#404)
Signed-off-by: Zhiwei Yin <[email protected]>
1 parent a8652dd commit 3e1bb92

File tree

3 files changed

+150
-3
lines changed

3 files changed

+150
-3
lines changed

operator/v1/0000_01_operator.open-cluster-management.io_clustermanagers.crd.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,13 +580,43 @@ spec:
580580
required:
581581
- host
582582
type: object
583+
loadBalancer:
584+
description: LoadBalancer points customized configuration
585+
for loadBalancer type.
586+
properties:
587+
caBundle:
588+
description: CABundle is a customized caBundle of
589+
the endpoint.
590+
format: byte
591+
type: string
592+
host:
593+
description: Host is the customized host name of
594+
the endpoint.
595+
type: string
596+
type: object
597+
route:
598+
description: Route points customized configuration for
599+
route type.
600+
properties:
601+
caBundle:
602+
description: CABundle is a customized caBundle of
603+
the endpoint.
604+
format: byte
605+
type: string
606+
host:
607+
description: Host is the customized host name of
608+
the endpoint.
609+
type: string
610+
type: object
583611
type:
584612
default: hostname
585613
description: |-
586614
type specifies how the endpoint is exposed.
587615
You may need to apply an object to expose the endpoint, for example: a route.
588616
enum:
589617
- hostname
618+
- loadBalancer
619+
- route
590620
type: string
591621
required:
592622
- type
@@ -609,13 +639,43 @@ spec:
609639
required:
610640
- host
611641
type: object
642+
loadBalancer:
643+
description: LoadBalancer points customized configuration
644+
for loadBalancer type.
645+
properties:
646+
caBundle:
647+
description: CABundle is a customized caBundle of
648+
the endpoint.
649+
format: byte
650+
type: string
651+
host:
652+
description: Host is the customized host name of
653+
the endpoint.
654+
type: string
655+
type: object
656+
route:
657+
description: Route points customized configuration for
658+
route type.
659+
properties:
660+
caBundle:
661+
description: CABundle is a customized caBundle of
662+
the endpoint.
663+
format: byte
664+
type: string
665+
host:
666+
description: Host is the customized host name of
667+
the endpoint.
668+
type: string
669+
type: object
612670
type:
613671
default: hostname
614672
description: |-
615673
type specifies how the endpoint is exposed.
616674
You may need to apply an object to expose the endpoint, for example: a route.
617675
enum:
618676
- hostname
677+
- loadBalancer
678+
- route
619679
type: string
620680
required:
621681
- type

operator/v1/types_clustermanager.go

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,22 @@ type EndpointExposure struct {
197197
type Endpoint struct {
198198
// type specifies how the endpoint is exposed.
199199
// You may need to apply an object to expose the endpoint, for example: a route.
200-
// TODO: support loadbalancer.
201200
// +kubebuilder:default:=hostname
202-
// +kubebuilder:validation:Enum=hostname
201+
// +kubebuilder:validation:Enum=hostname;loadBalancer;route
203202
// +required
204203
Type EndpointExposureType `json:"type,omitempty"`
205204

206205
// hostname points to a fixed hostname for serving agents' handshakes.
207206
// +optional
208207
Hostname *HostnameConfig `json:"hostname,omitempty"`
208+
209+
// LoadBalancer points customized configuration for loadBalancer type.
210+
// +optional
211+
LoadBalancer *LoadBalancerConfig `json:"loadBalancer,omitempty"`
212+
213+
// Route points customized configuration for route type.
214+
// +optional
215+
Route *RouteConfig `json:"route,omitempty"`
209216
}
210217

211218
// HostnameConfig references a fixed hostname.
@@ -219,12 +226,40 @@ type HostnameConfig struct {
219226
CABundle []byte `json:"caBundle,omitempty"`
220227
}
221228

222-
// GRPCEndpointExposureType represents the type of endpoint exposure for gRPC.
229+
// LoadBalancerConfig references customized configuration for LoadBalancer type.
230+
type LoadBalancerConfig struct {
231+
// Host is the customized host name of the endpoint.
232+
// +optional
233+
Host string `json:"host,omitempty"`
234+
235+
// CABundle is a customized caBundle of the endpoint.
236+
// +optional
237+
CABundle []byte `json:"caBundle,omitempty"`
238+
}
239+
240+
// RouteConfig references customized configuration for Route type.
241+
type RouteConfig struct {
242+
// Host is the customized host name of the endpoint.
243+
// +optional
244+
Host string `json:"host,omitempty"`
245+
246+
// CABundle is a customized caBundle of the endpoint.
247+
// +optional
248+
CABundle []byte `json:"caBundle,omitempty"`
249+
}
250+
251+
// EndpointExposureType represents the type of endpoint exposure.
223252
type EndpointExposureType string
224253

225254
const (
226255
// EndpointTypeHostname is the endpoint exposure type for hostname.
227256
EndpointTypeHostname EndpointExposureType = "hostname"
257+
258+
// EndpointTypeLoadBalancer is the endpoint exposure type for load balancer.
259+
EndpointTypeLoadBalancer EndpointExposureType = "loadBalancer"
260+
261+
// EndpointTypeRoute is the endpoint exposure type for route.
262+
EndpointTypeRoute EndpointExposureType = "route"
228263
)
229264

230265
type CSRConfig struct {

operator/v1/zz_generated.deepcopy.go

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)