forked from gardener/gardener
/
types.go
1619 lines (1454 loc) · 70.7 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
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
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2018 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 v1beta1
import (
"encoding/json"
"time"
gardencorev1alpha1 "github.com/gardener/gardener/pkg/apis/core/v1alpha1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
)
////////////////////////////////////////////////////
// CLOUD PROFILES //
////////////////////////////////////////////////////
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CloudProfile represents certain properties about a cloud environment.
type CloudProfile struct {
metav1.TypeMeta `json:",inline"`
// Standard object metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec defines the cloud environment properties.
// +optional
Spec CloudProfileSpec `json:"spec,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CloudProfileList is a collection of CloudProfiles.
type CloudProfileList struct {
metav1.TypeMeta `json:",inline"`
// Standard list object metadata.
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// Items is the list of CloudProfiles.
Items []CloudProfile `json:"items"`
}
// CloudProfileSpec is the specification of a CloudProfile.
// It must contain exactly one of its defined keys.
type CloudProfileSpec struct {
// AWS is the profile specification for the Amazon Web Services cloud.
// +optional
AWS *AWSProfile `json:"aws,omitempty"`
// Azure is the profile specification for the Microsoft Azure cloud.
// +optional
Azure *AzureProfile `json:"azure,omitempty"`
// GCP is the profile specification for the Google Cloud Platform cloud.
// +optional
GCP *GCPProfile `json:"gcp,omitempty"`
// OpenStack is the profile specification for the OpenStack cloud.
// +optional
OpenStack *OpenStackProfile `json:"openstack,omitempty"`
// Alicloud is the profile specification for the Alibaba cloud.
// +optional
Alicloud *AlicloudProfile `json:"alicloud,omitempty"`
// Packet is the profile specification for the Packet cloud.
// +optional
Packet *PacketProfile `json:"packet,omitempty"`
// CABundle is a certificate bundle which will be installed onto every host machine of the Shoot cluster.
// +optional
CABundle *string `json:"caBundle,omitempty"`
}
// AWSProfile defines certain constraints and definitions for the AWS cloud.
type AWSProfile struct {
// Constraints is an object containing constraints for certain values in the Shoot specification.
Constraints AWSConstraints `json:"constraints"`
}
// AWSConstraints is an object containing constraints for certain values in the Shoot specification.
type AWSConstraints struct {
// DNSProviders contains constraints regarding allowed values of the 'dns.provider' block in the Shoot specification.
DNSProviders []DNSProviderConstraint `json:"dnsProviders"`
// Kubernetes contains constraints regarding allowed values of the 'kubernetes' block in the Shoot specification.
Kubernetes KubernetesConstraints `json:"kubernetes"`
// MachineImages contains constraints regarding allowed values for machine images in the Shoot specification.
MachineImages []MachineImage `json:"machineImages"`
// MachineTypes contains constraints regarding allowed values for machine types in the 'workers' block in the Shoot specification.
MachineTypes []MachineType `json:"machineTypes"`
// VolumeTypes contains constraints regarding allowed values for volume types in the 'workers' block in the Shoot specification.
VolumeTypes []VolumeType `json:"volumeTypes"`
// Zones contains constraints regarding allowed values for 'zones' block in the Shoot specification.
Zones []Zone `json:"zones"`
}
// MachineImage defines the name and the version of the machine image in any environment.
type MachineImage struct {
// Name is the name of the image.
Name string `json:"name"`
// Version is the version of the image.
Version string `json:"version"`
}
// AzureProfile defines certain constraints and definitions for the Azure cloud.
type AzureProfile struct {
// Constraints is an object containing constraints for certain values in the Shoot specification.
Constraints AzureConstraints `json:"constraints"`
// CountUpdateDomains is list of Azure update domain counts for each region.
CountUpdateDomains []AzureDomainCount `json:"countUpdateDomains"`
// CountFaultDomains is list of Azure fault domain counts for each region.
CountFaultDomains []AzureDomainCount `json:"countFaultDomains"`
}
// AzureConstraints is an object containing constraints for certain values in the Shoot specification.
type AzureConstraints struct {
// DNSProviders contains constraints regarding allowed values of the 'dns.provider' block in the Shoot specification.
DNSProviders []DNSProviderConstraint `json:"dnsProviders"`
// Kubernetes contains constraints regarding allowed values of the 'kubernetes' block in the Shoot specification.
Kubernetes KubernetesConstraints `json:"kubernetes"`
// MachineImages contains constraints regarding allowed values for machine images in the Shoot specification.
MachineImages []MachineImage `json:"machineImages"`
// MachineTypes contains constraints regarding allowed values for machine types in the 'workers' block in the Shoot specification.
MachineTypes []MachineType `json:"machineTypes"`
// VolumeTypes contains constraints regarding allowed values for volume types in the 'workers' block in the Shoot specification.
VolumeTypes []VolumeType `json:"volumeTypes"`
}
// AzureDomainCount defines the region and the count for this domain count value.
type AzureDomainCount struct {
// Region is a region in Azure.
Region string `json:"region"`
// Count is the count value for the respective domain count.
Count int `json:"count"`
}
// GCPProfile defines certain constraints and definitions for the GCP cloud.
type GCPProfile struct {
// Constraints is an object containing constraints for certain values in the Shoot specification.
Constraints GCPConstraints `json:"constraints"`
}
// GCPConstraints is an object containing constraints for certain values in the Shoot specification.
type GCPConstraints struct {
// DNSProviders contains constraints regarding allowed values of the 'dns.provider' block in the Shoot specification.
DNSProviders []DNSProviderConstraint `json:"dnsProviders"`
// Kubernetes contains constraints regarding allowed values of the 'kubernetes' block in the Shoot specification.
Kubernetes KubernetesConstraints `json:"kubernetes"`
// MachineImages contains constraints regarding allowed values for machine images in the Shoot specification.
MachineImages []MachineImage `json:"machineImages"`
// MachineTypes contains constraints regarding allowed values for machine types in the 'workers' block in the Shoot specification.
MachineTypes []MachineType `json:"machineTypes"`
// VolumeTypes contains constraints regarding allowed values for volume types in the 'workers' block in the Shoot specification.
VolumeTypes []VolumeType `json:"volumeTypes"`
// Zones contains constraints regarding allowed values for 'zones' block in the Shoot specification.
Zones []Zone `json:"zones"`
}
// OpenStackProfile defines certain constraints and definitions for the OpenStack cloud.
type OpenStackProfile struct {
// Constraints is an object containing constraints for certain values in the Shoot specification.
Constraints OpenStackConstraints `json:"constraints"`
// KeyStoneURL is the URL for auth{n,z} in OpenStack (pointing to KeyStone).
KeyStoneURL string `json:"keystoneURL"`
// DNSServers is a list of IPs of DNS servers used while creating subnets.
// +optional
DNSServers []string `json:"dnsServers,omitempty"`
// DHCPDomain is the dhcp domain of the OpenStack system configured in nova.conf. Only meaningful for
// Kubernetes 1.10.1+. See https://github.com/kubernetes/kubernetes/pull/61890 for details.
// +optional
DHCPDomain *string `json:"dhcpDomain,omitempty"`
// RequestTimeout specifies the HTTP timeout against the OpenStack API.
// +optional
RequestTimeout *string `json:"requestTimeout,omitempty"`
}
// OpenStackConstraints is an object containing constraints for certain values in the Shoot specification.
type OpenStackConstraints struct {
// DNSProviders contains constraints regarding allowed values of the 'dns.provider' block in the Shoot specification.
DNSProviders []DNSProviderConstraint `json:"dnsProviders"`
// FloatingPools contains constraints regarding allowed values of the 'floatingPoolName' block in the Shoot specification.
FloatingPools []OpenStackFloatingPool `json:"floatingPools"`
// Kubernetes contains constraints regarding allowed values of the 'kubernetes' block in the Shoot specification.
Kubernetes KubernetesConstraints `json:"kubernetes"`
// LoadBalancerProviders contains constraints regarding allowed values of the 'loadBalancerProvider' block in the Shoot specification.
LoadBalancerProviders []OpenStackLoadBalancerProvider `json:"loadBalancerProviders"`
// MachineImages contains constraints regarding allowed values for machine images in the Shoot specification.
MachineImages []MachineImage `json:"machineImages"`
// MachineTypes contains constraints regarding allowed values for machine types in the 'workers' block in the Shoot specification.
MachineTypes []OpenStackMachineType `json:"machineTypes"`
// Zones contains constraints regarding allowed values for 'zones' block in the Shoot specification.
Zones []Zone `json:"zones"`
}
// FloatingPools contains constraints regarding allowed values of the 'floatingPoolName' block in the Shoot specification.
type OpenStackFloatingPool struct {
// Name is the name of the floating pool.
Name string `json:"name"`
}
// LoadBalancerProviders contains constraints regarding allowed values of the 'loadBalancerProvider' block in the Shoot specification.
type OpenStackLoadBalancerProvider struct {
// Name is the name of the load balancer provider.
Name string `json:"name"`
}
// AlicloudProfile defines constraints and definitions in Alibaba Cloud environment.
type AlicloudProfile struct {
// Constraints is an object containing constraints for certain values in the Shoot specification.
Constraints AlicloudConstraints `json:"constraints"`
}
// AlicloudConstraints is an object containing constraints for certain values in the Shoot specification
type AlicloudConstraints struct {
// DNSProviders contains constraints regarding allowed values of the 'dns.provider' block in the Shoot specification.
DNSProviders []DNSProviderConstraint `json:"dnsProviders"`
// Kubernetes contains constraints regarding allowed values of the 'kubernetes' block in the Shoot specification.
Kubernetes KubernetesConstraints `json:"kubernetes"`
// MachineImages contains constraints regarding allowed values for machine images in the Shoot specification.
MachineImages []MachineImage `json:"machineImages"`
// MachineTypes contains constraints regarding allowed values for machine types in the 'workers' block in the Shoot specification.
MachineTypes []AlicloudMachineType `json:"machineTypes"`
// VolumeTypes contains constraints regarding allowed values for volume types in the 'workers' block in the Shoot specification.
VolumeTypes []AlicloudVolumeType `json:"volumeTypes"`
// Zones contains constraints regarding allowed values for 'zones' block in the Shoot specification.
Zones []Zone `json:"zones"`
}
// AlicloudMachineType defines certain machine types and zone constraints.
type AlicloudMachineType struct {
MachineType `json:",inline"`
Zones []string `json:"zones"`
}
// AlicloudVolumeType defines certain volume types and zone constraints.
type AlicloudVolumeType struct {
VolumeType `json:",inline"`
Zones []string `json:"zones"`
}
// PacketProfile defines constraints and definitions in Packet Cloud environment.
type PacketProfile struct {
// Constraints is an object containing constraints for certain values in the Shoot specification.
Constraints PacketConstraints `json:"constraints"`
}
// PacketConstraints is an object containing constraints for certain values in the Shoot specification
type PacketConstraints struct {
// DNSProviders contains constraints regarding allowed values of the 'dns.provider' block in the Shoot specification.
DNSProviders []DNSProviderConstraint `json:"dnsProviders"`
// Kubernetes contains constraints regarding allowed values of the 'kubernetes' block in the Shoot specification.
Kubernetes KubernetesConstraints `json:"kubernetes"`
// MachineImages contains constraints regarding allowed values for machine images in the Shoot specification.
MachineImages []MachineImage `json:"machineImages"`
// MachineTypes contains constraints regarding allowed values for machine types in the 'workers' block in the Shoot specification.
MachineTypes []MachineType `json:"machineTypes"`
// VolumeTypes contains constraints regarding allowed values for volume types in the 'workers' block in the Shoot specification.
VolumeTypes []VolumeType `json:"volumeTypes"`
// Zones contains constraints regarding allowed values for 'zones' block in the Shoot specification.
Zones []Zone `json:"zones"`
}
// DNSProviderConstraint contains constraints regarding allowed values of the 'dns.provider' block in the Shoot specification.
type DNSProviderConstraint struct {
// Name is the name of the DNS provider.
Name string `json:"name"`
}
// KubernetesConstraints contains constraints regarding allowed values of the 'kubernetes' block in the Shoot specification.
type KubernetesConstraints struct {
// Versions is the list of allowed Kubernetes versions for Shoot clusters (e.g., 1.13.1).
Versions []string `json:"versions"`
}
// MachineType contains certain properties of a machine type.
type MachineType struct {
// Name is the name of the machine type.
Name string `json:"name"`
// Usable defines if the machine type can be used for shoot clusters.
// +optional
Usable *bool `json:"usable,omitempty"`
// CPU is the number of CPUs for this machine type.
CPU resource.Quantity `json:"cpu"`
// GPU is the number of GPUs for this machine type.
GPU resource.Quantity `json:"gpu"`
// Memory is the amount of memory for this machine type.
Memory resource.Quantity `json:"memory"`
}
// OpenStackMachineType contains certain properties of a machine type in OpenStack
type OpenStackMachineType struct {
MachineType `json:",inline"`
// VolumeType is the type of that volume.
VolumeType string `json:"volumeType"`
// VolumeSize is the amount of disk storage for this machine type.
VolumeSize resource.Quantity `json:"volumeSize"`
}
// VolumeType contains certain properties of a volume type.
type VolumeType struct {
// Name is the name of the volume type.
Name string `json:"name"`
// Usable defines if the volume type can be used for shoot clusters.
// +optional
Usable *bool `json:"usable,omitempty"`
// Class is the class of the volume type.
Class string `json:"class"`
}
// Zone contains certain properties of an availability zone.
type Zone struct {
// Region is a region name.
Region string `json:"region"`
// Names is a list of availability zone names in this region.
Names []string `json:"names"`
}
////////////////////////////////////////////////////
// PROJECTS //
////////////////////////////////////////////////////
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Project holds certain properties about a Gardener project.
type Project struct {
metav1.TypeMeta `json:",inline"`
// Standard object metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec defines the project properties.
// +optional
Spec ProjectSpec `json:"spec,omitempty"`
// Most recently observed status of the Project.
// +optional
Status ProjectStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ProjectList is a collection of Projects.
type ProjectList struct {
metav1.TypeMeta `json:",inline"`
// Standard list object metadata.
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// Items is the list of Projects.
Items []Project `json:"items"`
}
// ProjectSpec is the specification of a Project.
type ProjectSpec struct {
// CreatedBy is a subject representing a user name, an email address, or any other identifier of a user
// who created the project.
// +optional
CreatedBy *rbacv1.Subject `json:"createdBy,omitempty"`
// Description is a human-readable description of what the project is used for.
// +optional
Description *string `json:"description,omitempty"`
// Owner is a subject representing a user name, an email address, or any other identifier of a user owning
// the project.
// +optional
Owner *rbacv1.Subject `json:"owner,omitempty"`
// Purpose is a human-readable explanation of the project's purpose.
// +optional
Purpose *string `json:"purpose,omitempty"`
// Members is a list of subjects representing a user name, an email address, or any other identifier of a user
// that should be part of this project with full permissions to manage it.
// +optional
Members []rbacv1.Subject `json:"members,omitempty"`
// Namespace is the name of the namespace that has been created for the Project object.
// A nil value means that Gardener will determine the name of the namespace.
// +optional
Namespace *string `json:"namespace,omitempty"`
// Viewers is a list of subjects representing a user name, an email address, or any other identifier of a user
// that should be part of this project with limited permissions to only view some resources.
// +optional
Viewers []rbacv1.Subject `json:"viewers,omitempty"`
}
// ProjectStatus holds the most recently observed status of the project.
type ProjectStatus struct {
// ObservedGeneration is the most recent generation observed for this project.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Phase is the current phase of the project.
Phase ProjectPhase `json:"phase,omitempty"`
}
// ProjectPhase is a label for the condition of a project at the current time.
type ProjectPhase string
const (
// ProjectPending indicates that the project reconciliation is pending.
ProjectPending ProjectPhase = "Pending"
// ProjectReady indicates that the project reconciliation was successful.
ProjectReady ProjectPhase = "Ready"
// ProjectFailed indicates that the project reconciliation failed.
ProjectFailed ProjectPhase = "Failed"
// ProjectTerminating indicates that the project is in termination process.
ProjectTerminating ProjectPhase = "Terminating"
)
////////////////////////////////////////////////////
// SEEDS //
////////////////////////////////////////////////////
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// Seed holds certain properties about a Seed cluster.
// +k8s:openapi-gen=x-kubernetes-print-columns:custom-columns=NAME:.metadata.name,DOMAIN:.spec.ingressDomain,CLOUDPROFILE:.spec.cloud.profile,REGION:.spec.cloud.profile,READY:.status.conditions[?(@.type == 'Available')].status
type Seed struct {
metav1.TypeMeta `json:",inline"`
// Standard object metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec defines the Seed cluster properties.
// +optional
Spec SeedSpec `json:"spec,omitempty"`
// Most recently observed status of the Seed cluster.
// +optional
Status SeedStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// SeedList is a collection of Seeds.
type SeedList struct {
metav1.TypeMeta `json:",inline"`
// Standard list object metadata.
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// Items is the list of Seeds.
Items []Seed `json:"items"`
}
// SeedSpec is the specification of a Seed.
type SeedSpec struct {
// Cloud defines the cloud profile and the region this Seed cluster belongs to.
Cloud SeedCloud `json:"cloud"`
// IngressDomain is the domain of the Seed cluster pointing to the ingress controller endpoint. It will be used
// to construct ingress URLs for system applications running in Shoot clusters.
IngressDomain string `json:"ingressDomain"`
// SecretRef is a reference to a Secret object containing the Kubeconfig and the cloud provider credentials for
// the account the Seed cluster has been deployed to.
SecretRef corev1.SecretReference `json:"secretRef"`
// Networks defines the pod, service and worker network of the Seed cluster.
Networks SeedNetworks `json:"networks"`
// BlockCIDRs is a list of network addresses tha should be blocked for shoot control plane components running
// in the seed cluster.
// +optional
BlockCIDRs []gardencorev1alpha1.CIDR `json:"blockCIDRs,omitempty"`
// Visible labels the Seed cluster as selectable for the seedfinder admission controller.
// +optional
Visible *bool `json:"visible,omitempty"`
// Protected prevent that the Seed Cluster can be used for regular Shoot cluster control planes.
// +optional
Protected *bool `json:"protected,omitempty"`
}
// SeedStatus holds the most recently observed status of the Seed cluster.
type SeedStatus struct {
// Gardener holds information about the Gardener which last acted on the Shoot.
// +optional
Gardener Gardener `json:"gardener,omitempty"`
// Conditions represents the latest available observations of a Seed's current state.
// +optional
Conditions []gardencorev1alpha1.Condition `json:"conditions,omitempty"`
// ObservedGeneration is the most recent generation observed for this Seed. It corresponds to the
// Seed's generation, which is updated on mutation by the API Server.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}
// SeedCloud defines the cloud profile and the region this Seed cluster belongs to.
type SeedCloud struct {
// Profile is the name of a cloud profile.
Profile string `json:"profile"`
// Region is a name of a region.
Region string `json:"region"`
}
// SeedNetworks contains CIDRs for the pod, service and node networks of a Kubernetes cluster.
type SeedNetworks struct {
// Nodes is the CIDR of the node network.
Nodes gardencorev1alpha1.CIDR `json:"nodes"`
// Pods is the CIDR of the pod network.
Pods gardencorev1alpha1.CIDR `json:"pods"`
// Services is the CIDR of the service network.
Services gardencorev1alpha1.CIDR `json:"services"`
}
////////////////////////////////////////////////////
// QUOTAS //
////////////////////////////////////////////////////
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Quota struct {
metav1.TypeMeta `json:",inline"`
// Standard object metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec defines the Quota constraints.
// +optional
Spec QuotaSpec `json:"spec,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// QuotaList is a collection of Quotas.
type QuotaList struct {
metav1.TypeMeta `json:",inline"`
// Standard list object metadata.
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// Items is the list of Quotas.
Items []Quota `json:"items"`
}
// QuotaSpec is the specification of a Quota.
type QuotaSpec struct {
// ClusterLifetimeDays is the lifetime of a Shoot cluster in days before it will be terminated automatically.
// +optional
ClusterLifetimeDays *int `json:"clusterLifetimeDays,omitempty"`
// Metrics is a list of resources which will be put under constraints.
Metrics corev1.ResourceList `json:"metrics"`
// Scope is the scope of the Quota object, either 'project' or 'secret'.
Scope QuotaScope `json:"scope"`
}
// QuotaScope is a string alias.
type QuotaScope string
const (
// QuotaScopeProject indicates that the scope of a Quota object is a project.
QuotaScopeProject QuotaScope = "project"
// QuotaScopeSecret indicates that the scope of a Quota object is a cloud provider secret.
QuotaScopeSecret QuotaScope = "secret"
)
////////////////////////////////////////////////////
// SECRET BINDINGS //
////////////////////////////////////////////////////
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type SecretBinding struct {
metav1.TypeMeta `json:",inline"`
// Standard object metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// SecretRef is a reference to a secret object in the same or another namespace.
SecretRef corev1.SecretReference `json:"secretRef"`
// Quotas is a list of references to Quota objects in the same or another namespace.
// +optional
Quotas []corev1.ObjectReference `json:"quotas,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// SecretBindingList is a collection of SecretBindings.
type SecretBindingList struct {
metav1.TypeMeta `json:",inline"`
// Standard list object metadata.
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// Items is the list of SecretBindings.
Items []SecretBinding `json:"items"`
}
////////////////////////////////////////////////////
// SHOOTS //
////////////////////////////////////////////////////
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:openapi-gen=x-kubernetes-print-columns:custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name,SEED:.spec.cloud.seed,DOMAIN:.spec.dns.domain,VERSION:.spec.kubernetes.version,CONTROL:.status.conditions[?(@.type == 'ControlPlaneHealthy')].status,NODES:.status.conditions[?(@.type == 'EveryNodeReady')].status,SYSTEM:.status.conditions[?(@.type == 'SystemComponentsHealthy')].status,LATEST:.status.lastOperation.state
type Shoot struct {
metav1.TypeMeta `json:",inline"`
// Standard object metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// Specification of the Shoot cluster.
// +optional
Spec ShootSpec `json:"spec,omitempty"`
// Most recently observed status of the Shoot cluster.
// +optional
Status ShootStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ShootList is a list of Shoot objects.
type ShootList struct {
metav1.TypeMeta `json:",inline"`
// Standard list object metadata.
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// Items is the list of Shoots.
Items []Shoot `json:"items"`
}
// ShootSpec is the specification of a Shoot.
type ShootSpec struct {
// Addons contains information about enabled/disabled addons and their configuration.
// +optional
Addons *Addons `json:"addons,omitempty"`
// DEPRECATED: This field will be removed in a future version.
// +optional
Backup *Backup `json:"backup,omitempty"`
// Cloud contains information about the cloud environment and their specific settings.
Cloud Cloud `json:"cloud"`
// DNS contains information about the DNS settings of the Shoot.
DNS DNS `json:"dns"`
// Extensions contain type and provider information for Shoot extensions.
// +optional
Extensions []Extension `json:"extensions,omitempty"`
// Hibernation contains information whether the Shoot is suspended or not.
// +optional
Hibernation *Hibernation `json:"hibernation,omitempty"`
// Kubernetes contains the version and configuration settings of the control plane components.
Kubernetes Kubernetes `json:"kubernetes"`
// Maintenance contains information about the time window for maintenance operations and which
// operations should be performed.
// +optional
Maintenance *Maintenance `json:"maintenance,omitempty"`
}
// ShootStatus holds the most recently observed status of the Shoot cluster.
type ShootStatus struct {
// Conditions represents the latest available observations of a Shoots's current state.
// +optional
Conditions []gardencorev1alpha1.Condition `json:"conditions,omitempty"`
// Gardener holds information about the Gardener which last acted on the Shoot.
Gardener Gardener `json:"gardener"`
// LastOperation holds information about the last operation on the Shoot.
// +optional
LastOperation *gardencorev1alpha1.LastOperation `json:"lastOperation,omitempty"`
// LastError holds information about the last occurred error during an operation.
// +optional
LastError *gardencorev1alpha1.LastError `json:"lastError,omitempty"`
// ObservedGeneration is the most recent generation observed for this Shoot. It corresponds to the
// Shoot's generation, which is updated on mutation by the API Server.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// RetryCycleStartTime is the start time of the last retry cycle (used to determine how often an operation
// must be retried until we give up).
// +optional
RetryCycleStartTime *metav1.Time `json:"retryCycleStartTime,omitempty"`
// Seed is the name of the seed cluster that runs the control plane of the Shoot. This value is only written
// after a successful create/reconcile operation. It will be used when control planes are moved between Seeds.
Seed string `json:"seed,omitempty"`
// TechnicalID is the name that is used for creating the Seed namespace, the infrastructure resources, and
// basically everything that is related to this particular Shoot.
TechnicalID string `json:"technicalID"`
// UID is a unique identifier for the Shoot cluster to avoid portability between Kubernetes clusters.
// It is used to compute unique hashes.
UID types.UID `json:"uid"`
}
///////////////////////////////
// Shoot Specification Types //
///////////////////////////////
// Cloud contains information about the cloud environment and their specific settings.
// It must contain exactly one key of the below cloud providers.
type Cloud struct {
// Profile is a name of a CloudProfile object.
Profile string `json:"profile"`
// Region is a name of a cloud provider region.
Region string `json:"region"`
// SecretBindingRef is a reference to a SecretBinding object.
SecretBindingRef corev1.LocalObjectReference `json:"secretBindingRef"`
// Seed is the name of a Seed object.
// +optional
Seed *string `json:"seed,omitempty"`
// AWS contains the Shoot specification for the Amazon Web Services cloud.
// +optional
AWS *AWSCloud `json:"aws,omitempty"`
// Azure contains the Shoot specification for the Microsoft Azure cloud.
// +optional
Azure *AzureCloud `json:"azure,omitempty"`
// GCP contains the Shoot specification for the Google Cloud Platform cloud.
// +optional
GCP *GCPCloud `json:"gcp,omitempty"`
// OpenStack contains the Shoot specification for the OpenStack cloud.
// +optional
OpenStack *OpenStackCloud `json:"openstack,omitempty"`
// Alicloud contains the Shoot specification for the Alibaba cloud.
// +optional
Alicloud *Alicloud `json:"alicloud,omitempty"`
// Packet contains the Shoot specification for the Packet cloud.
// +optional
Packet *PacketCloud `json:"packet,omitempty"`
}
// AWSCloud contains the Shoot specification for AWS.
type AWSCloud struct {
// MachineImage holds information about the machine image to use for all workers.
// It will default to the first image stated in the referenced CloudProfile if no
// value has been provided.
// +optional
MachineImage *MachineImage `json:"machineImage,omitempty"`
// Networks holds information about the Kubernetes and infrastructure networks.
Networks AWSNetworks `json:"networks"`
// Workers is a list of worker groups.
Workers []AWSWorker `json:"workers"`
// Zones is a list of availability zones to deploy the Shoot cluster to.
Zones []string `json:"zones"`
}
// AWSNetworks holds information about the Kubernetes and infrastructure networks.
type AWSNetworks struct {
gardencorev1alpha1.K8SNetworks `json:",inline"`
// VPC indicates whether to use an existing VPC or create a new one.
VPC AWSVPC `json:"vpc"`
// Internal is a list of private subnets to create (used for internal load balancers).
Internal []gardencorev1alpha1.CIDR `json:"internal"`
// Public is a list of public subnets to create (used for bastion and load balancers).
Public []gardencorev1alpha1.CIDR `json:"public"`
// Workers is a list of worker subnets (private) to create (used for the VMs).
Workers []gardencorev1alpha1.CIDR `json:"workers"`
}
// AWSVPC contains either an id (of an existing VPC) or the CIDR (for a VPC to be created).
type AWSVPC struct {
// ID is the AWS VPC id of an existing VPC.
// +optional
ID *string `json:"id,omitempty"`
// CIDR is a CIDR range for a new VPC.
// +optional
CIDR *gardencorev1alpha1.CIDR `json:"cidr,omitempty"`
}
// AWSWorker is the definition of a worker group.
type AWSWorker struct {
Worker `json:",inline"`
// VolumeType is the type of the root volumes.
VolumeType string `json:"volumeType"`
// VolumeSize is the size of the root volume.
VolumeSize string `json:"volumeSize"`
}
// Alicloud contains the Shoot specification for Alibaba cloud
type Alicloud struct {
// MachineImage holds information about the machine image to use for all workers.
// It will default to the first image stated in the referenced CloudProfile if no
// value has been provided.
// +optional
MachineImage *MachineImage `json:"machineImage,omitempty"`
// Networks holds information about the Kubernetes and infrastructure networks.
Networks AlicloudNetworks `json:"networks"`
// Workers is a list of worker groups.
Workers []AlicloudWorker `json:"workers"`
// Zones is a list of availability zones to deploy the Shoot cluster to, currently, only one is supported.
Zones []string `json:"zones"`
}
// AlicloudVPC contains either an id (of an existing VPC) or the CIDR (for a VPC to be created).
type AlicloudVPC struct {
// ID is the Alicloud VPC id of an existing VPC.
// +optional
ID *string `json:"id,omitempty"`
// CIDR is a CIDR range for a new VPC.
// +optional
CIDR *gardencorev1alpha1.CIDR `json:"cidr,omitempty"`
}
// AlicloudNetworks holds information about the Kubernetes and infrastructure networks.
type AlicloudNetworks struct {
gardencorev1alpha1.K8SNetworks `json:",inline"`
// VPC indicates whether to use an existing VPC or create a new one.
VPC AlicloudVPC `json:"vpc"`
// Workers is a CIDR of a worker subnet (private) to create (used for the VMs).
Workers []gardencorev1alpha1.CIDR `json:"workers"`
}
// AlicloudWorker is the definition of a worker group.
type AlicloudWorker struct {
Worker `json:",inline"`
// VolumeType is the type of the root volumes.
VolumeType string `json:"volumeType"`
// VolumeSize is the size of the root volume.
VolumeSize string `json:"volumeSize"`
}
// PacketCloud contains the Shoot specification for Packet cloud
type PacketCloud struct {
// MachineImage holds information about the machine image to use for all workers.
// It will default to the first image stated in the referenced CloudProfile if no
// value has been provided.
// +optional
MachineImage *MachineImage `json:"machineImage,omitempty"`
// Networks holds information about the Kubernetes and infrastructure networks.
Networks PacketNetworks `json:"networks"`
// Workers is a list of worker groups.
Workers []PacketWorker `json:"workers"`
// Zones is a list of availability zones to deploy the Shoot cluster to, currently, only one is supported.
Zones []string `json:"zones"`
}
// PacketNetworks holds information about the Kubernetes and infrastructure networks.
type PacketNetworks struct {
gardencorev1alpha1.K8SNetworks `json:",inline"`
}
// PacketWorker is the definition of a worker group.
type PacketWorker struct {
Worker `json:",inline"`
// VolumeType is the type of the root volumes.
VolumeType string `json:"volumeType"`
// VolumeSize is the size of the root volume.
VolumeSize string `json:"volumeSize"`
}
// AzureCloud contains the Shoot specification for Azure.
type AzureCloud struct {
// MachineImage holds information about the machine image to use for all workers.
// It will default to the first image stated in the referenced CloudProfile if no
// value has been provided.
// +optional
MachineImage *MachineImage `json:"machineImage,omitempty"`
// Networks holds information about the Kubernetes and infrastructure networks.
Networks AzureNetworks `json:"networks"`
// ResourceGroup indicates whether to use an existing resource group or create a new one.
// +optional
ResourceGroup *AzureResourceGroup `json:"resourceGroup,omitempty"`
// Workers is a list of worker groups.
Workers []AzureWorker `json:"workers"`
}
// AzureResourceGroup indicates whether to use an existing resource group or create a new one.
type AzureResourceGroup struct {
// Name is the name of an existing resource group.
Name string `json:"name"`
}
// AzureNetworks holds information about the Kubernetes and infrastructure networks.
type AzureNetworks struct {
gardencorev1alpha1.K8SNetworks `json:",inline"`
// VNet indicates whether to use an existing VNet or create a new one.
VNet AzureVNet `json:"vnet"`
// Workers is a CIDR of a worker subnet (private) to create (used for the VMs).
Workers gardencorev1alpha1.CIDR `json:"workers"`
}
// AzureVNet indicates whether to use an existing VNet or create a new one.
type AzureVNet struct {
// Name is the AWS VNet name of an existing VNet.
// +optional
Name *string `json:"name,omitempty"`
// CIDR is a CIDR range for a new VNet.
// +optional
CIDR *gardencorev1alpha1.CIDR `json:"cidr,omitempty"`
}
// AzureWorker is the definition of a worker group.
type AzureWorker struct {
Worker `json:",inline"`
// VolumeType is the type of the root volumes.
VolumeType string `json:"volumeType"`
// VolumeSize is the size of the root volume.
VolumeSize string `json:"volumeSize"`
}
// GCPCloud contains the Shoot specification for GCP.
type GCPCloud struct {
// MachineImage holds information about the machine image to use for all workers.
// It will default to the first image stated in the referenced CloudProfile if no
// value has been provided.
// +optional
MachineImage *MachineImage `json:"machineImage,omitempty"`
// Networks holds information about the Kubernetes and infrastructure networks.
Networks GCPNetworks `json:"networks"`
// Workers is a list of worker groups.
Workers []GCPWorker `json:"workers"`
// Zones is a list of availability zones to deploy the Shoot cluster to.
Zones []string `json:"zones"`
}
// GCPNetworks holds information about the Kubernetes and infrastructure networks.
type GCPNetworks struct {
gardencorev1alpha1.K8SNetworks `json:",inline"`
// VPC indicates whether to use an existing VPC or create a new one.
// +optional
VPC *GCPVPC `json:"vpc,omitempty"`
// Workers is a list of CIDRs of worker subnets (private) to create (used for the VMs).
Workers []gardencorev1alpha1.CIDR `json:"workers"`
// Internal is a private subnet (used for internal load balancers).
// +optional
Internal *gardencorev1alpha1.CIDR `json:"internal,omitempty"`
}
// GCPVPC indicates whether to use an existing VPC or create a new one.
type GCPVPC struct {
// Name is the name of an existing GCP VPC.
Name string `json:"name"`
}
// GCPWorker is the definition of a worker group.
type GCPWorker struct {
Worker `json:",inline"`
// VolumeType is the type of the root volumes.
VolumeType string `json:"volumeType"`
// VolumeSize is the size of the root volume.
VolumeSize string `json:"volumeSize"`
}
// OpenStackCloud contains the Shoot specification for OpenStack.
type OpenStackCloud struct {
// FloatingPoolName is the name of the floating pool to get FIPs from.
FloatingPoolName string `json:"floatingPoolName"`
// LoadBalancerProvider is the name of the load balancer provider in the OpenStack environment.
LoadBalancerProvider string `json:"loadBalancerProvider"`
// MachineImage holds information about the machine image to use for all workers.
// It will default to the first image stated in the referenced CloudProfile if no
// value has been provided.
// +optional
MachineImage *MachineImage `json:"machineImage,omitempty"`
// Networks holds information about the Kubernetes and infrastructure networks.
Networks OpenStackNetworks `json:"networks"`
// Workers is a list of worker groups.
Workers []OpenStackWorker `json:"workers"`
// Zones is a list of availability zones to deploy the Shoot cluster to.
Zones []string `json:"zones"`
}
// OpenStackNetworks holds information about the Kubernetes and infrastructure networks.
type OpenStackNetworks struct {
gardencorev1alpha1.K8SNetworks `json:",inline"`
// Router indicates whether to use an existing router or create a new one.
// +optional
Router *OpenStackRouter `json:"router,omitempty"`
// Workers is a list of CIDRs of worker subnets (private) to create (used for the VMs).
Workers []gardencorev1alpha1.CIDR `json:"workers"`
}
// OpenStackRouter indicates whether to use an existing router or create a new one.
type OpenStackRouter struct {
// ID is the router id of an existing OpenStack router.
ID string `json:"id"`
}
// OpenStackWorker is the definition of a worker group.
type OpenStackWorker struct {
Worker `json:",inline"`
}
// Worker is the base definition of a worker group.
type Worker struct {
// Name is the name of the worker group.
Name string `json:"name"`
// MachineType is the machine type of the worker group.
MachineType string `json:"machineType"`
// AutoScalerMin is the minimum number of VMs to create.
AutoScalerMin int `json:"autoScalerMin"`
// AutoScalerMin is the maximum number of VMs to create.
AutoScalerMax int `json:"autoScalerMax"`
// MaxSurge is maximum number of VMs that are created during an update.
// +optional
MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"`
// MaxUnavailable is the maximum number of VMs that can be unavailable during an update.
// +optional
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
// Annotations is a map of key/value pairs for annotations for all the `Node` objects in this worker pool.
// +optional
Annotations map[string]string `json:"annotations,omitempty"`
// Labels is a map of key/value pairs for labels for all the `Node` objects in this worker pool.
// +optional
Labels map[string]string `json:"labels,omitempty"`
// Taints is a list of taints for all the `Node` objects in this worker pool.
// +optional
Taints []corev1.Taint `json:"taints,omitempty"`
}
var (
// DefaultWorkerMaxSurge is the default value for Worker MaxSurge.
DefaultWorkerMaxSurge = intstr.FromInt(1)