@@ -2,16 +2,18 @@ package model
2
2
3
3
// Service describes a service's configurations
4
4
type Service struct {
5
- ID string `json:"id,omitempty" yaml:"id,omitempty"`
6
- Name string `json:"name,omitempty" yaml:"name,omitempty"`
7
- ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"`
8
- Version string `json:"version,omitempty" yaml:"version,omitempty"`
9
- Scale ScaleConfig `json:"scale" yaml:"scale"`
10
- Labels map [string ]string `json:"labels" yaml:"labels"`
11
- Tasks []Task `json:"tasks" yaml:"tasks"`
12
- Affinity []Affinity `json:"affinity" yaml:"affinity"`
13
- Whitelist []Whitelist `json:"whitelists" yaml:"whitelists"`
14
- Upstreams []Upstream `json:"upstreams" yaml:"upstreams"`
5
+ ID string `json:"id,omitempty" yaml:"id,omitempty"`
6
+ Name string `json:"name,omitempty" yaml:"name,omitempty"`
7
+ ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"`
8
+ Version string `json:"version,omitempty" yaml:"version,omitempty"`
9
+ Scale * ScaleConfig `json:"scale,omitempty" yaml:"scale,omitempty"`
10
+ AutoScale * AutoScaleConfig `json:"autoScale,omitempty" yaml:"autoScale,omitempty"`
11
+ Labels map [string ]string `json:"labels,omitempty" yaml:"labels,omitempty"`
12
+ Tasks []Task `json:"tasks" yaml:"tasks"`
13
+ Affinity []Affinity `json:"affinity,omitempty" yaml:"affinity,omitempty"`
14
+ Whitelist []Whitelist `json:"whitelists" yaml:"whitelists"`
15
+ Upstreams []Upstream `json:"upstreams" yaml:"upstreams"`
16
+ StatsInclusionPrefixes string `json:"statsInclusionPrefixes" yaml:"statsInclusionPrefixes"`
15
17
}
16
18
17
19
// ScaleConfig describes the config used to scale a service
@@ -23,6 +25,36 @@ type ScaleConfig struct {
23
25
Mode string `json:"mode" yaml:"mode"`
24
26
}
25
27
28
+ // AutoScaleConfig describes the config used to scale a service
29
+ type AutoScaleConfig struct {
30
+ PollingInterval int32 `json:"pollingInterval" yaml:"pollingInterval"` // Default 15 (in seconds)
31
+ CoolDownInterval int32 `json:"coolDownInterval" yaml:"coolDownInterval"` // Default 120 (in seconds)
32
+
33
+ MinReplicas int32 `json:"minReplicas" yaml:"minReplicas"` // Default 1
34
+ MaxReplicas int32 `json:"maxReplicas" yaml:"maxReplicas"` // Default 100
35
+
36
+ Triggers []AutoScaleTrigger `json:"triggers,omitempty" yaml:"triggers,omitempty"`
37
+ }
38
+
39
+ // AutoScaleTrigger describes the config of a scaler
40
+ type AutoScaleTrigger struct {
41
+ Name string `json:"name" yaml:"name"`
42
+ Type string `json:"type" yaml:"type"`
43
+ MetaData map [string ]string `json:"metadata" yaml:"metadata"`
44
+ AuthenticatedRef * AutoScaleAuthRef `json:"authRef" yaml:"authRef"` // Authentication ref is optional
45
+ }
46
+
47
+ // AutoScaleAuthRef describes the authentication reference for a scaler
48
+ type AutoScaleAuthRef struct {
49
+ SecretMapping []AutoScaleAuthRefMapping `json:"secretMapping" yaml:"secretMapping"`
50
+ }
51
+
52
+ // AutoScaleAuthRefMapping describes the mapping between the keys of the secret and parameters of the scaler
53
+ type AutoScaleAuthRefMapping struct {
54
+ Parameter string `json:"param" yaml:"param"`
55
+ Key string `json:"key" yaml:"key"`
56
+ }
57
+
26
58
// Task describes the configuration of a task
27
59
type Task struct {
28
60
ID string `json:"id" yaml:"id"`
0 commit comments