Nitya Dhanushkodi 92aab7ea31
[NET-5586][rebased] v2: Support virtual port references in config (#20371)
[OG Author: michael.zalimeni@hashicorp.com, rebase needed a separate PR]

* v2: support virtual port in Service port references

In addition to Service target port references, allow users to specify a
port by stringified virtual port value. This is useful in environments
such as Kubernetes where typical configuration is written in terms of
Service virtual ports rather than workload (pod) target port names.

Retaining the option of referencing target ports by name supports VMs,
Nomad, and other use cases where virtual ports are not used by default.

To support both uses cases at once, we will strictly interpret port
references based on whether the value is numeric. See updated
`ServicePort` docs for more details.

* v2: update service ref docs for virtual port support

Update proto and generated .go files with docs reflecting virtual port
reference support.

* v2: add virtual port references to L7 topo test

Add coverage for mixed virtual and target port references to existing
test.

* update failover policy controller tests to work with computed failover policy and assert error conditions against FailoverPolicy and ComputedFailoverPolicy resources

* accumulate services; don't overwrite them in enterprise

---------

Co-authored-by: Michael Zalimeni <michael.zalimeni@hashicorp.com>
Co-authored-by: R.B. Boyer <rb@hashicorp.com>
2024-01-29 10:43:41 -08:00

38 lines
1.1 KiB
Protocol Buffer

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
syntax = "proto3";
package hashicorp.consul.mesh.v2beta1;
import "pbresource/resource.proto";
// NOTE: roughly equivalent to structs.ResourceReference
message ParentReference {
// For east/west configuration, this should point to a Service.
// For north/south it should point to a Gateway.
hashicorp.consul.resource.Reference ref = 1;
// For east/west this is the name of the Consul Service port to direct traffic to
// or empty to imply all.
// For north/south this is TBD.
//
// For more details on potential values of this field, see documentation for
// Service.ServicePort.
string port = 2;
}
message BackendReference {
// For east/west configuration, this should point to a Service.
hashicorp.consul.resource.Reference ref = 1;
// For east/west this is the name of the Consul Service port to direct traffic to
// or empty to imply using the same value as the parent ref.
// For north/south this is TBD.
//
// For more details on potential values of this field, see documentation for
// Service.ServicePort.
string port = 2;
string datacenter = 3;
}