/
types.go
1655 lines (1417 loc) · 59.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
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 2020 The Kubermatic Kubernetes Platform 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 v1
import (
"encoding/json"
"github.com/Masterminds/semver"
kubermaticv1 "github.com/kubermatic/kubermatic/api/pkg/crd/kubermatic/v1"
ksemver "github.com/kubermatic/kubermatic/api/pkg/semver"
"github.com/kubermatic/machine-controller/pkg/apis/cluster/v1alpha1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
cmdv1 "k8s.io/client-go/tools/clientcmd/api/v1"
)
// LegacyObjectMeta is an object storing common metadata for persistable objects.
// Deprecated: LegacyObjectMeta is deprecated use ObjectMeta instead.
type LegacyObjectMeta struct {
Name string `json:"name"`
ResourceVersion string `json:"resourceVersion,omitempty"`
UID string `json:"uid,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
// ObjectMeta defines the set of fields that objects returned from the API have
// swagger:model ObjectMeta
type ObjectMeta struct {
// ID unique value that identifies the resource generated by the server. Read-Only.
ID string `json:"id,omitempty"`
// Name represents human readable name for the resource
Name string `json:"name"`
// DeletionTimestamp is a timestamp representing the server time when this object was deleted.
// swagger:strfmt date-time
DeletionTimestamp *Time `json:"deletionTimestamp,omitempty"`
// CreationTimestamp is a timestamp representing the server time when this object was created.
// swagger:strfmt date-time
CreationTimestamp Time `json:"creationTimestamp,omitempty"`
}
// DigitialoceanDatacenterSpec specifies a datacenter of DigitalOcean.
type DigitialoceanDatacenterSpec struct {
Region string `json:"region"`
}
// HetznerDatacenterSpec specifies a datacenter of Hetzner.
type HetznerDatacenterSpec struct {
Datacenter string `json:"datacenter"`
Location string `json:"location"`
}
// ImageList defines a map of operating system and the image to use
type ImageList map[string]string
// VSphereDatacenterSpec specifies a datacenter of VSphere.
type VSphereDatacenterSpec struct {
Endpoint string `json:"endpoint"`
Datacenter string `json:"datacenter"`
Datastore string `json:"datastore"`
Cluster string `json:"cluster"`
Templates ImageList `json:"templates"`
}
// KubevirtDatacenterSpec specifies a datacenter of Kubevirt.
type KubevirtDatacenterSpec struct {
}
// AlibabaDatacenterSpec specifies a datacenter of Alibaba.
type AlibabaDatacenterSpec struct {
Region string `json:"region"`
}
// BringYourOwnDatacenterSpec specifies a data center with bring-your-own nodes.
type BringYourOwnDatacenterSpec struct{}
// AWSDatacenterSpec specifies a data center of Amazon Web Services.
type AWSDatacenterSpec struct {
Region string `json:"region"`
}
// AzureDatacenterSpec specifies a datacenter of Azure.
type AzureDatacenterSpec struct {
Location string `json:"location"`
}
// OpenstackDatacenterSpec specifies a generic bare metal datacenter.
type OpenstackDatacenterSpec struct {
AvailabilityZone string `json:"availability_zone"`
Region string `json:"region"`
AuthURL string `json:"auth_url"`
Images ImageList `json:"images"`
EnforceFloatingIP bool `json:"enforce_floating_ip"`
}
// PacketDatacenterSpec specifies a datacenter of Packet.
type PacketDatacenterSpec struct {
Facilities []string `json:"facilities"`
}
// GCPDatacenterSpec specifies a datacenter of GCP.
type GCPDatacenterSpec struct {
Region string `json:"region"`
ZoneSuffixes []string `json:"zone_suffixes"`
Regional bool `json:"regional"`
}
// DatacenterSpec specifies the data for a datacenter.
type DatacenterSpec struct {
Seed string `json:"seed"`
Country string `json:"country,omitempty"`
Location string `json:"location,omitempty"`
Provider string `json:"provider,omitempty"`
Digitalocean *DigitialoceanDatacenterSpec `json:"digitalocean,omitempty"`
BringYourOwn *BringYourOwnDatacenterSpec `json:"bringyourown,omitempty"`
AWS *AWSDatacenterSpec `json:"aws,omitempty"`
Azure *AzureDatacenterSpec `json:"azure,omitempty"`
Openstack *OpenstackDatacenterSpec `json:"openstack,omitempty"`
Packet *PacketDatacenterSpec `json:"packet,omitempty"`
GCP *GCPDatacenterSpec `json:"gcp,omitempty"`
Hetzner *HetznerDatacenterSpec `json:"hetzner,omitempty"`
VSphere *VSphereDatacenterSpec `json:"vsphere,omitempty"`
Kubevirt *KubevirtDatacenterSpec `json:"kubevirt,omitempty"`
Alibaba *AlibabaDatacenterSpec `json:"alibaba,omitempty"`
// Deprecated. Automatically migrated to the RequiredEmailDomains field.
RequiredEmailDomain string `json:"requiredEmailDomain,omitempty"`
RequiredEmailDomains []string `json:"requiredEmailDomains,omitempty"`
// EnforceAuditLogging enforces audit logging on every cluster within the DC,
// ignoring cluster-specific settings.
EnforceAuditLogging bool `json:"enforceAuditLogging"`
}
// DatacenterList represents a list of datacenters
// swagger:model DatacenterList
type DatacenterList []Datacenter
// Datacenter is the object representing a Kubernetes infra datacenter.
// swagger:model Datacenter
type Datacenter struct {
Metadata LegacyObjectMeta `json:"metadata"`
Spec DatacenterSpec `json:"spec"`
Seed bool `json:"seed,omitempty"`
}
// AWSSize represents a object of AWS size.
// swagger:model AWSSize
type AWSSize struct {
Name string `json:"name"`
PrettyName string `json:"pretty_name"`
Memory float32 `json:"memory"`
VCPUs int `json:"vcpus"`
Price float64 `json:"price"`
}
// AWSSizeList represents an array of AWS sizes.
// swagger:model AWSSizeList
type AWSSizeList []AWSSize
// AWSSubnetList represents an array of AWS availability subnets.
// swagger:model AWSSubnetList
type AWSSubnetList []AWSSubnet
// AWSSubnet represents a object of AWS availability subnet.
// swagger:model AWSSubnet
type AWSSubnet struct {
Name string `json:"name"`
ID string `json:"id"`
AvailabilityZone string `json:"availability_zone"`
AvailabilityZoneID string `json:"availability_zone_id"`
IPv4CIDR string `json:"ipv4cidr"`
IPv6CIDR string `json:"ipv6cidr"`
Tags []AWSTag `json:"tags,omitempty"`
State string `json:"state"`
AvailableIPAddressCount int64 `json:"available_ip_address_count"`
DefaultForAz bool `json:"default"`
IsDefaultSubnet bool `json:"isDefaultSubnet"`
}
// AWSTag represents a object of AWS tags.
// swagger:model AWSTag
type AWSTag struct {
Key string `json:"key"`
Value string `json:"value"`
}
// AWSVPCList represents an array of AWS VPC's.
// swagger:model AWSVPCList
type AWSVPCList []AWSVPC
// AWSVPC represents a object of AWS VPC.
// swagger:model AWSVPC
type AWSVPC struct {
// The primary IPv4 CIDR block for the VPC.
CidrBlock string `json:"cidrBlock"`
// Information about the IPv4 CIDR blocks associated with the VPC.
CidrBlockAssociationSet []AWSVpcCidrBlockAssociation `json:"cidrBlockAssociationSet,omitempty"`
// The ID of the set of DHCP options you've associated with the VPC (or default
// if the default options are associated with the VPC).
DhcpOptionsID string `json:"dhcpOptionsId"`
// The allowed tenancy of instances launched into the VPC.
InstanceTenancy string `json:"instanceTenancy"`
// Information about the IPv6 CIDR blocks associated with the VPC.
Ipv6CidrBlockAssociationSet []AWSVpcIpv6CidrBlockAssociation `json:"ipv6CidrBlockAssociationSet,omitempty"`
// Indicates whether the VPC is the default VPC.
IsDefault bool `json:"isDefault"`
// The ID of the AWS account that owns the VPC.
OwnerID string `json:"ownerId"`
// The current state of the VPC.
State string `json:"state"`
// Any tags assigned to the VPC.
Tags []AWSTag `json:"tags,omitempty"`
Name string `json:"name"`
// The ID of the VPC.
VpcID string `json:"vpcId"`
}
// AWSVpcCidrBlockAssociation describes an IPv4 CIDR block associated with a VPC.
// swagger:model AWSVpcCidrBlockAssociation
type AWSVpcCidrBlockAssociation struct {
// The association ID for the IPv4 CIDR block.
AssociationID string `json:"associationId"`
// The IPv4 CIDR block.
CidrBlock string `json:"cidrBlock"`
// The state of the CIDR block.
State string `json:"state"`
// A message about the status of the CIDR block, if applicable.
StatusMessage string `json:"statusMessage"`
}
// AWSVpcIpv6CidrBlockAssociation describes an IPv6 CIDR block associated with a VPC.
// swagger:model AWSVpcIpv6CidrBlockAssociation
type AWSVpcIpv6CidrBlockAssociation struct {
AWSVpcCidrBlockAssociation
}
// GCPDiskTypeList represents an array of GCP disk types.
// swagger:model GCPDiskTypeList
type GCPDiskTypeList []GCPDiskType
// GCPDiskType represents a object of GCP disk type.
// swagger:model GCPDiskType
type GCPDiskType struct {
Name string `json:"name"`
Description string `json:"description"`
}
// GCPMachineSizeList represents an array of GCP machine sizes.
// swagger:model GCPMachineSizeList
type GCPMachineSizeList []GCPMachineSize
// GCPMachineSize represents a object of GCP machine size.
// swagger:model GCPMachineSize
type GCPMachineSize struct {
Name string `json:"name"`
Description string `json:"description"`
Memory int64 `json:"memory"`
VCPUs int64 `json:"vcpus"`
}
// GCPZone represents a object of GCP zone.
// swagger:model GCPZone
type GCPZone struct {
Name string `json:"name"`
}
// GCPZoneList represents an array of GCP zones.
// swagger:model GCPZoneList
type GCPZoneList []GCPZone
// GCPNetworkList represents an array of GCP networks.
// swagger:model GCPNetworkList
type GCPNetworkList []GCPNetwork
// GCPNetwork represents a object of GCP networks.
// swagger:model GCPNetwork
type GCPNetwork struct {
ID uint64 `json:"id"`
Name string `json:"name"`
AutoCreateSubnetworks bool `json:"autoCreateSubnetworks"`
Subnetworks []string `json:"subnetworks"`
Kind string `json:"kind"`
Path string `json:"path"`
}
// GCPSubnetworkList represents an array of GCP subnetworks.
// swagger:model GCPSubnetworkList
type GCPSubnetworkList []GCPSubnetwork
// GCPSubnetwork represents a object of GCP subnetworks.
// swagger:model GCPSubnetwork
type GCPSubnetwork struct {
ID uint64 `json:"id"`
Name string `json:"name"`
Network string `json:"network"`
IPCidrRange string `json:"ipCidrRange"`
GatewayAddress string `json:"gatewayAddress"`
Region string `json:"region"`
SelfLink string `json:"selfLink"`
PrivateIPGoogleAccess bool `json:"privateIpGoogleAccess"`
Kind string `json:"kind"`
Path string `json:"path"`
}
// DigitaloceanSizeList represents a object of digitalocean sizes.
// swagger:model DigitaloceanSizeList
type DigitaloceanSizeList struct {
Standard []DigitaloceanSize `json:"standard"`
Optimized []DigitaloceanSize `json:"optimized"`
}
// CredentialList represents a object for provider credential names.
// swagger:model CredentialList
type CredentialList struct {
Names []string `json:"names,omitempty"`
}
// DigitaloceanSize is the object representing digitalocean sizes.
// swagger:model DigitaloceanSize
type DigitaloceanSize struct {
Slug string `json:"slug"`
Available bool `json:"available"`
Transfer float64 `json:"transfer"`
PriceMonthly float64 `json:"price_monthly"`
PriceHourly float64 `json:"price_hourly"`
Memory int `json:"memory"`
VCPUs int `json:"vcpus"`
Disk int `json:"disk"`
Regions []string `json:"regions"`
}
// AzureAvailabilityZonesList is the object representing the availability zones for vms in azure cloud provider
// swagger:model AzureAvailabilityZonesList
type AzureAvailabilityZonesList struct {
Zones []string `json:"zones"`
}
// AzureSizeList represents an array of Azure VM sizes.
// swagger:model AzureSizeList
type AzureSizeList []AzureSize
// AzureSize is the object representing Azure VM sizes.
// swagger:model AzureSize
type AzureSize struct {
Name string `json:"name"`
NumberOfCores int32 `json:"numberOfCores"`
OsDiskSizeInMB int32 `json:"osDiskSizeInMB"`
ResourceDiskSizeInMB int32 `json:"resourceDiskSizeInMB"`
MemoryInMB int32 `json:"memoryInMB"`
MaxDataDiskCount int32 `json:"maxDataDiskCount"`
}
// HetznerSizeList represents an array of Hetzner sizes.
// swagger:model HetznerSizeList
type HetznerSizeList struct {
Standard []HetznerSize `json:"standard"`
Dedicated []HetznerSize `json:"dedicated"`
}
// HetznerSize is the object representing Hetzner sizes.
// swagger:model HetznerSize
type HetznerSize struct {
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Cores int `json:"cores"`
Memory float32 `json:"memory"`
Disk int `json:"disk"`
}
// PacketSizeList represents an array of Packet VM sizes.
// swagger:model PacketSizeList
type PacketSizeList []PacketSize
// PacketSize is the object representing Packet VM sizes.
// swagger:model PacketSize
type PacketSize struct {
Name string `json:"name,omitempty"`
CPUs []PacketCPU `json:"cpus,omitempty"`
Memory string `json:"memory,omitempty"`
Drives []PacketDrive `json:"drives,omitempty"`
}
// PacketCPU represents an array of Packet CPUs. It is a part of PacketSize.
// swagger:model PacketCPU
type PacketCPU struct {
Count int `json:"count,omitempty"`
Type string `json:"type,omitempty"`
}
// PacketDrive represents an array of Packet drives. It is a part of PacketSize.
// swagger:model PacketDrive
type PacketDrive struct {
Count int `json:"count,omitempty"`
Size string `json:"size,omitempty"`
Type string `json:"type,omitempty"`
}
// SSHKey represents a ssh key
// swagger:model SSHKey
type SSHKey struct {
ObjectMeta
Spec SSHKeySpec `json:"spec"`
}
// SSHKeySpec represents the details of a ssh key
type SSHKeySpec struct {
Fingerprint string `json:"fingerprint"`
PublicKey string `json:"publicKey"`
}
// User represent an API user
// swagger:model User
type User struct {
ObjectMeta
// Email an email address of the user
Email string `json:"email"`
// IsAdmin indicates admin role
IsAdmin bool `json:"isAdmin,omitempty"`
// Projects holds the list of project the user belongs to
// along with the group names
Projects []ProjectGroup `json:"projects,omitempty"`
Settings *kubermaticv1.UserSettings `json:"userSettings,omitempty"`
}
// Admin represents admin user
// swagger:model Admin
type Admin struct {
// Email address of the admin user
Email string `json:"email"`
// Name of the admin user
Name string `json:"name,omitempty"`
// IsAdmin indicates admin role
IsAdmin bool `json:"isAdmin"`
}
// ProjectGroup is a helper data structure that
// stores the information about a project and a group prefix that a user belongs to
type ProjectGroup struct {
ID string `json:"id"`
GroupPrefix string `json:"group"`
}
// These are the valid statuses of a ServiceAccount.
const (
// ServiceAccountActive means the ServiceAccount is available for use in the system
ServiceAccountActive string = "Active"
// ServiceAccountInactive means the ServiceAccount is inactive and requires further initialization
ServiceAccountInactive string = "Inactive"
// ServiceAccountTerminating means the ServiceAccount is undergoing graceful termination
ServiceAccountTerminating string = "Terminating"
)
// ServiceAccount represent an API service account
// swagger:model ServiceAccount
type ServiceAccount struct {
ObjectMeta
// Status describes three stages of ServiceAccount life including Active, Inactive and Terminating
Status string `json:"status"`
// Group that a service account belongs to
Group string `json:"group"`
}
// PublicServiceAccountToken represent an API service account token without secret fields
// swagger:model PublicServiceAccountToken
type PublicServiceAccountToken struct {
ObjectMeta
// Expiry is a timestamp representing the time when this token will expire.
// swagger:strfmt date-time
Expiry Time `json:"expiry,omitempty"`
}
// ServiceAccountToken represent an API service account token
// swagger:model ServiceAccountToken
type ServiceAccountToken struct {
PublicServiceAccountToken
// Token the JWT token
Token string `json:"token,omitempty"`
}
// Project is a top-level container for a set of resources
// swagger:model Project
type Project struct {
ObjectMeta
Status string `json:"status"`
Labels map[string]string `json:"labels,omitempty"`
// Owners an optional owners list for the given project
Owners []User `json:"owners,omitempty"`
ClustersNumber int `json:"clustersNumber,omitempty"`
}
// Kubeconfig is a clusters kubeconfig
// swagger:response Kubeconfig
type Kubeconfig struct {
// in: body
Config cmdv1.Config
}
// OpenstackSize is the object representing openstack's sizes.
// swagger:model OpenstackSize
type OpenstackSize struct {
// Slug holds the name of the size
Slug string `json:"slug"`
// MemoryTotalBytes is the amount of memory, measured in MB
Memory int `json:"memory"`
// VCPUs indicates how many (virtual) CPUs are available for this flavor
VCPUs int `json:"vcpus"`
// Disk is the amount of root disk, measured in GB
Disk int `json:"disk"`
// Swap is the amount of swap space, measured in MB
Swap int `json:"swap"`
// Region specifies the geographic region in which the size resides
Region string `json:"region"`
// IsPublic indicates whether the size is public (available to all projects) or scoped to a set of projects
IsPublic bool `json:"isPublic"`
}
// OpenstackSubnet is the object representing a openstack subnet.
// swagger:model OpenstackSubnet
type OpenstackSubnet struct {
// Id uniquely identifies the subnet
ID string `json:"id"`
// Name is human-readable name for the subnet
Name string `json:"name"`
}
// OpenstackTenant is the object representing a openstack tenant.
// swagger:model OpenstackTenant
type OpenstackTenant struct {
// Id uniquely identifies the current tenant
ID string `json:"id"`
// Name is the name of the tenant
Name string `json:"name"`
}
// OpenstackNetwork is the object representing a openstack network.
// swagger:model OpenstackNetwork
type OpenstackNetwork struct {
// Id uniquely identifies the current network
ID string `json:"id"`
// Name is the name of the network
Name string `json:"name"`
// External set if network is the external network
External bool `json:"external"`
}
// OpenstackSecurityGroup is the object representing a openstack security group.
// swagger:model OpenstackSecurityGroup
type OpenstackSecurityGroup struct {
// Id uniquely identifies the current security group
ID string `json:"id"`
// Name is the name of the security group
Name string `json:"name"`
}
// VSphereNetwork is the object representing a vsphere network.
// swagger:model VSphereNetwork
type VSphereNetwork struct {
// Name is the name of the network
Name string `json:"name"`
// AbsolutePath is the absolute path inside vCenter
AbsolutePath string `json:"absolutePath"`
// RelativePath is the relative path inside the datacenter
RelativePath string `json:"relativePath"`
// Type defines the type of network
Type string `json:"type"`
}
// VSphereFolder is the object representing a vsphere folder.
// swagger:model VSphereFolder
type VSphereFolder struct {
// Path is the path of the folder
Path string `json:"path"`
}
// AlibabaInstanceTypeList represents an array of Alibaba instance types.
// swagger:model AlibabaInstanceTypeList
type AlibabaInstanceTypeList []AlibabaInstanceType
// AlibabaInstanceType represents a object of Alibaba instance type.
// swagger:model AlibabaInstanceType
type AlibabaInstanceType struct {
ID string `json:"id"`
CPUCoreCount int `json:"cpuCoreCount"`
MemorySize float64 `json:"memorySize"`
}
// AlibabaZoneList represents an array of Alibaba zones.
// swagger:model AlibabaZoneList
type AlibabaZoneList []AlibabaZone
// AlibabaZone represents a object of Alibaba zone.
// swagger:model AlibabaZone
type AlibabaZone struct {
ID string `json:"id"`
}
// MasterVersion describes a version of the master components
// swagger:model MasterVersion
type MasterVersion struct {
Version *semver.Version `json:"version"`
Default bool `json:"default,omitempty"`
// If true, then given version control plane version is not compatible
// with one of the kubelets inside cluster and shouldn't be used.
RestrictedByKubeletVersion bool `json:"restrictedByKubeletVersion,omitempty"`
}
// CreateClusterSpec is the structure that is used to create cluster with its initial node deployment
// swagger:model CreateClusterSpec
type CreateClusterSpec struct {
Cluster Cluster `json:"cluster"`
NodeDeployment *NodeDeployment `json:"nodeDeployment,omitempty"`
}
const (
// OpenShiftClusterType defines the OpenShift cluster type
OpenShiftClusterType string = "openshift"
// KubernetesClusterType defines the Kubernetes cluster type
KubernetesClusterType string = "kubernetes"
)
// Cluster defines the cluster resource
//
// Note:
// Cluster has a custom MarshalJSON method defined
// and thus the output may vary
//
// swagger:model Cluster
type Cluster struct {
ObjectMeta `json:",inline"`
Labels map[string]string `json:"labels,omitempty"`
InheritedLabels map[string]string `json:"inheritedLabels,omitempty"`
Type string `json:"type"`
Credential string `json:"credential,omitempty"`
Spec ClusterSpec `json:"spec"`
Status ClusterStatus `json:"status"`
}
// ClusterSpec defines the cluster specification
type ClusterSpec struct {
// Cloud specifies the cloud providers configuration
Cloud kubermaticv1.CloudSpec `json:"cloud"`
// MachineNetworks optionally specifies the parameters for IPAM.
MachineNetworks []kubermaticv1.MachineNetworkingConfig `json:"machineNetworks,omitempty"`
// Version desired version of the kubernetes master components
Version ksemver.Semver `json:"version"`
// OIDC settings
OIDC kubermaticv1.OIDCSettings `json:"oidc,omitempty"`
// Configure cluster upgrade window, currently used for coreos node reboots
UpdateWindow *kubermaticv1.UpdateWindow `json:"updateWindow,omitempty"`
// If active the PodSecurityPolicy admission plugin is configured at the apiserver
UsePodSecurityPolicyAdmissionPlugin bool `json:"usePodSecurityPolicyAdmissionPlugin,omitempty"`
// If active the PodNodeSelector admission plugin is configured at the apiserver
UsePodNodeSelectorAdmissionPlugin bool `json:"usePodNodeSelectorAdmissionPlugin,omitempty"`
// PodNodeSelectorAdmissionPluginConfig provides the configuration for the PodNodeSelector.
// It's used by the backend to create a configuration file for this plugin.
// The key:value from the map is converted to the namespace:<node-selectors-labels> in the file.
// The format in a file:
// podNodeSelectorPluginConfig:
// clusterDefaultNodeSelector: <node-selectors-labels>
// namespace1: <node-selectors-labels>
// namespace2: <node-selectors-labels>
PodNodeSelectorAdmissionPluginConfig map[string]string `json:"podNodeSelectorAdmissionPluginConfig,omitempty"`
// Additional Admission Controller plugins
AdmissionPlugins []string `json:"admissionPlugins,omitempty"`
// AuditLogging
AuditLogging *kubermaticv1.AuditLoggingSettings `json:"auditLogging,omitempty"`
// Openshift holds all openshift-specific settings
Openshift *kubermaticv1.Openshift `json:"openshift,omitempty"`
}
// MarshalJSON marshals ClusterSpec object into JSON. It is overwritten to control data
// that will be returned in the API responses (see: PublicCloudSpec struct).
func (cs *ClusterSpec) MarshalJSON() ([]byte, error) {
ret, err := json.Marshal(struct {
Cloud PublicCloudSpec `json:"cloud"`
MachineNetworks []kubermaticv1.MachineNetworkingConfig `json:"machineNetworks,omitempty"`
Version ksemver.Semver `json:"version"`
OIDC kubermaticv1.OIDCSettings `json:"oidc"`
UpdateWindow *kubermaticv1.UpdateWindow `json:"updateWindow,omitempty"`
UsePodSecurityPolicyAdmissionPlugin bool `json:"usePodSecurityPolicyAdmissionPlugin,omitempty"`
UsePodNodeSelectorAdmissionPlugin bool `json:"usePodNodeSelectorAdmissionPlugin,omitempty"`
AuditLogging *kubermaticv1.AuditLoggingSettings `json:"auditLogging,omitempty"`
AdmissionPlugins []string `json:"admissionPlugins,omitempty"`
PodNodeSelectorAdmissionPluginConfig map[string]string `json:"podNodeSelectorAdmissionPluginConfig,omitempty"`
}{
Cloud: PublicCloudSpec{
DatacenterName: cs.Cloud.DatacenterName,
Fake: newPublicFakeCloudSpec(cs.Cloud.Fake),
Digitalocean: newPublicDigitaloceanCloudSpec(cs.Cloud.Digitalocean),
BringYourOwn: newPublicBringYourOwnCloudSpec(cs.Cloud.BringYourOwn),
AWS: newPublicAWSCloudSpec(cs.Cloud.AWS),
Azure: newPublicAzureCloudSpec(cs.Cloud.Azure),
Openstack: newPublicOpenstackCloudSpec(cs.Cloud.Openstack),
Packet: newPublicPacketCloudSpec(cs.Cloud.Packet),
Hetzner: newPublicHetznerCloudSpec(cs.Cloud.Hetzner),
VSphere: newPublicVSphereCloudSpec(cs.Cloud.VSphere),
GCP: newPublicGCPCloudSpec(cs.Cloud.GCP),
Kubevirt: newPublicKubevirtCloudSpec(cs.Cloud.Kubevirt),
Alibaba: newPublicAlibabaCloudSpec(cs.Cloud.Alibaba),
},
Version: cs.Version,
MachineNetworks: cs.MachineNetworks,
OIDC: cs.OIDC,
UpdateWindow: cs.UpdateWindow,
UsePodSecurityPolicyAdmissionPlugin: cs.UsePodSecurityPolicyAdmissionPlugin,
UsePodNodeSelectorAdmissionPlugin: cs.UsePodNodeSelectorAdmissionPlugin,
AuditLogging: cs.AuditLogging,
AdmissionPlugins: cs.AdmissionPlugins,
PodNodeSelectorAdmissionPluginConfig: cs.PodNodeSelectorAdmissionPluginConfig,
})
return ret, err
}
// PublicCloudSpec is a public counterpart of apiv1.CloudSpec.
// swagger:model PublicCloudSpec
type PublicCloudSpec struct {
DatacenterName string `json:"dc"`
Fake *PublicFakeCloudSpec `json:"fake,omitempty"`
Digitalocean *PublicDigitaloceanCloudSpec `json:"digitalocean,omitempty"`
BringYourOwn *PublicBringYourOwnCloudSpec `json:"bringyourown,omitempty"`
AWS *PublicAWSCloudSpec `json:"aws,omitempty"`
Azure *PublicAzureCloudSpec `json:"azure,omitempty"`
Openstack *PublicOpenstackCloudSpec `json:"openstack,omitempty"`
Packet *PublicPacketCloudSpec `json:"packet,omitempty"`
Hetzner *PublicHetznerCloudSpec `json:"hetzner,omitempty"`
VSphere *PublicVSphereCloudSpec `json:"vsphere,omitempty"`
GCP *PublicGCPCloudSpec `json:"gcp,omitempty"`
Kubevirt *PublicKubevirtCloudSpec `json:"kubevirt,omitempty"`
Alibaba *PublicAlibabaCloudSpec `json:"alibaba,omitempty"`
}
// PublicFakeCloudSpec is a public counterpart of apiv1.FakeCloudSpec.
type PublicFakeCloudSpec struct{}
func newPublicFakeCloudSpec(internal *kubermaticv1.FakeCloudSpec) (public *PublicFakeCloudSpec) {
if internal == nil {
return nil
}
return &PublicFakeCloudSpec{}
}
// PublicDigitaloceanCloudSpec is a public counterpart of apiv1.DigitaloceanCloudSpec.
type PublicDigitaloceanCloudSpec struct{}
func newPublicDigitaloceanCloudSpec(internal *kubermaticv1.DigitaloceanCloudSpec) (public *PublicDigitaloceanCloudSpec) {
if internal == nil {
return nil
}
return &PublicDigitaloceanCloudSpec{}
}
// PublicHetznerCloudSpec is a public counterpart of apiv1.HetznerCloudSpec.
type PublicHetznerCloudSpec struct{}
func newPublicHetznerCloudSpec(internal *kubermaticv1.HetznerCloudSpec) (public *PublicHetznerCloudSpec) {
if internal == nil {
return nil
}
return &PublicHetznerCloudSpec{}
}
// PublicAzureCloudSpec is a public counterpart of apiv1.AzureCloudSpec.
type PublicAzureCloudSpec struct{}
func newPublicAzureCloudSpec(internal *kubermaticv1.AzureCloudSpec) (public *PublicAzureCloudSpec) {
if internal == nil {
return nil
}
return &PublicAzureCloudSpec{}
}
// PublicVSphereCloudSpec is a public counterpart of apiv1.VSphereCloudSpec.
type PublicVSphereCloudSpec struct{}
func newPublicVSphereCloudSpec(internal *kubermaticv1.VSphereCloudSpec) (public *PublicVSphereCloudSpec) {
if internal == nil {
return nil
}
return &PublicVSphereCloudSpec{}
}
// PublicBringYourOwnCloudSpec is a public counterpart of apiv1.BringYourOwnCloudSpec.
type PublicBringYourOwnCloudSpec struct{}
func newPublicBringYourOwnCloudSpec(internal *kubermaticv1.BringYourOwnCloudSpec) (public *PublicBringYourOwnCloudSpec) {
if internal == nil {
return nil
}
return &PublicBringYourOwnCloudSpec{}
}
// PublicAWSCloudSpec is a public counterpart of apiv1.AWSCloudSpec.
type PublicAWSCloudSpec struct{}
func newPublicAWSCloudSpec(internal *kubermaticv1.AWSCloudSpec) (public *PublicAWSCloudSpec) {
if internal == nil {
return nil
}
return &PublicAWSCloudSpec{}
}
// PublicOpenstackCloudSpec is a public counterpart of apiv1.OpenstackCloudSpec.
type PublicOpenstackCloudSpec struct {
FloatingIPPool string `json:"floatingIpPool"`
Tenant string `json:"tenant,omitempty"`
TenantID string `json:"tenantID,omitempty"`
Domain string `json:"domain,omitempty"`
Network string `json:"network"`
SecurityGroups string `json:"securityGroups"`
RouterID string `json:"routerID"`
SubnetID string `json:"subnetID"`
}
func newPublicOpenstackCloudSpec(internal *kubermaticv1.OpenstackCloudSpec) (public *PublicOpenstackCloudSpec) {
if internal == nil {
return nil
}
return &PublicOpenstackCloudSpec{
FloatingIPPool: internal.FloatingIPPool,
Tenant: internal.Tenant,
TenantID: internal.TenantID,
Domain: internal.Domain,
Network: internal.Network,
SecurityGroups: internal.SecurityGroups,
RouterID: internal.RouterID,
SubnetID: internal.SubnetID,
}
}
// PublicPacketCloudSpec is a public counterpart of apiv1.PacketCloudSpec.
type PublicPacketCloudSpec struct{}
func newPublicPacketCloudSpec(internal *kubermaticv1.PacketCloudSpec) (public *PublicPacketCloudSpec) {
if internal == nil {
return nil
}
return &PublicPacketCloudSpec{}
}
// PublicGCPCloudSpec is a public counterpart of apiv1.GCPCloudSpec.
type PublicGCPCloudSpec struct{}
func newPublicGCPCloudSpec(internal *kubermaticv1.GCPCloudSpec) (public *PublicGCPCloudSpec) {
if internal == nil {
return nil
}
return &PublicGCPCloudSpec{}
}
// PublicKubevirtCloudSpec is a public counterpart of apiv1.KubevirtCloudSpec.
type PublicKubevirtCloudSpec struct{}
func newPublicKubevirtCloudSpec(internal *kubermaticv1.KubevirtCloudSpec) (public *PublicKubevirtCloudSpec) {
if internal == nil {
return nil
}
return &PublicKubevirtCloudSpec{}
}
// PublicAlibabaCloudSpec is a public counterpart of apiv1.AlibabaCloudSpec.
type PublicAlibabaCloudSpec struct{}
func newPublicAlibabaCloudSpec(internal *kubermaticv1.AlibabaCloudSpec) (public *PublicAlibabaCloudSpec) {
if internal == nil {
return nil
}
return &PublicAlibabaCloudSpec{}
}
// ClusterStatus defines the cluster status
type ClusterStatus struct {
// Version actual version of the kubernetes master components
Version ksemver.Semver `json:"version"`
// URL specifies the address at which the cluster is available
URL string `json:"url"`
}
// ClusterHealth stores health information about the cluster's components.
// swagger:model ClusterHealth
type ClusterHealth struct {
Apiserver kubermaticv1.HealthStatus `json:"apiserver"`
Scheduler kubermaticv1.HealthStatus `json:"scheduler"`
Controller kubermaticv1.HealthStatus `json:"controller"`
MachineController kubermaticv1.HealthStatus `json:"machineController"`
Etcd kubermaticv1.HealthStatus `json:"etcd"`
CloudProviderInfrastructure kubermaticv1.HealthStatus `json:"cloudProviderInfrastructure"`
UserClusterControllerManager kubermaticv1.HealthStatus `json:"userClusterControllerManager"`
}
// AccessibleAddons represents an array of addons that can be configured in the user clusters.
// swagger:model AccessibleAddons
type AccessibleAddons []string
// Addon represents a predefined addon that users may install into their cluster
// swagger:model Addon
type Addon struct {
ObjectMeta `json:",inline"`
Spec AddonSpec `json:"spec"`
}
// AddonSpec addon specification
// swagger:model AddonSpec
type AddonSpec struct {
// Variables is free form data to use for parsing the manifest templates
Variables map[string]interface{} `json:"variables,omitempty"`
// IsDefault indicates whether the addon is default
IsDefault bool `json:"isDefault,omitempty"`
}
// AddonConfig represents a addon configuration
// swagger:model AddonConfig
type AddonConfig struct {
ObjectMeta `json:",inline"`
Spec kubermaticv1.AddonConfigSpec `json:"spec"`
}
// ClusterList represents a list of clusters
// swagger:model ClusterList
type ClusterList []Cluster
// Node represents a worker node that is part of a cluster
// swagger:model Node
type Node struct {
ObjectMeta `json:",inline"`
Spec NodeSpec `json:"spec"`
Status NodeStatus `json:"status"`
}
// NodeCloudSpec represents the collection of cloud provider specific settings. Only one must be set at a time.
// swagger:model NodeCloudSpec
type NodeCloudSpec struct {
Digitalocean *DigitaloceanNodeSpec `json:"digitalocean,omitempty"`
AWS *AWSNodeSpec `json:"aws,omitempty"`