-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClassDiagram.puml
529 lines (431 loc) · 19.7 KB
/
ClassDiagram.puml
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
@startuml
namespace api {
interface Pipeline {
+ Apply(context echo.Context) error
+ GetLogs(context echo.Context) error
+ GetEvents(context echo.Context) error
}
}
namespace common {
class MetaData << (S,Aquamarine) >> {
+ Page int64
+ PerPage int64
+ PageCount int64
+ TotalCount int64
+ Links []<font color=blue>map</font>[string]string
}
class ResponseDTO << (S,Aquamarine) >> {
+ Metadata *MetaData
+ Data <font color=blue>interface</font>{}
+ Status string
+ Message string
}
}
namespace docs {
class s << (S,Aquamarine) >> {
+ ReadDoc() string
}
class swaggerInfo << (S,Aquamarine) >> {
+ Version string
+ Host string
+ BasePath string
+ Schemes []string
+ Title string
+ Description string
}
}
namespace enums {
class enums.API_VERSION << (T, #FF7700) >> {
}
class enums.PARAMS << (T, #FF7700) >> {
}
class enums.PIPELINE_PURGING << (T, #FF7700) >> {
}
class enums.PIPELINE_RESOURCE_TYPE << (T, #FF7700) >> {
}
class enums.PIPELINE_STATUS << (T, #FF7700) >> {
}
class enums.POD_STATUS << (T, #FF7700) >> {
}
class enums.PROCESS_STATUS << (T, #FF7700) >> {
}
class enums.STEP_TYPE << (T, #FF7700) >> {
}
class enums.TRIGGER << (T, #FF7700) >> {
}
}
namespace inmemory {
class logEventRepository << (S,Aquamarine) >> {
+ Store(log v1.LogEvent)
+ GetByProcessId(processId string, option v1.LogEventQueryOption) ([]string, int64)
}
class processEventRepository << (S,Aquamarine) >> {
+ Store(data v1.ProcessEvent)
+ GetByProcessId(processId string) <font color=blue>map</font>[string]<font color=blue>interface</font>{}
+ DequeueByProcessId(processId string) <font color=blue>map</font>[string]<font color=blue>interface</font>{}
}
class processLifeCycleRepository << (S,Aquamarine) >> {
- updateStatus(data v1.ProcessLifeCycleEvent, status string) error
- update(data v1.ProcessLifeCycleEvent) error
+ PullNonInitializedAndAutoTriggerEnabledEventsByStepType(count int64, stepType string) []v1.ProcessLifeCycleEvent
+ PullPausedAndAutoTriggerEnabledResourcesByAgentName(count int64, agent string) []v1.ProcessLifeCycleEvent
+ Get(count int64) []v1.ProcessLifeCycleEvent
+ Store(events []v1.ProcessLifeCycleEvent)
+ GetByProcessIdAndStep(processId string, step string) *v1.ProcessLifeCycleEvent
+ GetByProcessId(processId string) []v1.ProcessLifeCycleEvent
}
}
"repository.LogEventRepository" <|-- "inmemory.logEventRepository"
"repository.ProcessEventRepository" <|-- "inmemory.processEventRepository"
"repository.ProcessLifeCycleEventRepository" <|-- "inmemory.processLifeCycleRepository"
namespace logic {
class eventStoreEventService << (S,Aquamarine) >> {
- httpPublisher service.HttpClient
+ Listen(subject v1.Subject)
}
class eventStoreProcessEventService << (S,Aquamarine) >> {
- httpPublisher service.HttpClient
+ Listen(subject v1.Subject)
}
class eventStoreProcessLifeCycleService << (S,Aquamarine) >> {
- httpPublisher service.HttpClient
+ PullBuildEvents() []v1.ProcessLifeCycleEvent
+ Listen(subject v1.Subject)
}
class httpClientMockService << (S,Aquamarine) >> {
+ Post(url string, header <font color=blue>map</font>[string]string, body []byte) error
+ Get(url string, header <font color=blue>map</font>[string]string) ([]byte, error)
}
class httpClientService << (S,Aquamarine) >> {
+ Get(url string, header <font color=blue>map</font>[string]string) ([]byte, error)
+ Post(url string, header <font color=blue>map</font>[string]string, body []byte) error
}
class jwtService << (S,Aquamarine) >> {
- jwt v1.Jwt
+ ValidateToken(tokenString string) (bool, *jwt.Token)
}
class k8sService << (S,Aquamarine) >> {
- tekton service.Tekton
- observerList []service.Observer
+ Kcs *kubernetes.Clientset
- notifyAll(listener v1.Subject)
+ GetContainerLog(namespace string, podName string, containerName string, taskRunLabel <font color=blue>map</font>[string]string) (io.ReadCloser, error)
+ FollowContainerLifeCycle(namespace string, podName string, containerName string, step string, processId string, stepType enums.STEP_TYPE)
+ RequestContainerLog(namespace string, podName string, containerName string) *rest.Request
+ GetSecret(name string, namespace string) (v1.Secret, error)
+ GetConfigMap(name string, namespace string) (v1.ConfigMap, error)
+ GetPodListByProcessId(namespace string, processId string, option v1.PodListGetOption) *v1.PodList
+ WaitAndGetInitializedPods(namespace string, processId string, step string) *v1.PodList
}
class logEventService << (S,Aquamarine) >> {
- repo repository.LogEventRepository
+ Listen(listener v1.Subject)
+ Store(log v1.LogEvent)
+ GetByProcessId(processId string, option v1.LogEventQueryOption) ([]string, int64)
}
class mockK8sService << (S,Aquamarine) >> {
- service service.LogEvent
+ RequestContainerLog(namespace string, podName string, containerName string) *rest.Request
+ GetContainerLog(namespace string, podName string, containerName string, taskRunLabel <font color=blue>map</font>[string]string) (io.ReadCloser, error)
+ FollowContainerLifeCycle(namespace string, podName string, containerName string, step string, processId string, stepType enums.STEP_TYPE)
+ GetPodListByProcessId(namespace string, processId string, option v1.PodListGetOption) *v1.PodList
+ WaitAndGetInitializedPods(namespace string, processId string, step string) *v1.PodList
+ GetSecret(name string, namespace string) (v1.Secret, error)
+ GetConfigMap(name string, namespace string) (v1.ConfigMap, error)
}
class pipelineService << (S,Aquamarine) >> {
- k8s service.K8s
- tekton service.Tekton
- pipeline v1.Pipeline
- logEventService service.LogEvent
- processEventService service.ProcessEvent
- processLifeCycleEvent service.ProcessLifeCycleEvent
- observerList []service.Observer
- buildProcessLifeCycleEvents()
- applySteps(step v1.Step)
- apply()
- applyBuildStep(step v1.Step) error
- notifyAll(listener v1.Subject)
+ ApplyBuildSteps()
+ ReadEventByProcessId(c <font color=blue>chan</font> <font color=blue>map</font>[string]<font color=blue>interface</font>{}, processId string)
+ GetLogsByProcessId(processId string, option v1.LogEventQueryOption) ([]string, int64)
+ PostOperations(step string, stepType enums.STEP_TYPE, pipeline v1.Pipeline)
+ LoadArgs(pipeline v1.Pipeline)
+ LoadEnvs(pipeline v1.Pipeline)
+ SetInputResource(url string, revision string, pipeline v1.Pipeline)
+ Build(url string, revision string, pipeline v1.Pipeline)
+ BuildProcessLifeCycleEvents(url string, revision string, pipeline v1.Pipeline) error
}
class processEventService << (S,Aquamarine) >> {
- repo repository.ProcessEventRepository
+ Listen(listener v1.Subject)
+ Store(data v1.ProcessEvent)
+ GetByProcessId(processId string) <font color=blue>map</font>[string]<font color=blue>interface</font>{}
+ DequeueByProcessId(processId string) <font color=blue>map</font>[string]<font color=blue>interface</font>{}
}
class processLifeCycleEventService << (S,Aquamarine) >> {
- repo repository.ProcessLifeCycleEventRepository
+ PullBuildEvents() []v1.ProcessLifeCycleEvent
+ Listen(subject v1.Subject)
+ PullNonInitializedAndAutoTriggerEnabledEventsByStepType(count int64, stepType string) []v1.ProcessLifeCycleEvent
+ PullPausedAndAutoTriggerEnabledResourcesByAgentName(count int64, agent string) []v1.AgentDeployableResource
+ Store(events []v1.ProcessLifeCycleEvent)
}
class stepService << (S,Aquamarine) >> {
- step v1.Step
+ SetInput(url string, revision string)
+ SetArgs(k8s service.K8s)
+ SetEnvs(k8s service.K8s)
}
class tektonService << (S,Aquamarine) >> {
+ Tcs *versioned.Clientset
+ GetTaskRun(name string, waitUntilTaskRunIsCompleted bool) (*v1alpha1.TaskRun, error)
+ InitPipelineResources(step v1.Step, label <font color=blue>map</font>[string]string, processId string) (v1alpha1.PipelineResource, []v1alpha1.PipelineResource, error)
+ InitTask(step v1.Step, label <font color=blue>map</font>[string]string, processId string) (v1alpha1.Task, error)
+ InitTaskRun(step v1.Step, label <font color=blue>map</font>[string]string, processId string) (v1alpha1.TaskRun, error)
+ CreatePipelineResource(resource v1alpha1.PipelineResource) error
+ CreateTask(resource v1alpha1.Task) error
+ CreateTaskRun(resource v1alpha1.TaskRun) error
+ DeletePipelineResourceByProcessId(processId string) error
+ DeleteTaskByProcessId(processId string) error
+ DeleteTaskRunByProcessId(processId string) error
+ PurgeByProcessId(processId string)
}
}
"service.Observer" <|-- "logic.eventStoreEventService"
"service.Observer" <|-- "logic.eventStoreProcessEventService"
"service.Observer" <|-- "logic.eventStoreProcessLifeCycleService"
"service.ProcessLifeCycleEvent" <|-- "logic.eventStoreProcessLifeCycleService"
"service.HttpClient" <|-- "logic.httpClientMockService"
"service.HttpClient" <|-- "logic.httpClientService"
"service.Jwt" <|-- "logic.jwtService"
"service.K8s" <|-- "logic.k8sService"
"repository.LogEventRepository" <|-- "logic.logEventService"
"service.LogEvent" <|-- "logic.logEventService"
"service.Observer" <|-- "logic.logEventService"
"service.K8s" <|-- "logic.mockK8sService"
"service.Pipeline" <|-- "logic.pipelineService"
"repository.ProcessEventRepository" <|-- "logic.processEventService"
"service.Observer" <|-- "logic.processEventService"
"service.ProcessEvent" <|-- "logic.processEventService"
"service.Observer" <|-- "logic.processLifeCycleEventService"
"service.ProcessLifeCycleEvent" <|-- "logic.processLifeCycleEventService"
"service.Step" <|-- "logic.stepService"
"service.Tekton" <|-- "logic.tektonService"
namespace mongo {
class dmManager << (S,Aquamarine) >> {
+ Ctx context.Context
+ Db *mongo.Database
- initConnection()
- initMockMongoConnection()
}
class logEventRepository << (S,Aquamarine) >> {
- manager *dmManager
- timeout time.Duration
+ Store(event v1.LogEvent)
+ GetByProcessId(processId string, option v1.LogEventQueryOption) ([]string, int64)
}
class processLifeCycleRepository << (S,Aquamarine) >> {
- manager *dmManager
- timeout time.Duration
- updateStatus(data v1.ProcessLifeCycleEvent, status string) error
- update(data v1.ProcessLifeCycleEvent) error
+ PullNonInitializedAndAutoTriggerEnabledEventsByStepType(count int64, stepType string) []v1.ProcessLifeCycleEvent
+ PullPausedAndAutoTriggerEnabledResourcesByAgentName(count int64, agent string) []v1.ProcessLifeCycleEvent
+ Get(count int64) []v1.ProcessLifeCycleEvent
+ Store(events []v1.ProcessLifeCycleEvent)
+ GetByProcessIdAndStep(processId string, step string) *v1.ProcessLifeCycleEvent
+ GetByProcessId(processId string) []v1.ProcessLifeCycleEvent
}
}
"repository.LogEventRepository" <|-- "mongo.logEventRepository"
"repository.ProcessLifeCycleEventRepository" <|-- "mongo.processLifeCycleRepository"
namespace repository {
interface LogEventRepository {
+ Store(log v1.LogEvent)
+ GetByProcessId(processId string, option v1.LogEventQueryOption) ([]string, int64)
}
interface ProcessEventRepository {
+ Store(data v1.ProcessEvent)
+ GetByProcessId(processId string) <font color=blue>map</font>[string]<font color=blue>interface</font>{}
+ DequeueByProcessId(processId string) <font color=blue>map</font>[string]<font color=blue>interface</font>{}
}
interface ProcessLifeCycleEventRepository {
+ Store(data []v1.ProcessLifeCycleEvent)
+ Get(count int64) []v1.ProcessLifeCycleEvent
+ PullPausedAndAutoTriggerEnabledResourcesByAgentName(count int64, agent string) []v1.ProcessLifeCycleEvent
+ PullNonInitializedAndAutoTriggerEnabledEventsByStepType(count int64, stepType string) []v1.ProcessLifeCycleEvent
}
}
namespace service {
interface HttpClient {
+ Post(url string, header <font color=blue>map</font>[string]string, body []byte) error
+ Get(url string, header <font color=blue>map</font>[string]string) ([]byte, error)
}
interface Jwt {
+ ValidateToken(tokenString string) (bool, *jwt.Token)
}
interface K8s {
+ GetSecret(name string, namespace string) (v1.Secret, error)
+ GetConfigMap(name string, namespace string) (v1.ConfigMap, error)
+ GetPodListByProcessId(namespace string, processId string, option v1.PodListGetOption) *v1.PodList
+ WaitAndGetInitializedPods(namespace string, processId string, step string) *v1.PodList
+ FollowContainerLifeCycle(namespace string, podName string, containerName string, step string, processId string, stepType enums.STEP_TYPE)
+ GetContainerLog(namespace string, podName string, containerName string, taskRunLabel <font color=blue>map</font>[string]string) (io.ReadCloser, error)
+ RequestContainerLog(namespace string, podName string, containerName string) *rest.Request
}
interface LogEvent {
+ Store(log v1.LogEvent)
+ GetByProcessId(processId string, option v1.LogEventQueryOption) ([]string, int64)
+ Listen(subject v1.Subject)
}
interface Observer {
+ Listen(subject v1.Subject)
}
interface Pipeline {
+ BuildProcessLifeCycleEvents(url string, revision string, pipeline v1.Pipeline) error
+ LoadArgs(pipeline v1.Pipeline)
+ LoadEnvs(pipeline v1.Pipeline)
+ SetInputResource(url string, revision string, pipeline v1.Pipeline)
+ Build(url string, revision string, pipeline v1.Pipeline)
+ PostOperations(step string, stepType enums.STEP_TYPE, pipeline v1.Pipeline)
+ GetLogsByProcessId(processId string, option v1.LogEventQueryOption) ([]string, int64)
+ ReadEventByProcessId(c <font color=blue>chan</font> <font color=blue>map</font>[string]<font color=blue>interface</font>{}, processId string)
+ ApplyBuildSteps()
}
interface ProcessEvent {
+ Store(data v1.ProcessEvent)
+ GetByProcessId(processId string) <font color=blue>map</font>[string]<font color=blue>interface</font>{}
+ DequeueByProcessId(processId string) <font color=blue>map</font>[string]<font color=blue>interface</font>{}
+ Listen(subject v1.Subject)
}
interface ProcessLifeCycleEvent {
+ PullBuildEvents() []v1.ProcessLifeCycleEvent
+ Listen(subject v1.Subject)
}
interface Step {
+ SetInput(url string, revision string)
+ SetArgs(k8s K8s)
+ SetEnvs(k8s K8s)
}
interface Tekton {
+ InitPipelineResources(step v1.Step, label <font color=blue>map</font>[string]string, processId string) (v1alpha1.PipelineResource, []v1alpha1.PipelineResource, error)
+ InitTask(step v1.Step, label <font color=blue>map</font>[string]string, processId string) (v1alpha1.Task, error)
+ InitTaskRun(step v1.Step, label <font color=blue>map</font>[string]string, processId string) (v1alpha1.TaskRun, error)
+ CreatePipelineResource( v1alpha1.PipelineResource) error
+ CreateTask( v1alpha1.Task) error
+ CreateTaskRun( v1alpha1.TaskRun) error
+ DeletePipelineResourceByProcessId(processId string) error
+ DeleteTaskByProcessId(processId string) error
+ DeleteTaskRunByProcessId(processId string) error
+ PurgeByProcessId(processId string)
+ GetTaskRun(name string, waitUntilTaskRunIsCompleted bool) (*v1alpha1.TaskRun, error)
}
}
namespace v1 {
class Agent << (S,Aquamarine) >> {
+ Url string
}
class AgentDeployableResource << (S,Aquamarine) >> {
+ Step string
+ ProcessId string
+ Descriptors *[]unstructured.Unstructured
+ Type enums.PIPELINE_RESOURCE_TYPE
+ Name string
+ Namespace string
+ Images []string
}
class CompanyMetadata << (S,Aquamarine) >> {
+ Labels <font color=blue>map</font>[string]string
+ NumberOfConcurrentProcess int64
+ TotalProcessPerDay int64
}
class Jwt << (S,Aquamarine) >> {
+ PublicKey *rsa.PublicKey
}
class LogEvent << (S,Aquamarine) >> {
+ ProcessId string
+ Log string
+ Step string
+ CreatedAt time.Time
}
class LogEventQueryOption << (S,Aquamarine) >> {
+ Pagination <font color=blue>struct</font>{int64, int64}
+ Step string
}
class Pipeline << (S,Aquamarine) >> {
+ MetaData PipelineMetadata
+ Option PipelineApplyOption
+ ApiVersion string
+ Name string
+ ProcessId string
+ Label <font color=blue>map</font>[string]string
+ Steps []Step
+ Validate() error
}
class PipelineApplyOption << (S,Aquamarine) >> {
+ Purging enums.PIPELINE_PURGING
}
class PipelineMetadata << (S,Aquamarine) >> {
+ CompanyId string
+ CompanyMetadata CompanyMetadata
}
class PodListGetOption << (S,Aquamarine) >> {
+ Wait bool
+ Duration int
}
class ProcessEvent << (S,Aquamarine) >> {
+ ProcessId string
+ Data <font color=blue>map</font>[string]<font color=blue>interface</font>{}
}
class ProcessLifeCycleEvent << (S,Aquamarine) >> {
+ ProcessId string
+ Step string
+ StepType enums.STEP_TYPE
+ Status enums.PROCESS_STATUS
+ Next []string
+ Agent string
+ Pipeline *Pipeline
+ CreatedAt time.Time
+ Trigger enums.TRIGGER
}
class Step << (S,Aquamarine) >> {
+ Name string
+ Type enums.STEP_TYPE
+ Trigger enums.TRIGGER
+ Params <font color=blue>map</font>[enums.PARAMS]string
+ Next []string
+ ArgData <font color=blue>map</font>[string]string
+ EnvData <font color=blue>map</font>[string]string
+ Descriptors *[]unstructured.Unstructured
- validateDeployStep() error
- validateBuildStep() error
+ Validate() error
}
class Subject << (S,Aquamarine) >> {
+ Step string
+ StepType enums.STEP_TYPE
+ EventData <font color=blue>map</font>[string]<font color=blue>interface</font>{}
+ ProcessLabel <font color=blue>map</font>[string]string
+ Pipeline Pipeline
}
class pipelineApi << (S,Aquamarine) >> {
- pipelineService service.Pipeline
- observerList []service.Observer
- notifyAll(listener v1.Subject)
+ GetLogs(context echo.Context) error
+ GetEvents(context echo.Context) error
+ Apply(context echo.Context) error
}
}
"api.Pipeline" <|-- "v1.pipelineApi"
"__builtin__.string" #.. "enums.API_VERSION"
"__builtin__.string" #.. "enums.PARAMS"
"__builtin__.string" #.. "enums.PIPELINE_PURGING"
"__builtin__.string" #.. "enums.PIPELINE_RESOURCE_TYPE"
"__builtin__.string" #.. "enums.PIPELINE_STATUS"
"__builtin__.string" #.. "enums.POD_STATUS"
"__builtin__.string" #.. "enums.PROCESS_STATUS"
"__builtin__.string" #.. "enums.STEP_TYPE"
"__builtin__.string" #.. "enums.TRIGGER"
@enduml