-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtypes.go
259 lines (177 loc) · 8.87 KB
/
types.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
// Package configurator implements the Configurator interface that provides APIs to retrieve FSM control plane configurations.
package configurator
import (
"time"
corev1 "k8s.io/api/core/v1"
configv1alpha3 "github.com/flomesh-io/fsm/pkg/apis/config/v1alpha3"
"github.com/flomesh-io/fsm/pkg/k8s/informers"
"github.com/flomesh-io/fsm/pkg/logger"
"github.com/flomesh-io/fsm/pkg/trafficpolicy"
)
var (
log = logger.New("configurator")
)
// Client is the type used to represent the Kubernetes Client for the config.flomesh.io API group
type Client struct {
fsmNamespace string
informers *informers.InformerCollection
meshConfigName string
}
// Configurator is the controller interface for K8s namespaces
type Configurator interface {
// GetMeshConfig returns the MeshConfig resource corresponding to the control plane
GetMeshConfig() configv1alpha3.MeshConfig
// GetFSMNamespace returns the namespace in which FSM controller pod resides
GetFSMNamespace() string
// GetMeshConfigJSON returns the MeshConfig in pretty JSON (human readable)
GetMeshConfigJSON() (string, error)
// GetTrafficInterceptionMode returns the traffic interception mode
GetTrafficInterceptionMode() string
// IsPermissiveTrafficPolicyMode determines whether we are in "allow-all" mode or SMI policy (block by default) mode
IsPermissiveTrafficPolicyMode() bool
// GetServiceAccessMode returns the service access mode
GetServiceAccessMode() configv1alpha3.ServiceAccessMode
// GetServiceAccessNames returns the service access names
GetServiceAccessNames() *configv1alpha3.ServiceAccessNames
// IsEgressEnabled determines whether egress is globally enabled in the mesh or not
IsEgressEnabled() bool
// IsTracingEnabled returns whether tracing is enabled
IsTracingEnabled() bool
// IsLocalDNSProxyEnabled returns whether local DNS proxy is enabled
IsLocalDNSProxyEnabled() bool
// IsWildcardDNSProxyEnabled returns whether wildcard DNS proxy is enabled
IsWildcardDNSProxyEnabled() bool
// GetLocalDNSProxyPrimaryUpstream returns the primary upstream DNS server for local DNS Proxy
GetLocalDNSProxyPrimaryUpstream() string
// GetLocalDNSProxySecondaryUpstream returns the secondary upstream DNS server for local DNS Proxy
GetLocalDNSProxySecondaryUpstream() string
// IsXNetDNSProxyEnabled returns whether xnet xnet proxy is enabled
IsXNetDNSProxyEnabled() bool
// GetXNetDNSProxyUpstreams returns the upstream DNS servers for xnet dns Proxy
GetXNetDNSProxyUpstreams() []configv1alpha3.DNSUpstream
// IsHoldApplicationUntilProxyStarts returns whether delay application startup
// until the pod proxy is ready to accept traffic
IsHoldApplicationUntilProxyStarts() bool
// IsGracefulExitUntilDownstreamEnds returns whether delays the pod proxy exit until active downstream connections end
IsGracefulExitUntilDownstreamEnds() bool
// GenerateIPv6BasedOnIPv4 returns whether auto generate IPv6 based on IPv4
GenerateIPv6BasedOnIPv4() bool
// GetTracingHost is the host to which we send tracing spans
GetTracingHost() string
// GetTracingPort returns the tracing listener port
GetTracingPort() uint32
// GetTracingEndpoint returns the collector endpoint
GetTracingEndpoint() string
// GetTracingSampledFraction returns the sampled fraction
GetTracingSampledFraction() float32
// IsRemoteLoggingEnabled returns whether remote logging is enabled
IsRemoteLoggingEnabled() bool
// GetRemoteLoggingLevel returns the remote logging level
GetRemoteLoggingLevel() uint16
// GetRemoteLoggingHost is the host to which we send logging spans
GetRemoteLoggingHost() string
// GetRemoteLoggingPort returns the remote logging listener port
GetRemoteLoggingPort() uint32
// GetRemoteLoggingEndpoint returns the collector endpoint
GetRemoteLoggingEndpoint() string
// GetRemoteLoggingAuthorization returns the access entity that allows to authorize someone in remote logging service.
GetRemoteLoggingAuthorization() string
// GetRemoteLoggingSampledFraction returns the sampled fraction
GetRemoteLoggingSampledFraction() float32
// GetRemoteLoggingSecretName returns the name of secret that contains the access entity that allows to authorize someone in remote logging service.
GetRemoteLoggingSecretName() string
// GetMaxDataPlaneConnections returns the max data plane connections allowed, 0 if disabled
GetMaxDataPlaneConnections() int
// GetSidecarTimeout returns connect/idle/read/write timeout
GetSidecarTimeout() int
// GetFSMLogLevel returns the configured FSM log level
GetFSMLogLevel() string
// GetSidecarLogLevel returns the sidecar log level
GetSidecarLogLevel() string
// GetSidecarClass returns the sidecar class
GetSidecarClass() string
// GetSidecarImage returns the sidecar image
GetSidecarImage() string
// GetInitContainerImage returns the init container image
GetInitContainerImage() string
// GetProxyServerPort returns the port on which the Discovery Service listens for new connections from Sidecars
GetProxyServerPort() uint32
// GetSidecarDisabledMTLS returns the status of mTLS
GetSidecarDisabledMTLS() bool
// GetRepoServerIPAddr returns the ip address of RepoServer
GetRepoServerIPAddr() string
// GetRepoServerCodebase returns the codebase of RepoServer
GetRepoServerCodebase() string
// GetServiceCertValidityPeriod returns the validity duration for service certificates
GetServiceCertValidityPeriod() time.Duration
// GetIngressGatewayCertValidityPeriod returns the validity duration for the Ingress
// Gateway certificate, default value if not specified
GetIngressGatewayCertValidityPeriod() time.Duration
// GetCertKeyBitSize returns the certificate key bit size
GetCertKeyBitSize() int
// IsPrivilegedInitContainer determines whether init containers should be privileged
IsPrivilegedInitContainer() bool
// GetConfigResyncInterval returns the duration for resync interval.
// If error or non-parsable value, returns 0 duration
GetConfigResyncInterval() time.Duration
// GetProxyResources returns the `Resources` configured for proxies, if any
GetProxyResources() corev1.ResourceRequirements
// GetInjectedInitResources returns the `Resources` configured for proxies, if any
GetInjectedInitResources() corev1.ResourceRequirements
// GetInjectedHealthcheckResources returns the `Resources` configured for proxies, if any
GetInjectedHealthcheckResources() corev1.ResourceRequirements
// GetFeatureFlags returns FSM's feature flags
GetFeatureFlags() configv1alpha3.FeatureFlags
// GetGlobalPluginChains returns plugin chains
GetGlobalPluginChains() map[string][]trafficpolicy.Plugin
// IsGatewayAPIEnabled returns whether GatewayAPI is enabled
IsGatewayAPIEnabled() bool
// GetFSMGatewayLogLevel returns log level of FSM Gateway
GetFSMGatewayLogLevel() string
// IsIngressEnabled returns whether Ingress is enabled
IsIngressEnabled() bool
// IsIngressTLSEnabled returns whether Ingress is enabled
IsIngressTLSEnabled() bool
// GetIngressTLSListenPort returns the listen port of Ingress TLS
GetIngressTLSListenPort() int32
// IsIngressMTLSEnabled returns whether Ingress mTLS is enabled
IsIngressMTLSEnabled() bool
// IsIngressSSLPassthroughEnabled returns whether Ingress is enabled
IsIngressSSLPassthroughEnabled() bool
// GetIngressSSLPassthroughUpstreamPort returns the upstream port for SSL passthrough
GetIngressSSLPassthroughUpstreamPort() int32
// IsNamespacedIngressEnabled returns whether Namespaced Ingress is enabled
IsNamespacedIngressEnabled() bool
// IsIngressHTTPEnabled returns whether http port of Ingress is enabled
IsIngressHTTPEnabled() bool
// GetIngressHTTPListenPort returns the listen port of Ingress HTTP
GetIngressHTTPListenPort() int32
// GetFSMIngressLogLevel returns log level of FSM Gateway
GetFSMIngressLogLevel() string
// IsServiceLBEnabled returns whether ServiceLB is enabled
IsServiceLBEnabled() bool
// IsFLBEnabled returns whether FLB is enabled
IsFLBEnabled() bool
// GetFLBSecretName returns the secret name of FLB
GetFLBSecretName() string
// IsFLBStrictModeEnabled returns whether FLB Strict Mode is enabled
IsFLBStrictModeEnabled() bool
// IsMultiClusterControlPlane returns whether current cluster is the control plane of a multi cluster set
IsMultiClusterControlPlane() bool
// IsManaged returns whether the current cluster is managed by multicluster control plane
IsManaged() bool
// GetClusterUID returns the UID of the cluster
GetClusterUID() string
// GetMultiClusterControlPlaneUID returns the UID of the control plane if it's managed, or empty if not managed
GetMultiClusterControlPlaneUID() string
// GetImageRegistry returns the image registry
GetImageRegistry() string
// GetImageTag returns the image tag
GetImageTag() string
// GetImagePullPolicy returns the image pull policy
GetImagePullPolicy() corev1.PullPolicy
// ServiceLBImage string returns the service-lb image
ServiceLBImage() string
// GetFLBUpstreamMode returns the upstream mode of FLB
GetFLBUpstreamMode() configv1alpha3.FLBUpstreamMode
}