-
Notifications
You must be signed in to change notification settings - Fork 14
/
astarte_deployment.go
310 lines (304 loc) · 10.8 KB
/
astarte_deployment.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
// Copyright © 2019 Ispirata Srl
//
// 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 deployment
// Astartev1alpha1GenericAPISpec represents a generic Astarte API Component in the Deployment spec
type Astartev1alpha1GenericAPISpec struct {
Replicas int `yaml:"replicas,omitempty"`
DisableAuthentication bool `yaml:"disableAuthentication,omitempty"`
Version string `yaml:"version,omitempty"`
Resources struct {
Requests struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"requests"`
Limits struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"limits"`
} `yaml:"resources,omitempty"`
}
// Astartev1alpha1GenericBackendSpec represents a generic Astarte Backend Component in the Deployment spec
type Astartev1alpha1GenericBackendSpec struct {
Replicas int `yaml:"replicas,omitempty"`
Version string `yaml:"version,omitempty"`
Resources struct {
Requests struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"requests"`
Limits struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"limits"`
} `yaml:"resources,omitempty"`
}
// Astartev1alpha1DeploymentSpec represents the spec for Kubernetes API api.astarte-platform.org/v1alpha1/Astarte
type Astartev1alpha1DeploymentSpec struct {
Version string `yaml:"version"`
ImagePullPolicy string `yaml:"imagePullPolicy,omitempty"`
ImagePullSecrets []string `yaml:"imagePullSecrets,omitempty"`
DistributionChannel string `yaml:"distributionChannel,omitempty"`
Rbac bool `yaml:"rbac,omitempty"`
StorageClassName interface{} `yaml:"storageClassName,omitempty"`
API struct {
Ssl bool `yaml:"ssl,omitempty"`
Host string `yaml:"host"`
} `yaml:"api"`
Rabbitmq struct {
Deploy bool `yaml:"deploy,omitempty"`
Connection struct {
Host string `yaml:"host"`
Port string `yaml:"port"`
Username string `yaml:"username"`
Password string `yaml:"password"`
Secret struct {
Name string `yaml:"name"`
UsernameKey string `yaml:"usernameKey"`
PasswordKey string `yaml:"passwordKey"`
} `yaml:"secret"`
} `yaml:"connection,omitempty"`
Replicas int `yaml:"replicas,omitempty"`
AntiAffinity bool `yaml:"antiAffinity,omitempty"`
Storage struct {
Size string `yaml:"size"`
ClassName string `yaml:"className,omitempty"`
VolumeDefinition interface{} `yaml:"volumeDefinition,omitempty"`
} `yaml:"storage,omitempty"`
Resources struct {
Requests struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"requests"`
Limits struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"limits"`
} `yaml:"resources,omitempty"`
} `yaml:"rabbitmq"`
Cassandra struct {
Deploy bool `yaml:"deploy"`
Version string `yaml:"version,omitempty"`
Nodes string `yaml:"nodes,omitempty"`
Replicas int `yaml:"replicas,omitempty"`
AntiAffinity bool `yaml:"antiAffinity,omitempty"`
MaxHeapSize string `yaml:"maxHeapSize,omitempty"`
HeapNewSize string `yaml:"heapNewSize,omitempty"`
Storage struct {
Size string `yaml:"size"`
ClassName string `yaml:"className,omitempty"`
VolumeDefinition interface{} `yaml:"volumeDefinition,omitempty"`
} `yaml:"storage,omitempty"`
Resources struct {
Requests struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"requests"`
Limits struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"limits"`
} `yaml:"resources,omitempty"`
} `yaml:"cassandra"`
Vernemq struct {
Host string `yaml:"host,omitempty"`
Port int `yaml:"port,omitempty"`
Deploy bool `yaml:"deploy,omitempty"`
Replicas int `yaml:"replicas,omitempty"`
AntiAffinity bool `yaml:"antiAffinity,omitempty"`
CaSecret string `yaml:"caSecret,omitempty"`
Storage struct {
Size string `yaml:"size"`
ClassName string `yaml:"className,omitempty"`
VolumeDefinition interface{} `yaml:"volumeDefinition,omitempty"`
} `yaml:"storage,omitempty"`
Resources struct {
Requests struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"requests"`
Limits struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"limits"`
} `yaml:"resources,omitempty"`
} `yaml:"vernemq"`
Cfssl struct {
Deploy bool `yaml:"deploy,omitempty"`
Replicas int `yaml:"replicas,omitempty"`
URL string `yaml:"url,omitempty"`
CaExpiry string `yaml:"caExpiry,omitempty"`
CertificateExpiry string `yaml:"certificateExpiry,omitempty"`
DbConfig struct {
Driver string `yaml:"driver,omitempty"`
DataSource string `yaml:"dataSource,omitempty"`
} `yaml:"dbConfig,omitempty"`
Resources struct {
Requests struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"requests"`
Limits struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"limits"`
} `yaml:"resources,omitempty"`
Storage struct {
Size string `yaml:"size"`
ClassName string `yaml:"className,omitempty"`
VolumeDefinition interface{} `yaml:"volumeDefinition,omitempty"`
} `yaml:"storage,omitempty"`
CsrRootCa struct {
CN string `yaml:"CN"`
Key struct {
Algo string `yaml:"algo"`
Size int `yaml:"size"`
} `yaml:"key"`
Names []struct {
C string `yaml:"C"`
L string `yaml:"L"`
O string `yaml:"O"`
OU string `yaml:"OU"`
ST string `yaml:"ST"`
} `yaml:"names"`
Ca struct {
Expiry string `yaml:"expiry"`
} `yaml:"ca"`
} `yaml:"csrRootCa,omitempty"`
CaRootConfig struct {
Signing struct {
Default struct {
Usages []string `yaml:"usages"`
Expiry string `yaml:"expiry"`
CaConstraint struct {
IsCa bool `yaml:"isCa"`
MaxPathLen int `yaml:"maxPathLen"`
MaxPathLenZero bool `yaml:"maxPathLenZero"`
} `yaml:"caConstraint"`
} `yaml:"default"`
} `yaml:"signing"`
} `yaml:"caRootConfig,omitempty"`
} `yaml:"cfssl"`
Components struct {
Resources struct {
Requests struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"requests"`
Limits struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"limits"`
} `yaml:"resources,omitempty"`
Housekeeping struct {
API Astartev1alpha1GenericAPISpec `yaml:"api,omitempty"`
Backend Astartev1alpha1GenericBackendSpec `yaml:"backend,omitempty"`
} `yaml:"housekeeping,omitempty"`
RealmManagement struct {
API Astartev1alpha1GenericAPISpec `yaml:"api,omitempty"`
Backend Astartev1alpha1GenericBackendSpec `yaml:"backend,omitempty"`
} `yaml:"realmManagement,omitempty"`
Pairing struct {
API Astartev1alpha1GenericAPISpec `yaml:"api,omitempty"`
Backend Astartev1alpha1GenericBackendSpec `yaml:"backend,omitempty"`
} `yaml:"pairing,omitempty"`
DataUpdaterPlant struct {
Replicas int `yaml:"replicas,omitempty"`
DataQueueCount int `yaml:"dataQueueCount,omitempty"`
Version string `yaml:"version,omitempty"`
Resources struct {
Requests struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"requests"`
Limits struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"limits"`
} `yaml:"resources,omitempty"`
} `yaml:"dataUpdaterPlant,omitempty"`
AppengineAPI struct {
Replicas int `yaml:"replicas,omitempty"`
DisableAuthentication bool `yaml:"disableAuthentication,omitempty"`
MaxResultsLimit int `yaml:"maxResultsLimit,omitempty"`
Version string `yaml:"version,omitempty"`
Resources struct {
Requests struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"requests"`
Limits struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"limits"`
} `yaml:"resources,omitempty"`
} `yaml:"appengineApi,omitempty"`
TriggerEngine struct {
Deploy bool `yaml:"deploy,omitempty"`
Replicas int `yaml:"replicas,omitempty"`
Version string `yaml:"version,omitempty"`
Resources struct {
Requests struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"requests"`
Limits struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"limits"`
} `yaml:"resources,omitempty"`
} `yaml:"triggerEngine,omitempty"`
Dashboard struct {
Deploy bool `yaml:"deploy,omitempty"`
Replicas int `yaml:"replicas,omitempty"`
DefaultRealm string `yaml:"defaultRealm,omitempty"`
Version string `yaml:"version,omitempty"`
Config struct {
RealmManagementAPIURL string `yaml:"realmManagementApiUrl"`
DefaultRealm string `yaml:"defaultRealm"`
DefaultAuth string `yaml:"defaultAuth"`
Auth []struct {
Type string `yaml:"type"`
} `yaml:"auth"`
} `yaml:"config,omitempty"`
Resources struct {
Requests struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"requests"`
Limits struct {
CPU string `yaml:"cpu"`
Memory string `yaml:"memory"`
} `yaml:"limits"`
} `yaml:"resources,omitempty"`
} `yaml:"dashboard,omitempty"`
} `yaml:"components"`
}
// Astartev1alpha1Deployment represents an Astarte Deployment object
type Astartev1alpha1Deployment struct {
APIVersion string `yaml:"apiVersion"`
Kind string `yaml:"kind"`
Metadata struct {
Name string `yaml:"name"`
Namespace string `yaml:"namespace"`
Annotations map[string]string `yaml:"annotations,omitempty"`
} `yaml:"metadata"`
Spec Astartev1alpha1DeploymentSpec `yaml:"spec"`
}
// GetBaseAstartev1alpha1Deployment returns a ready to customise deployment spec for an Astarte v1alpha1 resource
func GetBaseAstartev1alpha1Deployment() Astartev1alpha1Deployment {
return Astartev1alpha1Deployment{
APIVersion: "api.astarte-platform.org/v1alpha1",
Kind: "Astarte",
}
}