-
Notifications
You must be signed in to change notification settings - Fork 7
/
mesh_config.go
736 lines (561 loc) · 27.8 KB
/
mesh_config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
package v1alpha3
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// MeshConfig is the type used to represent the mesh configuration.
// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// +kubebuilder:metadata:labels=app.kubernetes.io/name=flomesh.io
// +kubebuilder:resource:shortName=meshconfig,scope=Namespaced
type MeshConfig struct {
// Object's type metadata.
metav1.TypeMeta `json:",inline" yaml:",inline"`
// Object's metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
// Spec is the MeshConfig specification.
// +optional
Spec MeshConfigSpec `json:"spec,omitempty" yaml:"spec,omitempty"`
}
// MeshConfigSpec is the spec for FSM's configuration.
type MeshConfigSpec struct {
// ClusterSetSpec defines the configurations of cluster.
ClusterSet ClusterSetSpec `json:"clusterSet,omitempty"`
// Sidecar defines the configurations of the proxy sidecar in a mesh.
Sidecar SidecarSpec `json:"sidecar,omitempty"`
// RepoServer defines the configurations of pipy repo server.
RepoServer RepoServerSpec `json:"repoServer,omitempty"`
// Traffic defines the traffic management configurations for a mesh instance.
Traffic TrafficSpec `json:"traffic,omitempty"`
// Observalility defines the observability configurations for a mesh instance.
Observability ObservabilitySpec `json:"observability,omitempty"`
// Certificate defines the certificate management configurations for a mesh instance.
Certificate CertificateSpec `json:"certificate,omitempty"`
// FeatureFlags defines the feature flags for a mesh instance.
FeatureFlags FeatureFlags `json:"featureFlags,omitempty"`
// PluginChains defines the default plugin chains.
PluginChains PluginChainsSpec `json:"pluginChains,omitempty"`
// Ingress defines the configurations of Ingress features.
Ingress IngressSpec `json:"ingress,omitempty"`
// GatewayAPI defines the configurations of GatewayAPI features.
GatewayAPI GatewayAPISpec `json:"gatewayAPI,omitempty"`
// ServiceLB defines the configurations of ServiceLBServiceLB features.
ServiceLB ServiceLBSpec `json:"serviceLB,omitempty"`
// FLB defines the configurations of FLB features.
FLB FLBSpec `json:"flb,omitempty"`
// EgressGateway defines the configurations of EgressGateway features.
EgressGateway EgressGatewaySpec `json:"egressGateway,omitempty"`
// Image defines the configurations of Image info
Image ImageSpec `json:"image"`
// Misc defines the configurations of misc info
Misc MiscSpec `json:"misc"`
// Connector defines the configurations of connector info
Connector ConnectorSpec `json:"connector"`
}
// LocalProxyMode is a type alias representing the way the sidecar proxies to the main application
type LocalProxyMode string
const (
// LocalProxyModeLocalhost indicates the the sidecar should communicate with the main application over localhost
LocalProxyModeLocalhost LocalProxyMode = "Localhost"
// LocalProxyModePodIP indicates that the sidecar should communicate with the main application via the pod ip
LocalProxyModePodIP LocalProxyMode = "PodIP"
)
// WildcardDN is the type to represent FSM's Wildcard DN configuration.
type WildcardDN struct {
// Enable defines a boolean indicating if wildcard are enabled for local DNS Proxy.
Enable bool `json:"enable"`
// IPv4 defines a ipv4 address for wildcard DN.
IPv4 []string `json:"ipv4,omitempty"`
}
// ResolveDN is the type to represent FSM's Resolve DN configuration.
type ResolveDN struct {
// DN defines resolve DN.
DN string `json:"dn"`
// IPv4 defines a ipv4 address for resolve DN.
IPv4 []string `json:"ipv4"`
}
// LocalDNSProxy is the type to represent FSM's local DNS proxy configuration.
type LocalDNSProxy struct {
// Enable defines a boolean indicating if the sidecars are enabled for local DNS Proxy.
Enable bool `json:"enable"`
// PrimaryUpstreamDNSServerIPAddr defines a primary upstream DNS server for local DNS Proxy.
// +optional
PrimaryUpstreamDNSServerIPAddr string `json:"primaryUpstreamDNSServerIPAddr,omitempty"`
// SecondaryUpstreamDNSServerIPAddr defines a secondary upstream DNS server for local DNS Proxy.
// +optional
SecondaryUpstreamDNSServerIPAddr string `json:"secondaryUpstreamDNSServerIPAddr,omitempty"`
// Wildcard defines Wildcard DN.
Wildcard WildcardDN `json:"wildcard"`
// DB defines Resolve DB.
DB []ResolveDN `json:"db,omitempty"`
}
// SidecarSpec is the type used to represent the specifications for the proxy sidecar.
type SidecarSpec struct {
// EnablePrivilegedInitContainer defines a boolean indicating whether the init container for a meshed pod should run as privileged.
EnablePrivilegedInitContainer bool `json:"enablePrivilegedInitContainer"`
// +kubebuilder:validation:Enum=trace;debug;info;warn;error;fatal;panic;disabled
// LogLevel defines the logging level for the sidecar's logs. Non developers should generally never set this value. In production environments the LogLevel should be set to error.
LogLevel string `json:"logLevel,omitempty"`
// SidecarImage defines the container image used for the proxy sidecar.
SidecarImage string `json:"sidecarImage,omitempty"`
// SidecarDisabledMTLS defines whether mTLS is disabled.
SidecarDisabledMTLS bool `json:"sidecarDisabledMTLS"`
// MaxDataPlaneConnections defines the maximum allowed data plane connections from a proxy sidecar to the FSM controller.
MaxDataPlaneConnections int `json:"maxDataPlaneConnections,omitempty"`
// ConfigResyncInterval defines the resync interval for regular proxy broadcast updates.
ConfigResyncInterval string `json:"configResyncInterval,omitempty"`
// SidecarTimeout defines the connect/idle/read/write timeout.
SidecarTimeout int `json:"sidecarTimeout,omitempty"`
// Resources defines the compute resources for the sidecar.
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
// TLSMinProtocolVersion defines the minimum TLS protocol version that the sidecar supports. Valid TLS protocol versions are TLS_AUTO, TLSv1_0, TLSv1_1, TLSv1_2 and TLSv1_3.
TLSMinProtocolVersion string `json:"tlsMinProtocolVersion,omitempty"`
// TLSMaxProtocolVersion defines the maximum TLS protocol version that the sidecar supports. Valid TLS protocol versions are TLS_AUTO, TLSv1_0, TLSv1_1, TLSv1_2 and TLSv1_3.
TLSMaxProtocolVersion string `json:"tlsMaxProtocolVersion,omitempty"`
// CipherSuites defines a list of ciphers that listener supports when negotiating TLS 1.0-1.2. This setting has no effect when negotiating TLS 1.3. For valid cipher names, see the latest OpenSSL ciphers manual page. E.g. https://www.openssl.org/docs/man1.1.1/apps/ciphers.html.
CipherSuites []string `json:"cipherSuites,omitempty"`
// ECDHCurves defines a list of ECDH curves that TLS connection supports. If not specified, the curves are [X25519, P-256] for non-FIPS build and P-256 for builds using BoringSSL FIPS.
ECDHCurves []string `json:"ecdhCurves,omitempty"`
// LocalProxyMode defines the network interface the proxy will use to send traffic to the backend service application. Acceptable values are [`Localhost`, `PodIP`]. The default is `Localhost`
LocalProxyMode LocalProxyMode `json:"localProxyMode,omitempty"`
// LocalDNSProxy improves the performance of your computer by caching the responses coming from your DNS servers
LocalDNSProxy LocalDNSProxy `json:"localDNSProxy,omitempty"`
}
// TrafficSpec is the type used to represent FSM's traffic management configuration.
type TrafficSpec struct {
// InterceptionMode defines a string indicating which traffic interception mode is used.
InterceptionMode string `json:"interceptionMode"`
// EnableEgress defines a boolean indicating if mesh-wide Egress is enabled.
EnableEgress bool `json:"enableEgress"`
// OutboundIPRangeExclusionList defines a global list of IP address ranges to exclude from outbound traffic interception by the sidecar proxy.
OutboundIPRangeExclusionList []string `json:"outboundIPRangeExclusionList"`
// OutboundIPRangeInclusionList defines a global list of IP address ranges to include for outbound traffic interception by the sidecar proxy.
// IP addresses outside this range will be excluded from outbound traffic interception by the sidecar proxy.
OutboundIPRangeInclusionList []string `json:"outboundIPRangeInclusionList"`
// OutboundPortExclusionList defines a global list of ports to exclude from outbound traffic interception by the sidecar proxy.
OutboundPortExclusionList []int `json:"outboundPortExclusionList"`
// InboundPortExclusionList defines a global list of ports to exclude from inbound traffic interception by the sidecar proxy.
InboundPortExclusionList []int `json:"inboundPortExclusionList"`
// EnablePermissiveTrafficPolicyMode defines a boolean indicating if permissive traffic policy mode is enabled mesh-wide.
EnablePermissiveTrafficPolicyMode bool `json:"enablePermissiveTrafficPolicyMode"`
// ServiceAccessMode defines a string indicating service access mode.
ServiceAccessMode string `json:"serviceAccessMode"`
// InboundExternalAuthorization defines a ruleset that, if enabled, will configure a remote external authorization endpoint
// for all inbound and ingress traffic in the mesh.
InboundExternalAuthorization ExternalAuthzSpec `json:"inboundExternalAuthorization,omitempty"`
// NetworkInterfaceExclusionList defines a global list of network interface
// names to exclude from inbound and outbound traffic interception by the
// sidecar proxy.
NetworkInterfaceExclusionList []string `json:"networkInterfaceExclusionList"`
// HTTP1PerRequestLoadBalancing defines a boolean indicating if load balancing based on request is enabled for http1.
HTTP1PerRequestLoadBalancing bool `json:"http1PerRequestLoadBalancing"`
// HTTP1PerRequestLoadBalancing defines a boolean indicating if load balancing based on request is enabled for http2.
HTTP2PerRequestLoadBalancing bool `json:"http2PerRequestLoadBalancing"`
}
// ObservabilitySpec is the type to represent FSM's observability configurations.
type ObservabilitySpec struct {
// +kubebuilder:validation:Enum=trace;debug;info;warn;error;fatal;panic;disabled
// FSMLogLevel defines the log level for FSM control plane logs.
FSMLogLevel string `json:"fsmLogLevel,omitempty"`
// EnableDebugServer defines if the debug endpoint on the FSM controller pod is enabled.
EnableDebugServer bool `json:"enableDebugServer"`
// Tracing defines FSM's tracing configuration.
Tracing TracingSpec `json:"tracing,omitempty"`
// RemoteLogging defines FSM's remote logging configuration.
RemoteLogging RemoteLoggingSpec `json:"remoteLogging,omitempty"`
}
// TracingSpec is the type to represent FSM's tracing configuration.
type TracingSpec struct {
// Enable defines a boolean indicating if the sidecars are enabled for tracing.
Enable bool `json:"enable"`
// Port defines the tracing collector's port.
Port int16 `json:"port,omitempty"`
// Address defines the tracing collectio's hostname.
Address string `json:"address,omitempty"`
// Endpoint defines the API endpoint for tracing requests sent to the collector.
Endpoint string `json:"endpoint,omitempty"`
// SampledFraction defines the sampled fraction.
SampledFraction *string `json:"sampledFraction,omitempty"`
}
// RemoteLoggingSpec is the type to represent FSM's remote logging configuration.
type RemoteLoggingSpec struct {
// Enable defines a boolean indicating if the sidecars are enabled for remote logging.
Enable bool `json:"enable"`
// Level defines the remote logging's level.
Level uint16 `json:"level,omitempty"`
// Port defines the remote logging's port.
Port int16 `json:"port,omitempty"`
// Address defines the remote logging's hostname.
Address string `json:"address,omitempty"`
// Endpoint defines the API endpoint for remote logging requests sent to the collector.
Endpoint string `json:"endpoint,omitempty"`
// Authorization defines the access entity that allows to authorize someone in remote logging service.
Authorization string `json:"authorization,omitempty"`
// SampledFraction defines the sampled fraction.
SampledFraction *string `json:"sampledFraction,omitempty"`
// SecretName defines the name of the secret that contains the configuration for remote logging.
SecretName string `json:"secretName,omitempty"`
}
// ExternalAuthzSpec is a type to represent external authorization configuration.
type ExternalAuthzSpec struct {
// Enable defines a boolean indicating if the external authorization policy is to be enabled.
Enable bool `json:"enable"`
// Address defines the remote address of the external authorization endpoint.
Address string `json:"address,omitempty"`
// Port defines the destination port of the remote external authorization endpoint.
Port uint16 `json:"port,omitempty"`
// StatPrefix defines a prefix for the stats sink for this external authorization policy.
StatPrefix string `json:"statPrefix,omitempty"`
// Timeout defines the timeout in which a response from the external authorization endpoint.
// is expected to execute.
Timeout string `json:"timeout,omitempty"`
// FailureModeAllow defines a boolean indicating if traffic should be allowed on a failure to get a
// response against the external authorization endpoint.
FailureModeAllow bool `json:"failureModeAllow"`
}
// CertificateSpec is the type to reperesent FSM's certificate management configuration.
type CertificateSpec struct {
// ServiceCertValidityDuration defines the service certificate validity duration.
ServiceCertValidityDuration string `json:"serviceCertValidityDuration,omitempty"`
// CertKeyBitSize defines the certicate key bit size.
CertKeyBitSize int `json:"certKeyBitSize,omitempty"`
// IngressGateway defines the certificate specification for an ingress gateway.
// +optional
IngressGateway *IngressGatewayCertSpec `json:"ingressGateway,omitempty"`
}
// IngressGatewayCertSpec is the type to represent the certificate specification for an ingress gateway.
type IngressGatewayCertSpec struct {
// SubjectAltNames defines the Subject Alternative Names (domain names and IP addresses) secured by the certificate.
SubjectAltNames []string `json:"subjectAltNames"`
// ValidityDuration defines the validity duration of the certificate.
ValidityDuration string `json:"validityDuration"`
// Secret defines the secret in which the certificate is stored.
Secret corev1.SecretReference `json:"secret"`
}
// MeshConfigList lists the MeshConfig objects.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type MeshConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []MeshConfig `json:"items"`
}
// FeatureFlags is a type to represent FSM's feature flags.
type FeatureFlags struct {
// EnableEgressPolicy defines if FSM's Egress policy is enabled.
EnableEgressPolicy bool `json:"enableEgressPolicy"`
// EnableSnapshotCacheMode defines if XDS server starts with snapshot cache.
EnableSnapshotCacheMode bool `json:"enableSnapshotCacheMode"`
//EnableAsyncProxyServiceMapping defines if FSM will map proxies to services asynchronously.
EnableAsyncProxyServiceMapping bool `json:"enableAsyncProxyServiceMapping"`
// EnableIngressBackendPolicy defines if FSM will use the IngressBackend API to allow ingress traffic to
// service mesh backends.
EnableIngressBackendPolicy bool `json:"enableIngressBackendPolicy"`
// EnableAccessControlPolicy defines if FSM will use the AccessControl API to allow access control traffic to
// service mesh backends.
EnableAccessControlPolicy bool `json:"enableAccessControlPolicy"`
// EnableAccessCertPolicy defines if FSM can issue certificates for external services..
EnableAccessCertPolicy bool `json:"enableAccessCertPolicy"`
// EnableSidecarActiveHealthChecks defines if FSM will Sidecar active health
// checks between services allowed to communicate.
EnableSidecarActiveHealthChecks bool `json:"enableSidecarActiveHealthChecks"`
// EnableRetryPolicy defines if retry policy is enabled.
EnableRetryPolicy bool `json:"enableRetryPolicy"`
// EnablePluginPolicy defines if plugin policy is enabled.
EnablePluginPolicy bool `json:"enablePluginPolicy"`
// EnableAutoDefaultRoute defines if auto default route is enabled.
EnableAutoDefaultRoute bool `json:"enableAutoDefaultRoute"`
// EnableValidateGatewayListenerHostname defines if validate gateway listener hostname is enabled.
EnableValidateGatewayListenerHostname bool `json:"enableValidateGatewayListenerHostname"`
// EnableValidateHTTPRouteHostnames defines if validate http route hostnames is enabled.
EnableValidateHTTPRouteHostnames bool `json:"enableValidateHTTPRouteHostnames"`
// EnableValidateGRPCRouteHostnames defines if validate grpc route hostnames is enabled.
EnableValidateGRPCRouteHostnames bool `json:"enableValidateGRPCRouteHostnames"`
// EnableValidateTCPRouteHostnames defines if validate tcp route hostnames is enabled.
EnableValidateTLSRouteHostnames bool `json:"enableValidateTLSRouteHostnames"`
// EnableGatewayAgentService defines if agent service is enabled.
EnableGatewayAgentService bool `json:"enableGatewayAgentService"`
// EnableGatewayProxyTag defines if gateway proxy-tag header is enabled.
EnableGatewayProxyTag bool `json:"enableGatewayProxyTag"`
}
// RepoServerSpec is the type to represent repo server.
type RepoServerSpec struct {
// IPAddr of the pipy repo server
IPAddr string `json:"ipaddr"`
// Port defines the pipy repo server's port.
Port int16 `json:"port,omitempty"`
// Codebase is the folder used by fsmController
Codebase string `json:"codebase"`
}
// ClusterPropertySpec is the type to represent cluster property.
type ClusterPropertySpec struct {
// Name defines the name of cluster property.
Name string `json:"name"`
// Value defines the name of cluster property.
Value string `json:"value"`
}
// ClusterSetSpec is the type to represent cluster set.
type ClusterSetSpec struct {
// +kubebuilder:default=false
// IsManaged defines if the cluster is managed.
IsManaged bool `json:"isManaged"`
// UID defines Unique ID of cluster.
UID string `json:"uid"`
// +kubebuilder:default=default
// +optional
// Region defines Region of cluster.
Region string `json:"region"`
// +kubebuilder:default=default
// +optional
// Zone defines Zone of cluster.
Zone string `json:"zone"`
// +kubebuilder:default=default
// +optional
// Group defines Group of cluster.
Group string `json:"group"`
// Name defines Name of cluster.
Name string `json:"name"`
// ControlPlaneUID defines the unique ID of the control plane cluster,
// in case it's managed
ControlPlaneUID string `json:"controlPlaneUID"`
// Properties defines properties for cluster.
Properties []ClusterPropertySpec `json:"properties"`
}
// PluginChainsSpec is the type to represent plugin chains.
type PluginChainsSpec struct {
// InboundTCPChains defines inbound tcp chains
InboundTCPChains []*PluginChainSpec `json:"inbound-tcp"`
// InboundHTTPChains defines inbound http chains
InboundHTTPChains []*PluginChainSpec `json:"inbound-http"`
// OutboundTCPChains defines outbound tcp chains
OutboundTCPChains []*PluginChainSpec `json:"outbound-tcp"`
// OutboundHTTPChains defines outbound http chains
OutboundHTTPChains []*PluginChainSpec `json:"outbound-http"`
}
// PluginChainSpec is the type to represent plugin chain.
type PluginChainSpec struct {
// Plugin defines the name of plugin
Plugin string `json:"plugin"`
// Priority defines the priority of plugin
Priority float32 `json:"priority"`
// Disable defines the visibility of plugin
Disable bool `json:"disable"`
}
// IngressSpec is the type to represent ingress.
type IngressSpec struct {
// +kubebuilder:default=true
// Enabled defines if ingress is enabled.
Enabled bool `json:"enabled"`
// +kubebuilder:default=false
// Namespaced defines if ingress is namespaced.
Namespaced bool `json:"namespaced"`
// +kubebuilder:default=LoadBalancer
// +kubebuilder:validation:Enum=LoadBalancer;NodePort
// Type defines the type of ingress service.
Type corev1.ServiceType `json:"type"`
// +kubebuilder:default=info
// +kubebuilder:validation:Enum=trace;debug;info;warn;error;fatal;panic;disabled
// LogLevel defines the log level of ingress.
LogLevel string `json:"logLevel"`
// +kubebuilder:default={enabled: true, bind: 80, listen: 8000, nodePort: 30508}
// +optional
// HTTP defines the http configuration of ingress.
HTTP *HTTP `json:"http"`
// +kubebuilder:default={enabled: true, bind: 443, listen: 8443, nodePort: 30607, mTLS: false}
// +optional
// TLS defines the tls configuration of ingress.
TLS *TLS `json:"tls"`
}
// HTTP is the type to represent http.
type HTTP struct {
// +kubebuilder:default=true
// Enabled defines if http is enabled.
Enabled bool `json:"enabled"`
// +kubebuilder:default=80
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
// Bind defines the bind port of http.
Bind int32 `json:"bind"`
// +kubebuilder:default=8000
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
// Listen defines the listen port of http.
Listen int32 `json:"listen"`
// +kubebuilder:default=30508
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
// NodePort defines the node port of http.
NodePort int32 `json:"nodePort"`
}
// TLS is the type to represent tls.
type TLS struct {
// +kubebuilder:default=false
// Enabled defines if tls is enabled.
Enabled bool `json:"enabled"`
// +kubebuilder:default=443
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
// Bind defines the bind port of tls.
Bind int32 `json:"bind" validate:"gte=1,lte=65535"`
// +kubebuilder:default=8443
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
// Listen defines the listen port of tls.
Listen int32 `json:"listen" validate:"gte=1,lte=65535"`
// +kubebuilder:default=30607
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
// NodePort defines the node port of tls.
NodePort int32 `json:"nodePort" validate:"gte=0,lte=65535"`
// +kubebuilder:default=false
// MTLS defines if mTLS is enabled.
MTLS bool `json:"mTLS"`
// +kubebuilder:default={enabled: false, upstreamPort: 443}
// +optional
// SSLPassthrough defines the ssl passthrough configuration of tls.
SSLPassthrough *SSLPassthrough `json:"sslPassthrough"`
}
// SSLPassthrough is the type to represent ssl passthrough.
type SSLPassthrough struct {
// +kubebuilder:default=false
// Enabled defines if ssl passthrough is enabled.
Enabled bool `json:"enabled"`
// +kubebuilder:default=443
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
// UpstreamPort defines the upstream port of ssl passthrough.
UpstreamPort int32 `json:"upstreamPort"`
}
// GatewayAPISpec is the type to represent gateway api.
type GatewayAPISpec struct {
// +kubebuilder:default=false
// Enabled defines if gateway api is enabled.
Enabled bool `json:"enabled"`
// +kubebuilder:default=info
// +kubebuilder:validation:Enum=trace;debug;info;warn;error;fatal;panic;disabled
// LogLevel defines the log level of gateway api.
LogLevel string `json:"logLevel"`
// +kubebuilder:default=info
// +kubebuilder:validation:Enum=trace;debug;info;warn;error;fatal;panic;disabled
// FGWLogLevel defines the log level of FGW.
FGWLogLevel string `json:"fgwLogLevel"`
// +kubebuilder:default=false
// StripAnyHostPort defines if strip any host port is enabled.
StripAnyHostPort bool `json:"StripAnyHostPort"`
// +kubebuilder:default=443
// SSLPassthroughUpstreamPort defines the default upstream port of SSL passthrough.
SSLPassthroughUpstreamPort int32 `json:"sslPassthroughUpstreamPort"`
// +kubebuilder:default=false
// HTTP1PerRequestLoadBalancing defines if load balancing based on per-request is enabled for http1.
HTTP1PerRequestLoadBalancing bool `json:"http1PerRequestLoadBalancing"`
// +kubebuilder:default=false
// HTTP2PerRequestLoadBalancing defines if load balancing based on per-request is enabled for http2.
HTTP2PerRequestLoadBalancing bool `json:"http2PerRequestLoadBalancing"`
// +kubebuilder:default={srcHostHeader: "orig-host", dstHostHeader: "proxy-tag"}
// ProxyTag defines the proxy tag configuration of gateway api.
ProxyTag ProxyTag `json:"proxyTag"`
}
type ProxyTag struct {
// +kubebuilder:default="orig-host"
// SrcHostHeader defines the src host header.
SrcHostHeader string `json:"srcHostHeader"`
// +kubebuilder:default="proxy-tag"
// DstHostHeader defines the dst host header.
DstHostHeader string `json:"dstHostHeader"`
}
// ServiceLBSpec is the type to represent service lb.
type ServiceLBSpec struct {
// +kubebuilder:default=false
// Enabled defines if service lb is enabled.
Enabled bool `json:"enabled"`
// +kubebuilder:default="flomesh/mirrored-klipper-lb:v0.3.5"
// Image defines the service lb image.
Image string `json:"image"`
}
type FLBUpstreamMode string
const (
FLBUpstreamModeNodePort FLBUpstreamMode = "NodePort"
FLBUpstreamModeEndpoint FLBUpstreamMode = "Endpoint"
)
// FLBSpec is the type to represent flb.
type FLBSpec struct {
// +kubebuilder:default=false
// Enabled defines if flb is enabled.
Enabled bool `json:"enabled"`
// +kubebuilder:default=false
// StrictMode defines if flb is in strict mode.
StrictMode bool `json:"strictMode"`
// +kubebuilder:default=Endpoint
// +kubebuilder:validation:Enum=NodePort;Endpoint
// UpstreamMode defines the upstream mode of flb.
UpstreamMode FLBUpstreamMode `json:"upstreamMode"`
// +kubebuilder:default=fsm-flb-secret
// SecretName defines the secret name of flb.
SecretName string `json:"secretName"`
}
// EgressGatewaySpec is the type to represent egress gateway.
type EgressGatewaySpec struct {
// +kubebuilder:default=false
// Enabled defines if flb is enabled.
Enabled bool `json:"enabled"`
// +kubebuilder:default=info
// +kubebuilder:validation:Enum=trace;debug;info;warn;error;fatal;panic;disabled
// LogLevel defines the log level of gateway api.
LogLevel string `json:"logLevel"`
// +kubebuilder:default=http2tunnel
// +kubebuilder:validation:Enum=http2tunnel;sock5
// Mode defines the mode of egress gateway.
Mode string `json:"mode"`
// +kubebuilder:default=1080
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
// Port defines the port of egress gateway.
Port *int32 `json:"port,omitempty"`
// +kubebuilder:default=6060
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=65535
// AdminPort defines the admin port of egress gateway.
AdminPort *int32 `json:"adminPort,omitempty"`
// +kubebuilder:default=1
// Replicas defines the replicas of egress gateway.
Replicas *int32 `json:"replicas,omitempty"`
}
// ImageSpec is the type to represent image.
type ImageSpec struct {
// +kubebuilder:default=flomesh
// Registry defines the registry of docker image.
Registry string `json:"registry"`
// +kubebuilder:default=latest
// Tag defines the tag of docker image.
Tag string `json:"tag"`
// +kubebuilder:default=IfNotPresent
// PullPolicy defines the pull policy of docker image.
PullPolicy corev1.PullPolicy `json:"pullPolicy"`
}
// MiscSpec is the type to represent misc configs.
type MiscSpec struct {
// +kubebuilder:default="flomesh/fsm-curl"
// CurlImage defines the image of curl.
CurlImage string `json:"curlImage"`
// +kubebuilder:default="flomesh/pipy-repo:0.99.0-2"
// RepoServerImage defines the image of repo server.
RepoServerImage string `json:"repoServerImage"`
}
// ConnectorGatewaySpec is the type to represent connector gateway configs.
type ConnectorGatewaySpec struct {
IngressAddr string `json:"ingressAddr"`
IngressHTTPPort uint `json:"ingressHTTPPort"`
IngressGRPCPort uint `json:"ingressGRPCPort"`
EgressAddr string `json:"egressAddr"`
EgressHTTPPort uint `json:"egressHTTPPort"`
EgressGRPCPort uint `json:"egressGRPCPort"`
}
// ConnectorSpec is the type to represent connector configs.
type ConnectorSpec struct {
// +kubebuilder:default="Managed by fsm-connector-gateway."
Notice string `json:"DO_NOT_EDIT"`
// ViaGateway defines gateway settings
ViaGateway ConnectorGatewaySpec `json:"viaGateway"`
}