consul/proto/private/pbservice/healthcheck.proto

163 lines
5.0 KiB
Protocol Buffer
Raw Normal View History

// Copyright (c) HashiCorp, Inc.
[COMPLIANCE] License changes (#18443) * Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at <Blog URL>, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-08-11 13:12:13 +00:00
// SPDX-License-Identifier: BUSL-1.1
syntax = "proto3";
package hashicorp.consul.internal.service;
import "google/protobuf/duration.proto";
Protobuf Refactoring for Multi-Module Cleanliness (#16302) Protobuf Refactoring for Multi-Module Cleanliness This commit includes the following: Moves all packages that were within proto/ to proto/private Rewrites imports to account for the packages being moved Adds in buf.work.yaml to enable buf workspaces Names the proto-public buf module so that we can override the Go package imports within proto/buf.yaml Bumps the buf version dependency to 1.14.0 (I was trying out the version to see if it would get around an issue - it didn't but it also doesn't break things and it seemed best to keep up with the toolchain changes) Why: In the future we will need to consume other protobuf dependencies such as the Google HTTP annotations for openapi generation or grpc-gateway usage. There were some recent changes to have our own ratelimiting annotations. The two combined were not working when I was trying to use them together (attempting to rebase another branch) Buf workspaces should be the solution to the problem Buf workspaces means that each module will have generated Go code that embeds proto file names relative to the proto dir and not the top level repo root. This resulted in proto file name conflicts in the Go global protobuf type registry. The solution to that was to add in a private/ directory into the path within the proto/ directory. That then required rewriting all the imports. Is this safe? AFAICT yes The gRPC wire protocol doesn't seem to care about the proto file names (although the Go grpc code does tack on the proto file name as Metadata in the ServiceDesc) Other than imports, there were no changes to any generated code as a result of this.
2023-02-17 21:14:46 +00:00
import "private/pbcommon/common.proto";
// HealthCheck represents a single check on a given node
//
// mog annotation:
//
// target=github.com/hashicorp/consul/agent/structs.HealthCheck
// output=healthcheck.gen.go
// name=Structs
message HealthCheck {
string Node = 1;
// mog: func-to=CheckIDType func-from=string
string CheckID = 2;
string Name = 3;
string Status = 4; // The current check status
string Notes = 5; // Additional notes with the status
string Output = 6; // Holds output of script runs
string ServiceID = 7; // optional associated service
string ServiceName = 8; // optional service name
repeated string ServiceTags = 9; // optional service tags
string Type = 12; // Check type: http/ttl/tcp/etc
HealthCheckDefinition Definition = 10;
// mog: func-to=RaftIndexToStructs func-from=NewRaftIndexFromStructs
common.RaftIndex RaftIndex = 11;
// mog: func-to=EnterpriseMetaToStructs func-from=NewEnterpriseMetaFromStructs
common.EnterpriseMeta EnterpriseMeta = 13;
// mog: func-to=int func-from=int32
int32 ExposedPort = 14;
string Interval = 15;
string Timeout = 16;
string PeerName = 17;
}
message HeaderValue {
repeated string Value = 1;
}
// HealthCheckDefinition of a single HealthCheck.
//
// mog annotation:
//
// target=github.com/hashicorp/consul/agent/structs.HealthCheckDefinition
// output=healthcheck.gen.go
// name=Structs
message HealthCheckDefinition {
string HTTP = 1;
string TLSServerName = 19;
bool TLSSkipVerify = 2;
// mog: func-to=MapHeadersToStructs func-from=NewMapHeadersFromStructs
map<string, HeaderValue> Header = 3;
string Method = 4;
string Body = 18;
bool DisableRedirects = 22;
string TCP = 5;
bool TCPUseTLS = 25;
UDP check for service stanza #12221 (#12722) * UDP check for service stanza #12221 * add pass status on timeout condition * delete useless files * Update check_test.go improve comment in test * fix test * fix requested changes and update TestRuntimeConfig_Sanitize.golden * add freeport to TestCheckUDPCritical * improve comment for CheckUDP struct * fix requested changes * fix requested changes * fix requested changes * add UDP to proto * add UDP to proto and add a changelog * add requested test on agent_endpoint_test.go * add test for given endpoints * fix failing tests * add documentation for udp healthcheck * regenerate proto using buf * Update website/content/api-docs/agent/check.mdx Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> * Update website/content/api-docs/agent/check.mdx Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> * Update website/content/docs/discovery/checks.mdx Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> * Update website/content/docs/ecs/configuration-reference.mdx Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> * Update website/content/docs/ecs/configuration-reference.mdx Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> * add debug echo * add debug circle-ci * add debug circle-ci bash * use echo instead of status_stage * remove debug and status from devtools script and use echo instead * Update website/content/api-docs/agent/check.mdx Co-authored-by: Jared Kirschner <85913323+jkirschner-hashicorp@users.noreply.github.com> * fix test * replace status_stage with status * replace functions with echo Co-authored-by: Dhia Ayachi <dhia@hashicorp.com> Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> Co-authored-by: Jared Kirschner <85913323+jkirschner-hashicorp@users.noreply.github.com>
2022-06-06 19:13:19 +00:00
string UDP = 23;
2022-06-07 17:27:14 +00:00
string OSService = 24;
// mog: func-to=structs.DurationFromProto func-from=structs.DurationToProto
google.protobuf.Duration Interval = 6;
// mog: func-to=uint func-from=uint32
uint32 OutputMaxSize = 9;
// mog: func-to=structs.DurationFromProto func-from=structs.DurationToProto
google.protobuf.Duration Timeout = 7;
// mog: func-to=structs.DurationFromProto func-from=structs.DurationToProto
google.protobuf.Duration DeregisterCriticalServiceAfter = 8;
repeated string ScriptArgs = 10;
string DockerContainerID = 11;
string Shell = 12;
string H2PING = 20;
bool H2PingUseTLS = 21;
string GRPC = 13;
bool GRPCUseTLS = 14;
string AliasNode = 15;
string AliasService = 16;
// mog: func-to=structs.DurationFromProto func-from=structs.DurationToProto
google.protobuf.Duration TTL = 17;
}
// CheckType is used to create either the CheckMonitor or the CheckTTL.
// The following types are supported: Script, HTTP, TCP, Docker, TTL, GRPC,
// Alias. Script, H2PING,
// HTTP, Docker, TCP, H2PING and GRPC all require Interval. Only one of the types may
// to be provided: TTL or Script/Interval or HTTP/Interval or TCP/Interval or
// Docker/Interval or GRPC/Interval or H2PING/Interval or AliasService.
//
// mog annotation:
//
// target=github.com/hashicorp/consul/agent/structs.CheckType
// output=healthcheck.gen.go
// name=Structs
message CheckType {
// mog: func-to=CheckIDType func-from=string
string CheckID = 1;
string Name = 2;
string Status = 3;
string Notes = 4;
repeated string ScriptArgs = 5;
string HTTP = 6;
// mog: func-to=MapHeadersToStructs func-from=NewMapHeadersFromStructs
map<string, HeaderValue> Header = 20;
string Method = 7;
string Body = 26;
bool DisableRedirects = 31;
string TCP = 8;
bool TCPUseTLS = 34;
UDP check for service stanza #12221 (#12722) * UDP check for service stanza #12221 * add pass status on timeout condition * delete useless files * Update check_test.go improve comment in test * fix test * fix requested changes and update TestRuntimeConfig_Sanitize.golden * add freeport to TestCheckUDPCritical * improve comment for CheckUDP struct * fix requested changes * fix requested changes * fix requested changes * add UDP to proto * add UDP to proto and add a changelog * add requested test on agent_endpoint_test.go * add test for given endpoints * fix failing tests * add documentation for udp healthcheck * regenerate proto using buf * Update website/content/api-docs/agent/check.mdx Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> * Update website/content/api-docs/agent/check.mdx Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> * Update website/content/docs/discovery/checks.mdx Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> * Update website/content/docs/ecs/configuration-reference.mdx Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> * Update website/content/docs/ecs/configuration-reference.mdx Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> * add debug echo * add debug circle-ci * add debug circle-ci bash * use echo instead of status_stage * remove debug and status from devtools script and use echo instead * Update website/content/api-docs/agent/check.mdx Co-authored-by: Jared Kirschner <85913323+jkirschner-hashicorp@users.noreply.github.com> * fix test * replace status_stage with status * replace functions with echo Co-authored-by: Dhia Ayachi <dhia@hashicorp.com> Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> Co-authored-by: Jared Kirschner <85913323+jkirschner-hashicorp@users.noreply.github.com>
2022-06-06 19:13:19 +00:00
string UDP = 32;
2022-06-07 17:27:14 +00:00
string OSService = 33;
// mog: func-to=structs.DurationFromProto func-from=structs.DurationToProto
google.protobuf.Duration Interval = 9;
string AliasNode = 10;
string AliasService = 11;
string DockerContainerID = 12;
string Shell = 13;
string H2PING = 28;
bool H2PingUseTLS = 30;
string GRPC = 14;
bool GRPCUseTLS = 15;
string TLSServerName = 27;
bool TLSSkipVerify = 16;
2022-06-07 17:27:14 +00:00
2022-03-23 16:10:03 +00:00
// mog: func-to=structs.DurationFromProto func-from=structs.DurationToProto
google.protobuf.Duration Timeout = 17;
2022-03-23 16:10:03 +00:00
// mog: func-to=structs.DurationFromProto func-from=structs.DurationToProto
google.protobuf.Duration TTL = 18;
// mog: func-to=int func-from=int32
int32 SuccessBeforePassing = 21;
// mog: func-to=int func-from=int32
int32 FailuresBeforeWarning = 29;
// mog: func-to=int func-from=int32
int32 FailuresBeforeCritical = 22;
// Definition fields used when exposing checks through a proxy
string ProxyHTTP = 23;
string ProxyGRPC = 24;
// DeregisterCriticalServiceAfter, if >0, will cause the associated
// service, if any, to be deregistered if this check is critical for
// longer than this duration.
// mog: func-to=structs.DurationFromProto func-from=structs.DurationToProto
google.protobuf.Duration DeregisterCriticalServiceAfter = 19;
// mog: func-to=int func-from=int32
int32 OutputMaxSize = 25;
}