mirror of https://github.com/status-im/consul.git
feat(v2dns): move DNSPolicy to workload/endpoints (#20246)
This commit is contained in:
parent
938d2315e0
commit
15ab80c832
|
@ -391,6 +391,7 @@ func workloadToEndpoint(svc *pbcatalog.Service, data *workloadData) *pbcatalog.E
|
||||||
Addresses: workloadAddrs,
|
Addresses: workloadAddrs,
|
||||||
Ports: endpointPorts,
|
Ports: endpointPorts,
|
||||||
Identity: data.workload.Identity,
|
Identity: data.workload.Identity,
|
||||||
|
Dns: data.workload.Dns,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,12 @@ func TestWorkloadToEndpoint(t *testing.T) {
|
||||||
"grpc": {Port: 9090, Protocol: pbcatalog.Protocol_PROTOCOL_HTTP2},
|
"grpc": {Port: 9090, Protocol: pbcatalog.Protocol_PROTOCOL_HTTP2},
|
||||||
},
|
},
|
||||||
Identity: "test-identity",
|
Identity: "test-identity",
|
||||||
|
Dns: &pbcatalog.DNSPolicy{
|
||||||
|
Weights: &pbcatalog.Weights{
|
||||||
|
Passing: 3,
|
||||||
|
Warning: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
data := &workloadData{
|
data := &workloadData{
|
||||||
|
@ -151,6 +157,12 @@ func TestWorkloadToEndpoint(t *testing.T) {
|
||||||
// controller tests will prove that the integration works as expected.
|
// controller tests will prove that the integration works as expected.
|
||||||
HealthStatus: pbcatalog.Health_HEALTH_CRITICAL,
|
HealthStatus: pbcatalog.Health_HEALTH_CRITICAL,
|
||||||
Identity: workload.Identity,
|
Identity: workload.Identity,
|
||||||
|
Dns: &pbcatalog.DNSPolicy{
|
||||||
|
Weights: &pbcatalog.Weights{
|
||||||
|
Passing: 3,
|
||||||
|
Warning: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
prototest.AssertDeepEqual(t, expected, workloadToEndpoint(service, data))
|
prototest.AssertDeepEqual(t, expected, workloadToEndpoint(service, data))
|
||||||
|
|
|
@ -38,7 +38,7 @@ type controllerSuite struct {
|
||||||
func (suite *controllerSuite) SetupTest() {
|
func (suite *controllerSuite) SetupTest() {
|
||||||
suite.tenancies = rtest.TestTenancies()
|
suite.tenancies = rtest.TestTenancies()
|
||||||
client := svctest.NewResourceServiceBuilder().
|
client := svctest.NewResourceServiceBuilder().
|
||||||
WithRegisterFns(types.Register, types.RegisterDNSPolicy).
|
WithRegisterFns(types.Register).
|
||||||
WithTenancies(suite.tenancies...).
|
WithTenancies(suite.tenancies...).
|
||||||
Run(suite.T())
|
Run(suite.T())
|
||||||
|
|
||||||
|
|
|
@ -35,13 +35,23 @@ var (
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
dnsPolicyData = &pbcatalog.DNSPolicy{
|
workloadData = &pbcatalog.Workload{
|
||||||
Workloads: &pbcatalog.WorkloadSelector{
|
Addresses: []*pbcatalog.WorkloadAddress{
|
||||||
Prefixes: []string{""},
|
{
|
||||||
|
Host: "127.0.0.1",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Weights: &pbcatalog.Weights{
|
Ports: map[string]*pbcatalog.WorkloadPort{
|
||||||
Passing: 1,
|
"http": {
|
||||||
Warning: 1,
|
Port: 8443,
|
||||||
|
Protocol: pbcatalog.Protocol_PROTOCOL_HTTP2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
NodeName: "foo",
|
||||||
|
Identity: "api",
|
||||||
|
Locality: &pbcatalog.Locality{
|
||||||
|
Region: "us-east-1",
|
||||||
|
Zone: "1a",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -83,7 +93,7 @@ func (suite *nodeHealthControllerTestSuite) writeNode(name string, tenancy *pbre
|
||||||
func (suite *nodeHealthControllerTestSuite) SetupTest() {
|
func (suite *nodeHealthControllerTestSuite) SetupTest() {
|
||||||
suite.tenancies = resourcetest.TestTenancies()
|
suite.tenancies = resourcetest.TestTenancies()
|
||||||
client := svctest.NewResourceServiceBuilder().
|
client := svctest.NewResourceServiceBuilder().
|
||||||
WithRegisterFns(types.Register, types.RegisterDNSPolicy).
|
WithRegisterFns(types.Register).
|
||||||
WithTenancies(suite.tenancies...).
|
WithTenancies(suite.tenancies...).
|
||||||
Run(suite.T())
|
Run(suite.T())
|
||||||
|
|
||||||
|
@ -418,11 +428,11 @@ func (suite *nodeHealthControllerTestSuite) setupNodesWithTenancy(tenancy *pbres
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a DNSPolicy to be owned by the node. The type doesn't really matter it just needs
|
// create a Workload to be owned by the node. The type doesn't really matter it just needs
|
||||||
// to be something that doesn't care about its owner. All we want to prove is that we are
|
// to be something that doesn't care about its owner. All we want to prove is that we are
|
||||||
// filtering out non-NodeHealthStatus types appropriately.
|
// filtering out non-NodeHealthStatus types appropriately.
|
||||||
resourcetest.Resource(pbcatalog.DNSPolicyType, "test-policy-"+tenancy.Partition+"-"+tenancy.Namespace).
|
resourcetest.Resource(pbcatalog.WorkloadType, "test-workload-"+tenancy.Partition+"-"+tenancy.Namespace).
|
||||||
WithData(suite.T(), dnsPolicyData).
|
WithData(suite.T(), workloadData).
|
||||||
WithOwner(suite.nodeNoHealth).
|
WithOwner(suite.nodeNoHealth).
|
||||||
WithTenancy(tenancy).
|
WithTenancy(tenancy).
|
||||||
Write(suite.T(), suite.resourceClient)
|
Write(suite.T(), suite.resourceClient)
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
// Copyright (c) HashiCorp, Inc.
|
|
||||||
// SPDX-License-Identifier: BUSL-1.1
|
|
||||||
|
|
||||||
package types
|
|
||||||
|
|
||||||
import (
|
|
||||||
"math"
|
|
||||||
|
|
||||||
"github.com/hashicorp/go-multierror"
|
|
||||||
|
|
||||||
"github.com/hashicorp/consul/internal/resource"
|
|
||||||
pbcatalog "github.com/hashicorp/consul/proto-public/pbcatalog/v2beta1"
|
|
||||||
)
|
|
||||||
|
|
||||||
type DecodedDNSPolicy = resource.DecodedResource[*pbcatalog.DNSPolicy]
|
|
||||||
|
|
||||||
func RegisterDNSPolicy(r resource.Registry) {
|
|
||||||
r.Register(resource.Registration{
|
|
||||||
Type: pbcatalog.DNSPolicyType,
|
|
||||||
Proto: &pbcatalog.DNSPolicy{},
|
|
||||||
Scope: resource.ScopeNamespace,
|
|
||||||
Validate: ValidateDNSPolicy,
|
|
||||||
ACLs: ACLHooksForWorkloadSelectingType[*pbcatalog.DNSPolicy](),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var ValidateDNSPolicy = resource.DecodeAndValidate(validateDNSPolicy)
|
|
||||||
|
|
||||||
func validateDNSPolicy(res *DecodedDNSPolicy) error {
|
|
||||||
var err error
|
|
||||||
// Ensure that this resource isn't useless and is attempting to
|
|
||||||
// select at least one workload.
|
|
||||||
if selErr := ValidateSelector(res.Data.Workloads, false); selErr != nil {
|
|
||||||
err = multierror.Append(err, resource.ErrInvalidField{
|
|
||||||
Name: "workloads",
|
|
||||||
Wrapped: selErr,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate the weights
|
|
||||||
if weightErr := validateDNSPolicyWeights(res.Data.Weights); weightErr != nil {
|
|
||||||
err = multierror.Append(err, resource.ErrInvalidField{
|
|
||||||
Name: "weights",
|
|
||||||
Wrapped: weightErr,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func validateDNSPolicyWeights(weights *pbcatalog.Weights) error {
|
|
||||||
// Non nil weights are required
|
|
||||||
if weights == nil {
|
|
||||||
return resource.ErrMissing
|
|
||||||
}
|
|
||||||
|
|
||||||
var err error
|
|
||||||
if weights.Passing < 1 || weights.Passing > math.MaxUint16 {
|
|
||||||
err = multierror.Append(err, resource.ErrInvalidField{
|
|
||||||
Name: "passing",
|
|
||||||
Wrapped: errDNSPassingWeightOutOfRange,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Each weight is an unsigned integer so we don't need to
|
|
||||||
// check for negative weights.
|
|
||||||
if weights.Warning > math.MaxUint16 {
|
|
||||||
err = multierror.Append(err, resource.ErrInvalidField{
|
|
||||||
Name: "warning",
|
|
||||||
Wrapped: errDNSWarningWeightOutOfRange,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
|
@ -1,180 +0,0 @@
|
||||||
// Copyright (c) HashiCorp, Inc.
|
|
||||||
// SPDX-License-Identifier: BUSL-1.1
|
|
||||||
|
|
||||||
package types
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
"google.golang.org/protobuf/types/known/anypb"
|
|
||||||
|
|
||||||
"github.com/hashicorp/consul/internal/catalog/internal/testhelpers"
|
|
||||||
"github.com/hashicorp/consul/internal/resource"
|
|
||||||
pbcatalog "github.com/hashicorp/consul/proto-public/pbcatalog/v2beta1"
|
|
||||||
"github.com/hashicorp/consul/proto-public/pbresource"
|
|
||||||
)
|
|
||||||
|
|
||||||
func createDNSPolicyResource(t *testing.T, data protoreflect.ProtoMessage) *pbresource.Resource {
|
|
||||||
res := &pbresource.Resource{
|
|
||||||
Id: &pbresource.ID{
|
|
||||||
Type: pbcatalog.DNSPolicyType,
|
|
||||||
Tenancy: &pbresource.Tenancy{
|
|
||||||
Partition: "default",
|
|
||||||
Namespace: "default",
|
|
||||||
PeerName: "local",
|
|
||||||
},
|
|
||||||
Name: "test-policy",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
var err error
|
|
||||||
res.Data, err = anypb.New(data)
|
|
||||||
require.NoError(t, err)
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestValidateDNSPolicy_Ok(t *testing.T) {
|
|
||||||
data := &pbcatalog.DNSPolicy{
|
|
||||||
Workloads: &pbcatalog.WorkloadSelector{
|
|
||||||
Prefixes: []string{""},
|
|
||||||
},
|
|
||||||
Weights: &pbcatalog.Weights{
|
|
||||||
Passing: 3,
|
|
||||||
Warning: 0,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
res := createDNSPolicyResource(t, data)
|
|
||||||
|
|
||||||
err := ValidateDNSPolicy(res)
|
|
||||||
require.NoError(t, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestValidateDNSPolicy_ParseError(t *testing.T) {
|
|
||||||
// Any type other than the DNSPolicy type would work
|
|
||||||
// to cause the error we are expecting
|
|
||||||
data := &pbcatalog.IP{Address: "198.18.0.1"}
|
|
||||||
|
|
||||||
res := createDNSPolicyResource(t, data)
|
|
||||||
|
|
||||||
err := ValidateDNSPolicy(res)
|
|
||||||
require.Error(t, err)
|
|
||||||
require.ErrorAs(t, err, &resource.ErrDataParse{})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestValidateDNSPolicy_MissingWeights(t *testing.T) {
|
|
||||||
data := &pbcatalog.DNSPolicy{
|
|
||||||
Workloads: &pbcatalog.WorkloadSelector{
|
|
||||||
Prefixes: []string{""},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
res := createDNSPolicyResource(t, data)
|
|
||||||
|
|
||||||
err := ValidateDNSPolicy(res)
|
|
||||||
require.Error(t, err)
|
|
||||||
expected := resource.ErrInvalidField{
|
|
||||||
Name: "weights",
|
|
||||||
Wrapped: resource.ErrMissing,
|
|
||||||
}
|
|
||||||
var actual resource.ErrInvalidField
|
|
||||||
require.ErrorAs(t, err, &actual)
|
|
||||||
require.Equal(t, expected, actual)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestValidateDNSPolicy_InvalidPassingWeight(t *testing.T) {
|
|
||||||
for _, weight := range []uint32{0, 1000000} {
|
|
||||||
t.Run(fmt.Sprintf("%d", weight), func(t *testing.T) {
|
|
||||||
data := &pbcatalog.DNSPolicy{
|
|
||||||
Workloads: &pbcatalog.WorkloadSelector{
|
|
||||||
Prefixes: []string{""},
|
|
||||||
},
|
|
||||||
Weights: &pbcatalog.Weights{
|
|
||||||
Passing: weight,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
res := createDNSPolicyResource(t, data)
|
|
||||||
|
|
||||||
err := ValidateDNSPolicy(res)
|
|
||||||
require.Error(t, err)
|
|
||||||
expected := resource.ErrInvalidField{
|
|
||||||
Name: "passing",
|
|
||||||
Wrapped: errDNSPassingWeightOutOfRange,
|
|
||||||
}
|
|
||||||
var actual resource.ErrInvalidField
|
|
||||||
require.ErrorAs(t, err, &actual)
|
|
||||||
require.Equal(t, "weights", actual.Name)
|
|
||||||
err = actual.Unwrap()
|
|
||||||
require.ErrorAs(t, err, &actual)
|
|
||||||
require.Equal(t, expected, actual)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestValidateDNSPolicy_InvalidWarningWeight(t *testing.T) {
|
|
||||||
data := &pbcatalog.DNSPolicy{
|
|
||||||
Workloads: &pbcatalog.WorkloadSelector{
|
|
||||||
Prefixes: []string{""},
|
|
||||||
},
|
|
||||||
Weights: &pbcatalog.Weights{
|
|
||||||
Passing: 1,
|
|
||||||
Warning: 1000000,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
res := createDNSPolicyResource(t, data)
|
|
||||||
|
|
||||||
err := ValidateDNSPolicy(res)
|
|
||||||
require.Error(t, err)
|
|
||||||
expected := resource.ErrInvalidField{
|
|
||||||
Name: "warning",
|
|
||||||
Wrapped: errDNSWarningWeightOutOfRange,
|
|
||||||
}
|
|
||||||
var actual resource.ErrInvalidField
|
|
||||||
require.ErrorAs(t, err, &actual)
|
|
||||||
require.Equal(t, "weights", actual.Name)
|
|
||||||
err = actual.Unwrap()
|
|
||||||
require.ErrorAs(t, err, &actual)
|
|
||||||
require.Equal(t, expected, actual)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestValidateDNSPolicy_EmptySelector(t *testing.T) {
|
|
||||||
data := &pbcatalog.DNSPolicy{
|
|
||||||
Weights: &pbcatalog.Weights{
|
|
||||||
Passing: 10,
|
|
||||||
Warning: 3,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
res := createDNSPolicyResource(t, data)
|
|
||||||
|
|
||||||
err := ValidateDNSPolicy(res)
|
|
||||||
require.Error(t, err)
|
|
||||||
expected := resource.ErrInvalidField{
|
|
||||||
Name: "workloads",
|
|
||||||
Wrapped: resource.ErrEmpty,
|
|
||||||
}
|
|
||||||
var actual resource.ErrInvalidField
|
|
||||||
require.ErrorAs(t, err, &actual)
|
|
||||||
require.Equal(t, expected, actual)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestDNSPolicyACLs(t *testing.T) {
|
|
||||||
// Wire up a registry to generically invoke hooks
|
|
||||||
registry := resource.NewRegistry()
|
|
||||||
RegisterDNSPolicy(registry)
|
|
||||||
|
|
||||||
testhelpers.RunWorkloadSelectingTypeACLsTests[*pbcatalog.DNSPolicy](t, pbcatalog.DNSPolicyType,
|
|
||||||
func(selector *pbcatalog.WorkloadSelector) *pbcatalog.DNSPolicy {
|
|
||||||
return &pbcatalog.DNSPolicy{
|
|
||||||
Workloads: selector,
|
|
||||||
Weights: &pbcatalog.Weights{Passing: 1, Warning: 0},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
RegisterDNSPolicy,
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -167,5 +167,13 @@ func validateEndpoint(endpoint *pbcatalog.Endpoint, res *pbresource.Resource) er
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate DNS
|
||||||
|
if dnsErr := validateDNSPolicy(endpoint.Dns); dnsErr != nil {
|
||||||
|
err = multierror.Append(err, resource.ErrInvalidField{
|
||||||
|
Name: "dns_policy",
|
||||||
|
Wrapped: dnsErr,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,12 @@ func TestValidateServiceEndpoints_Ok(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
HealthStatus: pbcatalog.Health_HEALTH_PASSING,
|
HealthStatus: pbcatalog.Health_HEALTH_PASSING,
|
||||||
|
Dns: &pbcatalog.DNSPolicy{
|
||||||
|
Weights: &pbcatalog.Weights{
|
||||||
|
Passing: 3,
|
||||||
|
Warning: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -196,14 +202,14 @@ func TestValidateServiceEndpoints_EndpointInvalid(t *testing.T) {
|
||||||
},
|
},
|
||||||
"invalid-owner": {
|
"invalid-owner": {
|
||||||
owner: &pbresource.ID{
|
owner: &pbresource.ID{
|
||||||
Type: pbcatalog.DNSPolicyType,
|
Type: pbcatalog.HealthStatusType,
|
||||||
Tenancy: badEndpointTenancy,
|
Tenancy: badEndpointTenancy,
|
||||||
Name: "wrong",
|
Name: "wrong",
|
||||||
},
|
},
|
||||||
validateErr: func(t *testing.T, err error) {
|
validateErr: func(t *testing.T, err error) {
|
||||||
rtest.RequireError(t, err, resource.ErrOwnerTypeInvalid{
|
rtest.RequireError(t, err, resource.ErrOwnerTypeInvalid{
|
||||||
ResourceType: pbcatalog.ServiceEndpointsType,
|
ResourceType: pbcatalog.ServiceEndpointsType,
|
||||||
OwnerType: pbcatalog.DNSPolicyType})
|
OwnerType: pbcatalog.HealthStatusType})
|
||||||
rtest.RequireError(t, err, resource.ErrOwnerTenantInvalid{
|
rtest.RequireError(t, err, resource.ErrOwnerTenantInvalid{
|
||||||
ResourceType: pbcatalog.ServiceEndpointsType,
|
ResourceType: pbcatalog.ServiceEndpointsType,
|
||||||
ResourceTenancy: defaultEndpointTenancy,
|
ResourceTenancy: defaultEndpointTenancy,
|
||||||
|
@ -217,6 +223,20 @@ func TestValidateServiceEndpoints_EndpointInvalid(t *testing.T) {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"dns-policy-invalid": {
|
||||||
|
modify: func(endpoint *pbcatalog.Endpoint) {
|
||||||
|
endpoint.Dns = &pbcatalog.DNSPolicy{
|
||||||
|
Weights: &pbcatalog.Weights{
|
||||||
|
Passing: 0,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validateErr: func(t *testing.T, err error) {
|
||||||
|
var actual resource.ErrInvalidField
|
||||||
|
require.ErrorAs(t, err, &actual)
|
||||||
|
require.ErrorIs(t, err, errDNSPassingWeightOutOfRange)
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, tcase := range cases {
|
for name, tcase := range cases {
|
||||||
|
|
|
@ -18,6 +18,5 @@ func Register(r resource.Registry) {
|
||||||
RegisterComputedFailoverPolicy(r)
|
RegisterComputedFailoverPolicy(r)
|
||||||
// todo (v2): re-register once these resources are implemented.
|
// todo (v2): re-register once these resources are implemented.
|
||||||
//RegisterHealthChecks(r)
|
//RegisterHealthChecks(r)
|
||||||
//RegisterDNSPolicy(r)
|
|
||||||
//RegisterVirtualIPs(r)
|
//RegisterVirtualIPs(r)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ func TestTypeRegistration(t *testing.T) {
|
||||||
pbcatalog.HealthStatusKind,
|
pbcatalog.HealthStatusKind,
|
||||||
// todo (ishustava): uncomment once we implement these
|
// todo (ishustava): uncomment once we implement these
|
||||||
//pbcatalog.HealthChecksKind,
|
//pbcatalog.HealthChecksKind,
|
||||||
//pbcatalog.DNSPolicyKind,
|
|
||||||
//pbcatalog.VirtualIPsKind,
|
//pbcatalog.VirtualIPsKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ package types
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math"
|
||||||
"net"
|
"net"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -204,6 +205,34 @@ func validateWorkloadAddress(addr *pbcatalog.WorkloadAddress, ports map[string]*
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func validateDNSPolicy(policy *pbcatalog.DNSPolicy) error {
|
||||||
|
// an empty policy is valid
|
||||||
|
if policy == nil || policy.Weights == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var err error
|
||||||
|
|
||||||
|
// Validate the weights
|
||||||
|
if policy.Weights.Passing < 1 || policy.Weights.Passing > math.MaxUint16 {
|
||||||
|
err = multierror.Append(err, resource.ErrInvalidField{
|
||||||
|
Name: "passing",
|
||||||
|
Wrapped: errDNSPassingWeightOutOfRange,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Each weight is an unsigned integer, so we don't need to
|
||||||
|
// check for negative weights.
|
||||||
|
if policy.Weights.Warning > math.MaxUint16 {
|
||||||
|
err = multierror.Append(err, resource.ErrInvalidField{
|
||||||
|
Name: "warning",
|
||||||
|
Wrapped: errDNSWarningWeightOutOfRange,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func validateReferenceType(allowed *pbresource.Type, check *pbresource.Type) error {
|
func validateReferenceType(allowed *pbresource.Type, check *pbresource.Type) error {
|
||||||
if allowed.Group == check.Group &&
|
if allowed.Group == check.Group &&
|
||||||
allowed.GroupVersion == check.GroupVersion &&
|
allowed.GroupVersion == check.GroupVersion &&
|
||||||
|
|
|
@ -468,6 +468,79 @@ func TestValidateWorkloadAddress(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestValidateDNSPolicy(t *testing.T) {
|
||||||
|
type testCase struct {
|
||||||
|
policy *pbcatalog.DNSPolicy
|
||||||
|
validateErr func(*testing.T, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
cases := map[string]testCase{
|
||||||
|
"invalid-passing-weight-too-high": {
|
||||||
|
policy: &pbcatalog.DNSPolicy{
|
||||||
|
Weights: &pbcatalog.Weights{
|
||||||
|
Passing: 1000000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
validateErr: func(t *testing.T, err error) {
|
||||||
|
var actual resource.ErrInvalidField
|
||||||
|
require.ErrorAs(t, err, &actual)
|
||||||
|
require.Equal(t, "passing", actual.Name)
|
||||||
|
require.ErrorIs(t, err, errDNSPassingWeightOutOfRange)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"invalid-passing-weight-too-low": {
|
||||||
|
policy: &pbcatalog.DNSPolicy{
|
||||||
|
Weights: &pbcatalog.Weights{
|
||||||
|
Passing: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
validateErr: func(t *testing.T, err error) {
|
||||||
|
var actual resource.ErrInvalidField
|
||||||
|
require.ErrorAs(t, err, &actual)
|
||||||
|
require.Equal(t, "passing", actual.Name)
|
||||||
|
require.ErrorIs(t, err, errDNSPassingWeightOutOfRange)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"invalid-warning-weight": {
|
||||||
|
policy: &pbcatalog.DNSPolicy{
|
||||||
|
Weights: &pbcatalog.Weights{
|
||||||
|
Passing: 1,
|
||||||
|
Warning: 1000000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
validateErr: func(t *testing.T, err error) {
|
||||||
|
var actual resource.ErrInvalidField
|
||||||
|
require.ErrorAs(t, err, &actual)
|
||||||
|
require.Equal(t, "warning", actual.Name)
|
||||||
|
require.ErrorIs(t, err, errDNSWarningWeightOutOfRange)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"ok": {
|
||||||
|
policy: &pbcatalog.DNSPolicy{
|
||||||
|
Weights: &pbcatalog.Weights{
|
||||||
|
Passing: 3,
|
||||||
|
Warning: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"nil ok": {
|
||||||
|
policy: &pbcatalog.DNSPolicy{},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for name, tcase := range cases {
|
||||||
|
t.Run(name, func(t *testing.T) {
|
||||||
|
err := validateDNSPolicy(tcase.policy)
|
||||||
|
if tcase.validateErr != nil {
|
||||||
|
require.Error(t, err)
|
||||||
|
tcase.validateErr(t, err)
|
||||||
|
} else {
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestValidateReferenceType(t *testing.T) {
|
func TestValidateReferenceType(t *testing.T) {
|
||||||
allowedType := &pbresource.Type{
|
allowedType := &pbresource.Type{
|
||||||
Group: "foo",
|
Group: "foo",
|
||||||
|
|
|
@ -147,6 +147,14 @@ func validateWorkload(res *DecodedWorkload) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate DNS
|
||||||
|
if dnsErr := validateDNSPolicy(res.Data.Dns); dnsErr != nil {
|
||||||
|
err = multierror.Append(err, resource.ErrInvalidField{
|
||||||
|
Name: "dns_policy",
|
||||||
|
Wrapped: dnsErr,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,21 @@ func TestValidateWorkload_Ok(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestValidateWorkload_OkWithDNSPolicy(t *testing.T) {
|
||||||
|
data := validWorkload()
|
||||||
|
data.Dns = &pbcatalog.DNSPolicy{
|
||||||
|
Weights: &pbcatalog.Weights{
|
||||||
|
Passing: 3,
|
||||||
|
Warning: 2,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
res := createWorkloadResource(t, data)
|
||||||
|
|
||||||
|
err := ValidateWorkload(res)
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
func TestValidateWorkload_ParseError(t *testing.T) {
|
func TestValidateWorkload_ParseError(t *testing.T) {
|
||||||
// Any type other than the Workload type would work
|
// Any type other than the Workload type would work
|
||||||
// to cause the error we are expecting
|
// to cause the error we are expecting
|
||||||
|
@ -306,6 +321,24 @@ func TestValidateWorkload_Locality(t *testing.T) {
|
||||||
require.Equal(t, expected, actual)
|
require.Equal(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestValidateWorkload_DNSPolicy(t *testing.T) {
|
||||||
|
data := validWorkload()
|
||||||
|
data.Dns = &pbcatalog.DNSPolicy{
|
||||||
|
Weights: &pbcatalog.Weights{
|
||||||
|
Passing: 0, // Needs to be a positive integer
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
res := createWorkloadResource(t, data)
|
||||||
|
|
||||||
|
err := ValidateWorkload(res)
|
||||||
|
require.Error(t, err)
|
||||||
|
|
||||||
|
var actual resource.ErrInvalidField
|
||||||
|
require.ErrorAs(t, err, &actual)
|
||||||
|
require.ErrorIs(t, err, errDNSPassingWeightOutOfRange)
|
||||||
|
}
|
||||||
|
|
||||||
func TestWorkloadACLs(t *testing.T) {
|
func TestWorkloadACLs(t *testing.T) {
|
||||||
registry := resource.NewRegistry()
|
registry := resource.NewRegistry()
|
||||||
Register(registry)
|
Register(registry)
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
// Code generated by protoc-gen-go-binary. DO NOT EDIT.
|
|
||||||
// source: pbcatalog/v2beta1/dns.proto
|
|
||||||
|
|
||||||
package catalogv2beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
)
|
|
||||||
|
|
||||||
// MarshalBinary implements encoding.BinaryMarshaler
|
|
||||||
func (msg *DNSPolicy) MarshalBinary() ([]byte, error) {
|
|
||||||
return proto.Marshal(msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
|
||||||
func (msg *DNSPolicy) UnmarshalBinary(b []byte) error {
|
|
||||||
return proto.Unmarshal(b, msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalBinary implements encoding.BinaryMarshaler
|
|
||||||
func (msg *Weights) MarshalBinary() ([]byte, error) {
|
|
||||||
return proto.Marshal(msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
|
||||||
func (msg *Weights) UnmarshalBinary(b []byte) error {
|
|
||||||
return proto.Unmarshal(b, msg)
|
|
||||||
}
|
|
|
@ -1,262 +0,0 @@
|
||||||
// Copyright (c) HashiCorp, Inc.
|
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
|
||||||
|
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
||||||
// versions:
|
|
||||||
// protoc-gen-go v1.31.0
|
|
||||||
// protoc (unknown)
|
|
||||||
// source: pbcatalog/v2beta1/dns.proto
|
|
||||||
|
|
||||||
package catalogv2beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
_ "github.com/hashicorp/consul/proto-public/pbresource"
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
|
||||||
reflect "reflect"
|
|
||||||
sync "sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Verify that this generated code is sufficiently up-to-date.
|
|
||||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
|
||||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
|
||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
|
||||||
)
|
|
||||||
|
|
||||||
type DNSPolicy struct {
|
|
||||||
state protoimpl.MessageState
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Workloads *WorkloadSelector `protobuf:"bytes,1,opt,name=workloads,proto3" json:"workloads,omitempty"`
|
|
||||||
Weights *Weights `protobuf:"bytes,2,opt,name=weights,proto3" json:"weights,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *DNSPolicy) Reset() {
|
|
||||||
*x = DNSPolicy{}
|
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_pbcatalog_v2beta1_dns_proto_msgTypes[0]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *DNSPolicy) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*DNSPolicy) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *DNSPolicy) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_pbcatalog_v2beta1_dns_proto_msgTypes[0]
|
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use DNSPolicy.ProtoReflect.Descriptor instead.
|
|
||||||
func (*DNSPolicy) Descriptor() ([]byte, []int) {
|
|
||||||
return file_pbcatalog_v2beta1_dns_proto_rawDescGZIP(), []int{0}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *DNSPolicy) GetWorkloads() *WorkloadSelector {
|
|
||||||
if x != nil {
|
|
||||||
return x.Workloads
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *DNSPolicy) GetWeights() *Weights {
|
|
||||||
if x != nil {
|
|
||||||
return x.Weights
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type Weights struct {
|
|
||||||
state protoimpl.MessageState
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Passing uint32 `protobuf:"varint,1,opt,name=passing,proto3" json:"passing,omitempty"`
|
|
||||||
Warning uint32 `protobuf:"varint,2,opt,name=warning,proto3" json:"warning,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Weights) Reset() {
|
|
||||||
*x = Weights{}
|
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_pbcatalog_v2beta1_dns_proto_msgTypes[1]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Weights) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*Weights) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *Weights) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_pbcatalog_v2beta1_dns_proto_msgTypes[1]
|
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use Weights.ProtoReflect.Descriptor instead.
|
|
||||||
func (*Weights) Descriptor() ([]byte, []int) {
|
|
||||||
return file_pbcatalog_v2beta1_dns_proto_rawDescGZIP(), []int{1}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Weights) GetPassing() uint32 {
|
|
||||||
if x != nil {
|
|
||||||
return x.Passing
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Weights) GetWarning() uint32 {
|
|
||||||
if x != nil {
|
|
||||||
return x.Warning
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
var File_pbcatalog_v2beta1_dns_proto protoreflect.FileDescriptor
|
|
||||||
|
|
||||||
var file_pbcatalog_v2beta1_dns_proto_rawDesc = []byte{
|
|
||||||
0x0a, 0x1b, 0x70, 0x62, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2f, 0x76, 0x32, 0x62, 0x65,
|
|
||||||
0x74, 0x61, 0x31, 0x2f, 0x64, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x20, 0x68,
|
|
||||||
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e,
|
|
||||||
0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a,
|
|
||||||
0x20, 0x70, 0x62, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74,
|
|
||||||
0x61, 0x31, 0x2f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
|
||||||
0x6f, 0x1a, 0x1c, 0x70, 0x62, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x61, 0x6e,
|
|
||||||
0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
|
||||||
0xaa, 0x01, 0x0a, 0x09, 0x44, 0x4e, 0x53, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x50, 0x0a,
|
|
||||||
0x09, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
|
|
||||||
0x32, 0x32, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e,
|
|
||||||
0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62, 0x65,
|
|
||||||
0x74, 0x61, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x65, 0x6c, 0x65,
|
|
||||||
0x63, 0x74, 0x6f, 0x72, 0x52, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x12,
|
|
||||||
0x43, 0x0a, 0x07, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
|
|
||||||
0x32, 0x29, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e,
|
|
||||||
0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62, 0x65,
|
|
||||||
0x74, 0x61, 0x31, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x52, 0x07, 0x77, 0x65, 0x69,
|
|
||||||
0x67, 0x68, 0x74, 0x73, 0x3a, 0x06, 0xa2, 0x93, 0x04, 0x02, 0x08, 0x03, 0x22, 0x3d, 0x0a, 0x07,
|
|
||||||
0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x73, 0x73, 0x69,
|
|
||||||
0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x70, 0x61, 0x73, 0x73, 0x69, 0x6e,
|
|
||||||
0x67, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01,
|
|
||||||
0x28, 0x0d, 0x52, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0x9e, 0x02, 0x0a, 0x24,
|
|
||||||
0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f,
|
|
||||||
0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62,
|
|
||||||
0x65, 0x74, 0x61, 0x31, 0x42, 0x08, 0x44, 0x6e, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
|
|
||||||
0x5a, 0x49, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73,
|
|
||||||
0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2f, 0x70, 0x72,
|
|
||||||
0x6f, 0x74, 0x6f, 0x2d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x70, 0x62, 0x63, 0x61, 0x74,
|
|
||||||
0x61, 0x6c, 0x6f, 0x67, 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x63, 0x61, 0x74,
|
|
||||||
0x61, 0x6c, 0x6f, 0x67, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x48, 0x43,
|
|
||||||
0x43, 0xaa, 0x02, 0x20, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f,
|
|
||||||
0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x56, 0x32, 0x62,
|
|
||||||
0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x20, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
|
||||||
0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5c,
|
|
||||||
0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x2c, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63,
|
|
||||||
0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x43, 0x61, 0x74, 0x61, 0x6c,
|
|
||||||
0x6f, 0x67, 0x5c, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65,
|
|
||||||
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x23, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f,
|
|
||||||
0x72, 0x70, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x3a, 0x3a, 0x43, 0x61, 0x74, 0x61,
|
|
||||||
0x6c, 0x6f, 0x67, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72,
|
|
||||||
0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
file_pbcatalog_v2beta1_dns_proto_rawDescOnce sync.Once
|
|
||||||
file_pbcatalog_v2beta1_dns_proto_rawDescData = file_pbcatalog_v2beta1_dns_proto_rawDesc
|
|
||||||
)
|
|
||||||
|
|
||||||
func file_pbcatalog_v2beta1_dns_proto_rawDescGZIP() []byte {
|
|
||||||
file_pbcatalog_v2beta1_dns_proto_rawDescOnce.Do(func() {
|
|
||||||
file_pbcatalog_v2beta1_dns_proto_rawDescData = protoimpl.X.CompressGZIP(file_pbcatalog_v2beta1_dns_proto_rawDescData)
|
|
||||||
})
|
|
||||||
return file_pbcatalog_v2beta1_dns_proto_rawDescData
|
|
||||||
}
|
|
||||||
|
|
||||||
var file_pbcatalog_v2beta1_dns_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
|
||||||
var file_pbcatalog_v2beta1_dns_proto_goTypes = []interface{}{
|
|
||||||
(*DNSPolicy)(nil), // 0: hashicorp.consul.catalog.v2beta1.DNSPolicy
|
|
||||||
(*Weights)(nil), // 1: hashicorp.consul.catalog.v2beta1.Weights
|
|
||||||
(*WorkloadSelector)(nil), // 2: hashicorp.consul.catalog.v2beta1.WorkloadSelector
|
|
||||||
}
|
|
||||||
var file_pbcatalog_v2beta1_dns_proto_depIdxs = []int32{
|
|
||||||
2, // 0: hashicorp.consul.catalog.v2beta1.DNSPolicy.workloads:type_name -> hashicorp.consul.catalog.v2beta1.WorkloadSelector
|
|
||||||
1, // 1: hashicorp.consul.catalog.v2beta1.DNSPolicy.weights:type_name -> hashicorp.consul.catalog.v2beta1.Weights
|
|
||||||
2, // [2:2] is the sub-list for method output_type
|
|
||||||
2, // [2:2] is the sub-list for method input_type
|
|
||||||
2, // [2:2] is the sub-list for extension type_name
|
|
||||||
2, // [2:2] is the sub-list for extension extendee
|
|
||||||
0, // [0:2] is the sub-list for field type_name
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() { file_pbcatalog_v2beta1_dns_proto_init() }
|
|
||||||
func file_pbcatalog_v2beta1_dns_proto_init() {
|
|
||||||
if File_pbcatalog_v2beta1_dns_proto != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
file_pbcatalog_v2beta1_selector_proto_init()
|
|
||||||
if !protoimpl.UnsafeEnabled {
|
|
||||||
file_pbcatalog_v2beta1_dns_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
|
||||||
switch v := v.(*DNSPolicy); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file_pbcatalog_v2beta1_dns_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
|
||||||
switch v := v.(*Weights); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
type x struct{}
|
|
||||||
out := protoimpl.TypeBuilder{
|
|
||||||
File: protoimpl.DescBuilder{
|
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
||||||
RawDescriptor: file_pbcatalog_v2beta1_dns_proto_rawDesc,
|
|
||||||
NumEnums: 0,
|
|
||||||
NumMessages: 2,
|
|
||||||
NumExtensions: 0,
|
|
||||||
NumServices: 0,
|
|
||||||
},
|
|
||||||
GoTypes: file_pbcatalog_v2beta1_dns_proto_goTypes,
|
|
||||||
DependencyIndexes: file_pbcatalog_v2beta1_dns_proto_depIdxs,
|
|
||||||
MessageInfos: file_pbcatalog_v2beta1_dns_proto_msgTypes,
|
|
||||||
}.Build()
|
|
||||||
File_pbcatalog_v2beta1_dns_proto = out.File
|
|
||||||
file_pbcatalog_v2beta1_dns_proto_rawDesc = nil
|
|
||||||
file_pbcatalog_v2beta1_dns_proto_goTypes = nil
|
|
||||||
file_pbcatalog_v2beta1_dns_proto_depIdxs = nil
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright (c) HashiCorp, Inc.
|
|
||||||
// SPDX-License-Identifier: MPL-2.0
|
|
||||||
|
|
||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package hashicorp.consul.catalog.v2beta1;
|
|
||||||
|
|
||||||
import "pbcatalog/v2beta1/selector.proto";
|
|
||||||
import "pbresource/annotations.proto";
|
|
||||||
|
|
||||||
message DNSPolicy {
|
|
||||||
option (hashicorp.consul.resource.spec) = {scope: SCOPE_NAMESPACE};
|
|
||||||
|
|
||||||
WorkloadSelector workloads = 1;
|
|
||||||
Weights weights = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Weights {
|
|
||||||
uint32 passing = 1;
|
|
||||||
uint32 warning = 2;
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
// Code generated by protoc-gen-deepcopy. DO NOT EDIT.
|
|
||||||
package catalogv2beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
proto "google.golang.org/protobuf/proto"
|
|
||||||
)
|
|
||||||
|
|
||||||
// DeepCopyInto supports using DNSPolicy within kubernetes types, where deepcopy-gen is used.
|
|
||||||
func (in *DNSPolicy) DeepCopyInto(out *DNSPolicy) {
|
|
||||||
proto.Reset(out)
|
|
||||||
proto.Merge(out, proto.Clone(in))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DNSPolicy. Required by controller-gen.
|
|
||||||
func (in *DNSPolicy) DeepCopy() *DNSPolicy {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(DNSPolicy)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new DNSPolicy. Required by controller-gen.
|
|
||||||
func (in *DNSPolicy) DeepCopyInterface() interface{} {
|
|
||||||
return in.DeepCopy()
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInto supports using Weights within kubernetes types, where deepcopy-gen is used.
|
|
||||||
func (in *Weights) DeepCopyInto(out *Weights) {
|
|
||||||
proto.Reset(out)
|
|
||||||
proto.Merge(out, proto.Clone(in))
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Weights. Required by controller-gen.
|
|
||||||
func (in *Weights) DeepCopy() *Weights {
|
|
||||||
if in == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
out := new(Weights)
|
|
||||||
in.DeepCopyInto(out)
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new Weights. Required by controller-gen.
|
|
||||||
func (in *Weights) DeepCopyInterface() interface{} {
|
|
||||||
return in.DeepCopy()
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
// Code generated by protoc-json-shim. DO NOT EDIT.
|
|
||||||
package catalogv2beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
protojson "google.golang.org/protobuf/encoding/protojson"
|
|
||||||
)
|
|
||||||
|
|
||||||
// MarshalJSON is a custom marshaler for DNSPolicy
|
|
||||||
func (this *DNSPolicy) MarshalJSON() ([]byte, error) {
|
|
||||||
str, err := DnsMarshaler.Marshal(this)
|
|
||||||
return []byte(str), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON is a custom unmarshaler for DNSPolicy
|
|
||||||
func (this *DNSPolicy) UnmarshalJSON(b []byte) error {
|
|
||||||
return DnsUnmarshaler.Unmarshal(b, this)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MarshalJSON is a custom marshaler for Weights
|
|
||||||
func (this *Weights) MarshalJSON() ([]byte, error) {
|
|
||||||
str, err := DnsMarshaler.Marshal(this)
|
|
||||||
return []byte(str), err
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnmarshalJSON is a custom unmarshaler for Weights
|
|
||||||
func (this *Weights) UnmarshalJSON(b []byte) error {
|
|
||||||
return DnsUnmarshaler.Unmarshal(b, this)
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
DnsMarshaler = &protojson.MarshalOptions{}
|
|
||||||
DnsUnmarshaler = &protojson.UnmarshalOptions{DiscardUnknown: false}
|
|
||||||
)
|
|
|
@ -11,7 +11,6 @@ const (
|
||||||
Version = "v2beta1"
|
Version = "v2beta1"
|
||||||
|
|
||||||
ComputedFailoverPolicyKind = "ComputedFailoverPolicy"
|
ComputedFailoverPolicyKind = "ComputedFailoverPolicy"
|
||||||
DNSPolicyKind = "DNSPolicy"
|
|
||||||
FailoverPolicyKind = "FailoverPolicy"
|
FailoverPolicyKind = "FailoverPolicy"
|
||||||
HealthChecksKind = "HealthChecks"
|
HealthChecksKind = "HealthChecks"
|
||||||
HealthStatusKind = "HealthStatus"
|
HealthStatusKind = "HealthStatus"
|
||||||
|
@ -30,12 +29,6 @@ var (
|
||||||
Kind: ComputedFailoverPolicyKind,
|
Kind: ComputedFailoverPolicyKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
DNSPolicyType = &pbresource.Type{
|
|
||||||
Group: GroupName,
|
|
||||||
GroupVersion: Version,
|
|
||||||
Kind: DNSPolicyKind,
|
|
||||||
}
|
|
||||||
|
|
||||||
FailoverPolicyType = &pbresource.Type{
|
FailoverPolicyType = &pbresource.Type{
|
||||||
Group: GroupName,
|
Group: GroupName,
|
||||||
GroupVersion: Version,
|
GroupVersion: Version,
|
||||||
|
|
|
@ -90,6 +90,8 @@ type Endpoint struct {
|
||||||
HealthStatus Health `protobuf:"varint,4,opt,name=health_status,json=healthStatus,proto3,enum=hashicorp.consul.catalog.v2beta1.Health" json:"health_status,omitempty"`
|
HealthStatus Health `protobuf:"varint,4,opt,name=health_status,json=healthStatus,proto3,enum=hashicorp.consul.catalog.v2beta1.Health" json:"health_status,omitempty"`
|
||||||
// identity is the name of the workload identity for this endpoint.
|
// identity is the name of the workload identity for this endpoint.
|
||||||
Identity string `protobuf:"bytes,5,opt,name=identity,proto3" json:"identity,omitempty"`
|
Identity string `protobuf:"bytes,5,opt,name=identity,proto3" json:"identity,omitempty"`
|
||||||
|
// dns contains customizations like Weight that will be returned in DNS discovery requests.
|
||||||
|
Dns *DNSPolicy `protobuf:"bytes,6,opt,name=dns,proto3" json:"dns,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Endpoint) Reset() {
|
func (x *Endpoint) Reset() {
|
||||||
|
@ -159,6 +161,13 @@ func (x *Endpoint) GetIdentity() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Endpoint) GetDns() *DNSPolicy {
|
||||||
|
if x != nil {
|
||||||
|
return x.Dns
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var File_pbcatalog_v2beta1_service_endpoints_proto protoreflect.FileDescriptor
|
var File_pbcatalog_v2beta1_service_endpoints_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_pbcatalog_v2beta1_service_endpoints_proto_rawDesc = []byte{
|
var file_pbcatalog_v2beta1_service_endpoints_proto_rawDesc = []byte{
|
||||||
|
@ -180,7 +189,7 @@ var file_pbcatalog_v2beta1_service_endpoints_proto_rawDesc = []byte{
|
||||||
0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
|
0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
|
||||||
0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74,
|
0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74,
|
||||||
0x61, 0x31, 0x2e, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x09, 0x65, 0x6e, 0x64,
|
0x61, 0x31, 0x2e, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x52, 0x09, 0x65, 0x6e, 0x64,
|
||||||
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x3a, 0x06, 0xa2, 0x93, 0x04, 0x02, 0x08, 0x03, 0x22, 0xbb,
|
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x3a, 0x06, 0xa2, 0x93, 0x04, 0x02, 0x08, 0x03, 0x22, 0xfa,
|
||||||
0x03, 0x0a, 0x08, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x0a, 0x74,
|
0x03, 0x0a, 0x08, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x0a, 0x74,
|
||||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||||
0x1d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
|
0x1d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
|
||||||
|
@ -202,33 +211,37 @@ var file_pbcatalog_v2beta1_service_endpoints_proto_rawDesc = []byte{
|
||||||
0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x0c, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68,
|
0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x0c, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68,
|
||||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69,
|
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69,
|
||||||
0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69,
|
0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69,
|
||||||
0x74, 0x79, 0x1a, 0x68, 0x0a, 0x0a, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
0x74, 0x79, 0x12, 0x3d, 0x0a, 0x03, 0x64, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||||
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
|
0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73,
|
||||||
0x65, 0x79, 0x12, 0x44, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74,
|
||||||
0x0b, 0x32, 0x2e, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f,
|
0x61, 0x31, 0x2e, 0x44, 0x4e, 0x53, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x03, 0x64, 0x6e,
|
||||||
|
0x73, 0x1a, 0x68, 0x0a, 0x0a, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
|
||||||
|
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65,
|
||||||
|
0x79, 0x12, 0x44, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
|
||||||
|
0x32, 0x2e, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e,
|
||||||
|
0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62, 0x65,
|
||||||
|
0x74, 0x61, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x6f, 0x72, 0x74,
|
||||||
|
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0xab, 0x02, 0x0a, 0x24,
|
||||||
|
0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f,
|
||||||
0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62,
|
0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62,
|
||||||
0x65, 0x74, 0x61, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x6f, 0x72,
|
0x65, 0x74, 0x61, 0x31, 0x42, 0x15, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x64,
|
||||||
0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0xab, 0x02, 0x0a,
|
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x49, 0x67,
|
||||||
0x24, 0x63, 0x6f, 0x6d, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63,
|
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63,
|
||||||
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32,
|
0x6f, 0x72, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x15, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x45, 0x6e,
|
0x2d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x70, 0x62, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f,
|
||||||
0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x49,
|
0x67, 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f,
|
||||||
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69,
|
0x67, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x48, 0x43, 0x43, 0xaa, 0x02,
|
||||||
0x63, 0x6f, 0x72, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
0x20, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75,
|
||||||
0x6f, 0x2d, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2f, 0x70, 0x62, 0x63, 0x61, 0x74, 0x61, 0x6c,
|
0x6c, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61,
|
||||||
0x6f, 0x67, 0x2f, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x63, 0x61, 0x74, 0x61, 0x6c,
|
0x31, 0xca, 0x02, 0x20, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43, 0x6f,
|
||||||
0x6f, 0x67, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x48, 0x43, 0x43, 0xaa,
|
0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5c, 0x56, 0x32, 0x62,
|
||||||
0x02, 0x20, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x73,
|
0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x2c, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
||||||
0x75, 0x6c, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x56, 0x32, 0x62, 0x65, 0x74,
|
0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5c,
|
||||||
0x61, 0x31, 0xca, 0x02, 0x20, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x5c, 0x43,
|
0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
|
||||||
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x5c, 0x56, 0x32,
|
0x61, 0x74, 0x61, 0xea, 0x02, 0x23, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x3a,
|
||||||
0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x2c, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72,
|
0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x3a, 0x3a, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67,
|
||||||
0x70, 0x5c, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x5c, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67,
|
0x3a, 0x3a, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x5c, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
|
0x33,
|
||||||
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x23, 0x48, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
|
||||||
0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x3a, 0x3a, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f,
|
|
||||||
0x67, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
|
||||||
0x6f, 0x33,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -251,7 +264,8 @@ var file_pbcatalog_v2beta1_service_endpoints_proto_goTypes = []interface{}{
|
||||||
(*pbresource.ID)(nil), // 3: hashicorp.consul.resource.ID
|
(*pbresource.ID)(nil), // 3: hashicorp.consul.resource.ID
|
||||||
(*WorkloadAddress)(nil), // 4: hashicorp.consul.catalog.v2beta1.WorkloadAddress
|
(*WorkloadAddress)(nil), // 4: hashicorp.consul.catalog.v2beta1.WorkloadAddress
|
||||||
(Health)(0), // 5: hashicorp.consul.catalog.v2beta1.Health
|
(Health)(0), // 5: hashicorp.consul.catalog.v2beta1.Health
|
||||||
(*WorkloadPort)(nil), // 6: hashicorp.consul.catalog.v2beta1.WorkloadPort
|
(*DNSPolicy)(nil), // 6: hashicorp.consul.catalog.v2beta1.DNSPolicy
|
||||||
|
(*WorkloadPort)(nil), // 7: hashicorp.consul.catalog.v2beta1.WorkloadPort
|
||||||
}
|
}
|
||||||
var file_pbcatalog_v2beta1_service_endpoints_proto_depIdxs = []int32{
|
var file_pbcatalog_v2beta1_service_endpoints_proto_depIdxs = []int32{
|
||||||
1, // 0: hashicorp.consul.catalog.v2beta1.ServiceEndpoints.endpoints:type_name -> hashicorp.consul.catalog.v2beta1.Endpoint
|
1, // 0: hashicorp.consul.catalog.v2beta1.ServiceEndpoints.endpoints:type_name -> hashicorp.consul.catalog.v2beta1.Endpoint
|
||||||
|
@ -259,12 +273,13 @@ var file_pbcatalog_v2beta1_service_endpoints_proto_depIdxs = []int32{
|
||||||
4, // 2: hashicorp.consul.catalog.v2beta1.Endpoint.addresses:type_name -> hashicorp.consul.catalog.v2beta1.WorkloadAddress
|
4, // 2: hashicorp.consul.catalog.v2beta1.Endpoint.addresses:type_name -> hashicorp.consul.catalog.v2beta1.WorkloadAddress
|
||||||
2, // 3: hashicorp.consul.catalog.v2beta1.Endpoint.ports:type_name -> hashicorp.consul.catalog.v2beta1.Endpoint.PortsEntry
|
2, // 3: hashicorp.consul.catalog.v2beta1.Endpoint.ports:type_name -> hashicorp.consul.catalog.v2beta1.Endpoint.PortsEntry
|
||||||
5, // 4: hashicorp.consul.catalog.v2beta1.Endpoint.health_status:type_name -> hashicorp.consul.catalog.v2beta1.Health
|
5, // 4: hashicorp.consul.catalog.v2beta1.Endpoint.health_status:type_name -> hashicorp.consul.catalog.v2beta1.Health
|
||||||
6, // 5: hashicorp.consul.catalog.v2beta1.Endpoint.PortsEntry.value:type_name -> hashicorp.consul.catalog.v2beta1.WorkloadPort
|
6, // 5: hashicorp.consul.catalog.v2beta1.Endpoint.dns:type_name -> hashicorp.consul.catalog.v2beta1.DNSPolicy
|
||||||
6, // [6:6] is the sub-list for method output_type
|
7, // 6: hashicorp.consul.catalog.v2beta1.Endpoint.PortsEntry.value:type_name -> hashicorp.consul.catalog.v2beta1.WorkloadPort
|
||||||
6, // [6:6] is the sub-list for method input_type
|
7, // [7:7] is the sub-list for method output_type
|
||||||
6, // [6:6] is the sub-list for extension type_name
|
7, // [7:7] is the sub-list for method input_type
|
||||||
6, // [6:6] is the sub-list for extension extendee
|
7, // [7:7] is the sub-list for extension type_name
|
||||||
0, // [0:6] is the sub-list for field type_name
|
7, // [7:7] is the sub-list for extension extendee
|
||||||
|
0, // [0:7] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_pbcatalog_v2beta1_service_endpoints_proto_init() }
|
func init() { file_pbcatalog_v2beta1_service_endpoints_proto_init() }
|
||||||
|
|
|
@ -35,4 +35,7 @@ message Endpoint {
|
||||||
|
|
||||||
// identity is the name of the workload identity for this endpoint.
|
// identity is the name of the workload identity for this endpoint.
|
||||||
string identity = 5;
|
string identity = 5;
|
||||||
|
|
||||||
|
// dns contains customizations like Weight that will be returned in DNS discovery requests.
|
||||||
|
DNSPolicy dns = 6;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,3 +46,23 @@ func (msg *Locality) MarshalBinary() ([]byte, error) {
|
||||||
func (msg *Locality) UnmarshalBinary(b []byte) error {
|
func (msg *Locality) UnmarshalBinary(b []byte) error {
|
||||||
return proto.Unmarshal(b, msg)
|
return proto.Unmarshal(b, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalBinary implements encoding.BinaryMarshaler
|
||||||
|
func (msg *DNSPolicy) MarshalBinary() ([]byte, error) {
|
||||||
|
return proto.Marshal(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
||||||
|
func (msg *DNSPolicy) UnmarshalBinary(b []byte) error {
|
||||||
|
return proto.Unmarshal(b, msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalBinary implements encoding.BinaryMarshaler
|
||||||
|
func (msg *Weights) MarshalBinary() ([]byte, error) {
|
||||||
|
return proto.Marshal(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalBinary implements encoding.BinaryUnmarshaler
|
||||||
|
func (msg *Weights) UnmarshalBinary(b []byte) error {
|
||||||
|
return proto.Unmarshal(b, msg)
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,8 @@ type Workload struct {
|
||||||
//
|
//
|
||||||
// Deprecated: Marked as deprecated in pbcatalog/v2beta1/workload.proto.
|
// Deprecated: Marked as deprecated in pbcatalog/v2beta1/workload.proto.
|
||||||
ConnectNative bool `protobuf:"varint,8,opt,name=connect_native,json=connectNative,proto3" json:"connect_native,omitempty"`
|
ConnectNative bool `protobuf:"varint,8,opt,name=connect_native,json=connectNative,proto3" json:"connect_native,omitempty"`
|
||||||
|
// dns contains any workload customization that will be returned in DNS discovery requests.
|
||||||
|
Dns *DNSPolicy `protobuf:"bytes,9,opt,name=dns,proto3" json:"dns,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Workload) Reset() {
|
func (x *Workload) Reset() {
|
||||||
|
@ -149,6 +151,13 @@ func (x *Workload) GetConnectNative() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Workload) GetDns() *DNSPolicy {
|
||||||
|
if x != nil {
|
||||||
|
return x.Dns
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type WorkloadAddress struct {
|
type WorkloadAddress struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
@ -330,6 +339,108 @@ func (x *Locality) GetZone() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DNSPolicy struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Weights *Weights `protobuf:"bytes,1,opt,name=weights,proto3" json:"weights,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DNSPolicy) Reset() {
|
||||||
|
*x = DNSPolicy{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_pbcatalog_v2beta1_workload_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DNSPolicy) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*DNSPolicy) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *DNSPolicy) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_pbcatalog_v2beta1_workload_proto_msgTypes[4]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use DNSPolicy.ProtoReflect.Descriptor instead.
|
||||||
|
func (*DNSPolicy) Descriptor() ([]byte, []int) {
|
||||||
|
return file_pbcatalog_v2beta1_workload_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DNSPolicy) GetWeights() *Weights {
|
||||||
|
if x != nil {
|
||||||
|
return x.Weights
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Weights struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Passing uint32 `protobuf:"varint,1,opt,name=passing,proto3" json:"passing,omitempty"`
|
||||||
|
Warning uint32 `protobuf:"varint,2,opt,name=warning,proto3" json:"warning,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Weights) Reset() {
|
||||||
|
*x = Weights{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_pbcatalog_v2beta1_workload_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Weights) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Weights) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Weights) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_pbcatalog_v2beta1_workload_proto_msgTypes[5]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Weights.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Weights) Descriptor() ([]byte, []int) {
|
||||||
|
return file_pbcatalog_v2beta1_workload_proto_rawDescGZIP(), []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Weights) GetPassing() uint32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Passing
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Weights) GetWarning() uint32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Warning
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
var File_pbcatalog_v2beta1_workload_proto protoreflect.FileDescriptor
|
var File_pbcatalog_v2beta1_workload_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_pbcatalog_v2beta1_workload_proto_rawDesc = []byte{
|
var file_pbcatalog_v2beta1_workload_proto_rawDesc = []byte{
|
||||||
|
@ -341,7 +452,7 @@ var file_pbcatalog_v2beta1_workload_proto_rawDesc = []byte{
|
||||||
0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c,
|
0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c,
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x70, 0x62, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
|
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x70, 0x62, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
|
||||||
0x63, 0x65, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70,
|
0x63, 0x65, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x92, 0x04, 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61,
|
0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd1, 0x04, 0x0a, 0x08, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61,
|
||||||
0x64, 0x12, 0x4f, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01,
|
0x64, 0x12, 0x4f, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01,
|
||||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
||||||
0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e,
|
0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e,
|
||||||
|
@ -367,30 +478,43 @@ var file_pbcatalog_v2beta1_workload_proto_rawDesc = []byte{
|
||||||
0x65, 0x54, 0x61, 0x67, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x12, 0x29, 0x0a, 0x0e,
|
0x65, 0x54, 0x61, 0x67, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x12, 0x29, 0x0a, 0x0e,
|
||||||
0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x18, 0x08,
|
0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x18, 0x08,
|
||||||
0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
|
0x20, 0x01, 0x28, 0x08, 0x42, 0x02, 0x18, 0x01, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
|
||||||
0x74, 0x4e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x1a, 0x68, 0x0a, 0x0a, 0x50, 0x6f, 0x72, 0x74, 0x73,
|
0x74, 0x4e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x12, 0x3d, 0x0a, 0x03, 0x64, 0x6e, 0x73, 0x18, 0x09,
|
||||||
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
|
0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70,
|
||||||
0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x44, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e,
|
||||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f,
|
0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x4e, 0x53, 0x50, 0x6f, 0x6c, 0x69, 0x63,
|
||||||
0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f,
|
0x79, 0x52, 0x03, 0x64, 0x6e, 0x73, 0x1a, 0x68, 0x0a, 0x0a, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x45,
|
||||||
0x67, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f,
|
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x61, 0x64, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
|
0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x44, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
|
||||||
0x01, 0x3a, 0x06, 0xa2, 0x93, 0x04, 0x02, 0x08, 0x03, 0x22, 0x57, 0x0a, 0x0f, 0x57, 0x6f, 0x72,
|
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72,
|
||||||
0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04,
|
0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67,
|
||||||
0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74,
|
0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61,
|
||||||
0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52,
|
0x64, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
|
||||||
0x05, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e,
|
0x3a, 0x06, 0xa2, 0x93, 0x04, 0x02, 0x08, 0x03, 0x22, 0x57, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6b,
|
||||||
0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e,
|
0x6c, 0x6f, 0x61, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x68,
|
||||||
0x61, 0x6c, 0x22, 0x6a, 0x0a, 0x0c, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x6f,
|
0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12,
|
||||||
0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d,
|
0x14, 0x0a, 0x05, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05,
|
||||||
0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x46, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63,
|
0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61,
|
||||||
0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69,
|
0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61,
|
||||||
0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61,
|
0x6c, 0x22, 0x6a, 0x0a, 0x0c, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x6f, 0x72,
|
||||||
0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x74,
|
0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52,
|
||||||
0x6f, 0x63, 0x6f, 0x6c, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x22, 0x36,
|
0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x46, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f,
|
||||||
0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65,
|
0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63,
|
||||||
0x67, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69,
|
0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c,
|
||||||
0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x52, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x42, 0xa3, 0x02, 0x0a, 0x24, 0x63, 0x6f, 0x6d, 0x2e, 0x68,
|
0x63, 0x6f, 0x6c, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x22, 0x36, 0x0a,
|
||||||
|
0x08, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67,
|
||||||
|
0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f,
|
||||||
|
0x6e, 0x12, 0x12, 0x0a, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
|
0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x22, 0x50, 0x0a, 0x09, 0x44, 0x4e, 0x53, 0x50, 0x6f, 0x6c, 0x69,
|
||||||
|
0x63, 0x79, 0x12, 0x43, 0x0a, 0x07, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x18, 0x01, 0x20,
|
||||||
|
0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e,
|
||||||
|
0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76,
|
||||||
|
0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x52, 0x07,
|
||||||
|
0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x73, 0x22, 0x3d, 0x0a, 0x07, 0x57, 0x65, 0x69, 0x67, 0x68,
|
||||||
|
0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20,
|
||||||
|
0x01, 0x28, 0x0d, 0x52, 0x07, 0x70, 0x61, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07,
|
||||||
|
0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x77,
|
||||||
|
0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x42, 0xa3, 0x02, 0x0a, 0x24, 0x63, 0x6f, 0x6d, 0x2e, 0x68,
|
||||||
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e,
|
0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x2e,
|
||||||
0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42,
|
0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x32, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42,
|
||||||
0x0d, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
|
0x0d, 0x57, 0x6f, 0x72, 0x6b, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
|
||||||
|
@ -424,26 +548,30 @@ func file_pbcatalog_v2beta1_workload_proto_rawDescGZIP() []byte {
|
||||||
return file_pbcatalog_v2beta1_workload_proto_rawDescData
|
return file_pbcatalog_v2beta1_workload_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_pbcatalog_v2beta1_workload_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
var file_pbcatalog_v2beta1_workload_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||||
var file_pbcatalog_v2beta1_workload_proto_goTypes = []interface{}{
|
var file_pbcatalog_v2beta1_workload_proto_goTypes = []interface{}{
|
||||||
(*Workload)(nil), // 0: hashicorp.consul.catalog.v2beta1.Workload
|
(*Workload)(nil), // 0: hashicorp.consul.catalog.v2beta1.Workload
|
||||||
(*WorkloadAddress)(nil), // 1: hashicorp.consul.catalog.v2beta1.WorkloadAddress
|
(*WorkloadAddress)(nil), // 1: hashicorp.consul.catalog.v2beta1.WorkloadAddress
|
||||||
(*WorkloadPort)(nil), // 2: hashicorp.consul.catalog.v2beta1.WorkloadPort
|
(*WorkloadPort)(nil), // 2: hashicorp.consul.catalog.v2beta1.WorkloadPort
|
||||||
(*Locality)(nil), // 3: hashicorp.consul.catalog.v2beta1.Locality
|
(*Locality)(nil), // 3: hashicorp.consul.catalog.v2beta1.Locality
|
||||||
nil, // 4: hashicorp.consul.catalog.v2beta1.Workload.PortsEntry
|
(*DNSPolicy)(nil), // 4: hashicorp.consul.catalog.v2beta1.DNSPolicy
|
||||||
(Protocol)(0), // 5: hashicorp.consul.catalog.v2beta1.Protocol
|
(*Weights)(nil), // 5: hashicorp.consul.catalog.v2beta1.Weights
|
||||||
|
nil, // 6: hashicorp.consul.catalog.v2beta1.Workload.PortsEntry
|
||||||
|
(Protocol)(0), // 7: hashicorp.consul.catalog.v2beta1.Protocol
|
||||||
}
|
}
|
||||||
var file_pbcatalog_v2beta1_workload_proto_depIdxs = []int32{
|
var file_pbcatalog_v2beta1_workload_proto_depIdxs = []int32{
|
||||||
1, // 0: hashicorp.consul.catalog.v2beta1.Workload.addresses:type_name -> hashicorp.consul.catalog.v2beta1.WorkloadAddress
|
1, // 0: hashicorp.consul.catalog.v2beta1.Workload.addresses:type_name -> hashicorp.consul.catalog.v2beta1.WorkloadAddress
|
||||||
4, // 1: hashicorp.consul.catalog.v2beta1.Workload.ports:type_name -> hashicorp.consul.catalog.v2beta1.Workload.PortsEntry
|
6, // 1: hashicorp.consul.catalog.v2beta1.Workload.ports:type_name -> hashicorp.consul.catalog.v2beta1.Workload.PortsEntry
|
||||||
3, // 2: hashicorp.consul.catalog.v2beta1.Workload.locality:type_name -> hashicorp.consul.catalog.v2beta1.Locality
|
3, // 2: hashicorp.consul.catalog.v2beta1.Workload.locality:type_name -> hashicorp.consul.catalog.v2beta1.Locality
|
||||||
5, // 3: hashicorp.consul.catalog.v2beta1.WorkloadPort.protocol:type_name -> hashicorp.consul.catalog.v2beta1.Protocol
|
4, // 3: hashicorp.consul.catalog.v2beta1.Workload.dns:type_name -> hashicorp.consul.catalog.v2beta1.DNSPolicy
|
||||||
2, // 4: hashicorp.consul.catalog.v2beta1.Workload.PortsEntry.value:type_name -> hashicorp.consul.catalog.v2beta1.WorkloadPort
|
7, // 4: hashicorp.consul.catalog.v2beta1.WorkloadPort.protocol:type_name -> hashicorp.consul.catalog.v2beta1.Protocol
|
||||||
5, // [5:5] is the sub-list for method output_type
|
5, // 5: hashicorp.consul.catalog.v2beta1.DNSPolicy.weights:type_name -> hashicorp.consul.catalog.v2beta1.Weights
|
||||||
5, // [5:5] is the sub-list for method input_type
|
2, // 6: hashicorp.consul.catalog.v2beta1.Workload.PortsEntry.value:type_name -> hashicorp.consul.catalog.v2beta1.WorkloadPort
|
||||||
5, // [5:5] is the sub-list for extension type_name
|
7, // [7:7] is the sub-list for method output_type
|
||||||
5, // [5:5] is the sub-list for extension extendee
|
7, // [7:7] is the sub-list for method input_type
|
||||||
0, // [0:5] is the sub-list for field type_name
|
7, // [7:7] is the sub-list for extension type_name
|
||||||
|
7, // [7:7] is the sub-list for extension extendee
|
||||||
|
0, // [0:7] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_pbcatalog_v2beta1_workload_proto_init() }
|
func init() { file_pbcatalog_v2beta1_workload_proto_init() }
|
||||||
|
@ -501,6 +629,30 @@ func file_pbcatalog_v2beta1_workload_proto_init() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
file_pbcatalog_v2beta1_workload_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*DNSPolicy); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_pbcatalog_v2beta1_workload_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Weights); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
|
@ -508,7 +660,7 @@ func file_pbcatalog_v2beta1_workload_proto_init() {
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_pbcatalog_v2beta1_workload_proto_rawDesc,
|
RawDescriptor: file_pbcatalog_v2beta1_workload_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 5,
|
NumMessages: 7,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -39,6 +39,9 @@ message Workload {
|
||||||
// deprecated: connect_native indicates whether this workload is connect native which will allow it to be
|
// deprecated: connect_native indicates whether this workload is connect native which will allow it to be
|
||||||
// part of MeshEndpoints without having the corresponding Proxy resource.
|
// part of MeshEndpoints without having the corresponding Proxy resource.
|
||||||
bool connect_native = 8 [deprecated = true];
|
bool connect_native = 8 [deprecated = true];
|
||||||
|
|
||||||
|
// dns contains any workload customization that will be returned in DNS discovery requests.
|
||||||
|
DNSPolicy dns = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
message WorkloadAddress {
|
message WorkloadAddress {
|
||||||
|
@ -67,3 +70,12 @@ message Locality {
|
||||||
// Zone is the zone the entity is running in.
|
// Zone is the zone the entity is running in.
|
||||||
string zone = 2;
|
string zone = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message DNSPolicy {
|
||||||
|
Weights weights = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Weights {
|
||||||
|
uint32 passing = 1;
|
||||||
|
uint32 warning = 2;
|
||||||
|
}
|
||||||
|
|
|
@ -88,3 +88,45 @@ func (in *Locality) DeepCopy() *Locality {
|
||||||
func (in *Locality) DeepCopyInterface() interface{} {
|
func (in *Locality) DeepCopyInterface() interface{} {
|
||||||
return in.DeepCopy()
|
return in.DeepCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto supports using DNSPolicy within kubernetes types, where deepcopy-gen is used.
|
||||||
|
func (in *DNSPolicy) DeepCopyInto(out *DNSPolicy) {
|
||||||
|
proto.Reset(out)
|
||||||
|
proto.Merge(out, proto.Clone(in))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DNSPolicy. Required by controller-gen.
|
||||||
|
func (in *DNSPolicy) DeepCopy() *DNSPolicy {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(DNSPolicy)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new DNSPolicy. Required by controller-gen.
|
||||||
|
func (in *DNSPolicy) DeepCopyInterface() interface{} {
|
||||||
|
return in.DeepCopy()
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto supports using Weights within kubernetes types, where deepcopy-gen is used.
|
||||||
|
func (in *Weights) DeepCopyInto(out *Weights) {
|
||||||
|
proto.Reset(out)
|
||||||
|
proto.Merge(out, proto.Clone(in))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Weights. Required by controller-gen.
|
||||||
|
func (in *Weights) DeepCopy() *Weights {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(Weights)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyInterface is an autogenerated deepcopy function, copying the receiver, creating a new Weights. Required by controller-gen.
|
||||||
|
func (in *Weights) DeepCopyInterface() interface{} {
|
||||||
|
return in.DeepCopy()
|
||||||
|
}
|
||||||
|
|
|
@ -49,6 +49,28 @@ func (this *Locality) UnmarshalJSON(b []byte) error {
|
||||||
return WorkloadUnmarshaler.Unmarshal(b, this)
|
return WorkloadUnmarshaler.Unmarshal(b, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalJSON is a custom marshaler for DNSPolicy
|
||||||
|
func (this *DNSPolicy) MarshalJSON() ([]byte, error) {
|
||||||
|
str, err := WorkloadMarshaler.Marshal(this)
|
||||||
|
return []byte(str), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON is a custom unmarshaler for DNSPolicy
|
||||||
|
func (this *DNSPolicy) UnmarshalJSON(b []byte) error {
|
||||||
|
return WorkloadUnmarshaler.Unmarshal(b, this)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON is a custom marshaler for Weights
|
||||||
|
func (this *Weights) MarshalJSON() ([]byte, error) {
|
||||||
|
str, err := WorkloadMarshaler.Marshal(this)
|
||||||
|
return []byte(str), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON is a custom unmarshaler for Weights
|
||||||
|
func (this *Weights) UnmarshalJSON(b []byte) error {
|
||||||
|
return WorkloadUnmarshaler.Unmarshal(b, this)
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
WorkloadMarshaler = &protojson.MarshalOptions{}
|
WorkloadMarshaler = &protojson.MarshalOptions{}
|
||||||
WorkloadUnmarshaler = &protojson.UnmarshalOptions{DiscardUnknown: false}
|
WorkloadUnmarshaler = &protojson.UnmarshalOptions{DiscardUnknown: false}
|
||||||
|
|
Loading…
Reference in New Issue