/
service.go
778 lines (677 loc) · 23.3 KB
/
service.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
// Copyright (c) 2021 Terminus, Inc.
//
// 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 apistructs
import (
"time"
corev1 "k8s.io/api/core/v1"
"github.com/erda-project/erda/pkg/parser/diceyml"
)
// The ServiceGroup of a Dice
type ServiceGroup struct {
// runtime create time
CreatedTime int64 `json:"created_time"`
// last modified (update) time
LastModifiedTime int64 `json:"last_modified_time"`
// executor for scheduling (e.g. marathon)
Executor string `json:"executor"`
// substitute for "Executor" field
ClusterName string `json:"clusterName"`
// version to tracing changes (create, update, etc.)
Version string `json:"version,omitempty"`
Force bool `json:"force,omitempty"`
// current usage for Extra:
// 1. record last restart time, to implement RESTART api through PUT api
Extra map[string]string `json:"extra,omitempty"`
// 根据集群配置以及 label 所计算出的调度规则
// TODO: DEPRECATED
ScheduleInfo ScheduleInfo `json:"scheduleInfo,omitempty"`
// 将会代替 ScheduleInfo
ScheduleInfo2 ScheduleInfo2 `json:"scheduleInfo2,omitempty"`
// ubiquitous dice
Dice
// status of this runtime
StatusDesc
}
// ScheduleInfo2 之后将完全代替 ScheduleInfo
type ScheduleInfo2 struct {
// 服务(包括JOB)打散在不同 host
// HasHostUnique: 是否启用 host 打散
// HostUnique: service 分组
HasHostUnique bool
HostUnique [][]string
// 指定 host, 列表中的host为 ‘或’ 关系
SpecificHost []string
// 是否需要调度到 `平台` 所属机器
IsPlatform bool
IsDaemonset bool
// 是否需要调度到 `非 locked` 机器
// 总是 true
IsUnLocked bool
// Location 允许调度目的节点类型列表
//
// e.g.
//
// Location: map[string] interface{}
// map[servicename] diceyml.Selector
//
// TODO: 目前 map value 是 interface{} 是因为 apistructs 没有 import diceyml,
// 需要把 diceyml 结构体移动到 apistructs
Location map[string]interface{}
// HasOrg 表示 Org 字段是否有意义
// 1. '集群配置' 中未开启: HasOrg = false
// 2. '集群配置' 中开启,`LabelInfo.Label` 中没有 `labelconfig.ORG_KEY` label & selectors 中没有 `org`:
// HasOrg = false
// 3. '集群配置' 中开启,`LabelInfo.Label` 中存在 `labelconfig.ORG_KEY` label | selectors 中存在 `org`:
// HasOrg = true, Org = "<orgname>"
HasOrg bool
Org string
// HasWorkSpace 表示 WorkSpace 字段是否有意义
// 1. HasOrg = false : HasWorkSpace = false
// 2. '集群配置' 中未开启 : HasWorkSpace = false
// 3. '集群配置' 中开启,`LabelInfo.Label` 中没有 `labelconfig.WORKSPACE_KEY` label & selectors 中没有 `org` :
// HasWorkSpace = false
// 4. '集群配置' 中开启,`LabelInfo.Label` 中存在 `labelconfig.ORG_KEY` label | selectors 中存在 `org`:
// HasWorkSpace = true, WorkSpace = ["<workspace>", ...]
HasWorkSpace bool
// WorkSpaces 列表中的 workspace 为 `或` 关系
// [a, b, c] => a | b | c
WorkSpaces []string
// 以下出现的 PreferXXX, 在 XXX = true 时,才有意义
Job bool
// PreferJob
// k8s 忽略该字段
// marathon 中生成的约束为 job | any
PreferJob bool
Pack bool
// PreferPack
// k8s 忽略该字段
// marathon 中生成的约束为 pack | any
PreferPack bool
Stateful bool
// PreferStateful
// k8s 忽略该字段
// marathon 中生成的约束为 stateful | any
PreferStateful bool
Stateless bool
// PreferStateless
// k8s 忽略该字段
// marathon 中生成的约束为 stateless | any
PreferStateless bool
BigData bool
// Project label
// =DEPRECATED= k8s 中忽略该字段
HasProject bool
Project string
}
// ScheduleInfo 之后将完全替换为 ScheduleInfo2
type ScheduleInfo struct {
// 调度喜好对应的个体
Likes []string
UnLikes []string
// 调度喜好对应的以该值为前缀的群体
LikePrefixs []string
UnLikePrefixs []string
// 不与 "any" 标签共存的 Like
ExclusiveLikes []string
// 元素是或集合,组合到一条约束语句中
InclusiveLikes []string
// currently only for "any" label
Flag bool
// 服务(包括JOB)打散在不同 host
// HostUnique: 是否启用 host 打散
// HostUniqueInfo: service 分组
HostUnique bool
HostUniqueInfo [][]string
// 指定 host, 列表中的host为‘或’关系
SpecificHost []string
// 是否需要调度到 `平台` 所属机器
IsPlatform bool
// 是否需要调度到 `非 locked` 机器
IsUnLocked bool
// Location 允许调度目的节点类型列表
//
// e.g.
//
// Location: map[string] interface{}
// map[servicename] diceyml.Selector
//
// TODO: 目前 map value 是 interface{} 是因为 apistructs 没有 import diceyml,
// 需要把 diceyml 结构体移动到 apistructs
Location map[string]interface{}
}
// Ubiquitous dice entity (we call it dice.json)
type Dice struct {
// name of dice, namespace + name is unique
// ID is the hash string identity for dice info like 'x389vj1l23...'
ID string `json:"name"`
// namespace of dice, namespace + name is unique
// Type indicates the type of dice, it contains services, group-addon ...
// Type and ID will compose the unique namespaces for kubernetes when Namespaces is empty
Type string `json:"namespace"`
// labels for extension and some tags
Labels map[string]string `json:"labels"`
// bunch of services running together with dependencies each other
Services []Service `json:"services"`
// service discovery kind: VIP, PROXY, NONE
ServiceDiscoveryKind string `json:"serviceDiscoveryKind"`
// Defines the way dice do env injection.
//
// GLOBAL:
// each service can see every services
// DEPEND:
// each service can see what he depends (XXX_HOST, XXX_PORT)
ServiceDiscoveryMode string `json:"serviceDiscoveryMode,omitempty"`
// Namespace indicates namespace for kubernetes
ProjectNamespace string `json:"projectNamespace"`
}
// ServicePort support service set port and protocol
type ServicePort struct {
// Port is port for service connection
Port int `json:"port"`
// Protocol support kubernetes orn Protocol Type. It
// contains ProtocolTCP, ProtocolUDP,ProtocolSCTP
Protocol corev1.Protocol `json:"protocol"`
}
const (
ServiceDiscoveryKindProxy = "PROXY"
)
// One single Service which is the minimum scheduling unit
type Service struct {
// unique name between services in one Dice (ServiceGroup)
Name string `json:"name"`
// namespace of service, equal to the namespace in Dice
Namespace string `json:"namespace,omitempty"`
// docker's image url
Image string `json:"image"`
// docker's image username
ImageUsername string `json:"image_username"`
// docker's image password
ImagePassword string `json:"image_password"`
// docker's CMD
Cmd string `json:"cmd,omitempty"`
// port list user-defined, we export these ports on our VIP
Ports []diceyml.ServicePort `json:"Ports"`
// only exists if serviceDiscoveryKind is PROXY
// can not modify directly, assigned by dice
ProxyPorts []int `json:"proxyPorts,omitempty"`
// virtual ip
// can not modify directly, assigned by dice
Vip string `json:"vip"`
// ShortVIP 短域名,为解决 DCOS, K8S等短域名不一致问题
ShortVIP string `json:"shortVIP,omitempty"`
// only exists if serviceDiscoveryKind is PROXY
// can not modify directly, assigned by dice
ProxyIp string `json:"proxyIp,omitempty"`
// TODO: refactor it, currently only work with label X_ENABLE_PUBLIC_IP=true
PublicIp string `json:"publicIp,omitempty"`
// instances of containers should running
Scale int `json:"scale"`
// resources like cpu, mem, disk
Resources Resources `json:"resources"`
// list of service names depends by this service, used for dependency scheduling
Depends []string `json:"depends,omitempty"`
// environment variables inject into container
Env map[string]string `json:"env"`
// labels for extension and some tags
Labels map[string]string `json:"labels"`
// deploymentLabels 会转化到 pod spec label 中, dcos 忽略此字段
DeploymentLabels map[string]string `json:"deploymentLabels,omitempty"`
// Selectors see also diceyml.Service.Selectors
//
// TODO: 把 ServiceGroup structure 移动到 scheduler 内部,Selectors 类型换为 diceyml.Selectors
Selectors interface{} `json:"selectors"`
// disk bind (mount) configuration, hostPath only
Binds []ServiceBind `json:"binds,omitempty"`
// Volumes intends to replace Binds
Volumes []Volume `json:"volumes,omitempty"`
// hosts append into /etc/hosts
Hosts []string `json:"hosts,omitempty"`
// health check
HealthCheck *HealthCheck `json:"healthCheck"`
//
NewHealthCheck *NewHealthCheck `json:"health_check,omitempty"`
SideCars map[string]*diceyml.SideCar `json:"sidecars,omitempty"`
InitContainer map[string]diceyml.InitContainer `json:"init,omitempty"`
// instance info, only for display
// marathon 中对应一个task, k8s中对应一个pod
InstanceInfos []InstanceInfo `json:"instanceInfos,omitempty"`
// service mesh 的服务级别开关
MeshEnable *bool `json:"mesh_enable,omitempty"`
// 对应 istio 的流量加密策略
TrafficSecurity diceyml.TrafficSecurity `json:"traffic_security,omitempty"`
// TODO: status should not show in Service spec, Service spec should only contains static description
// WorkLoad indicates the type of service,
//support Kubernetes workload DaemonSet(Per-Node), Statefulset and Deployment
WorkLoad string `json:"workLoad,omitempty"`
// ProjectServiceName means use service name with servicegroup id when create k8s service
ProjectServiceName string `json:"projectServiceName,omitempty"`
// K8s Container Snippet
K8SSnippet *diceyml.K8SSnippet `json:"k8sSnippet,omitempty"`
StatusDesc
}
// resources that container used
type Resources struct {
// cpu sharing
Cpu float64 `json:"cpu,omitempty"`
// memory usage
Mem float64 `json:"mem,omitempty"`
MaxCPU float64 `json:"max_cpu,omitempty"`
MaxMem float64 `json:"max_mem,omitempty"`
// disk usage
Disk float64 `json:"disk,omitempty"`
}
// health check to check container healthy
type HealthCheck struct {
// healthCheck kinds: HTTP, HTTPS, TCP, COMMAND
Kind string `json:"kind,omitempty"`
// port for HTTP, HTTPS, TCP
Port int `json:"port,omitempty"`
// path for HTTP, HTTPS
Path string `json:"path,omitempty"`
// command for COMMAND
Command string `json:"command,omitempty"`
}
type ServiceBind struct {
Bind
// TODO: refactor it, currently just copy the marathon struct
Persistent *PersistentVolume `json:"persistent,omitempty"`
}
type PersistentVolume struct {
Type string `json:"type,omitempty"`
Size int `json:"size,omitempty"`
MaxSize int `json:"maxSize,omitempty"`
Constraints [][]string `json:"constraints,omitempty"`
}
type HttpHealthCheck struct {
Port int `json:"port,omitempty"`
Path string `json:"path,omitempty"`
//单位是秒
Duration int `json:"duration,omitempty"`
}
type ExecHealthCheck struct {
Cmd string `json:"cmd,omitempty"`
//单位是秒
Duration int `json:"duration,omitempty"`
}
// 暂定支持"HTTP" 和 "COMMAND"两种方式
type NewHealthCheck struct {
HttpHealthCheck *HttpHealthCheck `json:"http,omitempty"`
ExecHealthCheck *ExecHealthCheck `json:"exec,omitempty"`
}
type Volume struct {
// volume ID
ID string `json:"volumeID,omitempty"`
// 由volume driver来填 volume 所在地址
// 对于 localvolume: hostpath
// 对于 nasvolume: nas网盘地址(/netdata/xxx/...)
VolumePath string `json:"volumePath"`
// 避免与原有的volumeType冲突,类型不同
// 所以叫做 ‘volumeTp’
VolumeType `json:"volumeTp"`
// 单位 G
Size int `json:"storage,omitempty"`
// 挂载到容器中的卷路径
ContainerPath string `json:"containerPath"`
// TODO: k8s.go 需要这个字段,现在对于k8s先不使用其插件中实现的volume相关实现(现在也没有用的地方)
// k8s plugin 重构的时候才去实现 k8s 特定的 volume 逻辑
Storage string `json:"-"`
}
type InstanceInfo struct {
Id string `json:"id,omitempty"`
Status string `json:"status,omitempty"`
Ip string `json:"ip,omitempty"`
Alive string `json:"alive,omitempty"`
}
type ServiceGroupCreateRequest ServiceGroup
type ServiceGroupCreateResponse struct {
Version string `json:"version"`
Name string `json:"name"`
Error string `json:"error"`
}
type ServiceGroupGetErrorResponse struct {
Error string `json:"error"`
}
type ServiceGroupRestartResponse struct {
Name string `json:"name"`
Error string `json:"error"`
}
type ServiceGroupUpdateResponse struct {
Name string `json:"name"`
Error string `json:"error"`
}
type ServiceGroupDeleteResponse struct {
Name string `json:"name"`
Error string `json:"error"`
}
/*
创建 servicegroup
POST: /api/servicegroup
*/
type ServiceGroupCreateV2Request struct {
DiceYml diceyml.Object `json:"diceyml"`
// DiceYml json.RawMessage `json:"diceyml"`
ClusterName string `json:"clusterName"`
ID string `json:"name"`
Type string `json:"namespace"`
// DEPRECATED, 放在 diceyml.meta 中
GroupLabels map[string]string `json:"grouplabels"`
// DEPRECATED, 放在 diceyml.meta 中
ServiceDiscoveryMode string `json:"serviceDiscoveryMode"`
// DEPRECATED
// map[servicename]volumeinfo
Volumes map[string]RequestVolumeInfo `json:"volumes"`
ProjectNamespace string `json:"projectNamespace"`
}
type RequestVolumeInfo struct {
ID string `json:"id"`
Type string `json:"type"`
ContainerPath string `json:"containerPath"`
}
type ServiceGroupCreateV2Response struct {
Header
Data ServiceGroupCreateV2Data `json:"data"`
}
type ServiceGroupCreateV2Data struct {
// 目前没用
Version string `json:"version"`
ID string `json:"namespace"`
Type string `json:"name"`
}
/*
更新 servicegroup
PUT: /api/servicegroup
*/
type ServiceGroupUpdateV2Request ServiceGroupCreateV2Request
type ServiceGroupUpdateV2Response ServiceGroupCreateV2Response
/*
删除 servicegroup
DELETE: /api/servicegroup
*/
type ServiceGroupDeleteV2Request struct {
Namespace string `query:"namespace"`
Name string `query:"name"`
}
type ServiceGroupDeleteRequest struct {
Namespace string `query:"namespace"`
Name string `query:"name"`
Force bool `query:"force"`
}
type ServiceGroupDeleteV2Response struct {
Header
}
/*
获取 servicegroup 信息
GET: /api/serivcegroup
*/
type ServiceGroupInfoRequest struct {
Type string `query:"namespace"`
ID string `query:"name"`
}
type ServiceGroupInfoResponse struct {
Header
Data ServiceGroup `json:"data"`
}
/*
kill pod
POST: /api/servicegroup/actions/killpod
*/
type ServiceGroupKillPodRequest struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
PodName string `json:"podName"`
}
type ServiceGroupKillPodResponse struct {
Header
}
/*
restart servicegroup
*/
type ServiceGroupRestartV2Request struct {
Namespace string `query:"namespace"`
Name string `query:"name"`
}
type ServiceGroupRestartV2Response struct {
Header
}
/*
cancel servicegroup
*/
type ServiceGroupCancelV2Request struct {
Namespace string `query:"namespace"`
Name string `query:"name"`
}
type ServiceGroupCancelV2Response struct {
Header
}
/*
precheck servicegroup
*/
type ServiceGroupPrecheckRequest ServiceGroupCreateV2Request
type ServiceGroupPrecheckResponse struct {
Header
Data ServiceGroupPrecheckData `json:"data"`
}
type ServiceGroupPrecheckData struct {
// key: servicename
Nodes map[string][]ServiceGroupPrecheckNodeData `json:"nodes"`
Status string `json:"status"`
Info string `json:"info"`
}
type ServiceGroupPrecheckNodeData struct {
IP string `json:"ip"`
Status string `json:"status"`
Info string `json:"info"`
}
type ServiceGroupConfigUpdateResponse struct {
Header
}
// UpdateServiceGroupScaleRequst request body for update servicegroup
type UpdateServiceGroupScaleRequst struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
ClusterName string `json:"clusterName"`
Services []Service `json:"services"`
}
// UpdateServiceGroupScaleResponse response for update servicegroup
type UpdateServiceGroupScaleResponse struct {
Header
}
type PodInfoRequest struct {
Cluster string `query:"cluster"`
OrgName string `query:"orgName"`
OrgID string `query:"orgID"`
ProjectName string `query:"projectName"`
ProjectID string `query:"projectID"`
ApplicationName string `query:"applicationName"`
ApplicationID string `query:"applicationID"`
RuntimeName string `query:"runtimeName"`
RuntimeID string `query:"runtimeID"`
ServiceName string `query:"serviceName"`
// enum: dev, test, staging, prod
Workspace string `query:"workspace"`
// enum: addon, stateless-service, job
ServiceType string `query:"serviceType"`
AddonID string `query:"addonID"`
// enum: Pending, Running, Succeeded, Failed, Unknown
Phases []string `query:"phases"`
Limit int `query:"limit"`
}
type PodInfoResponse struct {
Header
Data PodInfoDataList `json:"data"`
}
type PodInfoDataList []PodInfoData
type PodInfoData struct {
Cluster string `json:"cluster"`
Namespace string `json:"namespace"`
Name string `json:"name"`
OrgName string `json:"orgName"`
OrgID string `json:"orgID"`
ProjectName string `json:"projectName"`
ProjectID string `json:"projectID"`
ApplicationName string `json:"applicationName"`
ApplicationID string `json:"applicationID"`
RuntimeName string `json:"runtimeName"`
RuntimeID string `json:"runtimeID"`
ServiceName string `json:"serviceName"`
Workspace string `json:"workspace"`
ServiceType string `json:"serviceType"`
AddonID string `json:"addonID"`
Uid string `json:"uid"`
K8sNamespace string `json:"k8sNamespace"`
PodName string `json:"podName"`
Phase string `json:"phase"`
Message string `json:"message"`
PodIP string `json:"podIP"`
HostIP string `json:"hostIP"`
StartedAt *time.Time `json:"startedAt"`
MemRequest int `json:"memRequest"`
MemLimit int `json:"memLimit"`
CpuRequest float64 `json:"cpuRequest"`
CpuLimit float64 `json:"cpuLimit"`
}
type InstanceInfoRequest struct {
Cluster string `query:"cluster"`
OrgName string `query:"orgName"`
OrgID string `query:"orgID"`
ProjectName string `query:"projectName"`
ProjectID string `query:"projectID"`
ApplicationName string `query:"applicationName"`
ApplicationID string `query:"applicationID"`
RuntimeName string `query:"runtimeName"`
RuntimeID string `query:"runtimeID"`
ServiceName string `query:"serviceName"`
// enum: dev, test, staging, prod
Workspace string `query:"workspace"`
ContainerID string `query:"containerID"`
// ip1,ip2,ip3
InstanceIP string `query:"instanceIP"`
HostIP string `query:"hostIP"`
// enum: addon, stateless-service, job
ServiceType string `query:"serviceType"`
AddonID string `query:"addonID"`
// enum: unhealthy, healthy, dead, running
Phases []string `query:"phases"`
Limit int `query:"limit"`
}
type InstanceInfoResponse struct {
Header
Data InstanceInfoDataList `json:"data"`
}
type InstanceInfoDataList []InstanceInfoData
type InstanceInfoData struct {
Cluster string `json:"cluster"`
Namespace string `json:"namespace"`
Name string `json:"name"`
OrgName string `json:"orgName"`
OrgID string `json:"orgID"`
ProjectName string `json:"projectName"`
ProjectID string `json:"projectID"`
ApplicationName string `json:"applicationName"`
EdgeApplicationName string `json:"edgeApplicationName"`
EdgeSite string `json:"edgeSite"`
ApplicationID string `json:"applicationID"`
RuntimeName string `json:"runtimeName"`
RuntimeID string `json:"runtimeID"`
ServiceName string `json:"serviceName"`
Workspace string `json:"workspace"`
ServiceType string `json:"serviceType"`
AddonID string `json:"addonID"`
Meta string `json:"meta"`
TaskID string `json:"taskID"`
Phase string `json:"phase"`
Message string `json:"message"`
ContainerID string `json:"containerID"`
ContainerIP string `json:"containerIP"`
HostIP string `json:"hostIP"`
ExitCode int `json:"exitCode"`
CpuOrigin float64 `json:"cpuOrigin"`
MemOrigin int `json:"memOrigin"`
CpuRequest float64 `json:"cpuRequest"`
MemRequest int `json:"memRequest"`
CpuLimit float64 `json:"cpuLimit"`
MemLimit int `json:"memLimit"`
Image string `json:"image"`
StartedAt time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt"`
}
type ServiceInfoResponse struct {
Header
Data ServiceInfoDataList `json:"data"`
}
type ServiceInfoDataList []ServiceInfoData
type ServiceInfoData struct {
Cluster string `json:"cluster"`
Namespace string `json:"namespace"`
Name string `json:"name"`
OrgName string `json:"orgName"`
OrgID string `json:"orgId"`
ProjectName string `json:"projectName"`
ProjectID string `json:"projectId"`
ApplicationName string `json:"applicationName"`
ApplicationID string `json:"applicationId"`
RuntimeName string `json:"runtimeName"`
RuntimeID string `json:"runtimeId"`
ServiceName string `json:"serviceName"`
Workspace string `json:"workspace"`
ServiceType string `json:"serviceType"`
Meta string `json:"meta"`
Phase string `json:"phase"`
Message string `json:"message"`
StartedAt time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt"`
}
type CapacityInfoRequest struct {
ClusterName string `query:"clusterName"`
}
type CapacityInfoResponse struct {
Header
Data CapacityInfoData `json:"data"`
}
type CapacityInfoData struct {
ElasticsearchOperator bool `json:"elasticsearchOperator"`
RedisOperator bool `json:"redisOperator"`
MysqlOperator bool `json:"mysqlOperator"`
DaemonsetOperator bool `json:"daemonsetOperator"`
SourcecovOperator bool `json:"sourcecovOperator"`
}
type ComponentInfoResponse struct {
Header
Data ComponentInfoDataList `json:"data"`
}
type ComponentInfoDataList []ComponentInfoData
type ComponentInfoData struct {
Cluster string `json:"cluster"`
ComponentName string `json:"componentName"`
Phase string `json:"phase"`
Message string `json:"message"`
ContainerID string `json:"containerID"`
ContainerIP string `json:"containerIP"`
HostIP string `json:"hostIP"`
ExitCode int `json:"exitCode"`
CpuOrigin float64 `json:"cpuOrigin"`
MemOrigin int `json:"memOrigin"`
CpuRequest float64 `json:"cpuRequest"`
MemRequest int `json:"memRequest"`
CpuLimit float64 `json:"cpuLimit"`
MemLimit int `json:"memLimit"`
Image string `json:"image"`
StartedAt time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt"`
}
type RegistryInfo struct {
Host string `json:"host"`
UserName string `json:"userName"`
Password string `json:"password"`
}