/
fluxcdconfig_types.go
389 lines (350 loc) · 10.6 KB
/
fluxcdconfig_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
/*
Copyright AppsCode Inc. and Contributors.
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 (
core "k8s.io/api/core/v1"
networking "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
const (
ResourceKindFluxCDConfig = "FluxCDConfig"
ResourceFluxCDConfig = "fluxcdconfig"
ResourceFluxCDConfigs = "fluxcdconfigs"
)
// FluxCDConfigSpec defines the desired state of FluxCDConfig
type FluxCDConfigSpec struct {
InstallCRDs bool `json:"installCRDs"`
// +optional
CRDs CRDsSpec `json:"crds"`
// +optional
Multitenancy Multitenancy `json:"multitenancy"`
// +optional
ClusterDomain string `json:"clusterDomain"`
// +optional
Cli CliSpec `json:"cli"`
// +optional
HelmController ControllerSpec `json:"helmController"`
// +optional
ImageAutomationController ControllerSpec `json:"imageAutomationController"`
// +optional
ImageReflectionController ControllerSpec `json:"imageReflectionController"`
// +optional
KustomizeController KustomizeControllerSpec `json:"kustomizeController"`
// +optional
NotificationController NotificationControllerSpec `json:"notificationController"`
// +optional
SourceController SourceControllerSpec `json:"sourceController"`
// +optional
Policies Policies `json:"policies"`
// +optional
Rbac Rbac `json:"rbac"`
// +optional
LogLevel string `json:"logLevel"`
// +optional
WatchAllNamespaces bool `json:"watchAllNamespaces"`
// +optional
ImagePullSecrets []core.LocalObjectReference `json:"imagePullSecrets"`
// +optional
ExtraObjects []runtime.RawExtension `json:"extraObjects"`
// +optional
Prometheus PrometheusSpec `json:"prometheus"`
}
type CRDsSpec struct {
// +optional
Annotations map[string]string `json:"annotations"`
}
type Multitenancy struct {
// +optional
Enabled bool `json:"enabled"`
// +optional
DefaultServiceAccount string `json:"defaultServiceAccount"`
// +optional
Privileged bool `json:"privileged"`
}
type CliSpec struct {
// +optional
Image string `json:"image"`
// +optional
Tag string `json:"tag"`
// +optional
NodeSelector map[string]string `json:"nodeSelector"`
// +optional
Affinity core.Affinity `json:"affinity"`
// +optional
Tolerations []core.Toleration `json:"tolerations"`
// +optional
Annotations map[string]string `json:"annotations"`
// +optional
ServiceAccount CliServiceAccountSpec `json:"serviceAccount"`
}
type CliServiceAccountSpec struct {
// +optional
Automount bool `json:"automount"`
}
type ControllerSpec struct {
Create bool `json:"create"`
// +optional
Image string `json:"image"`
// +optional
Tag string `json:"tag"`
// +optional
Resources ResourceRequirements `json:"resources"`
// +optional
PriorityClassName string `json:"priorityClassName"`
// +optional
Annotations map[string]string `json:"annotations"`
// +optional
Labels map[string]string `json:"labels"`
// +optional
Container ContainerSpec `json:"container"`
// +optional
ExtraEnv []core.EnvVar `json:"extraEnv"`
// +optional
ServiceAccount ServiceAccountSpec `json:"serviceAccount"`
// +optional
//+kubebuilder:validation:Enum=Always;Never;IfNotPresent;""
ImagePullPolicy core.PullPolicy `json:"imagePullPolicy"`
// +optional
NodeSelector map[string]string `json:"nodeSelector"`
// +optional
Affinity core.Affinity `json:"affinity"`
// +optional
Tolerations []core.Toleration `json:"tolerations"`
}
type KustomizeControllerSpec struct {
Create bool `json:"create"`
// +optional
Image string `json:"image"`
// +optional
Tag string `json:"tag"`
// +optional
Resources ResourceRequirements `json:"resources"`
// +optional
PriorityClassName string `json:"priorityClassName"`
// +optional
Annotations map[string]string `json:"annotations"`
// +optional
Labels map[string]string `json:"labels"`
// +optional
Container ContainerSpec `json:"container"`
// +optional
EnvFrom EnvFromSource `json:"envFrom"`
// +optional
ExtraEnv []core.EnvVar `json:"extraEnv"`
// +optional
ExtraSecretMounts []core.VolumeMount `json:"extraSecretMounts"`
// +optional
ServiceAccount ServiceAccountSpec `json:"serviceAccount"`
// +optional
//+kubebuilder:validation:Enum=Always;Never;IfNotPresent;""
ImagePullPolicy core.PullPolicy `json:"imagePullPolicy"`
// +optional
Secret SecretSpec `json:"secret"`
// +optional
NodeSelector map[string]string `json:"nodeSelector"`
// +optional
Affinity core.Affinity `json:"affinity"`
// +optional
Tolerations []core.Toleration `json:"tolerations"`
}
type SecretSpec struct {
Create bool `json:"create"`
// +optional
Name string `json:"name"`
// +optional
Data map[string]string `json:"data"`
}
type NotificationControllerSpec struct {
Create bool `json:"create"`
// +optional
Image string `json:"image"`
// +optional
Tag string `json:"tag"`
// +optional
Resources ResourceRequirements `json:"resources"`
// +optional
PriorityClassName string `json:"priorityClassName"`
// +optional
Annotations map[string]string `json:"annotations"`
// +optional
Labels map[string]string `json:"labels"`
// +optional
Container ContainerSpec `json:"container"`
// +optional
ExtraEnv []core.EnvVar `json:"extraEnv"`
// +optional
ServiceAccount ServiceAccountSpec `json:"serviceAccount"`
// +optional
//+kubebuilder:validation:Enum=Always;Never;IfNotPresent;""
ImagePullPolicy core.PullPolicy `json:"imagePullPolicy"`
// +optional
Service ServiceSpec `json:"service"`
// +optional
WebhookReceiver WebhookReceiverSpec `json:"webhookReceiver"`
// +optional
NodeSelector map[string]string `json:"nodeSelector"`
// +optional
Affinity core.Affinity `json:"affinity"`
// +optional
Tolerations []core.Toleration `json:"tolerations"`
}
type WebhookReceiverSpec struct {
// +optional
Service ServiceSpec `json:"service"`
// +optional
Ingress IngressSpec `json:"ingress"`
}
type IngressSpec struct {
Create bool `json:"create"`
Annotations map[string]string `json:"annotations"`
Labels map[string]string `json:"labels"`
Hosts []IngressRule `json:"hosts"`
TLS []networking.IngressTLS `json:"tls"`
}
type IngressRule struct {
Host string `json:"host"`
Paths []HTTPIngressPath `json:"paths"`
}
type HTTPIngressPath struct {
Path string `json:"path"`
PathType string `json:"pathType"`
}
type SourceControllerSpec struct {
Create bool `json:"create"`
// +optional
Image string `json:"image"`
// +optional
Tag string `json:"tag"`
// +optional
Resources ResourceRequirements `json:"resources"`
// +optional
PriorityClassName string `json:"priorityClassName"`
// +optional
Annotations map[string]string `json:"annotations"`
// +optional
Labels map[string]string `json:"labels"`
// +optional
Container ContainerSpec `json:"container"`
// +optional
ExtraEnv []core.EnvVar `json:"extraEnv"`
// +optional
ServiceAccount ServiceAccountSpec `json:"serviceAccount"`
// +optional
//+kubebuilder:validation:Enum=Always;Never;IfNotPresent;""
ImagePullPolicy core.PullPolicy `json:"imagePullPolicy"`
// +optional
Service ServiceSpec `json:"service"`
// +optional
NodeSelector map[string]string `json:"nodeSelector"`
// +optional
Affinity core.Affinity `json:"affinity"`
// +optional
Tolerations []core.Toleration `json:"tolerations"`
}
type ServiceSpec struct {
// +optional
Labels map[string]string `json:"labels"`
// +optional
Annotations map[string]string `json:"annotations"`
}
// ResourceRequirements describes the compute resource requirements.
type ResourceRequirements struct {
// Limits describes the maximum amount of compute resources allowed.
// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
// +optional
Limits core.ResourceList `json:"limits"`
// Requests describes the minimum amount of compute resources required.
// If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
// otherwise to an implementation-defined value.
// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
// +optional
Requests core.ResourceList `json:"requests"`
}
type EnvFromSource struct {
// +optional
Map LocalObjectReference `json:"map"`
// +optional
Secret LocalObjectReference `json:"secret"`
}
type LocalObjectReference struct {
// Name of the referent.
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
// TODO: Add other useful fields. apiVersion, kind, uid?
// +optional
Name string `json:"name"`
}
type ContainerSpec struct {
// +optional
AdditionalArgs []string `json:"additionalArgs"`
}
type ServiceAccountSpec struct {
Create bool `json:"create"`
// +optional
Automount bool `json:"automount"`
// +optional
Annotations map[string]string `json:"annotations"`
}
type Policies struct {
Create bool `json:"create"`
}
type Rbac struct {
Create bool `json:"create"`
// +optional
CreateAggregation bool `json:"createAggregation"`
// +optional
Annotations map[string]string `json:"annotations"`
}
type PrometheusSpec struct {
// +optional
PodMonitor PodMonitorSpec `json:"podMonitor"`
}
type PodMonitorSpec struct {
Create bool `json:"create"`
// +optional
PodMetricsEndpoints []MetricsEndpoints `json:"podMetricsEndpoints"`
}
type MetricsEndpoints struct {
// +optional
Port string `json:"port"`
// +optional
Relabelings []Relabeling `json:"relabelings"`
}
type Relabeling struct {
// +optional
SourceLabels []string `json:"sourceLabels"`
// +optional
Action string `json:"action"`
// +optional
Regex string `json:"regex"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// FluxCDConfig is the Schema for the fluxcdconfigs API
type FluxCDConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec FluxCDConfigSpec `json:"spec"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
//+kubebuilder:object:root=true
// FluxCDConfigList contains a list of FluxCDConfig
type FluxCDConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []FluxCDConfig `json:"items"`
}
func init() {
SchemeBuilder.Register(&FluxCDConfig{}, &FluxCDConfigList{})
}