/
types_landscaper_config.go
294 lines (259 loc) · 12.6 KB
/
types_landscaper_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
// SPDX-FileCopyrightText: 2020 SAP SE or an SAP affiliate company and Gardener contributors.
//
// SPDX-License-Identifier: Apache-2.0
package config
import (
cdv2 "github.com/gardener/component-spec/bindings-go/apis/v2"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
lscore "github.com/gardener/landscaper/apis/core"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// LandscaperConfiguration contains all configuration for the landscaper controllers
type LandscaperConfiguration struct {
metav1.TypeMeta
// Controllers contains all controller specific configuration.
Controllers Controllers
// RepositoryContext defines the default repository context that should be used to resolve component descriptors.
// DEPRECATED: use controllers.context.config.default.repositoryContext instead.
// +optional
RepositoryContext *cdv2.UnstructuredTypedObject
// Registry configures the landscaper registry to resolve component descriptors, blueprints and other artifacts.
Registry RegistryConfiguration
// BlueprintStore contains the configuration for the blueprint cache.
BlueprintStore BlueprintStore
// Metrics allows to configure how metrics are exposed
//+optional
Metrics *MetricsConfiguration
// CrdManagement configures whether the landscaper controller should deploy the CRDs it needs into the cluster
// +optional
CrdManagement CrdManagementConfiguration
// DeployItemTimeouts contains configuration for multiple deploy item timeouts
// +optional
DeployItemTimeouts *DeployItemTimeouts
// LsDeployments contains the names of the landscaper deployments
// +optional
LsDeployments *LsDeployments
// HPAMainConfiguration contains the HPA configuration (horizontal pod autoscaling)
// for the main controllers (Installation and Execution controller).
// +optional
HPAMainConfiguration *HPAMainConfiguration `json:"hpaMain,omitempty"`
// +optional
UseOCMLib bool `json:"useOCMLib,omitempty"`
// SignatureVerificationEnforcementPolicy defines how the landscaper handles signature verification.
SignatureVerificationEnforcementPolicy SignatureVerificationEnforcementPolicy `json:"signatureVerificationEnforcementPolicy,omitempty"`
}
// LsDeployments contains the names of the landscaper deployments.
type LsDeployments struct {
// LsController is the name of the Landscaper controller deployment.
LsController string
// LsMainController is the name of the main Landscaper controller deployment.
// +optional
LsMainController string
// LsController is the name of the Landscaper webhook server deployment.
WebHook string
// DeploymentsNamespace is the namespace in which the deployments are located.
DeploymentsNamespace string
// LsHealthCheckName is the name of the LsHealthCheck object.
LsHealthCheckName string
// AdditionalDeployments is the definition of additional deployments that shall be watched.
// +optional
AdditionalDeployments *AdditionalDeployments
}
// AdditionalDeployments is the definition of additional deployments that shall be watched.
type AdditionalDeployments struct {
// Deployments is the list of deployments that shall be watched.
Deployments []string
}
// CommonControllerConfig describes common controller configuration that can be included in
// the specific controller configurations.
type CommonControllerConfig struct {
// Workers is the maximum number of concurrent Reconciles which can be run.
// Defaults to 1.
Workers int
// CacheSyncTimeout refers to the time limit set to wait for syncing the kubernetes resource caches.
// Defaults to 2 minutes if not set.
CacheSyncTimeout *metav1.Duration
}
// Controllers contains all configuration for the specific controllers
type Controllers struct {
// SyncPeriod determines the minimum frequency at which watched resources are
// reconciled. A lower period will correct entropy more quickly, but reduce
// responsiveness to change if there are many watched resources. Change this
// value only if you know what you are doing. Defaults to 10 hours if unset.
// there will a 10 percent jitter between the SyncPeriod of all controllers
// so that all controllers will not send list requests simultaneously.
//
// This applies to all controllers.
//
// A period sync happens for two reasons:
// 1. To insure against a bug in the controller that causes an object to not
// be requeued, when it otherwise should be requeued.
// 2. To insure against an unknown bug in controller-runtime, or its dependencies,
// that causes an object to not be requeued, when it otherwise should be
// requeued, or to be removed from the queue, when it otherwise should not
// be removed.
SyncPeriod *metav1.Duration
// Installations contains the controller config that reconciles installations.
Installations InstallationsController
// Installations contains the controller config that reconciles executions.
Executions ExecutionsController
// DeployItems contains the controller config that reconciles deploy items.
DeployItems DeployItemsController
// Contexts contains the controller config that reconciles context objects.
Contexts ContextsController
}
// InstallationsController contains the controller config that reconciles installations.
type InstallationsController struct {
CommonControllerConfig
}
// ExecutionsController contains the controller config that reconciles executions.
type ExecutionsController struct {
CommonControllerConfig
}
// DeployItemsController contains the controller config that reconciles deploy items.
type DeployItemsController struct {
CommonControllerConfig
}
// ContextsController contains all configuration for the context controller.
type ContextsController struct {
CommonControllerConfig
Config ContextControllerConfig
}
// ContextControllerConfig contains the context specific configuration.
type ContextControllerConfig struct {
Default ContextControllerDefaultConfig
}
// ContextControllerDefaultConfig contains the configuration for the context defaults.
type ContextControllerDefaultConfig struct {
// Disable disables the default controller.
// If disabled no default contexts are created.
Disable bool
// ExcludedNamespaces defines a list of namespaces where no default context should be created.
// +optional
ExcludedNamespaces []string
// RepositoryContext defines the default repository context that should be used to resolve component descriptors.
// +optional
RepositoryContext *cdv2.UnstructuredTypedObject
}
// DeployItemTimeouts contains multiple timeout configurations for deploy items
type DeployItemTimeouts struct {
// PickupTimeout defines how long a deployer can take to react on changes to a deploy item before the landscaper will mark it as failed.
// Allowed values are 'none' (to disable pickup timeout detection) and anything that is understood by golang's time.ParseDuration method.
// Defaults to five minutes if not specified.
// +optional
Pickup *lscore.Duration
// Abort specifies how long the deployer may take to abort handling a deploy item after getting the abort annotation.
// Allowed values are 'none' (to disable abort timeout detection) and anything that is understood by golang's time.ParseDuration method.
// Defaults to five minutes if not specified.
// +optional
Abort *lscore.Duration
}
// RegistryConfiguration contains the configuration for the used definition registry
type RegistryConfiguration struct {
// Local defines a local registry to use for definitions
// +optional
Local *LocalRegistryConfiguration `json:"local,omitempty"`
// OCI defines a oci registry to use for definitions
// +optional
OCI *OCIConfiguration `json:"oci,omitempty"`
}
// LocalRegistryConfiguration contains the configuration for a local registry
type LocalRegistryConfiguration struct {
// RootPath configures the root path of a local registry.
// This path is used to search for components locally.
RootPath string `json:"rootPath"`
}
// OCIConfiguration holds configuration for the oci registry
type OCIConfiguration struct {
// ConfigFiles path to additional docker configuration files
// +optional
ConfigFiles []string `json:"configFiles,omitempty"`
// Cache holds configuration for the oci cache
// +optional
Cache *OCICacheConfiguration `json:"cache,omitempty"`
// AllowPlainHttp allows the fallback to http if https is not supported by the registry.
AllowPlainHttp bool `json:"allowPlainHttp"`
// InsecureSkipVerify skips the certificate validation of the oci registry
InsecureSkipVerify bool `json:"insecureSkipVerify"`
}
// OCICacheConfiguration contains the configuration for the oci cache
type OCICacheConfiguration struct {
// UseInMemoryOverlay enables an additional in memory overlay cache of oci images
// +optional
UseInMemoryOverlay bool `json:"useInMemoryOverlay,omitempty"`
// Path specifies the path to the oci cache on the filesystem.
// Defaults to /tmp/ocicache
// +optional
Path string `json:"path"`
}
// MetricsConfiguration allows to configure how metrics are exposed
type MetricsConfiguration struct {
// Port specifies the port on which metrics are published
Port int32 `json:"port"`
}
// CrdManagementConfiguration contains the configuration of the CRD management
type CrdManagementConfiguration struct {
// DeployCustomResourceDefinitions specifies if CRDs should be deployed
DeployCustomResourceDefinitions *bool `json:"deployCrd"`
// ForceUpdate specifies whether existing CRDs should be updated
// +optional
ForceUpdate *bool `json:"forceUpdate,omitempty"`
}
// IndexMethod describes the blueprint store index method
type IndexMethod string
const (
// BlueprintDigestIndex describes a IndexMethod that uses the digest of the blueprint.
// This is useful if blueprints and component descriptors are not immutable (e.g. during development)
BlueprintDigestIndex IndexMethod = "BlueprintDigestIndex"
// ComponentDescriptorIdentityMethod describes a IndexMethod that uses the component descriptor identity.
// This means that the blueprint is uniquely identified using the component-descriptors repository, name and version
// with the blueprint resource identity.
ComponentDescriptorIdentityMethod IndexMethod = "ComponentDescriptorIdentityMethod"
)
// BlueprintStore contains the configuration for the blueprint store.
type BlueprintStore struct {
// Path defines the root path where the blueprints are cached.
Path string
// DisableCache disables the cache and always fetches the blob from the registry.
// The blueprint is still stored on the filesystem.
DisableCache bool
// IndexMethod describes the method that should be used to index blueprints in the store.
// If component descriptors and blueprint are immutable (blueprints cannot be updated) use ComponentDescriptorIdentityMethod
// otherwise use the BlueprintDigestIndex to index by the content hash.
// Defaults to ComponentDescriptorIdentityMethod
// +optional
IndexMethod IndexMethod
GarbageCollectionConfiguration
}
// GarbageCollectionConfiguration contains all options for the cache garbage collection.
type GarbageCollectionConfiguration struct {
// Size is the size of the filesystem.
// If the value is 0 there is no limit and no garbage collection will happen.
// See the kubernetes quantity docs for detailed description of the format
// https://github.com/kubernetes/apimachinery/blob/master/pkg/api/resource/quantity.go
Size string
// GCHighThreshold defines the percent of disk usage which triggers files garbage collection.
GCHighThreshold float64
// GCLowThreshold defines the percent of disk usage to which files garbage collection attempts to free.
GCLowThreshold float64
// ResetInterval defines the interval when the hit reset should run.
ResetInterval metav1.Duration
// PreservedHitsProportion defines the percent of hits that should be preserved.
PreservedHitsProportion float64
}
// HPAMainConfiguration contains the HPA configuration (horizontal pod autoscaling)
// for the main controllers (Installation and Execution controller).
type HPAMainConfiguration struct {
MaxReplicas int32 `json:"maxReplicas,omitempty"`
}
// SignatureVerificationEnforcementPolicy describes the policy for signature verification
// +enum
type SignatureVerificationEnforcementPolicy string
const (
// Enforce will enforce all instalations to have valid signatures before being worked on. Disabling the verification on installation level has no impact.
Enforce SignatureVerificationEnforcementPolicy = "Enforce"
// DoNotEnforce does not enforce a global policy. Signature verification can be enabled in the installation if desired. [DEFAULT]
DoNotEnforce SignatureVerificationEnforcementPolicy = "DoNotEnforce"
// Disabled explcitly disables signature verification. Enabling the verification on installation level will not have an effect and the verification will still be disabled.
Disabled SignatureVerificationEnforcementPolicy = "Disabled"
)