mirror of https://github.com/status-im/consul.git
Changes "TLS" to "GRPCUseTLS" since it only applies to GRPC checks.
This commit is contained in:
parent
64acd0ade0
commit
5f31c8d8d3
|
@ -1766,7 +1766,7 @@ func (a *Agent) AddCheck(check *structs.HealthCheck, chkType *structs.CheckType,
|
|||
}
|
||||
|
||||
var tlsClientConfig *tls.Config
|
||||
if chkType.TLS {
|
||||
if chkType.GRPCUseTLS {
|
||||
var err error
|
||||
tlsClientConfig, err = a.setupTLSClientConfig(chkType.TLSSkipVerify)
|
||||
if err != nil {
|
||||
|
|
|
@ -946,7 +946,7 @@ func (b *Builder) checkVal(v *CheckDefinition) *structs.CheckDefinition {
|
|||
DockerContainerID: b.stringVal(v.DockerContainerID),
|
||||
Shell: b.stringVal(v.Shell),
|
||||
GRPC: b.stringVal(v.GRPC),
|
||||
TLS: b.boolVal(v.TLS),
|
||||
GRPCUseTLS: b.boolVal(v.GRPCUseTLS),
|
||||
TLSSkipVerify: b.boolVal(v.TLSSkipVerify),
|
||||
Timeout: b.durationVal(fmt.Sprintf("check[%s].timeout", id), v.Timeout),
|
||||
TTL: b.durationVal(fmt.Sprintf("check[%s].ttl", id), v.TTL),
|
||||
|
|
|
@ -342,7 +342,7 @@ type CheckDefinition struct {
|
|||
DockerContainerID *string `json:"docker_container_id,omitempty" hcl:"docker_container_id" mapstructure:"docker_container_id"`
|
||||
Shell *string `json:"shell,omitempty" hcl:"shell" mapstructure:"shell"`
|
||||
GRPC *string `json:"grpc,omitempty" hcl:"grpc" mapstructure:"grpc"`
|
||||
TLS *bool `json:"tls,omitempty" hcl:"tls" mapstructure:"tls"`
|
||||
GRPCUseTLS *bool `json:"grpc_use_tls,omitempty" hcl:"grpc_use_tls" mapstructure:"grpc_use_tls"`
|
||||
TLSSkipVerify *bool `json:"tls_skip_verify,omitempty" hcl:"tls_skip_verify" mapstructure:"tls_skip_verify"`
|
||||
Timeout *string `json:"timeout,omitempty" hcl:"timeout" mapstructure:"timeout"`
|
||||
TTL *string `json:"ttl,omitempty" hcl:"ttl" mapstructure:"ttl"`
|
||||
|
|
|
@ -1868,14 +1868,14 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
|
|||
`-data-dir=` + dataDir,
|
||||
},
|
||||
json: []string{
|
||||
`{ "check": { "name": "a", "grpc": "localhost:12345/foo" } }`,
|
||||
`{ "check": { "name": "a", "grpc": "localhost:12345/foo", "grpc_use_tls": true } }`,
|
||||
},
|
||||
hcl: []string{
|
||||
`check = { name = "a" grpc = "localhost:12345/foo" }`,
|
||||
`check = { name = "a" grpc = "localhost:12345/foo", grpc_use_tls = true }`,
|
||||
},
|
||||
patch: func(rt *RuntimeConfig) {
|
||||
rt.Checks = []*structs.CheckDefinition{
|
||||
&structs.CheckDefinition{Name: "a", GRPC: "localhost:12345/foo"},
|
||||
&structs.CheckDefinition{Name: "a", GRPC: "localhost:12345/foo", GRPCUseTLS: true},
|
||||
}
|
||||
rt.DataDir = dataDir
|
||||
},
|
||||
|
@ -3906,6 +3906,7 @@ func TestSanitize(t *testing.T) {
|
|||
"DeregisterCriticalServiceAfter": "0s",
|
||||
"DockerContainerID": "",
|
||||
"GRPC": "",
|
||||
"GRPCUseTLS": false,
|
||||
"HTTP": "",
|
||||
"Header": {},
|
||||
"ID": "",
|
||||
|
@ -3919,7 +3920,6 @@ func TestSanitize(t *testing.T) {
|
|||
"Shell": "",
|
||||
"Status": "",
|
||||
"TCP": "",
|
||||
"TLS": false,
|
||||
"TLSSkipVerify": false,
|
||||
"TTL": "0s",
|
||||
"Timeout": "0s",
|
||||
|
@ -4037,6 +4037,7 @@ func TestSanitize(t *testing.T) {
|
|||
"DeregisterCriticalServiceAfter": "0s",
|
||||
"DockerContainerID": "",
|
||||
"GRPC": "",
|
||||
"GRPCUseTLS": false,
|
||||
"HTTP": "",
|
||||
"Header": {},
|
||||
"Interval": "0s",
|
||||
|
@ -4048,7 +4049,6 @@ func TestSanitize(t *testing.T) {
|
|||
"Shell": "",
|
||||
"Status": "",
|
||||
"TCP": "",
|
||||
"TLS": false,
|
||||
"TLSSkipVerify": false,
|
||||
"TTL": "0s",
|
||||
"Timeout": "0s"
|
||||
|
|
|
@ -31,7 +31,7 @@ type CheckDefinition struct {
|
|||
DockerContainerID string
|
||||
Shell string
|
||||
GRPC string
|
||||
TLS bool
|
||||
GRPCUseTLS bool
|
||||
TLSSkipVerify bool
|
||||
Timeout time.Duration
|
||||
TTL time.Duration
|
||||
|
@ -67,13 +67,13 @@ func (c *CheckDefinition) CheckType() *CheckType {
|
|||
ScriptArgs: c.ScriptArgs,
|
||||
HTTP: c.HTTP,
|
||||
GRPC: c.GRPC,
|
||||
GRPCUseTLS: c.GRPCUseTLS,
|
||||
Header: c.Header,
|
||||
Method: c.Method,
|
||||
TCP: c.TCP,
|
||||
Interval: c.Interval,
|
||||
DockerContainerID: c.DockerContainerID,
|
||||
Shell: c.Shell,
|
||||
TLS: c.TLS,
|
||||
TLSSkipVerify: c.TLSSkipVerify,
|
||||
Timeout: c.Timeout,
|
||||
TTL: c.TTL,
|
||||
|
|
|
@ -35,7 +35,7 @@ type CheckType struct {
|
|||
DockerContainerID string
|
||||
Shell string
|
||||
GRPC string
|
||||
TLS bool
|
||||
GRPCUseTLS bool
|
||||
TLSSkipVerify bool
|
||||
Timeout time.Duration
|
||||
TTL time.Duration
|
||||
|
|
Loading…
Reference in New Issue