From 3c9f5a73d9b9513527611e397bc54b1d6d7e9bd3 Mon Sep 17 00:00:00 2001 From: tarat44 <32471142+tarat44@users.noreply.github.com> Date: Sun, 25 Jul 2021 16:08:44 -0400 Subject: [PATCH 01/12] add support for h2c in h2 ping health checks --- .changelog/10690.txt | 3 + agent/agent.go | 8 +- agent/agent_test.go | 26 ++ agent/checks/check.go | 22 +- agent/checks/check_test.go | 59 ++++ agent/config/builder.go | 1 + agent/config/config.go | 1 + agent/config/runtime_test.go | 8 + .../TestRuntimeConfig_Sanitize.golden | 2 + agent/config/testdata/full-config.hcl | 8 + agent/config/testdata/full-config.json | 8 + agent/http_decode_test.go | 59 ++++ agent/structs/check_definition.go | 6 + agent/structs/check_type.go | 5 + agent/structs/structs.go | 2 + api/agent.go | 2 + proto/pbservice/healthcheck.gen.go | 4 + proto/pbservice/healthcheck.pb.go | 297 ++++++++++++------ proto/pbservice/healthcheck.proto | 2 + proto/pbservice/service.pb.go | 116 +++++-- website/content/api-docs/agent/check.mdx | 5 +- website/content/docs/discovery/checks.mdx | 8 +- 22 files changed, 516 insertions(+), 136 deletions(-) create mode 100644 .changelog/10690.txt diff --git a/.changelog/10690.txt b/.changelog/10690.txt new file mode 100644 index 0000000000..47cfd6bdfe --- /dev/null +++ b/.changelog/10690.txt @@ -0,0 +1,3 @@ +```release-note:feature +health-checks: add support for h2c in http2 ping health checks +``` diff --git a/agent/agent.go b/agent/agent.go index e5385abbce..17dfd83de2 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -2706,9 +2706,11 @@ func (a *Agent) addCheck(check *structs.HealthCheck, chkType *structs.CheckType, ) chkType.Interval = checks.MinInterval } - - tlsClientConfig := a.tlsConfigurator.OutgoingTLSConfigForCheck(chkType.TLSSkipVerify, chkType.TLSServerName) - tlsClientConfig.NextProtos = []string{http2.NextProtoTLS} + var tlsClientConfig *tls.Config + if !chkType.H2PINGDisableTLS { + tlsClientConfig = a.tlsConfigurator.OutgoingTLSConfigForCheck(chkType.TLSSkipVerify, chkType.TLSServerName) + tlsClientConfig.NextProtos = []string{http2.NextProtoTLS} + } h2ping := &checks.CheckH2PING{ CheckID: cid, diff --git a/agent/agent_test.go b/agent/agent_test.go index 6638fa35cf..07eb94166a 100644 --- a/agent/agent_test.go +++ b/agent/agent_test.go @@ -855,6 +855,32 @@ func TestAgent_AddServiceWithH2PINGCheck(t *testing.T) { requireCheckExists(t, a, "test-h2ping-check") } +func TestAgent_AddServiceWithH2CPINGCheck(t *testing.T) { + t.Parallel() + a := NewTestAgent(t, "") + defer a.Shutdown() + check := []*structs.CheckType{ + { + CheckID: "test-h2cping-check", + Name: "test-h2cping-check", + H2PING: "localhost:12345", + TLSSkipVerify: true, + Interval: 10 * time.Second, + H2PINGDisableTLS: true, + }, + } + + nodeService := &structs.NodeService{ + ID: "test-h2cping-check-service", + Service: "test-h2cping-check-service", + } + err := a.addServiceFromSource(nodeService, check, false, "", ConfigSourceLocal) + if err != nil { + t.Fatalf("Error registering service: %v", err) + } + requireCheckExists(t, a, "test-h2cping-check") +} + func TestAgent_AddServiceNoExec(t *testing.T) { if testing.Short() { t.Skip("too slow for testing.Short") diff --git a/agent/checks/check.go b/agent/checks/check.go index 687de9e51a..5bc00bc186 100644 --- a/agent/checks/check.go +++ b/agent/checks/check.go @@ -535,11 +535,25 @@ func shutdownHTTP2ClientConn(clientConn *http2.ClientConn, timeout time.Duration } func (c *CheckH2PING) check() { - t := &http2.Transport{ - TLSClientConfig: c.TLSClientConfig, + t := &http2.Transport{} + var dialFunc func(ctx context.Context, network, address string, tlscfg *tls.Config) (net.Conn, error) + if c.TLSClientConfig != nil { + t.TLSClientConfig = c.TLSClientConfig + dialFunc = func(ctx context.Context, network, address string, tlscfg *tls.Config) (net.Conn, error) { + dialer := &tls.Dialer{Config: tlscfg} + return dialer.DialContext(ctx, network, address) + } + } else { + t.AllowHTTP = true + dialFunc = func(ctx context.Context, network, address string, tlscfg *tls.Config) (net.Conn, error) { + dialer := &net.Dialer{} + return dialer.DialContext(ctx, network, address) + } } target := c.H2PING - conn, err := tls.Dial("tcp", target, c.TLSClientConfig) + ctx, cancel := context.WithTimeout(context.Background(), c.Timeout) + defer cancel() + conn, err := dialFunc(ctx, "tcp", target, c.TLSClientConfig) if err != nil { message := fmt.Sprintf("Failed to dial to %s: %s", target, err) c.StatusHandler.updateCheck(c.CheckID, api.HealthCritical, message) @@ -553,8 +567,6 @@ func (c *CheckH2PING) check() { return } defer shutdownHTTP2ClientConn(clientConn, c.Timeout, c.CheckID.String(), c.Logger) - ctx, cancel := context.WithTimeout(context.Background(), c.Timeout) - defer cancel() err = clientConn.Ping(ctx) if err == nil { c.StatusHandler.updateCheck(c.CheckID, api.HealthPassing, "HTTP2 ping was successful") diff --git a/agent/checks/check_test.go b/agent/checks/check_test.go index af97d02389..b3cf312bc7 100644 --- a/agent/checks/check_test.go +++ b/agent/checks/check_test.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/go-uuid" "github.com/stretchr/testify/require" http2 "golang.org/x/net/http2" + "golang.org/x/net/http2/h2c" ) func uniqueID() string { @@ -1256,6 +1257,64 @@ func TestCheckH2PINGInvalidListener(t *testing.T) { }) } +func TestCheckH2CPING(t *testing.T) { + t.Parallel() + + tests := []struct { + desc string + passing bool + timeout time.Duration + connTimeout time.Duration + }{ + {desc: "passing", passing: true, timeout: 1 * time.Second, connTimeout: 1 * time.Second}, + {desc: "failing because of time out", passing: false, timeout: 1 * time.Nanosecond, connTimeout: 1 * time.Second}, + {desc: "failing because of closed connection", passing: false, timeout: 1 * time.Nanosecond, connTimeout: 1 * time.Millisecond}, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return }) + h2chandler := h2c.NewHandler(handler, &http2.Server{}) + server := httptest.NewUnstartedServer(h2chandler) + server.Config.ReadTimeout = tt.connTimeout + server.Start() + defer server.Close() + serverAddress := server.Listener.Addr() + target := serverAddress.String() + + notif := mock.NewNotify() + logger := testutil.Logger(t) + statusHandler := NewStatusHandler(notif, logger, 0, 0) + cid := structs.NewCheckID("foo", nil) + check := &CheckH2PING{ + CheckID: cid, + H2PING: target, + Interval: 5 * time.Second, + Timeout: tt.timeout, + Logger: logger, + TLSClientConfig: nil, + StatusHandler: statusHandler, + } + + check.Start() + defer check.Stop() + if tt.passing { + retry.Run(t, func(r *retry.R) { + if got, want := notif.State(cid), api.HealthPassing; got != want { + r.Fatalf("got state %q want %q", got, want) + } + }) + } else { + retry.Run(t, func(r *retry.R) { + if got, want := notif.State(cid), api.HealthCritical; got != want { + r.Fatalf("got state %q want %q", got, want) + } + }) + } + }) + } +} + func TestCheck_Docker(t *testing.T) { if testing.Short() { t.Skip("too slow for testing.Short") diff --git a/agent/config/builder.go b/agent/config/builder.go index ecbb379755..4558cdffe8 100644 --- a/agent/config/builder.go +++ b/agent/config/builder.go @@ -1571,6 +1571,7 @@ func (b *builder) checkVal(v *CheckDefinition) *structs.CheckDefinition { FailuresBeforeCritical: intVal(v.FailuresBeforeCritical), FailuresBeforeWarning: intValWithDefault(v.FailuresBeforeWarning, intVal(v.FailuresBeforeCritical)), H2PING: stringVal(v.H2PING), + H2PINGDisableTLS: boolVal(v.H2PINGDisableTLS), DeregisterCriticalServiceAfter: b.durationVal(fmt.Sprintf("check[%s].deregister_critical_service_after", id), v.DeregisterCriticalServiceAfter), OutputMaxSize: intValWithDefault(v.OutputMaxSize, checks.DefaultBufSize), EnterpriseMeta: v.EnterpriseMeta.ToStructs(), diff --git a/agent/config/config.go b/agent/config/config.go index 7a85b6747e..9e255a6c33 100644 --- a/agent/config/config.go +++ b/agent/config/config.go @@ -419,6 +419,7 @@ type CheckDefinition struct { Timeout *string `mapstructure:"timeout"` TTL *string `mapstructure:"ttl"` H2PING *string `mapstructure:"h2ping"` + H2PINGDisableTLS *bool `mapstructure:"h2ping_disable_tls"` SuccessBeforePassing *int `mapstructure:"success_before_passing"` FailuresBeforeWarning *int `mapstructure:"failures_before_warning"` FailuresBeforeCritical *int `mapstructure:"failures_before_critical"` diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go index cf3ad45512..022b64b37e 100644 --- a/agent/config/runtime_test.go +++ b/agent/config/runtime_test.go @@ -5307,6 +5307,7 @@ func TestLoad_FullConfig(t *testing.T) { Body: "wSjTy7dg", TCP: "RJQND605", H2PING: "9N1cSb5B", + H2PINGDisableTLS: true, Interval: 22164 * time.Second, OutputMaxSize: checks.DefaultBufSize, DockerContainerID: "ipgdFtjd", @@ -5334,6 +5335,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "4jG5casb", H2PING: "HCHU7gEb", + H2PINGDisableTLS: true, Interval: 28767 * time.Second, DockerContainerID: "THW6u7rL", Shell: "C1Zt3Zwh", @@ -5360,6 +5362,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "JY6fTTcw", H2PING: "rQ8eyCSF", + H2PINGDisableTLS: true, Interval: 18714 * time.Second, DockerContainerID: "qF66POS9", Shell: "sOnDy228", @@ -5565,6 +5568,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "ICbxkpSF", H2PING: "7s7BbMyb", + H2PINGDisableTLS: true, Interval: 24392 * time.Second, DockerContainerID: "ZKXr68Yb", Shell: "CEfzx0Fo", @@ -5616,6 +5620,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "MN3oA9D2", H2PING: "OV6Q2XEg", + H2PINGDisableTLS: true, Interval: 32718 * time.Second, DockerContainerID: "cU15LMet", Shell: "nEz9qz2l", @@ -5759,6 +5764,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "bNnNfx2A", H2PING: "qC1pidiW", + H2PINGDisableTLS: true, Interval: 22224 * time.Second, DockerContainerID: "ipgdFtjd", Shell: "omVZq7Sz", @@ -5783,6 +5789,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "FfvCwlqH", H2PING: "spI3muI3", + H2PINGDisableTLS: true, Interval: 12356 * time.Second, DockerContainerID: "HBndBU6R", Shell: "hVI33JjA", @@ -5807,6 +5814,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "fjiLFqVd", H2PING: "5NbNWhan", + H2PINGDisableTLS: true, Interval: 23926 * time.Second, DockerContainerID: "dO5TtRHk", Shell: "e6q2ttES", diff --git a/agent/config/testdata/TestRuntimeConfig_Sanitize.golden b/agent/config/testdata/TestRuntimeConfig_Sanitize.golden index d69bf7f3d5..3a79b0aefc 100644 --- a/agent/config/testdata/TestRuntimeConfig_Sanitize.golden +++ b/agent/config/testdata/TestRuntimeConfig_Sanitize.golden @@ -99,6 +99,7 @@ "GRPC": "", "GRPCUseTLS": false, "H2PING": "", + "H2PINGDisableTLS": false, "HTTP": "", "Header": {}, "ID": "", @@ -303,6 +304,7 @@ "GRPC": "", "GRPCUseTLS": false, "H2PING": "", + "H2PINGDisableTLS": false, "HTTP": "", "Header": {}, "Interval": "0s", diff --git a/agent/config/testdata/full-config.hcl b/agent/config/testdata/full-config.hcl index 1c840d192d..23dac8c9fa 100644 --- a/agent/config/testdata/full-config.hcl +++ b/agent/config/testdata/full-config.hcl @@ -110,6 +110,7 @@ check = { body = "5PBQd2OT" tcp = "JY6fTTcw" h2ping = "rQ8eyCSF" + h2ping_disable_tls = true interval = "18714s" output_max_size = 4096 docker_container_id = "qF66POS9" @@ -137,6 +138,7 @@ checks = [ body = "wSjTy7dg" tcp = "RJQND605" h2ping = "9N1cSb5B" + h2ping_disable_tls = true interval = "22164s" output_max_size = 4096 docker_container_id = "ipgdFtjd" @@ -163,6 +165,7 @@ checks = [ body = "0jkKgGUC" tcp = "4jG5casb" h2ping = "HCHU7gEb" + h2ping_disable_tls = true interval = "28767s" output_max_size = 4096 docker_container_id = "THW6u7rL" @@ -380,6 +383,7 @@ service = { body = "wVVL2V6f" tcp = "fjiLFqVd" h2ping = "5NbNWhan" + h2ping_disable_tls = true interval = "23926s" docker_container_id = "dO5TtRHk" shell = "e6q2ttES" @@ -404,6 +408,7 @@ service = { body = "OwGjTFQi" tcp = "bNnNfx2A" h2ping = "qC1pidiW" + h2ping_disable_tls = true interval = "22224s" output_max_size = 4096 docker_container_id = "ipgdFtjd" @@ -428,6 +433,7 @@ service = { body = "lUVLGYU7" tcp = "FfvCwlqH" h2ping = "spI3muI3" + h2ping_disable_tls = true interval = "12356s" output_max_size = 4096 docker_container_id = "HBndBU6R" @@ -466,6 +472,7 @@ services = [ body = "WeikigLh" tcp = "ICbxkpSF" h2ping = "7s7BbMyb" + h2ping_disable_tls = true interval = "24392s" output_max_size = 4096 docker_container_id = "ZKXr68Yb" @@ -507,6 +514,7 @@ services = [ body = "7CRjCJyz" tcp = "MN3oA9D2" h2ping = "OV6Q2XEg" + h2ping_disable_tls = true interval = "32718s" output_max_size = 4096 docker_container_id = "cU15LMet" diff --git a/agent/config/testdata/full-config.json b/agent/config/testdata/full-config.json index 7e28cc0c4f..4ac262eddd 100644 --- a/agent/config/testdata/full-config.json +++ b/agent/config/testdata/full-config.json @@ -112,6 +112,7 @@ "output_max_size": 4096, "tcp": "JY6fTTcw", "h2ping": "rQ8eyCSF", + "h2ping_disable_tls": true, "interval": "18714s", "docker_container_id": "qF66POS9", "shell": "sOnDy228", @@ -138,6 +139,7 @@ "body": "wSjTy7dg", "tcp": "RJQND605", "h2ping": "9N1cSb5B", + "h2ping_disable_tls": true, "interval": "22164s", "output_max_size": 4096, "docker_container_id": "ipgdFtjd", @@ -164,6 +166,7 @@ "body": "0jkKgGUC", "tcp": "4jG5casb", "h2ping": "HCHU7gEb", + "h2ping_disable_tls": true, "interval": "28767s", "output_max_size": 4096, "docker_container_id": "THW6u7rL", @@ -376,6 +379,7 @@ "body": "wVVL2V6f", "tcp": "fjiLFqVd", "h2ping": "5NbNWhan", + "h2ping_disable_tls": true, "interval": "23926s", "output_max_size": 4096, "docker_container_id": "dO5TtRHk", @@ -401,6 +405,7 @@ "body": "OwGjTFQi", "tcp": "bNnNfx2A", "h2ping": "qC1pidiW", + "h2ping_disable_tls": true, "interval": "22224s", "output_max_size": 4096, "docker_container_id": "ipgdFtjd", @@ -425,6 +430,7 @@ "body": "lUVLGYU7", "tcp": "FfvCwlqH", "h2ping": "spI3muI3", + "h2ping_disable_tls": true, "interval": "12356s", "output_max_size": 4096, "docker_container_id": "HBndBU6R", @@ -463,6 +469,7 @@ "body": "WeikigLh", "tcp": "ICbxkpSF", "h2ping": "7s7BbMyb", + "h2ping_disable_tls": true, "interval": "24392s", "output_max_size": 4096, "docker_container_id": "ZKXr68Yb", @@ -504,6 +511,7 @@ "body": "7CRjCJyz", "tcp": "MN3oA9D2", "h2ping": "OV6Q2XEg", + "h2ping_disable_tls": true, "interval": "32718s", "output_max_size": 4096, "docker_container_id": "cU15LMet", diff --git a/agent/http_decode_test.go b/agent/http_decode_test.go index 4b546f630e..3023baf3fc 100644 --- a/agent/http_decode_test.go +++ b/agent/http_decode_test.go @@ -285,6 +285,7 @@ var translateCheckTypeTCs = [][]translateKeyTestCase{ translateDockerTCs, translateGRPCUseTLSTCs, translateTLSServerNameTCs, + translateH2PINGDisableTLS, translateTLSSkipVerifyTCs, translateServiceIDTCs, } @@ -677,6 +678,62 @@ var translateGRPCUseTLSTCs = []translateKeyTestCase{ }, } +func h2pingDisableTLSEqFn(out interface{}, want interface{}) error { + var got interface{} + switch v := out.(type) { + case structs.CheckDefinition: + got = v.H2PINGDisableTLS + case *structs.CheckDefinition: + got = v.H2PINGDisableTLS + case structs.CheckType: + got = v.H2PINGDisableTLS + case *structs.CheckType: + got = v.H2PINGDisableTLS + case structs.HealthCheckDefinition: + got = v.H2PINGDisableTLS + case *structs.HealthCheckDefinition: + got = v.H2PINGDisableTLS + default: + panic(fmt.Sprintf("unexpected type %T", out)) + } + if got != want { + return fmt.Errorf("expected H2PINGDisableTLS to be %v, got %v", want, got) + } + return nil +} + +var h2pingDisableTLSFields = []string{`"H2PINGDisableTLS": %s`, `"h2ping_disable_tls": %s`} +var translateH2PINGDisableTLS = []translateKeyTestCase{ + { + desc: "H2PINGDisableTLS: both set", + in: []interface{}{"true", "false"}, + want: true, + jsonFmtStr: "{" + strings.Join(h2pingDisableTLSFields, ",") + "}", + equalityFn: h2pingDisableTLSEqFn, + }, + { + desc: "H2PINGDisableTLS:: first set", + in: []interface{}{`true`}, + want: true, + jsonFmtStr: "{" + h2pingDisableTLSFields[0] + "}", + equalityFn: h2pingDisableTLSEqFn, + }, + { + desc: "H2PINGDisableTLS: second set", + in: []interface{}{`true`}, + want: true, + jsonFmtStr: "{" + h2pingDisableTLSFields[1] + "}", + equalityFn: h2pingDisableTLSEqFn, + }, + { + desc: "H2PINGDisableTLS: neither set", + in: []interface{}{}, + want: false, // zero value + jsonFmtStr: "{}", + equalityFn: h2pingDisableTLSEqFn, + }, +} + // ServiceID: string func serviceIDEqFn(out interface{}, want interface{}) error { var got interface{} @@ -935,6 +992,8 @@ func TestDecodeACLRoleWrite(t *testing.T) { // Shell string // GRPC string // GRPCUseTLS bool +// H2PING string +// H2PINGDisableTLS bool // TLSServerName string // TLSSkipVerify bool // AliasNode string diff --git a/agent/structs/check_definition.go b/agent/structs/check_definition.go index 5ac0d60444..a0c3575198 100644 --- a/agent/structs/check_definition.go +++ b/agent/structs/check_definition.go @@ -25,6 +25,7 @@ type CheckDefinition struct { ScriptArgs []string HTTP string H2PING string + H2PINGDisableTLS bool Header map[string][]string Method string Body string @@ -69,6 +70,7 @@ func (t *CheckDefinition) UnmarshalJSON(data []byte) (err error) { TLSSkipVerifySnake bool `json:"tls_skip_verify"` GRPCUseTLSSnake bool `json:"grpc_use_tls"` ServiceIDSnake string `json:"service_id"` + H2PINGDisableTLSSnake bool `json:"h2ping_disable_tls"` *Alias }{ @@ -100,6 +102,9 @@ func (t *CheckDefinition) UnmarshalJSON(data []byte) (err error) { if aux.GRPCUseTLSSnake { t.GRPCUseTLS = aux.GRPCUseTLSSnake } + if aux.H2PINGDisableTLSSnake { + t.H2PINGDisableTLS = aux.H2PINGDisableTLSSnake + } if t.ServiceID == "" { t.ServiceID = aux.ServiceIDSnake } @@ -182,6 +187,7 @@ func (c *CheckDefinition) CheckType() *CheckType { AliasService: c.AliasService, HTTP: c.HTTP, H2PING: c.H2PING, + H2PINGDisableTLS: c.H2PINGDisableTLS, GRPC: c.GRPC, GRPCUseTLS: c.GRPCUseTLS, Header: c.Header, diff --git a/agent/structs/check_type.go b/agent/structs/check_type.go index 50c9714b39..2bb446e49e 100644 --- a/agent/structs/check_type.go +++ b/agent/structs/check_type.go @@ -33,6 +33,7 @@ type CheckType struct { ScriptArgs []string HTTP string H2PING string + H2PINGDisableTLS bool Header map[string][]string Method string Body string @@ -81,6 +82,7 @@ func (t *CheckType) UnmarshalJSON(data []byte) (err error) { TLSServerNameSnake string `json:"tls_server_name"` TLSSkipVerifySnake bool `json:"tls_skip_verify"` GRPCUseTLSSnake bool `json:"grpc_use_tls"` + H2PINGDisableTLSSnake bool `json:"h2ping_disable_tls"` // These are going to be ignored but since we are disallowing unknown fields // during parsing we have to be explicit about parsing but not using these. @@ -115,6 +117,9 @@ func (t *CheckType) UnmarshalJSON(data []byte) (err error) { if aux.GRPCUseTLSSnake { t.GRPCUseTLS = aux.GRPCUseTLSSnake } + if aux.H2PINGDisableTLSSnake { + t.H2PINGDisableTLS = aux.H2PINGDisableTLSSnake + } if aux.Interval != nil { switch v := aux.Interval.(type) { diff --git a/agent/structs/structs.go b/agent/structs/structs.go index 83ae63e798..18c3bc3ca8 100644 --- a/agent/structs/structs.go +++ b/agent/structs/structs.go @@ -1544,6 +1544,7 @@ type HealthCheckDefinition struct { Body string `json:",omitempty"` TCP string `json:",omitempty"` H2PING string `json:",omitempty"` + H2PINGDisableTLS bool `json:",omitempty"` Interval time.Duration `json:",omitempty"` OutputMaxSize uint `json:",omitempty"` Timeout time.Duration `json:",omitempty"` @@ -1691,6 +1692,7 @@ func (c *HealthCheck) CheckType() *CheckType { Body: c.Definition.Body, TCP: c.Definition.TCP, H2PING: c.Definition.H2PING, + H2PINGDisableTLS: c.Definition.H2PINGDisableTLS, Interval: c.Definition.Interval, DockerContainerID: c.Definition.DockerContainerID, Shell: c.Definition.Shell, diff --git a/api/agent.go b/api/agent.go index feac04e7e7..f9f9667439 100644 --- a/api/agent.go +++ b/api/agent.go @@ -327,6 +327,8 @@ type AgentServiceCheck struct { TLSSkipVerify bool `json:",omitempty"` GRPC string `json:",omitempty"` GRPCUseTLS bool `json:",omitempty"` + H2PING string `json:",omitempty"` + H2PINGDisableTLS bool `json:",omitempty"` AliasNode string `json:",omitempty"` AliasService string `json:",omitempty"` SuccessBeforePassing int `json:",omitempty"` diff --git a/proto/pbservice/healthcheck.gen.go b/proto/pbservice/healthcheck.gen.go index d195c84d7c..74eb482f32 100644 --- a/proto/pbservice/healthcheck.gen.go +++ b/proto/pbservice/healthcheck.gen.go @@ -13,6 +13,7 @@ func CheckTypeToStructs(s CheckType) structs.CheckType { t.ScriptArgs = s.ScriptArgs t.HTTP = s.HTTP t.H2PING = s.H2PING + t.H2PINGDisableTLS = s.H2PINGDisableTLS t.Header = MapHeadersToStructs(s.Header) t.Method = s.Method t.Body = s.Body @@ -46,6 +47,7 @@ func NewCheckTypeFromStructs(t structs.CheckType) CheckType { s.ScriptArgs = t.ScriptArgs s.HTTP = t.HTTP s.H2PING = t.H2PING + s.H2PINGDisableTLS = t.H2PINGDisableTLS s.Header = NewMapHeadersFromStructs(t.Header) s.Method = t.Method s.Body = t.Body @@ -120,6 +122,7 @@ func HealthCheckDefinitionToStructs(s HealthCheckDefinition) structs.HealthCheck t.Body = s.Body t.TCP = s.TCP t.H2PING = s.H2PING + t.H2PINGDisableTLS = s.H2PINGDisableTLS t.Interval = s.Interval t.OutputMaxSize = uint(s.OutputMaxSize) t.Timeout = s.Timeout @@ -144,6 +147,7 @@ func NewHealthCheckDefinitionFromStructs(t structs.HealthCheckDefinition) Health s.Body = t.Body s.TCP = t.TCP s.H2PING = t.H2PING + s.H2PINGDisableTLS = t.H2PINGDisableTLS s.Interval = t.Interval s.OutputMaxSize = uint32(t.OutputMaxSize) s.Timeout = t.Timeout diff --git a/proto/pbservice/healthcheck.pb.go b/proto/pbservice/healthcheck.pb.go index f1e53fb4fa..2b5715d844 100644 --- a/proto/pbservice/healthcheck.pb.go +++ b/proto/pbservice/healthcheck.pb.go @@ -27,7 +27,7 @@ var _ = time.Kitchen // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // HealthCheck represents a single check on a given node // @@ -153,6 +153,7 @@ type HealthCheckDefinition struct { DockerContainerID string `protobuf:"bytes,11,opt,name=DockerContainerID,proto3" json:"DockerContainerID,omitempty"` Shell string `protobuf:"bytes,12,opt,name=Shell,proto3" json:"Shell,omitempty"` H2PING string `protobuf:"bytes,20,opt,name=H2PING,proto3" json:"H2PING,omitempty"` + H2PINGDisableTLS bool `protobuf:"varint,21,opt,name=H2PINGDisableTLS,proto3" json:"H2PINGDisableTLS,omitempty"` GRPC string `protobuf:"bytes,13,opt,name=GRPC,proto3" json:"GRPC,omitempty"` GRPCUseTLS bool `protobuf:"varint,14,opt,name=GRPCUseTLS,proto3" json:"GRPCUseTLS,omitempty"` AliasNode string `protobuf:"bytes,15,opt,name=AliasNode,proto3" json:"AliasNode,omitempty"` @@ -223,6 +224,7 @@ type CheckType struct { DockerContainerID string `protobuf:"bytes,12,opt,name=DockerContainerID,proto3" json:"DockerContainerID,omitempty"` Shell string `protobuf:"bytes,13,opt,name=Shell,proto3" json:"Shell,omitempty"` H2PING string `protobuf:"bytes,28,opt,name=H2PING,proto3" json:"H2PING,omitempty"` + H2PINGDisableTLS bool `protobuf:"varint,30,opt,name=H2PINGDisableTLS,proto3" json:"H2PINGDisableTLS,omitempty"` GRPC string `protobuf:"bytes,14,opt,name=GRPC,proto3" json:"GRPC,omitempty"` GRPCUseTLS bool `protobuf:"varint,15,opt,name=GRPCUseTLS,proto3" json:"GRPCUseTLS,omitempty"` TLSServerName string `protobuf:"bytes,27,opt,name=TLSServerName,proto3" json:"TLSServerName,omitempty"` @@ -291,75 +293,76 @@ func init() { func init() { proto.RegisterFile("proto/pbservice/healthcheck.proto", fileDescriptor_8a6f7448747c9fbe) } var fileDescriptor_8a6f7448747c9fbe = []byte{ - // 1076 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x5d, 0x4f, 0xe3, 0x46, - 0x14, 0x8d, 0x09, 0x24, 0xf1, 0x04, 0x58, 0x98, 0x05, 0x3a, 0xcb, 0x6e, 0x4d, 0x4a, 0xf7, 0x81, - 0xaa, 0x34, 0x91, 0xe8, 0x87, 0xda, 0x4a, 0x6d, 0x45, 0x08, 0x0b, 0xa9, 0x80, 0xa6, 0x4e, 0xba, - 0x95, 0xfa, 0x66, 0x9c, 0x49, 0x62, 0xe1, 0x78, 0xac, 0xf1, 0x18, 0x91, 0xfe, 0x8a, 0x7d, 0xdc, - 0x9f, 0xc4, 0x23, 0x8f, 0x95, 0x2a, 0xd1, 0x2e, 0xfc, 0x8b, 0x3e, 0x55, 0x73, 0xc7, 0x0e, 0xf6, - 0xc6, 0x5b, 0xd2, 0xd5, 0xee, 0x13, 0x73, 0xef, 0xb9, 0x77, 0xc6, 0x33, 0xf7, 0x9c, 0x13, 0xd0, - 0x47, 0x3e, 0x67, 0x82, 0xd5, 0xfc, 0xd3, 0x80, 0xf2, 0x73, 0xc7, 0xa6, 0xb5, 0x01, 0xb5, 0x5c, - 0x31, 0xb0, 0x07, 0xd4, 0x3e, 0xab, 0x02, 0x86, 0xf5, 0x31, 0xb8, 0x6e, 0xf4, 0x19, 0xeb, 0xbb, - 0xb4, 0x06, 0xc0, 0x69, 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35, 0x72, 0xbf, 0x7d, 0xfa, 0x5f, 0x16, 0xf7, 0xda, 0x3f, - 0xee, 0xa7, 0x05, 0x48, 0x7c, 0xfe, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8b, 0x36, 0xc6, 0x76, - 0xd2, 0x0b, 0x00, 0x00, + // 1100 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xdd, 0x4e, 0xe3, 0x46, + 0x14, 0x8e, 0x09, 0x49, 0xc8, 0x04, 0x58, 0x98, 0x05, 0x3a, 0xcb, 0x6e, 0x4d, 0x4a, 0xf7, 0x82, + 0xb6, 0x34, 0x91, 0xe8, 0x8f, 0xda, 0x4a, 0x6d, 0x45, 0x08, 0x0b, 0xa9, 0x80, 0xa6, 0x4e, 0xba, + 0x95, 0x7a, 0x67, 0x9c, 0x49, 0x32, 0xc2, 0xf1, 0x44, 0xe3, 0x31, 0x22, 0x7d, 0x87, 0x4a, 0xbd, + 0xdc, 0x87, 0xe9, 0x03, 0x70, 0xc9, 0x65, 0xa5, 0x4a, 0xb4, 0x85, 0xb7, 0xe8, 0x55, 0x35, 0x67, + 0xec, 0x60, 0x6f, 0xbc, 0x0d, 0x5d, 0x6d, 0xaf, 0x72, 0x7e, 0x67, 0x3c, 0xe7, 0x9c, 0xef, 0x3b, + 0x0a, 0x7a, 0x67, 0x28, 0xb8, 0xe4, 0xd5, 0xe1, 0xa9, 0x4f, 0xc5, 0x39, 0x73, 0x68, 0xb5, 0x4f, + 0x6d, 0x57, 0xf6, 0x9d, 0x3e, 0x75, 0xce, 0x2a, 0xe0, 0xc3, 0xc5, 0xb1, 0x73, 0xdd, 0xec, 0x71, + 0xde, 0x73, 0x69, 0x15, 0x1c, 0xa7, 0x41, 0xb7, 0xda, 0x09, 0x84, 0x2d, 0x19, 0xf7, 0x74, 0xe8, + 0xfa, 0xe3, 0xe8, 0x34, 0x87, 0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79, 0x71, 0x6b, 0x66, 0xae, 0x6e, 0xcd, 0xcc, 0x6f, 0xb7, 0x66, + 0xe6, 0xc7, 0x0f, 0xfe, 0x8d, 0x0e, 0x5f, 0xfa, 0x43, 0x70, 0x9a, 0x07, 0xc3, 0x47, 0xff, 0x04, + 0x00, 0x00, 0xff, 0xff, 0xb7, 0x54, 0xd1, 0x6f, 0x2a, 0x0c, 0x00, 0x00, } func (m *HealthCheck) Marshal() (dAtA []byte, err error) { @@ -560,6 +563,18 @@ func (m *HealthCheckDefinition) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.H2PINGDisableTLS { + i-- + if m.H2PINGDisableTLS { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa8 + } if len(m.H2PING) > 0 { i -= len(m.H2PING) copy(dAtA[i:], m.H2PING) @@ -760,6 +775,18 @@ func (m *CheckType) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.H2PINGDisableTLS { + i-- + if m.H2PINGDisableTLS { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xf0 + } if m.FailuresBeforeWarning != 0 { i = encodeVarintHealthcheck(dAtA, i, uint64(m.FailuresBeforeWarning)) i-- @@ -1191,6 +1218,9 @@ func (m *HealthCheckDefinition) Size() (n int) { if l > 0 { n += 2 + l + sovHealthcheck(uint64(l)) } + if m.H2PINGDisableTLS { + n += 3 + } return n } @@ -1309,6 +1339,9 @@ func (m *CheckType) Size() (n int) { if m.FailuresBeforeWarning != 0 { n += 2 + sovHealthcheck(uint64(m.FailuresBeforeWarning)) } + if m.H2PINGDisableTLS { + n += 3 + } return n } @@ -1855,7 +1888,10 @@ func (m *HealthCheck) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthHealthcheck + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthHealthcheck } if (iNdEx + skippy) > l { @@ -1937,7 +1973,10 @@ func (m *HeaderValue) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthHealthcheck + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthHealthcheck } if (iNdEx + skippy) > l { @@ -2151,7 +2190,7 @@ func (m *HealthCheckDefinition) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { return ErrInvalidLengthHealthcheck } if (iNdEx + skippy) > postIndex { @@ -2685,13 +2724,36 @@ func (m *HealthCheckDefinition) Unmarshal(dAtA []byte) error { } m.H2PING = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 21: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field H2PINGDisableTLS", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthcheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.H2PINGDisableTLS = bool(v != 0) default: iNdEx = preIndex skippy, err := skipHealthcheck(dAtA[iNdEx:]) if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthHealthcheck + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthHealthcheck } if (iNdEx + skippy) > l { @@ -3441,7 +3503,7 @@ func (m *CheckType) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { return ErrInvalidLengthHealthcheck } if (iNdEx + skippy) > postIndex { @@ -3688,13 +3750,36 @@ func (m *CheckType) Unmarshal(dAtA []byte) error { break } } + case 30: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field H2PINGDisableTLS", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthcheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.H2PINGDisableTLS = bool(v != 0) default: iNdEx = preIndex skippy, err := skipHealthcheck(dAtA[iNdEx:]) if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthHealthcheck + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthHealthcheck } if (iNdEx + skippy) > l { @@ -3712,7 +3797,6 @@ func (m *CheckType) Unmarshal(dAtA []byte) error { func skipHealthcheck(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 - depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -3744,8 +3828,10 @@ func skipHealthcheck(dAtA []byte) (n int, err error) { break } } + return iNdEx, nil case 1: iNdEx += 8 + return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -3766,30 +3852,55 @@ func skipHealthcheck(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthHealthcheck } iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupHealthcheck + if iNdEx < 0 { + return 0, ErrInvalidLengthHealthcheck } - depth-- + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHealthcheck + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipHealthcheck(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthHealthcheck + } + } + return iNdEx, nil + case 4: + return iNdEx, nil case 5: iNdEx += 4 + return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } - if iNdEx < 0 { - return 0, ErrInvalidLengthHealthcheck - } - if depth == 0 { - return iNdEx, nil - } } - return 0, io.ErrUnexpectedEOF + panic("unreachable") } var ( - ErrInvalidLengthHealthcheck = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowHealthcheck = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupHealthcheck = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthHealthcheck = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowHealthcheck = fmt.Errorf("proto: integer overflow") ) diff --git a/proto/pbservice/healthcheck.proto b/proto/pbservice/healthcheck.proto index 5bc893f4ae..503095bdd0 100644 --- a/proto/pbservice/healthcheck.proto +++ b/proto/pbservice/healthcheck.proto @@ -83,6 +83,7 @@ message HealthCheckDefinition { string DockerContainerID = 11; string Shell = 12; string H2PING = 20; + bool H2PINGDisableTLS = 21; string GRPC = 13; bool GRPCUseTLS = 14; string AliasNode = 15; @@ -124,6 +125,7 @@ message CheckType { string DockerContainerID = 12; string Shell = 13; string H2PING = 28; + bool H2PINGDisableTLS = 30; string GRPC = 14; bool GRPCUseTLS = 15; string TLSServerName = 27; diff --git a/proto/pbservice/service.pb.go b/proto/pbservice/service.pb.go index 9bd4b381ca..32784edc18 100644 --- a/proto/pbservice/service.pb.go +++ b/proto/pbservice/service.pb.go @@ -24,7 +24,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // ConnectProxyConfig describes the configuration needed for any proxy managed // or unmanaged. It describes a single logical service's listener and optionally @@ -2131,7 +2131,10 @@ func (m *ConnectProxyConfig) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -2545,7 +2548,10 @@ func (m *Upstream) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -2651,7 +2657,10 @@ func (m *ServiceConnect) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -2755,7 +2764,10 @@ func (m *ExposeConfig) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -2927,7 +2939,10 @@ func (m *ExposePath) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -3009,7 +3024,10 @@ func (m *MeshGatewayConfig) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -3098,7 +3116,10 @@ func (m *TransparentProxyConfig) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -3418,7 +3439,7 @@ func (m *ServiceDefinition) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > postIndex { @@ -3793,7 +3814,7 @@ func (m *ServiceDefinition) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > postIndex { @@ -3875,7 +3896,10 @@ func (m *ServiceDefinition) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -3976,7 +4000,10 @@ func (m *ServiceAddress) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -4064,7 +4091,10 @@ func (m *Weights) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -4082,7 +4112,6 @@ func (m *Weights) Unmarshal(dAtA []byte) error { func skipService(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 - depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -4114,8 +4143,10 @@ func skipService(dAtA []byte) (n int, err error) { break } } + return iNdEx, nil case 1: iNdEx += 8 + return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -4136,30 +4167,55 @@ func skipService(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthService } iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupService + if iNdEx < 0 { + return 0, ErrInvalidLengthService } - depth-- + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipService(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + } + return iNdEx, nil + case 4: + return iNdEx, nil case 5: iNdEx += 4 + return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - if depth == 0 { - return iNdEx, nil - } } - return 0, io.ErrUnexpectedEOF + panic("unreachable") } var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") ) diff --git a/website/content/api-docs/agent/check.mdx b/website/content/api-docs/agent/check.mdx index ba832ff76e..4c83c16a70 100644 --- a/website/content/api-docs/agent/check.mdx +++ b/website/content/api-docs/agent/check.mdx @@ -183,10 +183,11 @@ The table below shows this endpoint's support for If TLS is enabled, then by default, a valid TLS certificate is expected. Certificate verification can be turned off by setting `TLSSkipVerify` to `true`. -- `H2PING` `(string "")` - Specifies an address that uses http2 with TLS to run a ping check on. +- `H2PING` `(string "")` - Specifies an address that uses http2 to run a ping check on. At the specified `Interval`, a connection is made to the address, and a ping is sent. If the ping is successful, the check will be classified as `passing`, otherwise it will be marked as `critical`. - A valid SSL certificate is required by default, but verification can be removed with `TLSSkipVerify`. + TLS is used by default. To disable TLS and use h2c, set `H2PINGDisableTLS` to `true`. + If TLS is enabled, a valid SSL certificate is required by default, but verification can be removed with `TLSSkipVerify`. - `HTTP` `(string: "")` - Specifies an `HTTP` check to perform a `GET` request against the value of `HTTP` (expected to be a URL) every `Interval`. If the diff --git a/website/content/docs/discovery/checks.mdx b/website/content/docs/discovery/checks.mdx index 2a6ad28617..36dd92ab65 100644 --- a/website/content/docs/discovery/checks.mdx +++ b/website/content/docs/discovery/checks.mdx @@ -120,10 +120,11 @@ There are several different kinds of checks: `tls_skip_verify` field to `true` in the check definition. To check on a specific service instead of the whole gRPC server, add the service identifier after the `gRPC` check's endpoint in the following format `/:service_identifier`. -- `H2ping + Interval` - These checks test an endpoint that uses http2 with TLS - by connecting to the endpoint and sending a ping frame. If the ping is successful +- `H2ping + Interval` - These checks test an endpoint that uses http2 + by connecting to the endpoint and sending a ping frame. TLS is assumed to be configured by default. + To disable TLS and use h2c, set `h2ping_disable_tls` to `true`. If the ping is successful within a specified timeout, then the check is updated as passing. - The timeout defaults to 10 seconds, but is configurable using the `timeout` field. A valid + The timeout defaults to 10 seconds, but is configurable using the `timeout` field. If TLS is enabled a valid certificate is required, unless `tls_skip_verify` is set to `true`. The check will be run on the interval specified by the `interval` field. @@ -251,6 +252,7 @@ A h2ping check: "name": "h2ping", "h2ping": "localhost:22222", "interval": "10s", + "h2ping_disable_tls": false, } } ``` From 092626986bb3da146c38d068bfea777647ed50a4 Mon Sep 17 00:00:00 2001 From: tarat44 <32471142+tarat44@users.noreply.github.com> Date: Mon, 26 Jul 2021 01:21:23 -0400 Subject: [PATCH 02/12] remove trailing comma from example in docs --- website/content/docs/discovery/checks.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/content/docs/discovery/checks.mdx b/website/content/docs/discovery/checks.mdx index 36dd92ab65..314b4f610e 100644 --- a/website/content/docs/discovery/checks.mdx +++ b/website/content/docs/discovery/checks.mdx @@ -252,7 +252,7 @@ A h2ping check: "name": "h2ping", "h2ping": "localhost:22222", "interval": "10s", - "h2ping_disable_tls": false, + "h2ping_disable_tls": false } } ``` From c1ed3a9a94485a1802c04bf1a00e6b405d6641fa Mon Sep 17 00:00:00 2001 From: tarat44 <32471142+tarat44@users.noreply.github.com> Date: Mon, 4 Oct 2021 21:36:18 -0400 Subject: [PATCH 03/12] change config option to H2PingUseTLS --- agent/agent.go | 2 +- agent/agent_test.go | 2 +- agent/config/builder.go | 2 +- agent/config/config.go | 2 +- agent/config/runtime_test.go | 17 +- .../TestRuntimeConfig_Sanitize.golden | 6 +- agent/config/testdata/full-config.hcl | 16 +- agent/config/testdata/full-config.json | 16 +- agent/http_decode_test.go | 60 +++---- agent/structs/check_definition.go | 15 +- agent/structs/check_type.go | 13 +- agent/structs/structs.go | 4 +- api/agent.go | 2 +- proto/pbservice/healthcheck.gen.go | 8 +- proto/pbservice/healthcheck.pb.go | 164 +++++++++--------- proto/pbservice/healthcheck.proto | 4 +- website/content/api-docs/agent/check.mdx | 2 +- website/content/docs/discovery/checks.mdx | 4 +- 18 files changed, 172 insertions(+), 167 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index 17dfd83de2..08097a3508 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -2707,7 +2707,7 @@ func (a *Agent) addCheck(check *structs.HealthCheck, chkType *structs.CheckType, chkType.Interval = checks.MinInterval } var tlsClientConfig *tls.Config - if !chkType.H2PINGDisableTLS { + if chkType.H2PingUseTLS { tlsClientConfig = a.tlsConfigurator.OutgoingTLSConfigForCheck(chkType.TLSSkipVerify, chkType.TLSServerName) tlsClientConfig.NextProtos = []string{http2.NextProtoTLS} } diff --git a/agent/agent_test.go b/agent/agent_test.go index 07eb94166a..2ac66ffe65 100644 --- a/agent/agent_test.go +++ b/agent/agent_test.go @@ -866,7 +866,7 @@ func TestAgent_AddServiceWithH2CPINGCheck(t *testing.T) { H2PING: "localhost:12345", TLSSkipVerify: true, Interval: 10 * time.Second, - H2PINGDisableTLS: true, + H2PingUseTLS: false, }, } diff --git a/agent/config/builder.go b/agent/config/builder.go index 4558cdffe8..c27cb1866a 100644 --- a/agent/config/builder.go +++ b/agent/config/builder.go @@ -1571,7 +1571,7 @@ func (b *builder) checkVal(v *CheckDefinition) *structs.CheckDefinition { FailuresBeforeCritical: intVal(v.FailuresBeforeCritical), FailuresBeforeWarning: intValWithDefault(v.FailuresBeforeWarning, intVal(v.FailuresBeforeCritical)), H2PING: stringVal(v.H2PING), - H2PINGDisableTLS: boolVal(v.H2PINGDisableTLS), + H2PingUseTLS: boolValWithDefault(v.H2PingUseTLS, true), DeregisterCriticalServiceAfter: b.durationVal(fmt.Sprintf("check[%s].deregister_critical_service_after", id), v.DeregisterCriticalServiceAfter), OutputMaxSize: intValWithDefault(v.OutputMaxSize, checks.DefaultBufSize), EnterpriseMeta: v.EnterpriseMeta.ToStructs(), diff --git a/agent/config/config.go b/agent/config/config.go index 9e255a6c33..3b5b417dd3 100644 --- a/agent/config/config.go +++ b/agent/config/config.go @@ -419,7 +419,7 @@ type CheckDefinition struct { Timeout *string `mapstructure:"timeout"` TTL *string `mapstructure:"ttl"` H2PING *string `mapstructure:"h2ping"` - H2PINGDisableTLS *bool `mapstructure:"h2ping_disable_tls"` + H2PingUseTLS *bool `mapstructure:"h2ping_use_tls"` SuccessBeforePassing *int `mapstructure:"success_before_passing"` FailuresBeforeWarning *int `mapstructure:"failures_before_warning"` FailuresBeforeCritical *int `mapstructure:"failures_before_critical"` diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go index 022b64b37e..36c3c3af09 100644 --- a/agent/config/runtime_test.go +++ b/agent/config/runtime_test.go @@ -5307,7 +5307,7 @@ func TestLoad_FullConfig(t *testing.T) { Body: "wSjTy7dg", TCP: "RJQND605", H2PING: "9N1cSb5B", - H2PINGDisableTLS: true, + H2PingUseTLS: false, Interval: 22164 * time.Second, OutputMaxSize: checks.DefaultBufSize, DockerContainerID: "ipgdFtjd", @@ -5335,7 +5335,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "4jG5casb", H2PING: "HCHU7gEb", - H2PINGDisableTLS: true, + H2PingUseTLS: false, Interval: 28767 * time.Second, DockerContainerID: "THW6u7rL", Shell: "C1Zt3Zwh", @@ -5362,7 +5362,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "JY6fTTcw", H2PING: "rQ8eyCSF", - H2PINGDisableTLS: true, + H2PingUseTLS: false, Interval: 18714 * time.Second, DockerContainerID: "qF66POS9", Shell: "sOnDy228", @@ -5568,7 +5568,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "ICbxkpSF", H2PING: "7s7BbMyb", - H2PINGDisableTLS: true, + H2PingUseTLS: false, Interval: 24392 * time.Second, DockerContainerID: "ZKXr68Yb", Shell: "CEfzx0Fo", @@ -5620,7 +5620,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "MN3oA9D2", H2PING: "OV6Q2XEg", - H2PINGDisableTLS: true, + H2PingUseTLS: false, Interval: 32718 * time.Second, DockerContainerID: "cU15LMet", Shell: "nEz9qz2l", @@ -5638,6 +5638,7 @@ func TestLoad_FullConfig(t *testing.T) { Timeout: 4868 * time.Second, TTL: 11222 * time.Second, DeregisterCriticalServiceAfter: 68482 * time.Second, + H2PingUseTLS: true, }, }, Connect: &structs.ServiceConnect{}, @@ -5764,7 +5765,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "bNnNfx2A", H2PING: "qC1pidiW", - H2PINGDisableTLS: true, + H2PingUseTLS: false, Interval: 22224 * time.Second, DockerContainerID: "ipgdFtjd", Shell: "omVZq7Sz", @@ -5789,7 +5790,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "FfvCwlqH", H2PING: "spI3muI3", - H2PINGDisableTLS: true, + H2PingUseTLS: false, Interval: 12356 * time.Second, DockerContainerID: "HBndBU6R", Shell: "hVI33JjA", @@ -5814,7 +5815,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "fjiLFqVd", H2PING: "5NbNWhan", - H2PINGDisableTLS: true, + H2PingUseTLS: false, Interval: 23926 * time.Second, DockerContainerID: "dO5TtRHk", Shell: "e6q2ttES", diff --git a/agent/config/testdata/TestRuntimeConfig_Sanitize.golden b/agent/config/testdata/TestRuntimeConfig_Sanitize.golden index 3a79b0aefc..aadbf253dc 100644 --- a/agent/config/testdata/TestRuntimeConfig_Sanitize.golden +++ b/agent/config/testdata/TestRuntimeConfig_Sanitize.golden @@ -99,7 +99,7 @@ "GRPC": "", "GRPCUseTLS": false, "H2PING": "", - "H2PINGDisableTLS": false, + "H2PingUseTLS": false, "HTTP": "", "Header": {}, "ID": "", @@ -304,7 +304,7 @@ "GRPC": "", "GRPCUseTLS": false, "H2PING": "", - "H2PINGDisableTLS": false, + "H2PingUseTLS": false, "HTTP": "", "Header": {}, "Interval": "0s", @@ -420,4 +420,4 @@ "Version": "", "VersionPrerelease": "", "Watches": [] -} \ No newline at end of file +} diff --git a/agent/config/testdata/full-config.hcl b/agent/config/testdata/full-config.hcl index 23dac8c9fa..acdd740c62 100644 --- a/agent/config/testdata/full-config.hcl +++ b/agent/config/testdata/full-config.hcl @@ -110,7 +110,7 @@ check = { body = "5PBQd2OT" tcp = "JY6fTTcw" h2ping = "rQ8eyCSF" - h2ping_disable_tls = true + h2ping_use_tls = false interval = "18714s" output_max_size = 4096 docker_container_id = "qF66POS9" @@ -138,7 +138,7 @@ checks = [ body = "wSjTy7dg" tcp = "RJQND605" h2ping = "9N1cSb5B" - h2ping_disable_tls = true + h2ping_use_tls = false interval = "22164s" output_max_size = 4096 docker_container_id = "ipgdFtjd" @@ -165,7 +165,7 @@ checks = [ body = "0jkKgGUC" tcp = "4jG5casb" h2ping = "HCHU7gEb" - h2ping_disable_tls = true + h2ping_use_tls = false interval = "28767s" output_max_size = 4096 docker_container_id = "THW6u7rL" @@ -383,7 +383,7 @@ service = { body = "wVVL2V6f" tcp = "fjiLFqVd" h2ping = "5NbNWhan" - h2ping_disable_tls = true + h2ping_use_tls = false interval = "23926s" docker_container_id = "dO5TtRHk" shell = "e6q2ttES" @@ -408,7 +408,7 @@ service = { body = "OwGjTFQi" tcp = "bNnNfx2A" h2ping = "qC1pidiW" - h2ping_disable_tls = true + h2ping_use_tls = false interval = "22224s" output_max_size = 4096 docker_container_id = "ipgdFtjd" @@ -433,7 +433,7 @@ service = { body = "lUVLGYU7" tcp = "FfvCwlqH" h2ping = "spI3muI3" - h2ping_disable_tls = true + h2ping_use_tls = false interval = "12356s" output_max_size = 4096 docker_container_id = "HBndBU6R" @@ -472,7 +472,7 @@ services = [ body = "WeikigLh" tcp = "ICbxkpSF" h2ping = "7s7BbMyb" - h2ping_disable_tls = true + h2ping_use_tls = false interval = "24392s" output_max_size = 4096 docker_container_id = "ZKXr68Yb" @@ -514,7 +514,7 @@ services = [ body = "7CRjCJyz" tcp = "MN3oA9D2" h2ping = "OV6Q2XEg" - h2ping_disable_tls = true + h2ping_use_tls = false interval = "32718s" output_max_size = 4096 docker_container_id = "cU15LMet" diff --git a/agent/config/testdata/full-config.json b/agent/config/testdata/full-config.json index 4ac262eddd..711c0a1fa1 100644 --- a/agent/config/testdata/full-config.json +++ b/agent/config/testdata/full-config.json @@ -112,7 +112,7 @@ "output_max_size": 4096, "tcp": "JY6fTTcw", "h2ping": "rQ8eyCSF", - "h2ping_disable_tls": true, + "h2ping_use_tls": false, "interval": "18714s", "docker_container_id": "qF66POS9", "shell": "sOnDy228", @@ -139,7 +139,7 @@ "body": "wSjTy7dg", "tcp": "RJQND605", "h2ping": "9N1cSb5B", - "h2ping_disable_tls": true, + "h2ping_use_tls": false, "interval": "22164s", "output_max_size": 4096, "docker_container_id": "ipgdFtjd", @@ -166,7 +166,7 @@ "body": "0jkKgGUC", "tcp": "4jG5casb", "h2ping": "HCHU7gEb", - "h2ping_disable_tls": true, + "h2ping_use_tls": false, "interval": "28767s", "output_max_size": 4096, "docker_container_id": "THW6u7rL", @@ -379,7 +379,7 @@ "body": "wVVL2V6f", "tcp": "fjiLFqVd", "h2ping": "5NbNWhan", - "h2ping_disable_tls": true, + "h2ping_use_tls": false, "interval": "23926s", "output_max_size": 4096, "docker_container_id": "dO5TtRHk", @@ -405,7 +405,7 @@ "body": "OwGjTFQi", "tcp": "bNnNfx2A", "h2ping": "qC1pidiW", - "h2ping_disable_tls": true, + "h2ping_use_tls": false, "interval": "22224s", "output_max_size": 4096, "docker_container_id": "ipgdFtjd", @@ -430,7 +430,7 @@ "body": "lUVLGYU7", "tcp": "FfvCwlqH", "h2ping": "spI3muI3", - "h2ping_disable_tls": true, + "h2ping_use_tls": false, "interval": "12356s", "output_max_size": 4096, "docker_container_id": "HBndBU6R", @@ -469,7 +469,7 @@ "body": "WeikigLh", "tcp": "ICbxkpSF", "h2ping": "7s7BbMyb", - "h2ping_disable_tls": true, + "h2ping_use_tls": false, "interval": "24392s", "output_max_size": 4096, "docker_container_id": "ZKXr68Yb", @@ -511,7 +511,7 @@ "body": "7CRjCJyz", "tcp": "MN3oA9D2", "h2ping": "OV6Q2XEg", - "h2ping_disable_tls": true, + "h2ping_use_tls": false, "interval": "32718s", "output_max_size": 4096, "docker_container_id": "cU15LMet", diff --git a/agent/http_decode_test.go b/agent/http_decode_test.go index 3023baf3fc..8560945444 100644 --- a/agent/http_decode_test.go +++ b/agent/http_decode_test.go @@ -285,7 +285,7 @@ var translateCheckTypeTCs = [][]translateKeyTestCase{ translateDockerTCs, translateGRPCUseTLSTCs, translateTLSServerNameTCs, - translateH2PINGDisableTLS, + translateH2PingUseTLS, translateTLSSkipVerifyTCs, translateServiceIDTCs, } @@ -678,59 +678,59 @@ var translateGRPCUseTLSTCs = []translateKeyTestCase{ }, } -func h2pingDisableTLSEqFn(out interface{}, want interface{}) error { +func h2pingUseTLSEqFn(out interface{}, want interface{}) error { var got interface{} switch v := out.(type) { case structs.CheckDefinition: - got = v.H2PINGDisableTLS + got = v.H2PingUseTLS case *structs.CheckDefinition: - got = v.H2PINGDisableTLS + got = v.H2PingUseTLS case structs.CheckType: - got = v.H2PINGDisableTLS + got = v.H2PingUseTLS case *structs.CheckType: - got = v.H2PINGDisableTLS + got = v.H2PingUseTLS case structs.HealthCheckDefinition: - got = v.H2PINGDisableTLS + got = v.H2PingUseTLS case *structs.HealthCheckDefinition: - got = v.H2PINGDisableTLS + got = v.H2PingUseTLS default: panic(fmt.Sprintf("unexpected type %T", out)) } if got != want { - return fmt.Errorf("expected H2PINGDisableTLS to be %v, got %v", want, got) + return fmt.Errorf("expected H2PingUseTLS to be %v, got %v", want, got) } return nil } -var h2pingDisableTLSFields = []string{`"H2PINGDisableTLS": %s`, `"h2ping_disable_tls": %s`} -var translateH2PINGDisableTLS = []translateKeyTestCase{ +var h2pingUseTLSFields = []string{`"H2PingUseTLS": %s`, `"h2ping_use_tls": %s`} +var translateH2PingUseTLS = []translateKeyTestCase{ { - desc: "H2PINGDisableTLS: both set", - in: []interface{}{"true", "false"}, - want: true, - jsonFmtStr: "{" + strings.Join(h2pingDisableTLSFields, ",") + "}", - equalityFn: h2pingDisableTLSEqFn, + desc: "H2PingUseTLS: both set", + in: []interface{}{"false", "true"}, + want: false, + jsonFmtStr: "{" + strings.Join(h2pingUseTLSFields, ",") + "}", + equalityFn: h2pingUseTLSEqFn, }, { - desc: "H2PINGDisableTLS:: first set", - in: []interface{}{`true`}, - want: true, - jsonFmtStr: "{" + h2pingDisableTLSFields[0] + "}", - equalityFn: h2pingDisableTLSEqFn, + desc: "H2PingUseTLS:: first set", + in: []interface{}{`false`}, + want: false, + jsonFmtStr: "{" + h2pingUseTLSFields[0] + "}", + equalityFn: h2pingUseTLSEqFn, }, { - desc: "H2PINGDisableTLS: second set", - in: []interface{}{`true`}, - want: true, - jsonFmtStr: "{" + h2pingDisableTLSFields[1] + "}", - equalityFn: h2pingDisableTLSEqFn, + desc: "H2PingUseTLS: second set", + in: []interface{}{`false`}, + want: false, + jsonFmtStr: "{" + h2pingUseTLSFields[1] + "}", + equalityFn: h2pingUseTLSEqFn, }, { - desc: "H2PINGDisableTLS: neither set", + desc: "H2PingUseTLS: neither set", in: []interface{}{}, - want: false, // zero value + want: true, // zero value jsonFmtStr: "{}", - equalityFn: h2pingDisableTLSEqFn, + equalityFn: h2pingUseTLSEqFn, }, } @@ -993,7 +993,7 @@ func TestDecodeACLRoleWrite(t *testing.T) { // GRPC string // GRPCUseTLS bool // H2PING string -// H2PINGDisableTLS bool +// H2PingUseTLS bool // TLSServerName string // TLSSkipVerify bool // AliasNode string diff --git a/agent/structs/check_definition.go b/agent/structs/check_definition.go index a0c3575198..66ca85188b 100644 --- a/agent/structs/check_definition.go +++ b/agent/structs/check_definition.go @@ -25,7 +25,7 @@ type CheckDefinition struct { ScriptArgs []string HTTP string H2PING string - H2PINGDisableTLS bool + H2PingUseTLS bool Header map[string][]string Method string Body string @@ -70,12 +70,15 @@ func (t *CheckDefinition) UnmarshalJSON(data []byte) (err error) { TLSSkipVerifySnake bool `json:"tls_skip_verify"` GRPCUseTLSSnake bool `json:"grpc_use_tls"` ServiceIDSnake string `json:"service_id"` - H2PINGDisableTLSSnake bool `json:"h2ping_disable_tls"` + H2PingUseTLSSnake bool `json:"h2ping_use_tls"` *Alias }{ Alias: (*Alias)(t), } + + aux.H2PingUseTLS = true + aux.H2PingUseTLSSnake = true if err = lib.UnmarshalJSON(data, &aux); err != nil { return err } @@ -102,12 +105,12 @@ func (t *CheckDefinition) UnmarshalJSON(data []byte) (err error) { if aux.GRPCUseTLSSnake { t.GRPCUseTLS = aux.GRPCUseTLSSnake } - if aux.H2PINGDisableTLSSnake { - t.H2PINGDisableTLS = aux.H2PINGDisableTLSSnake - } if t.ServiceID == "" { t.ServiceID = aux.ServiceIDSnake } + if !aux.H2PingUseTLSSnake { + t.H2PingUseTLS = aux.H2PingUseTLSSnake + } // Parse special values if aux.Interval != nil { @@ -187,7 +190,7 @@ func (c *CheckDefinition) CheckType() *CheckType { AliasService: c.AliasService, HTTP: c.HTTP, H2PING: c.H2PING, - H2PINGDisableTLS: c.H2PINGDisableTLS, + H2PingUseTLS: c.H2PingUseTLS, GRPC: c.GRPC, GRPCUseTLS: c.GRPCUseTLS, Header: c.Header, diff --git a/agent/structs/check_type.go b/agent/structs/check_type.go index 2bb446e49e..6d375d0940 100644 --- a/agent/structs/check_type.go +++ b/agent/structs/check_type.go @@ -33,7 +33,7 @@ type CheckType struct { ScriptArgs []string HTTP string H2PING string - H2PINGDisableTLS bool + H2PingUseTLS bool Header map[string][]string Method string Body string @@ -82,7 +82,7 @@ func (t *CheckType) UnmarshalJSON(data []byte) (err error) { TLSServerNameSnake string `json:"tls_server_name"` TLSSkipVerifySnake bool `json:"tls_skip_verify"` GRPCUseTLSSnake bool `json:"grpc_use_tls"` - H2PINGDisableTLSSnake bool `json:"h2ping_disable_tls"` + H2PingUseTLSSnake bool `json:"h2ping_use_tls"` // These are going to be ignored but since we are disallowing unknown fields // during parsing we have to be explicit about parsing but not using these. @@ -93,6 +93,8 @@ func (t *CheckType) UnmarshalJSON(data []byte) (err error) { }{ Alias: (*Alias)(t), } + aux.H2PingUseTLS = true + aux.H2PingUseTLSSnake = true if err = lib.UnmarshalJSON(data, aux); err != nil { return err } @@ -117,10 +119,6 @@ func (t *CheckType) UnmarshalJSON(data []byte) (err error) { if aux.GRPCUseTLSSnake { t.GRPCUseTLS = aux.GRPCUseTLSSnake } - if aux.H2PINGDisableTLSSnake { - t.H2PINGDisableTLS = aux.H2PINGDisableTLSSnake - } - if aux.Interval != nil { switch v := aux.Interval.(type) { case string: @@ -161,6 +159,9 @@ func (t *CheckType) UnmarshalJSON(data []byte) (err error) { t.DeregisterCriticalServiceAfter = time.Duration(v) } } + if !aux.H2PingUseTLSSnake { + t.H2PingUseTLS = aux.H2PingUseTLSSnake + } return nil diff --git a/agent/structs/structs.go b/agent/structs/structs.go index 18c3bc3ca8..7f3bd3369e 100644 --- a/agent/structs/structs.go +++ b/agent/structs/structs.go @@ -1544,7 +1544,7 @@ type HealthCheckDefinition struct { Body string `json:",omitempty"` TCP string `json:",omitempty"` H2PING string `json:",omitempty"` - H2PINGDisableTLS bool `json:",omitempty"` + H2PingUseTLS bool `json:",omitempty"` Interval time.Duration `json:",omitempty"` OutputMaxSize uint `json:",omitempty"` Timeout time.Duration `json:",omitempty"` @@ -1692,7 +1692,7 @@ func (c *HealthCheck) CheckType() *CheckType { Body: c.Definition.Body, TCP: c.Definition.TCP, H2PING: c.Definition.H2PING, - H2PINGDisableTLS: c.Definition.H2PINGDisableTLS, + H2PingUseTLS: c.Definition.H2PingUseTLS, Interval: c.Definition.Interval, DockerContainerID: c.Definition.DockerContainerID, Shell: c.Definition.Shell, diff --git a/api/agent.go b/api/agent.go index f9f9667439..57f4583e65 100644 --- a/api/agent.go +++ b/api/agent.go @@ -328,7 +328,7 @@ type AgentServiceCheck struct { GRPC string `json:",omitempty"` GRPCUseTLS bool `json:",omitempty"` H2PING string `json:",omitempty"` - H2PINGDisableTLS bool `json:",omitempty"` + H2PingUseTLS bool `json:",omitempty"` AliasNode string `json:",omitempty"` AliasService string `json:",omitempty"` SuccessBeforePassing int `json:",omitempty"` diff --git a/proto/pbservice/healthcheck.gen.go b/proto/pbservice/healthcheck.gen.go index 74eb482f32..2939eddc64 100644 --- a/proto/pbservice/healthcheck.gen.go +++ b/proto/pbservice/healthcheck.gen.go @@ -13,7 +13,7 @@ func CheckTypeToStructs(s CheckType) structs.CheckType { t.ScriptArgs = s.ScriptArgs t.HTTP = s.HTTP t.H2PING = s.H2PING - t.H2PINGDisableTLS = s.H2PINGDisableTLS + t.H2PingUseTLS = s.H2PingUseTLS t.Header = MapHeadersToStructs(s.Header) t.Method = s.Method t.Body = s.Body @@ -47,7 +47,7 @@ func NewCheckTypeFromStructs(t structs.CheckType) CheckType { s.ScriptArgs = t.ScriptArgs s.HTTP = t.HTTP s.H2PING = t.H2PING - s.H2PINGDisableTLS = t.H2PINGDisableTLS + s.H2PingUseTLS = t.H2PingUseTLS s.Header = NewMapHeadersFromStructs(t.Header) s.Method = t.Method s.Body = t.Body @@ -122,7 +122,7 @@ func HealthCheckDefinitionToStructs(s HealthCheckDefinition) structs.HealthCheck t.Body = s.Body t.TCP = s.TCP t.H2PING = s.H2PING - t.H2PINGDisableTLS = s.H2PINGDisableTLS + t.H2PingUseTLS = s.H2PingUseTLS t.Interval = s.Interval t.OutputMaxSize = uint(s.OutputMaxSize) t.Timeout = s.Timeout @@ -147,7 +147,7 @@ func NewHealthCheckDefinitionFromStructs(t structs.HealthCheckDefinition) Health s.Body = t.Body s.TCP = t.TCP s.H2PING = t.H2PING - s.H2PINGDisableTLS = t.H2PINGDisableTLS + s.H2PingUseTLS = t.H2PingUseTLS s.Interval = t.Interval s.OutputMaxSize = uint32(t.OutputMaxSize) s.Timeout = t.Timeout diff --git a/proto/pbservice/healthcheck.pb.go b/proto/pbservice/healthcheck.pb.go index 2b5715d844..34517c79ab 100644 --- a/proto/pbservice/healthcheck.pb.go +++ b/proto/pbservice/healthcheck.pb.go @@ -153,7 +153,7 @@ type HealthCheckDefinition struct { DockerContainerID string `protobuf:"bytes,11,opt,name=DockerContainerID,proto3" json:"DockerContainerID,omitempty"` Shell string `protobuf:"bytes,12,opt,name=Shell,proto3" json:"Shell,omitempty"` H2PING string `protobuf:"bytes,20,opt,name=H2PING,proto3" json:"H2PING,omitempty"` - H2PINGDisableTLS bool `protobuf:"varint,21,opt,name=H2PINGDisableTLS,proto3" json:"H2PINGDisableTLS,omitempty"` + H2PingUseTLS bool `protobuf:"varint,21,opt,name=H2PingUseTLS,proto3" json:"H2PingUseTLS,omitempty"` GRPC string `protobuf:"bytes,13,opt,name=GRPC,proto3" json:"GRPC,omitempty"` GRPCUseTLS bool `protobuf:"varint,14,opt,name=GRPCUseTLS,proto3" json:"GRPCUseTLS,omitempty"` AliasNode string `protobuf:"bytes,15,opt,name=AliasNode,proto3" json:"AliasNode,omitempty"` @@ -224,7 +224,7 @@ type CheckType struct { DockerContainerID string `protobuf:"bytes,12,opt,name=DockerContainerID,proto3" json:"DockerContainerID,omitempty"` Shell string `protobuf:"bytes,13,opt,name=Shell,proto3" json:"Shell,omitempty"` H2PING string `protobuf:"bytes,28,opt,name=H2PING,proto3" json:"H2PING,omitempty"` - H2PINGDisableTLS bool `protobuf:"varint,30,opt,name=H2PINGDisableTLS,proto3" json:"H2PINGDisableTLS,omitempty"` + H2PingUseTLS bool `protobuf:"varint,30,opt,name=H2PingUseTLS,proto3" json:"H2PingUseTLS,omitempty"` GRPC string `protobuf:"bytes,14,opt,name=GRPC,proto3" json:"GRPC,omitempty"` GRPCUseTLS bool `protobuf:"varint,15,opt,name=GRPCUseTLS,proto3" json:"GRPCUseTLS,omitempty"` TLSServerName string `protobuf:"bytes,27,opt,name=TLSServerName,proto3" json:"TLSServerName,omitempty"` @@ -293,76 +293,76 @@ func init() { func init() { proto.RegisterFile("proto/pbservice/healthcheck.proto", fileDescriptor_8a6f7448747c9fbe) } var fileDescriptor_8a6f7448747c9fbe = []byte{ - // 1100 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xdd, 0x4e, 0xe3, 0x46, - 0x14, 0x8e, 0x09, 0x49, 0xc8, 0x04, 0x58, 0x98, 0x05, 0x3a, 0xcb, 0x6e, 0x4d, 0x4a, 0xf7, 0x82, - 0xb6, 0x34, 0x91, 0xe8, 0x8f, 0xda, 0x4a, 0x6d, 0x45, 0x08, 0x0b, 0xa9, 0x80, 0xa6, 0x4e, 0xba, - 0x95, 0x7a, 0x67, 0x9c, 0x49, 0x32, 0xc2, 0xf1, 0x44, 0xe3, 0x31, 0x22, 0x7d, 0x87, 0x4a, 0xbd, - 0xdc, 0x87, 0xe9, 0x03, 0x70, 0xc9, 0x65, 0xa5, 0x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8c, 0x8e, 0x42, 0x7c, 0x29, 0x11, 0x6f, 0xa3, 0xdc, 0x39, 0x40, 0x74, 0x26, 0xa4, 0x91, 0x04, - 0x22, 0x22, 0x24, 0x5b, 0x3a, 0xe8, 0x8b, 0x99, 0xcf, 0x8c, 0xcd, 0x9f, 0x11, 0x2a, 0x02, 0x4c, - 0x80, 0x12, 0x63, 0xbb, 0xc2, 0x78, 0x23, 0xbb, 0x62, 0x26, 0x75, 0x57, 0x64, 0xd3, 0x77, 0xc5, - 0x6c, 0x7c, 0x57, 0x24, 0x07, 0x28, 0x37, 0x31, 0x40, 0x11, 0xbb, 0xe4, 0x63, 0xec, 0xf2, 0xd5, - 0x98, 0x11, 0x56, 0x80, 0x11, 0xe2, 0x6c, 0x3e, 0x7e, 0xe4, 0xbd, 0x58, 0xa0, 0x90, 0xca, 0x02, - 0xeb, 0x93, 0x2c, 0x30, 0x97, 0xce, 0x02, 0xc5, 0xd7, 0x61, 0x81, 0xc4, 0x5c, 0xa1, 0x69, 0x73, - 0x55, 0x4a, 0x99, 0xab, 0x54, 0x54, 0xcd, 0x4f, 0x45, 0xd5, 0x42, 0x3a, 0xaa, 0x9e, 0x4c, 0x45, - 0x95, 0x39, 0x05, 0x55, 0x8b, 0xaf, 0x44, 0xd5, 0x83, 0x09, 0x54, 0x4d, 0xac, 0x86, 0xc7, 0xf7, - 0x5a, 0x0d, 0x4b, 0x69, 0xab, 0x21, 0xc6, 0x94, 0xcb, 0xaf, 0xc1, 0x94, 0x21, 0x3c, 0xf1, 0x7f, - 0x83, 0x27, 0xde, 0x41, 0x2b, 0xad, 0xc0, 0x71, 0xa8, 0xef, 0xd7, 0x68, 0x97, 0x0b, 0xda, 0xb4, - 0x7d, 0x9f, 0x79, 0x3d, 0xe0, 0x9e, 0x9c, 0x95, 0xea, 0xc3, 0x1f, 0xa3, 0xd5, 0x67, 0x36, 0x73, - 0x03, 0x41, 0x43, 0xc7, 0x0f, 0xb6, 0xf0, 0x54, 0xd2, 0xdb, 0x90, 0x94, 0xee, 0xc4, 0x9f, 0xa2, - 0xb5, 0xa4, 0x23, 0xe2, 0x60, 0xb2, 0x06, 0x69, 0xaf, 0xf0, 0xaa, 0x09, 0x6b, 0x0a, 0x7e, 0x31, - 0x02, 0xe4, 0xbc, 0xa5, 0x27, 0x6c, 0x6c, 0x18, 0x7b, 0xa1, 0x75, 0x24, 0xe6, 0x85, 0xfe, 0x4d, - 0x5f, 0x1f, 0x0f, 0xdf, 0xdc, 0xfa, 0x98, 0x58, 0x88, 0x8f, 0xe0, 0x5d, 0x49, 0xe3, 0xff, 0xc0, - 0x87, 0xb5, 0xe3, 0xcb, 0xbf, 0xcc, 0xcc, 0xe5, 0x8d, 0x69, 0x5c, 0xdd, 0x98, 0xc6, 0x9f, 0x37, - 0xa6, 0xf1, 0xcb, 0xad, 0x99, 0x79, 0x71, 0x6b, 0x66, 0xae, 0x6e, 0xcd, 0xcc, 0x6f, 0xb7, 0x66, - 0xe6, 0xc7, 0x0f, 0xfe, 0x8d, 0x0e, 0x5f, 0xfa, 0x43, 0x70, 0x9a, 0x07, 0xc3, 0x47, 0xff, 0x04, - 0x00, 0x00, 0xff, 0xff, 0xb7, 0x54, 0xd1, 0x6f, 0x2a, 0x0c, 0x00, 0x00, + // 1098 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4f, 0x4f, 0xe3, 0x46, + 0x14, 0x8f, 0x09, 0x49, 0xc8, 0x64, 0x61, 0x61, 0x16, 0xe8, 0x2c, 0xbb, 0x35, 0x29, 0xdd, 0x03, + 0x55, 0x69, 0x22, 0xd1, 0x3f, 0x6a, 0x2b, 0xb5, 0x15, 0x21, 0x2c, 0xa4, 0x02, 0x9a, 0x3a, 0xe9, + 0x56, 0xea, 0xcd, 0x38, 0x93, 0xc4, 0x22, 0xf1, 0x58, 0xe3, 0x31, 0x22, 0xbd, 0xf7, 0xde, 0xe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08, + 0x39, 0xd5, 0xc0, 0x8f, 0x36, 0xf7, 0x64, 0xd2, 0xbb, 0x90, 0x94, 0x0e, 0xe2, 0xcf, 0xd0, 0x6a, + 0x12, 0x88, 0x7a, 0x2e, 0x59, 0x85, 0xb4, 0xd7, 0xa0, 0x92, 0x59, 0x4d, 0xce, 0xce, 0x47, 0xa0, + 0x98, 0x77, 0x14, 0xb3, 0xc6, 0x8e, 0x31, 0x0a, 0xa5, 0x23, 0x31, 0x14, 0xea, 0x77, 0xff, 0xb8, + 0x78, 0xf4, 0xf6, 0xc6, 0xc5, 0xc4, 0x00, 0x7c, 0x0c, 0xf7, 0x4a, 0x3a, 0xff, 0x87, 0x3e, 0x58, + 0x3b, 0xba, 0xf8, 0xdb, 0xcc, 0x5c, 0x5c, 0x9b, 0xc6, 0xe5, 0xb5, 0x69, 0xfc, 0x75, 0x6d, 0x1a, + 0xbf, 0xde, 0x98, 0x99, 0x97, 0x37, 0x66, 0xe6, 0xf2, 0xc6, 0xcc, 0xfc, 0x7e, 0x63, 0x66, 0x7e, + 0xfa, 0xf0, 0xae, 0x36, 0xf8, 0xca, 0x1f, 0x80, 0x93, 0x3c, 0x38, 0x3e, 0xfe, 0x37, 0x00, 0x00, + 0xff, 0xff, 0xd0, 0xae, 0x76, 0xe3, 0x1a, 0x0c, 0x00, 0x00, } func (m *HealthCheck) Marshal() (dAtA []byte, err error) { @@ -563,9 +563,9 @@ func (m *HealthCheckDefinition) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.H2PINGDisableTLS { + if m.H2PingUseTLS { i-- - if m.H2PINGDisableTLS { + if m.H2PingUseTLS { dAtA[i] = 1 } else { dAtA[i] = 0 @@ -775,9 +775,9 @@ func (m *CheckType) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.H2PINGDisableTLS { + if m.H2PingUseTLS { i-- - if m.H2PINGDisableTLS { + if m.H2PingUseTLS { dAtA[i] = 1 } else { dAtA[i] = 0 @@ -1218,7 +1218,7 @@ func (m *HealthCheckDefinition) Size() (n int) { if l > 0 { n += 2 + l + sovHealthcheck(uint64(l)) } - if m.H2PINGDisableTLS { + if m.H2PingUseTLS { n += 3 } return n @@ -1339,7 +1339,7 @@ func (m *CheckType) Size() (n int) { if m.FailuresBeforeWarning != 0 { n += 2 + sovHealthcheck(uint64(m.FailuresBeforeWarning)) } - if m.H2PINGDisableTLS { + if m.H2PingUseTLS { n += 3 } return n @@ -2726,7 +2726,7 @@ func (m *HealthCheckDefinition) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 21: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field H2PINGDisableTLS", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field H2PingUseTLS", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -2743,7 +2743,7 @@ func (m *HealthCheckDefinition) Unmarshal(dAtA []byte) error { break } } - m.H2PINGDisableTLS = bool(v != 0) + m.H2PingUseTLS = bool(v != 0) default: iNdEx = preIndex skippy, err := skipHealthcheck(dAtA[iNdEx:]) @@ -3752,7 +3752,7 @@ func (m *CheckType) Unmarshal(dAtA []byte) error { } case 30: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field H2PINGDisableTLS", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field H2PingUseTLS", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -3769,7 +3769,7 @@ func (m *CheckType) Unmarshal(dAtA []byte) error { break } } - m.H2PINGDisableTLS = bool(v != 0) + m.H2PingUseTLS = bool(v != 0) default: iNdEx = preIndex skippy, err := skipHealthcheck(dAtA[iNdEx:]) diff --git a/proto/pbservice/healthcheck.proto b/proto/pbservice/healthcheck.proto index 503095bdd0..53c4ea731b 100644 --- a/proto/pbservice/healthcheck.proto +++ b/proto/pbservice/healthcheck.proto @@ -83,7 +83,7 @@ message HealthCheckDefinition { string DockerContainerID = 11; string Shell = 12; string H2PING = 20; - bool H2PINGDisableTLS = 21; + bool H2PingUseTLS = 21; string GRPC = 13; bool GRPCUseTLS = 14; string AliasNode = 15; @@ -125,7 +125,7 @@ message CheckType { string DockerContainerID = 12; string Shell = 13; string H2PING = 28; - bool H2PINGDisableTLS = 30; + bool H2PingUseTLS = 30; string GRPC = 14; bool GRPCUseTLS = 15; string TLSServerName = 27; diff --git a/website/content/api-docs/agent/check.mdx b/website/content/api-docs/agent/check.mdx index 4c83c16a70..ea97613757 100644 --- a/website/content/api-docs/agent/check.mdx +++ b/website/content/api-docs/agent/check.mdx @@ -186,7 +186,7 @@ The table below shows this endpoint's support for - `H2PING` `(string "")` - Specifies an address that uses http2 to run a ping check on. At the specified `Interval`, a connection is made to the address, and a ping is sent. If the ping is successful, the check will be classified as `passing`, otherwise it will be marked as `critical`. - TLS is used by default. To disable TLS and use h2c, set `H2PINGDisableTLS` to `true`. + TLS is used by default. To disable TLS and use h2c, set `H2PINGUseTLS` to `false`. If TLS is enabled, a valid SSL certificate is required by default, but verification can be removed with `TLSSkipVerify`. - `HTTP` `(string: "")` - Specifies an `HTTP` check to perform a `GET` request diff --git a/website/content/docs/discovery/checks.mdx b/website/content/docs/discovery/checks.mdx index 314b4f610e..cae21a938c 100644 --- a/website/content/docs/discovery/checks.mdx +++ b/website/content/docs/discovery/checks.mdx @@ -122,7 +122,7 @@ There are several different kinds of checks: - `H2ping + Interval` - These checks test an endpoint that uses http2 by connecting to the endpoint and sending a ping frame. TLS is assumed to be configured by default. - To disable TLS and use h2c, set `h2ping_disable_tls` to `true`. If the ping is successful + To disable TLS and use h2c, set `h2ping_enable_tls` to `false`. If the ping is successful within a specified timeout, then the check is updated as passing. The timeout defaults to 10 seconds, but is configurable using the `timeout` field. If TLS is enabled a valid certificate is required, unless `tls_skip_verify` is set to `true`. @@ -252,7 +252,7 @@ A h2ping check: "name": "h2ping", "h2ping": "localhost:22222", "interval": "10s", - "h2ping_disable_tls": false + "h2ping_use_tls": false } } ``` From 1e8e44d442a73b5a97730ca37cf0263ccb52bb61 Mon Sep 17 00:00:00 2001 From: tarat44 <32471142+tarat44@users.noreply.github.com> Date: Mon, 4 Oct 2021 22:12:26 -0400 Subject: [PATCH 04/12] fix formatting --- agent/agent_test.go | 12 ++++++------ agent/structs/check_definition.go | 10 +++++----- agent/structs/check_type.go | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/agent/agent_test.go b/agent/agent_test.go index 2ac66ffe65..00adf33230 100644 --- a/agent/agent_test.go +++ b/agent/agent_test.go @@ -861,12 +861,12 @@ func TestAgent_AddServiceWithH2CPINGCheck(t *testing.T) { defer a.Shutdown() check := []*structs.CheckType{ { - CheckID: "test-h2cping-check", - Name: "test-h2cping-check", - H2PING: "localhost:12345", - TLSSkipVerify: true, - Interval: 10 * time.Second, - H2PingUseTLS: false, + CheckID: "test-h2cping-check", + Name: "test-h2cping-check", + H2PING: "localhost:12345", + TLSSkipVerify: true, + Interval: 10 * time.Second, + H2PingUseTLS: false, }, } diff --git a/agent/structs/check_definition.go b/agent/structs/check_definition.go index 66ca85188b..d9d54dcb4d 100644 --- a/agent/structs/check_definition.go +++ b/agent/structs/check_definition.go @@ -77,8 +77,8 @@ func (t *CheckDefinition) UnmarshalJSON(data []byte) (err error) { Alias: (*Alias)(t), } - aux.H2PingUseTLS = true - aux.H2PingUseTLSSnake = true + aux.H2PingUseTLS = true + aux.H2PingUseTLSSnake = true if err = lib.UnmarshalJSON(data, &aux); err != nil { return err } @@ -108,9 +108,9 @@ func (t *CheckDefinition) UnmarshalJSON(data []byte) (err error) { if t.ServiceID == "" { t.ServiceID = aux.ServiceIDSnake } - if !aux.H2PingUseTLSSnake { - t.H2PingUseTLS = aux.H2PingUseTLSSnake - } + if !aux.H2PingUseTLSSnake { + t.H2PingUseTLS = aux.H2PingUseTLSSnake + } // Parse special values if aux.Interval != nil { diff --git a/agent/structs/check_type.go b/agent/structs/check_type.go index 6d375d0940..00eff8e23e 100644 --- a/agent/structs/check_type.go +++ b/agent/structs/check_type.go @@ -159,9 +159,9 @@ func (t *CheckType) UnmarshalJSON(data []byte) (err error) { t.DeregisterCriticalServiceAfter = time.Duration(v) } } - if !aux.H2PingUseTLSSnake { - t.H2PingUseTLS = aux.H2PingUseTLSSnake - } + if !aux.H2PingUseTLSSnake { + t.H2PingUseTLS = aux.H2PingUseTLSSnake + } return nil From ca2e7c2039c8b1368a9d2141b117e35108f6a15a Mon Sep 17 00:00:00 2001 From: tarat44 <32471142+tarat44@users.noreply.github.com> Date: Tue, 5 Oct 2021 00:15:04 -0400 Subject: [PATCH 05/12] fix formatting --- agent/config/runtime_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go index 36c3c3af09..b7a7c5079b 100644 --- a/agent/config/runtime_test.go +++ b/agent/config/runtime_test.go @@ -5307,7 +5307,7 @@ func TestLoad_FullConfig(t *testing.T) { Body: "wSjTy7dg", TCP: "RJQND605", H2PING: "9N1cSb5B", - H2PingUseTLS: false, + H2PingUseTLS: false, Interval: 22164 * time.Second, OutputMaxSize: checks.DefaultBufSize, DockerContainerID: "ipgdFtjd", @@ -5335,7 +5335,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "4jG5casb", H2PING: "HCHU7gEb", - H2PingUseTLS: false, + H2PingUseTLS: false, Interval: 28767 * time.Second, DockerContainerID: "THW6u7rL", Shell: "C1Zt3Zwh", @@ -5362,7 +5362,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "JY6fTTcw", H2PING: "rQ8eyCSF", - H2PingUseTLS: false, + H2PingUseTLS: false, Interval: 18714 * time.Second, DockerContainerID: "qF66POS9", Shell: "sOnDy228", @@ -5568,7 +5568,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "ICbxkpSF", H2PING: "7s7BbMyb", - H2PingUseTLS: false, + H2PingUseTLS: false, Interval: 24392 * time.Second, DockerContainerID: "ZKXr68Yb", Shell: "CEfzx0Fo", @@ -5620,7 +5620,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "MN3oA9D2", H2PING: "OV6Q2XEg", - H2PingUseTLS: false, + H2PingUseTLS: false, Interval: 32718 * time.Second, DockerContainerID: "cU15LMet", Shell: "nEz9qz2l", @@ -5638,7 +5638,7 @@ func TestLoad_FullConfig(t *testing.T) { Timeout: 4868 * time.Second, TTL: 11222 * time.Second, DeregisterCriticalServiceAfter: 68482 * time.Second, - H2PingUseTLS: true, + H2PingUseTLS: true, }, }, Connect: &structs.ServiceConnect{}, @@ -5765,7 +5765,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "bNnNfx2A", H2PING: "qC1pidiW", - H2PingUseTLS: false, + H2PingUseTLS: false, Interval: 22224 * time.Second, DockerContainerID: "ipgdFtjd", Shell: "omVZq7Sz", @@ -5790,7 +5790,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "FfvCwlqH", H2PING: "spI3muI3", - H2PingUseTLS: false, + H2PingUseTLS: false, Interval: 12356 * time.Second, DockerContainerID: "HBndBU6R", Shell: "hVI33JjA", @@ -5815,7 +5815,7 @@ func TestLoad_FullConfig(t *testing.T) { OutputMaxSize: checks.DefaultBufSize, TCP: "fjiLFqVd", H2PING: "5NbNWhan", - H2PingUseTLS: false, + H2PingUseTLS: false, Interval: 23926 * time.Second, DockerContainerID: "dO5TtRHk", Shell: "e6q2ttES", From 3b1ad2be97af053424f96814ab0c287241d1e9bd Mon Sep 17 00:00:00 2001 From: tarat44 <32471142+tarat44@users.noreply.github.com> Date: Tue, 5 Oct 2021 00:35:56 -0400 Subject: [PATCH 06/12] fix protos --- proto/pbservice/healthcheck.pb.go | 84 +++++++++---------------------- 1 file changed, 23 insertions(+), 61 deletions(-) diff --git a/proto/pbservice/healthcheck.pb.go b/proto/pbservice/healthcheck.pb.go index 34517c79ab..207088462f 100644 --- a/proto/pbservice/healthcheck.pb.go +++ b/proto/pbservice/healthcheck.pb.go @@ -27,7 +27,7 @@ var _ = time.Kitchen // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // HealthCheck represents a single check on a given node // @@ -1888,10 +1888,7 @@ func (m *HealthCheck) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthHealthcheck - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthHealthcheck } if (iNdEx + skippy) > l { @@ -1973,10 +1970,7 @@ func (m *HeaderValue) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthHealthcheck - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthHealthcheck } if (iNdEx + skippy) > l { @@ -2190,7 +2184,7 @@ func (m *HealthCheckDefinition) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthHealthcheck } if (iNdEx + skippy) > postIndex { @@ -2750,10 +2744,7 @@ func (m *HealthCheckDefinition) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthHealthcheck - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthHealthcheck } if (iNdEx + skippy) > l { @@ -3503,7 +3494,7 @@ func (m *CheckType) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthHealthcheck } if (iNdEx + skippy) > postIndex { @@ -3776,10 +3767,7 @@ func (m *CheckType) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthHealthcheck - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthHealthcheck } if (iNdEx + skippy) > l { @@ -3797,6 +3785,7 @@ func (m *CheckType) Unmarshal(dAtA []byte) error { func skipHealthcheck(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -3828,10 +3817,8 @@ func skipHealthcheck(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -3852,55 +3839,30 @@ func skipHealthcheck(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthHealthcheck } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthHealthcheck - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowHealthcheck - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipHealthcheck(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthHealthcheck - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupHealthcheck + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthHealthcheck + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthHealthcheck = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowHealthcheck = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthHealthcheck = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowHealthcheck = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupHealthcheck = fmt.Errorf("proto: unexpected end of group") ) From 02dda536f95844b59ec137506997f78d1384bd56 Mon Sep 17 00:00:00 2001 From: tarat44 <32471142+tarat44@users.noreply.github.com> Date: Tue, 5 Oct 2021 00:41:27 -0400 Subject: [PATCH 07/12] fix protos --- proto/pbservice/service.pb.go | 114 +++++++++------------------------- 1 file changed, 29 insertions(+), 85 deletions(-) diff --git a/proto/pbservice/service.pb.go b/proto/pbservice/service.pb.go index 32784edc18..9bd4b381ca 100644 --- a/proto/pbservice/service.pb.go +++ b/proto/pbservice/service.pb.go @@ -24,7 +24,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // ConnectProxyConfig describes the configuration needed for any proxy managed // or unmanaged. It describes a single logical service's listener and optionally @@ -2131,10 +2131,7 @@ func (m *ConnectProxyConfig) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -2548,10 +2545,7 @@ func (m *Upstream) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -2657,10 +2651,7 @@ func (m *ServiceConnect) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -2764,10 +2755,7 @@ func (m *ExposeConfig) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -2939,10 +2927,7 @@ func (m *ExposePath) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -3024,10 +3009,7 @@ func (m *MeshGatewayConfig) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -3116,10 +3098,7 @@ func (m *TransparentProxyConfig) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -3439,7 +3418,7 @@ func (m *ServiceDefinition) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > postIndex { @@ -3814,7 +3793,7 @@ func (m *ServiceDefinition) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > postIndex { @@ -3896,10 +3875,7 @@ func (m *ServiceDefinition) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -4000,10 +3976,7 @@ func (m *ServiceAddress) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -4091,10 +4064,7 @@ func (m *Weights) Unmarshal(dAtA []byte) error { if err != nil { return err } - if skippy < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthService } if (iNdEx + skippy) > l { @@ -4112,6 +4082,7 @@ func (m *Weights) Unmarshal(dAtA []byte) error { func skipService(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -4143,10 +4114,8 @@ func skipService(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -4167,55 +4136,30 @@ func skipService(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthService } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipService(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") ) From c5479cefe6c6dc7b688569e41b4f032c98fe46cf Mon Sep 17 00:00:00 2001 From: tarat44 <32471142+tarat44@users.noreply.github.com> Date: Tue, 5 Oct 2021 00:48:09 -0400 Subject: [PATCH 08/12] fix test --- agent/checks/check_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/checks/check_test.go b/agent/checks/check_test.go index b3cf312bc7..ba61aeeabf 100644 --- a/agent/checks/check_test.go +++ b/agent/checks/check_test.go @@ -1284,7 +1284,7 @@ func TestCheckH2CPING(t *testing.T) { notif := mock.NewNotify() logger := testutil.Logger(t) - statusHandler := NewStatusHandler(notif, logger, 0, 0) + statusHandler := NewStatusHandler(notif, logger, 0, 0, 0) cid := structs.NewCheckID("foo", nil) check := &CheckH2PING{ CheckID: cid, From ecdcfd63604d241c4ace8280a56b8f573fae258c Mon Sep 17 00:00:00 2001 From: tarat44 <32471142+tarat44@users.noreply.github.com> Date: Wed, 6 Oct 2021 22:13:01 -0400 Subject: [PATCH 09/12] only set default on H2PingUseTLS if H2PING is set --- agent/config/builder.go | 9 ++++++++- agent/config/runtime_test.go | 1 - agent/http_decode_test.go | 2 +- agent/structs/check_definition.go | 7 ++++++- agent/structs/check_type.go | 7 +++++++ 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/agent/config/builder.go b/agent/config/builder.go index c27cb1866a..ec98130e91 100644 --- a/agent/config/builder.go +++ b/agent/config/builder.go @@ -1541,6 +1541,13 @@ func (b *builder) checkVal(v *CheckDefinition) *structs.CheckDefinition { return nil } + var H2PingUseTLSVal bool + if stringVal(v.H2PING) != "" { + H2PingUseTLSVal = boolValWithDefault(v.H2PingUseTLS, true) + } else { + H2PingUseTLSVal = boolVal(v.H2PingUseTLS) + } + id := types.CheckID(stringVal(v.ID)) return &structs.CheckDefinition{ @@ -1571,7 +1578,7 @@ func (b *builder) checkVal(v *CheckDefinition) *structs.CheckDefinition { FailuresBeforeCritical: intVal(v.FailuresBeforeCritical), FailuresBeforeWarning: intValWithDefault(v.FailuresBeforeWarning, intVal(v.FailuresBeforeCritical)), H2PING: stringVal(v.H2PING), - H2PingUseTLS: boolValWithDefault(v.H2PingUseTLS, true), + H2PingUseTLS: H2PingUseTLSVal, DeregisterCriticalServiceAfter: b.durationVal(fmt.Sprintf("check[%s].deregister_critical_service_after", id), v.DeregisterCriticalServiceAfter), OutputMaxSize: intValWithDefault(v.OutputMaxSize, checks.DefaultBufSize), EnterpriseMeta: v.EnterpriseMeta.ToStructs(), diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go index b7a7c5079b..a939e96e89 100644 --- a/agent/config/runtime_test.go +++ b/agent/config/runtime_test.go @@ -5638,7 +5638,6 @@ func TestLoad_FullConfig(t *testing.T) { Timeout: 4868 * time.Second, TTL: 11222 * time.Second, DeregisterCriticalServiceAfter: 68482 * time.Second, - H2PingUseTLS: true, }, }, Connect: &structs.ServiceConnect{}, diff --git a/agent/http_decode_test.go b/agent/http_decode_test.go index 8560945444..ba8f060410 100644 --- a/agent/http_decode_test.go +++ b/agent/http_decode_test.go @@ -729,7 +729,7 @@ var translateH2PingUseTLS = []translateKeyTestCase{ desc: "H2PingUseTLS: neither set", in: []interface{}{}, want: true, // zero value - jsonFmtStr: "{}", + jsonFmtStr: "{" + `"h2ping":"testing"` + "}", equalityFn: h2pingUseTLSEqFn, }, } diff --git a/agent/structs/check_definition.go b/agent/structs/check_definition.go index d9d54dcb4d..9c0f007975 100644 --- a/agent/structs/check_definition.go +++ b/agent/structs/check_definition.go @@ -76,7 +76,7 @@ func (t *CheckDefinition) UnmarshalJSON(data []byte) (err error) { }{ Alias: (*Alias)(t), } - + // Set default values aux.H2PingUseTLS = true aux.H2PingUseTLSSnake = true if err = lib.UnmarshalJSON(data, &aux); err != nil { @@ -111,6 +111,11 @@ func (t *CheckDefinition) UnmarshalJSON(data []byte) (err error) { if !aux.H2PingUseTLSSnake { t.H2PingUseTLS = aux.H2PingUseTLSSnake } + // unset default values if it is not an H2Ping check + if t.H2PING == "" { + aux.H2PingUseTLS = false + aux.H2PingUseTLSSnake = false + } // Parse special values if aux.Interval != nil { diff --git a/agent/structs/check_type.go b/agent/structs/check_type.go index 00eff8e23e..13a06e0aab 100644 --- a/agent/structs/check_type.go +++ b/agent/structs/check_type.go @@ -93,8 +93,10 @@ func (t *CheckType) UnmarshalJSON(data []byte) (err error) { }{ Alias: (*Alias)(t), } + // set default values aux.H2PingUseTLS = true aux.H2PingUseTLSSnake = true + if err = lib.UnmarshalJSON(data, aux); err != nil { return err } @@ -162,6 +164,11 @@ func (t *CheckType) UnmarshalJSON(data []byte) (err error) { if !aux.H2PingUseTLSSnake { t.H2PingUseTLS = aux.H2PingUseTLSSnake } + // unset default values if it is not an H2Ping check + if t.H2PING == "" { + aux.H2PingUseTLS = false + aux.H2PingUseTLSSnake = false + } return nil From e52f5071d090e1983764460837bf8764423e3724 Mon Sep 17 00:00:00 2001 From: tarat44 <32471142+tarat44@users.noreply.github.com> Date: Thu, 7 Oct 2021 02:29:41 -0400 Subject: [PATCH 10/12] fix mistakes in docs --- website/content/api-docs/agent/check.mdx | 5 ++++- website/content/docs/discovery/checks.mdx | 12 ++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/website/content/api-docs/agent/check.mdx b/website/content/api-docs/agent/check.mdx index ea97613757..ec97e31d11 100644 --- a/website/content/api-docs/agent/check.mdx +++ b/website/content/api-docs/agent/check.mdx @@ -186,7 +186,10 @@ The table below shows this endpoint's support for - `H2PING` `(string "")` - Specifies an address that uses http2 to run a ping check on. At the specified `Interval`, a connection is made to the address, and a ping is sent. If the ping is successful, the check will be classified as `passing`, otherwise it will be marked as `critical`. - TLS is used by default. To disable TLS and use h2c, set `H2PINGUseTLS` to `false`. + TLS is used by default. To disable TLS and use h2c, set `H2PingUseTLS` to `false`. + If TLS is enabled, a valid SSL certificate is required by default, but verification can be removed with `TLSSkipVerify`. + +- `H2PingUseTLS` `(bool: true)` - Specifies if TLS should be used for H2PING check. If TLS is enabled, a valid SSL certificate is required by default, but verification can be removed with `TLSSkipVerify`. - `HTTP` `(string: "")` - Specifies an `HTTP` check to perform a `GET` request diff --git a/website/content/docs/discovery/checks.mdx b/website/content/docs/discovery/checks.mdx index cae21a938c..d9a6986d33 100644 --- a/website/content/docs/discovery/checks.mdx +++ b/website/content/docs/discovery/checks.mdx @@ -122,7 +122,7 @@ There are several different kinds of checks: - `H2ping + Interval` - These checks test an endpoint that uses http2 by connecting to the endpoint and sending a ping frame. TLS is assumed to be configured by default. - To disable TLS and use h2c, set `h2ping_enable_tls` to `false`. If the ping is successful + To disable TLS and use h2c, set `h2ping_use_tls` to `false`. If the ping is successful within a specified timeout, then the check is updated as passing. The timeout defaults to 10 seconds, but is configurable using the `timeout` field. If TLS is enabled a valid certificate is required, unless `tls_skip_verify` is set to `true`. @@ -165,7 +165,7 @@ A HTTP check: "tls_server_name": "", "tls_skip_verify": false, "method": "POST", - "header": {"Content-Type": ["application/json"]}, + "header": { "Content-Type": ["application/json"] }, "body": "{\"method\":\"health\"}", "interval": "10s", "timeout": "1s" @@ -422,14 +422,14 @@ a health check may be configured to become passing/warning/critical only after a specified number of consecutive checks return passing/critical. The status will not transition states until the configured threshold is reached. -* `success_before_passing` - Number of consecutive successful results required - before check status transitions to passing. Defaults to `0`. Added in Consul 1.7.0. -* `failures_before_warning` - Number of consecutive unsuccessful results required +- `success_before_passing` - Number of consecutive successful results required + before check status transitions to passing. Defaults to `0`. Added in Consul 1.7.0. +- `failures_before_warning` - Number of consecutive unsuccessful results required before check status transitions to warning. Defaults to the same value as that of `failures_before_critical` to maintain the expected behavior of not changing the status of serivce checks to `warning` before `critical` unless configured to do so. Values higher than `failures_before_critical` are invalid. Added in Consul 1.11.0. -* `failures_before_critical` - Number of consecutive unsuccessful results required +- `failures_before_critical` - Number of consecutive unsuccessful results required before check status transitions to critical. Defaults to `0`. Added in Consul 1.7.0. This feature is available for HTTP, TCP, gRPC, Docker & Monitor checks. From 3fe637156c19b423492a5766fd81264fa85e5165 Mon Sep 17 00:00:00 2001 From: tarat44 <32471142+tarat44@users.noreply.github.com> Date: Sat, 9 Oct 2021 17:12:52 -0400 Subject: [PATCH 11/12] add test cases for h2ping_use_tls default behavior --- agent/config/runtime_test.go | 36 ++++++++++++++++++++++++++++++++++++ agent/http_decode_test.go | 8 ++++---- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/agent/config/runtime_test.go b/agent/config/runtime_test.go index a939e96e89..43daf2187e 100644 --- a/agent/config/runtime_test.go +++ b/agent/config/runtime_test.go @@ -2375,6 +2375,42 @@ func TestLoad_IntegrationWithFlags(t *testing.T) { rt.DataDir = dataDir }, }) + run(t, testCase{ + desc: "h2ping check without h2ping_use_tls set", + args: []string{ + `-data-dir=` + dataDir, + }, + json: []string{ + `{ "check": { "name": "a", "h2ping": "localhost:55555", "interval": "5s" } }`, + }, + hcl: []string{ + `check = { name = "a" h2ping = "localhost:55555" interval = "5s" }`, + }, + expected: func(rt *RuntimeConfig) { + rt.Checks = []*structs.CheckDefinition{ + {Name: "a", H2PING: "localhost:55555", H2PingUseTLS: true, OutputMaxSize: checks.DefaultBufSize, Interval: 5 * time.Second}, + } + rt.DataDir = dataDir + }, + }) + run(t, testCase{ + desc: "h2ping check with h2ping_use_tls set to false", + args: []string{ + `-data-dir=` + dataDir, + }, + json: []string{ + `{ "check": { "name": "a", "h2ping": "localhost:55555", "h2ping_use_tls": false, "interval": "5s" } }`, + }, + hcl: []string{ + `check = { name = "a" h2ping = "localhost:55555" h2ping_use_tls = false interval = "5s" }`, + }, + expected: func(rt *RuntimeConfig) { + rt.Checks = []*structs.CheckDefinition{ + {Name: "a", H2PING: "localhost:55555", H2PingUseTLS: false, OutputMaxSize: checks.DefaultBufSize, Interval: 5 * time.Second}, + } + rt.DataDir = dataDir + }, + }) run(t, testCase{ desc: "alias check with no node", args: []string{ diff --git a/agent/http_decode_test.go b/agent/http_decode_test.go index ba8f060410..50347f6e1e 100644 --- a/agent/http_decode_test.go +++ b/agent/http_decode_test.go @@ -702,7 +702,7 @@ func h2pingUseTLSEqFn(out interface{}, want interface{}) error { return nil } -var h2pingUseTLSFields = []string{`"H2PingUseTLS": %s`, `"h2ping_use_tls": %s`} +var h2pingUseTLSFields = []string{`"H2PING": "testing"`, `"H2PingUseTLS": %s`, `"h2ping_use_tls": %s`} var translateH2PingUseTLS = []translateKeyTestCase{ { desc: "H2PingUseTLS: both set", @@ -715,21 +715,21 @@ var translateH2PingUseTLS = []translateKeyTestCase{ desc: "H2PingUseTLS:: first set", in: []interface{}{`false`}, want: false, - jsonFmtStr: "{" + h2pingUseTLSFields[0] + "}", + jsonFmtStr: "{" + strings.Join(h2pingUseTLSFields[0:2], ",") + "}", equalityFn: h2pingUseTLSEqFn, }, { desc: "H2PingUseTLS: second set", in: []interface{}{`false`}, want: false, - jsonFmtStr: "{" + h2pingUseTLSFields[1] + "}", + jsonFmtStr: "{" + h2pingUseTLSFields[0] + "," + h2pingUseTLSFields[2] + "}", equalityFn: h2pingUseTLSEqFn, }, { desc: "H2PingUseTLS: neither set", in: []interface{}{}, want: true, // zero value - jsonFmtStr: "{" + `"h2ping":"testing"` + "}", + jsonFmtStr: "{" + h2pingUseTLSFields[0] + "}", equalityFn: h2pingUseTLSEqFn, }, } From 166269f93bcb22ebc28663ba7226f5b6ebc2087b Mon Sep 17 00:00:00 2001 From: tarat44 <32471142+tarat44@users.noreply.github.com> Date: Sun, 10 Oct 2021 17:52:26 -0400 Subject: [PATCH 12/12] preload json values in structs to determine defaults --- agent/structs/check_definition.go | 22 +++++++++++++--------- agent/structs/check_type.go | 20 +++++++++++--------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/agent/structs/check_definition.go b/agent/structs/check_definition.go index 9c0f007975..434f35e65f 100644 --- a/agent/structs/check_definition.go +++ b/agent/structs/check_definition.go @@ -76,9 +76,17 @@ func (t *CheckDefinition) UnmarshalJSON(data []byte) (err error) { }{ Alias: (*Alias)(t), } - // Set default values - aux.H2PingUseTLS = true - aux.H2PingUseTLSSnake = true + + // Preevaluate struct values to determine where to set defaults + if err = lib.UnmarshalJSON(data, &aux); err != nil { + return err + } + // Set defaults + if aux.H2PING != "" { + aux.H2PingUseTLS = true + aux.H2PingUseTLSSnake = true + } + if err = lib.UnmarshalJSON(data, &aux); err != nil { return err } @@ -108,14 +116,10 @@ func (t *CheckDefinition) UnmarshalJSON(data []byte) (err error) { if t.ServiceID == "" { t.ServiceID = aux.ServiceIDSnake } - if !aux.H2PingUseTLSSnake { + + if (aux.H2PING != "" && !aux.H2PingUseTLSSnake) || (aux.H2PING == "" && aux.H2PingUseTLSSnake) { t.H2PingUseTLS = aux.H2PingUseTLSSnake } - // unset default values if it is not an H2Ping check - if t.H2PING == "" { - aux.H2PingUseTLS = false - aux.H2PingUseTLSSnake = false - } // Parse special values if aux.Interval != nil { diff --git a/agent/structs/check_type.go b/agent/structs/check_type.go index 13a06e0aab..7f3b583707 100644 --- a/agent/structs/check_type.go +++ b/agent/structs/check_type.go @@ -93,9 +93,16 @@ func (t *CheckType) UnmarshalJSON(data []byte) (err error) { }{ Alias: (*Alias)(t), } - // set default values - aux.H2PingUseTLS = true - aux.H2PingUseTLSSnake = true + + // Preevaluate struct values to determine where to set defaults + if err = lib.UnmarshalJSON(data, aux); err != nil { + return err + } + // Set defaults + if aux.H2PING != "" { + aux.H2PingUseTLS = true + aux.H2PingUseTLSSnake = true + } if err = lib.UnmarshalJSON(data, aux); err != nil { return err @@ -161,14 +168,9 @@ func (t *CheckType) UnmarshalJSON(data []byte) (err error) { t.DeregisterCriticalServiceAfter = time.Duration(v) } } - if !aux.H2PingUseTLSSnake { + if (aux.H2PING != "" && !aux.H2PingUseTLSSnake) || (aux.H2PING == "" && aux.H2PingUseTLSSnake) { t.H2PingUseTLS = aux.H2PingUseTLSSnake } - // unset default values if it is not an H2Ping check - if t.H2PING == "" { - aux.H2PingUseTLS = false - aux.H2PingUseTLSSnake = false - } return nil