-
Notifications
You must be signed in to change notification settings - Fork 1
/
engine.go
73 lines (60 loc) · 1.51 KB
/
engine.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
package application
import (
"fmt"
meshkube "github.com/khulnasoft/meshkit/utils/kubernetes"
v1 "k8s.io/api/core/v1"
)
type RolloutEngineGenericOptions struct {
Name string
Namespace string
ServiceMesh string
Metadata RolloutEngineGenericOptionsMetadata
Replicas int
Containers []RolloutEngineContainer
Delete bool
Advanced PatternSettingAdvanced
}
type RolloutEngineGenericOptionsMetadata struct {
Labels map[string]string
Annotations map[string]string
}
type RolloutEngineContainer struct {
Name string
Image string
Commands []string
Ports []RolloutEngineContainerPort
Resources []RolloutEngineContainerResource
Envs []v1.EnvVar
}
type RolloutEngineContainerPort struct {
Name string
ContainerPort int
}
type RolloutEngineContainerResource struct {
v1.ResourceRequirements
}
type RolloutEngineCanaryOptions struct {
RolloutEngineGenericOptions
Steps []RolloutEngineCanaryStep
}
type RolloutEngineCanaryStep struct {
SetWeight int
Steps []RolloutEngineCanaryStepPause
}
type RolloutEngineCanaryStepPause struct {
Duration int
// Inline Metrics - for the future
}
type RolloutEngine interface {
// Canary(RolloutEngineCanaryOptions) error
Install() error
Native(RolloutEngineGenericOptions) error
}
func NewRolloutEngine(kubeclient *meshkube.Client, typ string) (RolloutEngine, error) {
if typ == "argo" {
return &ArgoRollout{
kubeclient: kubeclient,
}, nil
}
return nil, fmt.Errorf("invalid rollout engine type: \"%s\"", typ)
}