/
aws_types.go
221 lines (190 loc) · 7.55 KB
/
aws_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
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/giantswarm/apiextensions/v3/pkg/annotation"
)
const (
kindAWSConfig = "AWSConfig"
awsConfigDocumentationLink = "https://docs.giantswarm.io/ui-api/management-api/crd/awsconfigs.provider.giantswarm.io/"
)
// NewAWSClusterTypeMeta returns the populated metav1 metadata object for this CRD.
func NewAWSClusterTypeMeta() metav1.TypeMeta {
return metav1.TypeMeta{
APIVersion: SchemeGroupVersion.String(),
Kind: kindAWSConfig,
}
}
// NewAWSConfigCR returns a custom resource of type AWSConfig.
func NewAWSConfigCR() *AWSConfig {
return &AWSConfig{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
annotation.Docs: awsConfigDocumentationLink,
},
},
TypeMeta: NewAWSClusterTypeMeta(),
}
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:resource:categories=aws;giantswarm
// +k8s:openapi-gen=true
// AWSConfig used to represent workload cluster configuration in earlier releases. Deprecated.
type AWSConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec AWSConfigSpec `json:"spec"`
// +kubebuilder:validation:Optional
Status AWSConfigStatus `json:"status"`
}
// +k8s:openapi-gen=true
type AWSConfigSpec struct {
Cluster Cluster `json:"cluster"`
AWS AWSConfigSpecAWS `json:"aws"`
VersionBundle AWSConfigSpecVersionBundle `json:"versionBundle"`
}
// +k8s:openapi-gen=true
type AWSConfigSpecAWS struct {
API AWSConfigSpecAWSAPI `json:"api"`
// TODO remove the deprecated AZ field due to AvailabilityZones.
//
// https://github.com/giantswarm/giantswarm/issues/4507
//
AZ string `json:"az"`
// AvailabilityZones is the number of AWS availability zones used to spread
// the workload cluster's worker nodes across. There are limitations on
// availability zone settings due to binary IP range splitting and provider
// specific region capabilities. When for instance choosing 3 availability
// zones, the configured IP range will be split into 4 ranges and thus one of
// it will not be able to be utilized. Such limitations have to be considered
// when designing the network topology and configuring workload cluster HA via
// AvailabilityZones.
//
// The selection and usage of the actual availability zones for the created
// workload cluster is randomized. In case there are 4 availability zones
// provided in the used region and the user selects 2 availability zones, the
// actually used availability zones in which workload cluster workload is put
// into will tend to be different across workload cluster creations. This is
// done in order to provide more HA during single availability zone failures.
// In case a specific availability zone fails, not all workload clusters will be
// affected due to the described selection process.
AvailabilityZones int `json:"availabilityZones"`
CredentialSecret CredentialSecret `json:"credentialSecret"`
Etcd AWSConfigSpecAWSEtcd `json:"etcd"`
// HostedZones is AWS hosted zones names in the host cluster account.
// For each zone there will be "CLUSTER_ID.k8s" NS record created in
// the host cluster account. Then for each created NS record there will
// be a zone created in the guest account. After that component
// specific records under those zones:
// - api.CLUSTER_ID.k8s.{{ .Spec.AWS.HostedZones.API.Name }}
// - etcd.CLUSTER_ID.k8s.{{ .Spec.AWS.HostedZones.Etcd.Name }}
// - ingress.CLUSTER_ID.k8s.{{ .Spec.AWS.HostedZones.Ingress.Name }}
// - *.CLUSTER_ID.k8s.{{ .Spec.AWS.HostedZones.Ingress.Name }}
HostedZones AWSConfigSpecAWSHostedZones `json:"hostedZones"`
Ingress AWSConfigSpecAWSIngress `json:"ingress"`
Masters []AWSConfigSpecAWSNode `json:"masters"`
Region string `json:"region"`
VPC AWSConfigSpecAWSVPC `json:"vpc"`
Workers []AWSConfigSpecAWSNode `json:"workers"`
}
// AWSConfigSpecAWSAPI deprecated since aws-operator v12 resources.
// +k8s:openapi-gen=true
type AWSConfigSpecAWSAPI struct {
HostedZones string `json:"hostedZones"`
ELB AWSConfigSpecAWSAPIELB `json:"elb"`
}
// AWSConfigSpecAWSAPIELB deprecated since aws-operator v12 resources.
// +k8s:openapi-gen=true
type AWSConfigSpecAWSAPIELB struct {
IdleTimeoutSeconds int `json:"idleTimeoutSeconds"`
}
// AWSConfigSpecAWSEtcd deprecated since aws-operator v12 resources.
// +k8s:openapi-gen=true
type AWSConfigSpecAWSEtcd struct {
HostedZones string `json:"hostedZones"`
ELB AWSConfigSpecAWSEtcdELB `json:"elb"`
}
// AWSConfigSpecAWSEtcdELB deprecated since aws-operator v12 resources.
// +k8s:openapi-gen=true
type AWSConfigSpecAWSEtcdELB struct {
IdleTimeoutSeconds int `json:"idleTimeoutSeconds"`
}
// +k8s:openapi-gen=true
type AWSConfigSpecAWSHostedZones struct {
API AWSConfigSpecAWSHostedZonesZone `json:"api"`
Etcd AWSConfigSpecAWSHostedZonesZone `json:"etcd"`
Ingress AWSConfigSpecAWSHostedZonesZone `json:"ingress"`
}
// +k8s:openapi-gen=true
type AWSConfigSpecAWSHostedZonesZone struct {
Name string `json:"name"`
}
// AWSConfigSpecAWSIngress deprecated since aws-operator v12 resources.
// +k8s:openapi-gen=true
type AWSConfigSpecAWSIngress struct {
HostedZones string `json:"hostedZones"`
ELB AWSConfigSpecAWSIngressELB `json:"elb"`
}
// AWSConfigSpecAWSIngressELB deprecated since aws-operator v12 resources.
// +k8s:openapi-gen=true
type AWSConfigSpecAWSIngressELB struct {
IdleTimeoutSeconds int `json:"idleTimeoutSeconds"`
}
// +k8s:openapi-gen=true
type AWSConfigSpecAWSNode struct {
ImageID string `json:"imageID"`
InstanceType string `json:"instanceType"`
DockerVolumeSizeGB int `json:"dockerVolumeSizeGB"`
}
// +k8s:openapi-gen=true
type AWSConfigSpecAWSVPC struct {
CIDR string `json:"cidr"`
PrivateSubnetCIDR string `json:"privateSubnetCidr"`
PublicSubnetCIDR string `json:"publicSubnetCidr"`
RouteTableNames []string `json:"routeTableNames"`
PeerID string `json:"peerId"`
}
// +k8s:openapi-gen=true
type AWSConfigSpecVersionBundle struct {
Version string `json:"version"`
}
// +k8s:openapi-gen=true
type AWSConfigStatus struct {
AWS AWSConfigStatusAWS `json:"aws"`
Cluster StatusCluster `json:"cluster"`
}
// +k8s:openapi-gen=true
type AWSConfigStatusAWS struct {
AvailabilityZones []AWSConfigStatusAWSAvailabilityZone `json:"availabilityZones"`
AutoScalingGroup AWSConfigStatusAWSAutoScalingGroup `json:"autoScalingGroup"`
}
// +k8s:openapi-gen=true
type AWSConfigStatusAWSAutoScalingGroup struct {
Name string `json:"name"`
}
// +k8s:openapi-gen=true
type AWSConfigStatusAWSAvailabilityZone struct {
Name string `json:"name"`
Subnet AWSConfigStatusAWSAvailabilityZoneSubnet `json:"subnet"`
}
// +k8s:openapi-gen=true
type AWSConfigStatusAWSAvailabilityZoneSubnet struct {
Private AWSConfigStatusAWSAvailabilityZoneSubnetPrivate `json:"private"`
Public AWSConfigStatusAWSAvailabilityZoneSubnetPublic `json:"public"`
}
// +k8s:openapi-gen=true
type AWSConfigStatusAWSAvailabilityZoneSubnetPrivate struct {
CIDR string `json:"cidr"`
}
// +k8s:openapi-gen=true
type AWSConfigStatusAWSAvailabilityZoneSubnetPublic struct {
CIDR string `json:"cidr"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type AWSConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []AWSConfig `json:"items"`
}