Changes "TLS" to "GRPCUseTLS" since it only applies to GRPC checks.

This commit is contained in:
James Phillips 2018-02-02 17:29:34 -08:00
parent 38f5b2e7ce
commit 1a08e8c0f1
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
6 changed files with 11 additions and 11 deletions

View File

@ -1766,7 +1766,7 @@ func (a *Agent) AddCheck(check *structs.HealthCheck, chkType *structs.CheckType,
} }
var tlsClientConfig *tls.Config var tlsClientConfig *tls.Config
if chkType.TLS { if chkType.GRPCUseTLS {
var err error var err error
tlsClientConfig, err = a.setupTLSClientConfig(chkType.TLSSkipVerify) tlsClientConfig, err = a.setupTLSClientConfig(chkType.TLSSkipVerify)
if err != nil { if err != nil {

View File

@ -946,7 +946,7 @@ func (b *Builder) checkVal(v *CheckDefinition) *structs.CheckDefinition {
DockerContainerID: b.stringVal(v.DockerContainerID), DockerContainerID: b.stringVal(v.DockerContainerID),
Shell: b.stringVal(v.Shell), Shell: b.stringVal(v.Shell),
GRPC: b.stringVal(v.GRPC), GRPC: b.stringVal(v.GRPC),
TLS: b.boolVal(v.TLS), GRPCUseTLS: b.boolVal(v.GRPCUseTLS),
TLSSkipVerify: b.boolVal(v.TLSSkipVerify), TLSSkipVerify: b.boolVal(v.TLSSkipVerify),
Timeout: b.durationVal(fmt.Sprintf("check[%s].timeout", id), v.Timeout), Timeout: b.durationVal(fmt.Sprintf("check[%s].timeout", id), v.Timeout),
TTL: b.durationVal(fmt.Sprintf("check[%s].ttl", id), v.TTL), TTL: b.durationVal(fmt.Sprintf("check[%s].ttl", id), v.TTL),

View File

@ -342,7 +342,7 @@ type CheckDefinition struct {
DockerContainerID *string `json:"docker_container_id,omitempty" hcl:"docker_container_id" mapstructure:"docker_container_id"` DockerContainerID *string `json:"docker_container_id,omitempty" hcl:"docker_container_id" mapstructure:"docker_container_id"`
Shell *string `json:"shell,omitempty" hcl:"shell" mapstructure:"shell"` Shell *string `json:"shell,omitempty" hcl:"shell" mapstructure:"shell"`
GRPC *string `json:"grpc,omitempty" hcl:"grpc" mapstructure:"grpc"` 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"` TLSSkipVerify *bool `json:"tls_skip_verify,omitempty" hcl:"tls_skip_verify" mapstructure:"tls_skip_verify"`
Timeout *string `json:"timeout,omitempty" hcl:"timeout" mapstructure:"timeout"` Timeout *string `json:"timeout,omitempty" hcl:"timeout" mapstructure:"timeout"`
TTL *string `json:"ttl,omitempty" hcl:"ttl" mapstructure:"ttl"` TTL *string `json:"ttl,omitempty" hcl:"ttl" mapstructure:"ttl"`

View File

@ -1868,14 +1868,14 @@ func TestConfigFlagsAndEdgecases(t *testing.T) {
`-data-dir=` + dataDir, `-data-dir=` + dataDir,
}, },
json: []string{ json: []string{
`{ "check": { "name": "a", "grpc": "localhost:12345/foo" } }`, `{ "check": { "name": "a", "grpc": "localhost:12345/foo", "grpc_use_tls": true } }`,
}, },
hcl: []string{ hcl: []string{
`check = { name = "a" grpc = "localhost:12345/foo" }`, `check = { name = "a" grpc = "localhost:12345/foo", grpc_use_tls = true }`,
}, },
patch: func(rt *RuntimeConfig) { patch: func(rt *RuntimeConfig) {
rt.Checks = []*structs.CheckDefinition{ 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 rt.DataDir = dataDir
}, },
@ -3906,6 +3906,7 @@ func TestSanitize(t *testing.T) {
"DeregisterCriticalServiceAfter": "0s", "DeregisterCriticalServiceAfter": "0s",
"DockerContainerID": "", "DockerContainerID": "",
"GRPC": "", "GRPC": "",
"GRPCUseTLS": false,
"HTTP": "", "HTTP": "",
"Header": {}, "Header": {},
"ID": "", "ID": "",
@ -3919,7 +3920,6 @@ func TestSanitize(t *testing.T) {
"Shell": "", "Shell": "",
"Status": "", "Status": "",
"TCP": "", "TCP": "",
"TLS": false,
"TLSSkipVerify": false, "TLSSkipVerify": false,
"TTL": "0s", "TTL": "0s",
"Timeout": "0s", "Timeout": "0s",
@ -4037,6 +4037,7 @@ func TestSanitize(t *testing.T) {
"DeregisterCriticalServiceAfter": "0s", "DeregisterCriticalServiceAfter": "0s",
"DockerContainerID": "", "DockerContainerID": "",
"GRPC": "", "GRPC": "",
"GRPCUseTLS": false,
"HTTP": "", "HTTP": "",
"Header": {}, "Header": {},
"Interval": "0s", "Interval": "0s",
@ -4048,7 +4049,6 @@ func TestSanitize(t *testing.T) {
"Shell": "", "Shell": "",
"Status": "", "Status": "",
"TCP": "", "TCP": "",
"TLS": false,
"TLSSkipVerify": false, "TLSSkipVerify": false,
"TTL": "0s", "TTL": "0s",
"Timeout": "0s" "Timeout": "0s"

View File

@ -31,7 +31,7 @@ type CheckDefinition struct {
DockerContainerID string DockerContainerID string
Shell string Shell string
GRPC string GRPC string
TLS bool GRPCUseTLS bool
TLSSkipVerify bool TLSSkipVerify bool
Timeout time.Duration Timeout time.Duration
TTL time.Duration TTL time.Duration
@ -67,13 +67,13 @@ func (c *CheckDefinition) CheckType() *CheckType {
ScriptArgs: c.ScriptArgs, ScriptArgs: c.ScriptArgs,
HTTP: c.HTTP, HTTP: c.HTTP,
GRPC: c.GRPC, GRPC: c.GRPC,
GRPCUseTLS: c.GRPCUseTLS,
Header: c.Header, Header: c.Header,
Method: c.Method, Method: c.Method,
TCP: c.TCP, TCP: c.TCP,
Interval: c.Interval, Interval: c.Interval,
DockerContainerID: c.DockerContainerID, DockerContainerID: c.DockerContainerID,
Shell: c.Shell, Shell: c.Shell,
TLS: c.TLS,
TLSSkipVerify: c.TLSSkipVerify, TLSSkipVerify: c.TLSSkipVerify,
Timeout: c.Timeout, Timeout: c.Timeout,
TTL: c.TTL, TTL: c.TTL,

View File

@ -35,7 +35,7 @@ type CheckType struct {
DockerContainerID string DockerContainerID string
Shell string Shell string
GRPC string GRPC string
TLS bool GRPCUseTLS bool
TLSSkipVerify bool TLSSkipVerify bool
Timeout time.Duration Timeout time.Duration
TTL time.Duration TTL time.Duration