2023-08-03 18:42:04 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-21 17:31:54 +00:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
2023-08-03 18:42:04 +00:00
|
|
|
|
|
|
|
syntax = "proto3";
|
|
|
|
|
2023-09-22 16:51:15 +00:00
|
|
|
package hashicorp.consul.mesh.v2beta1;
|
|
|
|
|
|
|
|
import "pbcatalog/v2beta1/failover_policy.proto";
|
|
|
|
import "pbcatalog/v2beta1/protocol.proto";
|
|
|
|
import "pbcatalog/v2beta1/service_endpoints.proto";
|
|
|
|
import "pbmesh/v2beta1/common.proto";
|
|
|
|
import "pbmesh/v2beta1/destination_policy.proto";
|
|
|
|
import "pbmesh/v2beta1/grpc_route.proto";
|
|
|
|
import "pbmesh/v2beta1/http_route.proto";
|
|
|
|
import "pbmesh/v2beta1/http_route_retries.proto";
|
|
|
|
import "pbmesh/v2beta1/http_route_timeouts.proto";
|
2023-09-21 21:18:47 +00:00
|
|
|
import "pbresource/annotations.proto";
|
2023-09-14 22:19:04 +00:00
|
|
|
import "pbresource/resource.proto";
|
2023-08-03 18:42:04 +00:00
|
|
|
|
|
|
|
// This is a Resource type.
|
|
|
|
message ComputedRoutes {
|
2023-09-21 21:18:47 +00:00
|
|
|
option (hashicorp.consul.resource.spec) = {scope: SCOPE_NAMESPACE};
|
|
|
|
|
2023-08-03 18:42:04 +00:00
|
|
|
map<string, ComputedPortRoutes> ported_configs = 1;
|
2023-09-22 20:46:14 +00:00
|
|
|
|
|
|
|
// BoundReferences is a slice of mixed type references of resources that were
|
|
|
|
// involved in the formulation of this resource.
|
|
|
|
repeated hashicorp.consul.resource.Reference bound_references = 2;
|
2023-08-03 18:42:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message ComputedPortRoutes {
|
|
|
|
oneof config {
|
2023-09-12 17:08:51 +00:00
|
|
|
ComputedHTTPRoute http = 1;
|
|
|
|
ComputedGRPCRoute grpc = 2;
|
|
|
|
ComputedTCPRoute tcp = 3;
|
2023-08-03 18:42:04 +00:00
|
|
|
}
|
|
|
|
bool using_default_config = 4; // TODO
|
|
|
|
|
2023-09-14 22:19:04 +00:00
|
|
|
ParentReference parent_ref = 5;
|
|
|
|
// Protocol is the ParentRef.Port's protocol. It is based on the value in the
|
|
|
|
// Service object, but may differ depending upon which xRoutes are actually
|
|
|
|
// in use.
|
2023-09-22 16:51:15 +00:00
|
|
|
hashicorp.consul.catalog.v2beta1.Protocol protocol = 6;
|
2023-09-14 22:19:04 +00:00
|
|
|
|
2023-08-03 18:42:04 +00:00
|
|
|
// map key is an opaque string; like disco chain target name
|
2023-09-14 22:19:04 +00:00
|
|
|
map<string, BackendTargetDetails> targets = 7;
|
2023-08-03 18:42:04 +00:00
|
|
|
}
|
|
|
|
|
2023-09-12 17:08:51 +00:00
|
|
|
message ComputedHTTPRoute {
|
2023-09-14 22:19:04 +00:00
|
|
|
reserved 1; // hostnames
|
|
|
|
repeated ComputedHTTPRouteRule rules = 2;
|
2023-08-03 18:42:04 +00:00
|
|
|
}
|
|
|
|
|
2023-09-12 17:08:51 +00:00
|
|
|
message ComputedHTTPRouteRule {
|
2023-08-03 18:42:04 +00:00
|
|
|
repeated HTTPRouteMatch matches = 1;
|
|
|
|
repeated HTTPRouteFilter filters = 2;
|
2023-09-12 17:08:51 +00:00
|
|
|
repeated ComputedHTTPBackendRef backend_refs = 3;
|
2023-08-03 18:42:04 +00:00
|
|
|
HTTPRouteTimeouts timeouts = 4;
|
|
|
|
HTTPRouteRetries retries = 5;
|
|
|
|
}
|
|
|
|
|
2023-09-12 17:08:51 +00:00
|
|
|
message ComputedHTTPBackendRef {
|
|
|
|
// BackendTarget indicates which key in the targets map provides
|
|
|
|
// the rest of the configuration.
|
|
|
|
//
|
|
|
|
// If this field is set to the empty string, or is the sentinel value
|
|
|
|
// "NULL-ROUTE" is an indication that all of the traffic destined for this
|
|
|
|
// backend reference should be null routed in a format appropriate for the
|
|
|
|
// protocol (i.e. for HTTP use 5xx).
|
2023-08-03 18:42:04 +00:00
|
|
|
string backend_target = 1;
|
|
|
|
uint32 weight = 2;
|
|
|
|
repeated HTTPRouteFilter filters = 3;
|
|
|
|
}
|
|
|
|
|
2023-09-12 17:08:51 +00:00
|
|
|
message ComputedGRPCRoute {
|
2023-09-14 22:19:04 +00:00
|
|
|
reserved 1; // hostnames
|
|
|
|
repeated ComputedGRPCRouteRule rules = 2;
|
2023-08-03 18:42:04 +00:00
|
|
|
}
|
|
|
|
|
2023-09-12 17:08:51 +00:00
|
|
|
message ComputedGRPCRouteRule {
|
2023-08-03 18:42:04 +00:00
|
|
|
repeated GRPCRouteMatch matches = 1;
|
|
|
|
repeated GRPCRouteFilter filters = 2;
|
2023-09-12 17:08:51 +00:00
|
|
|
repeated ComputedGRPCBackendRef backend_refs = 3;
|
2023-08-03 18:42:04 +00:00
|
|
|
HTTPRouteTimeouts timeouts = 4;
|
|
|
|
HTTPRouteRetries retries = 5;
|
|
|
|
}
|
|
|
|
|
2023-09-12 17:08:51 +00:00
|
|
|
message ComputedGRPCBackendRef {
|
|
|
|
// BackendTarget indicates which key in the targets map provides
|
|
|
|
// the rest of the configuration.
|
|
|
|
//
|
|
|
|
// If this field is set to the empty string, or is the sentinel value
|
|
|
|
// "NULL-ROUTE" is an indication that all of the traffic destined for this
|
|
|
|
// backend reference should be null routed in a format appropriate for the
|
|
|
|
// protocol (i.e. for HTTP use 5xx).
|
2023-08-03 18:42:04 +00:00
|
|
|
string backend_target = 1;
|
|
|
|
uint32 weight = 2;
|
|
|
|
repeated GRPCRouteFilter filters = 3;
|
|
|
|
}
|
|
|
|
|
2023-09-12 17:08:51 +00:00
|
|
|
message ComputedTCPRoute {
|
2023-09-14 22:19:04 +00:00
|
|
|
repeated ComputedTCPRouteRule rules = 1;
|
2023-08-03 18:42:04 +00:00
|
|
|
}
|
|
|
|
|
2023-09-12 17:08:51 +00:00
|
|
|
message ComputedTCPRouteRule {
|
|
|
|
repeated ComputedTCPBackendRef backend_refs = 1;
|
2023-08-03 18:42:04 +00:00
|
|
|
}
|
|
|
|
|
2023-10-13 14:55:58 +00:00
|
|
|
// TODO: look into smuggling the target through a different typeURL, or just skip in favor of letting the caller do their own lookups?
|
2023-09-12 17:08:51 +00:00
|
|
|
message ComputedTCPBackendRef {
|
|
|
|
// BackendTarget indicates which key in the targets map provides
|
|
|
|
// the rest of the configuration.
|
|
|
|
//
|
|
|
|
// If this field is set to the empty string, or is the sentinel value
|
|
|
|
// "NULL-ROUTE" is an indication that all of the traffic destined for this
|
|
|
|
// backend reference should be null routed in a format appropriate for the
|
|
|
|
// protocol (i.e. for HTTP use 5xx).
|
2023-08-03 18:42:04 +00:00
|
|
|
string backend_target = 1;
|
|
|
|
uint32 weight = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message BackendTargetDetails {
|
2023-09-20 16:59:01 +00:00
|
|
|
BackendTargetDetailsType type = 1;
|
|
|
|
BackendReference backend_ref = 2;
|
2023-08-03 18:42:04 +00:00
|
|
|
|
2023-09-20 16:59:01 +00:00
|
|
|
string mesh_port = 3;
|
|
|
|
ComputedFailoverConfig failover_config = 4;
|
|
|
|
DestinationConfig destination_config = 5;
|
2023-09-14 22:19:04 +00:00
|
|
|
|
2023-09-20 16:59:01 +00:00
|
|
|
reserved 6 to 20; // leaving a gap between computed and retroactively added fields.
|
2023-09-14 22:19:04 +00:00
|
|
|
|
|
|
|
// ServiceEndpointsID is not populated naturally and the field exists only for
|
|
|
|
// downstream consumers.
|
|
|
|
hashicorp.consul.resource.ID service_endpoints_id = 21;
|
|
|
|
|
|
|
|
// ServiceEndpoints is not populated naturally and the field exists only for
|
|
|
|
// downstream consumers.
|
2023-09-22 16:51:15 +00:00
|
|
|
hashicorp.consul.catalog.v2beta1.ServiceEndpoints service_endpoints = 22;
|
2023-09-14 22:19:04 +00:00
|
|
|
|
|
|
|
// IdentityRefs are not populated naturally and the field exists only for
|
|
|
|
// downstream consumers.
|
|
|
|
repeated hashicorp.consul.resource.Reference identity_refs = 23;
|
2023-08-03 18:42:04 +00:00
|
|
|
}
|
2023-09-20 16:59:01 +00:00
|
|
|
|
2023-10-13 14:55:58 +00:00
|
|
|
// +kubebuilder:validation:Enum=BACKEND_TARGET_DETAILS_TYPE_UNSPECIFIED;BACKEND_TARGET_DETAILS_TYPE_DIRECT;BACKEND_TARGET_DETAILS_TYPE_INDIRECT
|
|
|
|
// +kubebuilder:validation:Type=string
|
2023-09-20 16:59:01 +00:00
|
|
|
enum BackendTargetDetailsType {
|
|
|
|
BACKEND_TARGET_DETAILS_TYPE_UNSPECIFIED = 0;
|
|
|
|
|
|
|
|
// Direct means that the target is directly routable from a route. This does
|
|
|
|
// not mean that the target is not also indirect though.
|
|
|
|
BACKEND_TARGET_DETAILS_TYPE_DIRECT = 1;
|
|
|
|
|
|
|
|
// Indirect means that the target is not directly routable from a route.
|
|
|
|
//
|
|
|
|
// One example would be for a FailoverPolicy destination.
|
|
|
|
BACKEND_TARGET_DETAILS_TYPE_INDIRECT = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ComputedFailoverConfig {
|
|
|
|
repeated ComputedFailoverDestination destinations = 1;
|
2023-09-22 16:51:15 +00:00
|
|
|
hashicorp.consul.catalog.v2beta1.FailoverMode mode = 2;
|
2023-09-20 16:59:01 +00:00
|
|
|
repeated string regions = 3;
|
|
|
|
|
|
|
|
// SamenessGroup specifies the sameness group to failover to.
|
|
|
|
string sameness_group = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ComputedFailoverDestination {
|
2023-10-13 14:55:58 +00:00
|
|
|
// BackendTarget must be a Service.
|
2023-09-20 16:59:01 +00:00
|
|
|
string backend_target = 1;
|
|
|
|
}
|