-
Notifications
You must be signed in to change notification settings - Fork 458
/
types.go
440 lines (405 loc) · 20.1 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
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
// Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
componentbaseconfigv1alpha1 "k8s.io/component-base/config/v1alpha1"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ControllerManagerConfiguration defines the configuration for the Gardener controller manager.
type ControllerManagerConfiguration struct {
metav1.TypeMeta `json:",inline"`
// GardenClientConnection specifies the kubeconfig file and the client connection settings
// for the proxy server to use when communicating with the garden apiserver.
GardenClientConnection componentbaseconfigv1alpha1.ClientConnectionConfiguration `json:"gardenClientConnection"`
// Controllers defines the configuration of the controllers.
Controllers ControllerManagerControllerConfiguration `json:"controllers"`
// LeaderElection defines the configuration of leader election client.
// +optional
LeaderElection *componentbaseconfigv1alpha1.LeaderElectionConfiguration `json:"leaderElection,omitempty"`
// LogLevel is the level/severity for the logs. Must be one of [info,debug,error].
LogLevel string `json:"logLevel"`
// LogFormat is the output format for the logs. Must be one of [text,json].
LogFormat string `json:"logFormat"`
// Server defines the configuration of the HTTP server.
Server ServerConfiguration `json:"server"`
// Debugging holds configuration for Debugging related features.
// +optional
Debugging *componentbaseconfigv1alpha1.DebuggingConfiguration `json:"debugging,omitempty"`
// FeatureGates is a map of feature names to bools that enable or disable alpha/experimental
// features. This field modifies piecemeal the built-in default values from
// "github.com/gardener/gardener/pkg/controllermanager/features/features.go".
// Default: nil
// +optional
FeatureGates map[string]bool `json:"featureGates,omitempty"`
}
// ControllerManagerControllerConfiguration defines the configuration of the controllers.
type ControllerManagerControllerConfiguration struct {
// Bastion defines the configuration of the Bastion controller.
// +optional
Bastion *BastionControllerConfiguration `json:"bastion,omitempty"`
// CertificateSigningRequest defines the configuration of the CertificateSigningRequest controller.
// +optional
CertificateSigningRequest *CertificateSigningRequestControllerConfiguration `json:"certificateSigningRequest,omitempty"`
// CloudProfile defines the configuration of the CloudProfile controller.
// +optional
CloudProfile *CloudProfileControllerConfiguration `json:"cloudProfile,omitempty"`
// ControllerDeployment defines the configuration of the ControllerDeployment controller.
// +optional
ControllerDeployment *ControllerDeploymentControllerConfiguration `json:"controllerDeployment,omitempty"`
// ControllerRegistration defines the configuration of the ControllerRegistration controller.
// +optional
ControllerRegistration *ControllerRegistrationControllerConfiguration `json:"controllerRegistration,omitempty"`
// Event defines the configuration of the Event controller. If unset, the event controller will be disabled.
// +optional
Event *EventControllerConfiguration `json:"event,omitempty"`
// ExposureClass defines the configuration of the ExposureClass controller.
// +optional
ExposureClass *ExposureClassControllerConfiguration `json:"exposureClass,omitempty"`
// Project defines the configuration of the Project controller.
// +optional
Project *ProjectControllerConfiguration `json:"project,omitempty"`
// Quota defines the configuration of the Quota controller.
// +optional
Quota *QuotaControllerConfiguration `json:"quota,omitempty"`
// SecretBinding defines the configuration of the SecretBinding controller.
// +optional
SecretBinding *SecretBindingControllerConfiguration `json:"secretBinding,omitempty"`
// Seed defines the configuration of the Seed lifecycle controller.
// +optional
Seed *SeedControllerConfiguration `json:"seed,omitempty"`
// SeedExtensionsCheck defines the configuration of the SeedExtensionsCheck controller.
// +optional
SeedExtensionsCheck *SeedExtensionsCheckControllerConfiguration `json:"seedExtensionsCheck,omitempty"`
// SeedBackupBucketsCheck defines the configuration of the SeedBackupBucketsCheck controller.
// +optional
SeedBackupBucketsCheck *SeedBackupBucketsCheckControllerConfiguration `json:"seedBackupBucketsCheck,omitempty"`
// ShootMaintenance defines the configuration of the ShootMaintenance controller.
ShootMaintenance ShootMaintenanceControllerConfiguration `json:"shootMaintenance"`
// ShootQuota defines the configuration of the ShootQuota controller.
ShootQuota ShootQuotaControllerConfiguration `json:"shootQuota"`
// ShootHibernation defines the configuration of the ShootHibernation controller.
ShootHibernation ShootHibernationControllerConfiguration `json:"shootHibernation"`
// ShootReference defines the configuration of the ShootReference controller. If unspecified, it is defaulted with `concurrentSyncs=5`.
// +optional
ShootReference *ShootReferenceControllerConfiguration `json:"shootReference,omitempty"`
// ShootRetry defines the configuration of the ShootRetry controller. If unspecified, it is defaulted with `concurrentSyncs=5`.
// +optional
ShootRetry *ShootRetryControllerConfiguration `json:"shootRetry,omitempty"`
// ShootConditions defines the configuration of the ShootConditions controller. If unspecified, it is defaulted with `concurrentSyncs=5`.
// +optional
ShootConditions *ShootConditionsControllerConfiguration `json:"shootConditions,omitempty"`
// ShootStatusLabel defines the configuration of the ShootStatusLabel controller.
// +optional
ShootStatusLabel *ShootStatusLabelControllerConfiguration `json:"shootStatusLabel,omitempty"`
// ManagedSeedSet defines the configuration of the ManagedSeedSet controller.
// +optional
ManagedSeedSet *ManagedSeedSetControllerConfiguration `json:"managedSeedSet,omitempty"`
}
// BastionControllerConfiguration defines the configuration of the Bastion
// controller.
type BastionControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
// MaxLifetime is the maximum time a Bastion resource can exist before it is
// forcefully deleted (defaults to '24h').
// +optional
MaxLifetime *metav1.Duration `json:"maxLifetime,omitempty"`
}
// CertificateSigningRequestControllerConfiguration defines the configuration of the CertificateSigningRequest
// controller.
type CertificateSigningRequestControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
}
// CloudProfileControllerConfiguration defines the configuration of the CloudProfile
// controller.
type CloudProfileControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
}
// ControllerDeploymentControllerConfiguration defines the configuration of the
// ControllerDeployment controller.
type ControllerDeploymentControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
}
// ControllerRegistrationControllerConfiguration defines the configuration of the
// ControllerRegistration controller.
type ControllerRegistrationControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
}
// EventControllerConfiguration defines the configuration of the Event controller.
type EventControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
// TTLNonShootEvents is the time-to-live for all non-shoot related events (defaults to `1h`).
// +optional
TTLNonShootEvents *metav1.Duration `json:"ttlNonShootEvents,omitempty"`
}
// ExposureClassControllerConfiguration defines the configuration of the
// ExposureClass controller.
type ExposureClassControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
}
// ProjectControllerConfiguration defines the configuration of the
// Project controller.
type ProjectControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
// MinimumLifetimeDays is the number of days a `Project` may exist before it is being
// checked whether it is actively used or got stale.
// +optional
MinimumLifetimeDays *int `json:"minimumLifetimeDays,omitempty"`
// Quotas is the default configuration matching projects are set up with if a quota is not already specified.
// +optional
Quotas []QuotaConfiguration `json:"quotas,omitempty"`
// StaleGracePeriodDays is the number of days a `Project` may be unused before it will
// be considered for checks whether it is actively used or got stale.
// +optional
StaleGracePeriodDays *int `json:"staleGracePeriodDays,omitempty"`
// StaleExpirationTimeDays is the number of days after a `Project` that has been marked as
// 'stale'/'unused' and passed the 'stale grace period' will be considered for auto deletion.
// +optional
StaleExpirationTimeDays *int `json:"staleExpirationTimeDays,omitempty"`
// StaleSyncPeriod is the duration how often the reconciliation loop for stale Projects is executed.
// +optional
StaleSyncPeriod *metav1.Duration `json:"staleSyncPeriod,omitempty"`
}
// QuotaConfiguration defines quota configurations.
type QuotaConfiguration struct {
// Config is the quota specification used for the project set-up.
// Only v1.ResourceQuota resources are supported.
Config runtime.RawExtension `json:"config"`
// ProjectSelector is an optional setting to select the projects considered for quotas.
// Defaults to empty LabelSelector, which matches all projects.
// +optional
ProjectSelector *metav1.LabelSelector `json:"projectSelector,omitempty"`
}
// QuotaControllerConfiguration defines the configuration of the Quota controller.
type QuotaControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
}
// SecretBindingControllerConfiguration defines the configuration of the
// SecretBinding controller.
type SecretBindingControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
}
// SeedControllerConfiguration defines the configuration of the
// Seed controller.
type SeedControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
// MonitorPeriod is the duration after the seed controller will mark the `GardenletReady`
// condition in `Seed` resources as `Unknown` in case the gardenlet did not send heartbeats.
// +optional
MonitorPeriod *metav1.Duration `json:"monitorPeriod,omitempty"`
// ShootMonitorPeriod is the duration after the seed controller will mark Gardener's conditions
// in `Shoot` resources as `Unknown` in case the gardenlet of the responsible seed cluster did
// not send heartbeats.
// +optional
ShootMonitorPeriod *metav1.Duration `json:"shootMonitorPeriod,omitempty"`
// SyncPeriod is the duration how often the seed controller will check for active gardenlet hearbeats.
// +optional
SyncPeriod *metav1.Duration `json:"syncPeriod,omitempty"`
}
// SeedExtensionsCheckControllerConfiguration defines the configuration of the SeedExtensionsCheck
// controller.
type SeedExtensionsCheckControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
// SyncPeriod is the duration how often the existing resources are reconciled (how
// often the health check of Seed Extensions is performed).
// +optional
SyncPeriod *metav1.Duration `json:"syncPeriod,omitempty"`
// ConditionThresholds defines the condition threshold per condition type.
// +optional
ConditionThresholds []ConditionThreshold `json:"conditionThresholds,omitempty"`
}
// SeedBackupBucketsCheckControllerConfiguration defines the configuration of the SeedBackupBucketsCheck
// controller.
type SeedBackupBucketsCheckControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
// SyncPeriod is the duration how often the existing resources are reconciled (how
// often the health check of BackupBuckets is performed).
// +optional
SyncPeriod *metav1.Duration `json:"syncPeriod,omitempty"`
// ConditionThresholds defines the condition threshold per condition type.
// +optional
ConditionThresholds []ConditionThreshold `json:"conditionThresholds,omitempty"`
}
// ShootMaintenanceControllerConfiguration defines the configuration of the
// ShootMaintenance controller.
type ShootMaintenanceControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
// EnableShootControlPlaneRestarter configures whether adequate pods of the shoot control plane are restarted during maintenance.
// +optional
EnableShootControlPlaneRestarter *bool `json:"enableShootControlPlaneRestarter"`
// EnableShootCoreAddonRestarter configures whether some core addons to be restarted during maintenance.
// +optional
EnableShootCoreAddonRestarter *bool `json:"enableShootCoreAddonRestarter"`
}
// ShootQuotaControllerConfiguration defines the configuration of the
// ShootQuota controller.
type ShootQuotaControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
// SyncPeriod is the duration how often the existing resources are reconciled
// (how often Shoots referenced Quota is checked).
SyncPeriod metav1.Duration `json:"syncPeriod"`
}
// ShootHibernationControllerConfiguration defines the configuration of the
// ShootHibernation controller.
type ShootHibernationControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
// TriggerDeadlineDuration is an optional deadline for triggering hibernation if scheduled
// time is missed for any reason (defaults to '2h').
// +optional
TriggerDeadlineDuration *metav1.Duration `json:"triggerDeadlineDuration,omitempty"`
}
// ShootReferenceControllerConfiguration defines the configuration of the
// ShootReference controller.
type ShootReferenceControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// shoots.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
}
// ShootRetryControllerConfiguration defines the configuration of the
// ShootRetry controller.
type ShootRetryControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
// RetryPeriod is the retry period for retrying failed Shoots that match certain criterion.
// Defaults to 10m.
// +optional
RetryPeriod *metav1.Duration `json:"retryPeriod,omitempty"`
// RetryJitterPeriod is a jitter duration for the reconciler retry that can be used to distribute the retries randomly.
// If its value is greater than 0 then the shoot will not be retried with the configured retry period but a random
// duration between 0 and the configured value will be added. It is defaulted to 5m.
// +optional
RetryJitterPeriod *metav1.Duration `json:"retryJitterPeriod,omitempty"`
}
// ShootConditionsControllerConfiguration defines the configuration of the
// ShootConditions controller.
type ShootConditionsControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
}
// ShootStatusLabelControllerConfiguration defines the configuration of the
// ShootStatusLabel controller.
type ShootStatusLabelControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
}
// ManagedSeedSetControllerConfiguration defines the configuration of the
// ManagedSeedSet controller.
type ManagedSeedSetControllerConfiguration struct {
// ConcurrentSyncs is the number of workers used for the controller to work on
// events.
// +optional
ConcurrentSyncs *int `json:"concurrentSyncs,omitempty"`
// MaxShootRetries is the maximum number of times to retry failed shoots before giving up. Defaults to 3.
// +optional
MaxShootRetries *int `json:"maxShootRetries,omitempty"`
// SyncPeriod is the duration how often the existing resources are reconciled.
SyncPeriod metav1.Duration `json:"syncPeriod"`
}
// ConditionThreshold defines the duration how long a flappy condition stays in progressing state.
type ConditionThreshold struct {
// Type is the type of the condition to define the threshold for.
Type string `json:"type"`
// Duration is the duration how long the condition can stay in the progressing state.
Duration metav1.Duration `json:"duration"`
}
// ServerConfiguration contains details for the HTTP(S) servers.
type ServerConfiguration struct {
// HealthProbes is the configuration for serving the healthz and readyz endpoints.
// +optional
HealthProbes *Server `json:"healthProbes,omitempty"`
// Metrics is the configuration for serving the metrics endpoint.
// +optional
Metrics *Server `json:"metrics,omitempty"`
}
// Server contains information for HTTP(S) server configuration.
type Server struct {
// BindAddress is the IP address on which to listen for the specified port.
BindAddress string `json:"bindAddress"`
// Port is the port on which to serve requests.
Port int `json:"port"`
}
const (
// ControllerManagerDefaultLockObjectNamespace is the default lock namespace for leader election.
ControllerManagerDefaultLockObjectNamespace = "garden"
// ControllerManagerDefaultLockObjectName is the default lock name for leader election.
ControllerManagerDefaultLockObjectName = "gardener-controller-manager-leader-election"
// DefaultControllerConcurrentSyncs is a default value for concurrent syncs for controllers.
DefaultControllerConcurrentSyncs = 5
// LogLevelDebug is the debug log level, i.e. the most verbose.
LogLevelDebug = "debug"
// LogLevelInfo is the default log level.
LogLevelInfo = "info"
// LogLevelError is a log level where only errors are logged.
LogLevelError = "error"
// LogFormatJSON is the output type that produces a JSON object per log line.
LogFormatJSON = "json"
// LogFormatText outputs the log as human-readable text.
LogFormatText = "text"
)