-
Notifications
You must be signed in to change notification settings - Fork 3
/
cdsyaml.go
29 lines (24 loc) · 1.01 KB
/
cdsyaml.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
package xds
import (
"time"
)
type CDSConfig struct {
ClusterName string `yaml:"name" validate:"required"`
LbPolicy string `yaml:"lb-policy" validate:"required"`
HealthCheck CDSHealthCheckConfig `yaml:"health-check" validate:"required"`
}
type CDSHealthCheckConfig struct {
Host string `yaml:"host" validate:""`
Path string `yaml:"path" validate:"required"`
Status []string `yaml:"status" validate:"required,unique"`
Timeout uint32 `yaml:"timeout" validate:"gte=1,lte=900"`
Interval uint32 `yaml:"interval" validate:"gte=1,lte=180"`
HealthyCount uint32 `yaml:"healthy" validate:"gte=1,lte=10"`
UnhealthyCount uint32 `yaml:"unhealthy" validate:"gte=1,lte=10"`
}
func (c CDSHealthCheckConfig) TimeoutSecond() time.Duration {
return time.Duration(c.Timeout) * time.Second
}
func (c CDSHealthCheckConfig) IntervalSecond() time.Duration {
return time.Duration(c.Interval) * time.Second
}