Backport of Hash based config entry replication into release/1.16.x (#19915)
add hash based config entry replication Co-authored-by: Dhia Ayachi <dhia@hashicorp.com>
This commit is contained in:
parent
b83af6b165
commit
3c3e2c48fa
3
.changelog/19795.txt
Normal file
3
.changelog/19795.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
```release-note:enhancement
|
||||
wan-federation: use a hash to diff config entries when replicating in the secondary DC to avoid unnecessary writes..
|
||||
```
|
|
@ -6094,6 +6094,9 @@ func (tc testCase) run(format string, dataDir string) func(t *testing.T) {
|
|||
expected.ACLResolverSettings.NodeName = expected.NodeName
|
||||
expected.ACLResolverSettings.EnterpriseMeta = *structs.NodeEnterpriseMetaInPartition(expected.PartitionOrDefault())
|
||||
|
||||
for i, e := range expected.ConfigEntryBootstrap {
|
||||
e.SetHash(actual.ConfigEntryBootstrap[i].GetHash())
|
||||
}
|
||||
prototest.AssertDeepEqual(t, expected, actual, cmpopts.EquateEmpty())
|
||||
if tc.cleanup != nil {
|
||||
tc.cleanup()
|
||||
|
@ -6977,6 +6980,9 @@ func TestLoad_FullConfig(t *testing.T) {
|
|||
time.Date(2019, 11, 20, 5, 0, 0, 0, time.UTC)))
|
||||
r, err := Load(opts)
|
||||
require.NoError(t, err)
|
||||
for i, e := range expected.ConfigEntryBootstrap {
|
||||
e.SetHash(r.RuntimeConfig.ConfigEntryBootstrap[i].GetHash())
|
||||
}
|
||||
prototest.AssertDeepEqual(t, expected, r.RuntimeConfig)
|
||||
require.ElementsMatch(t, expectedWarns, r.Warnings, "Warnings: %#v", r.Warnings)
|
||||
})
|
||||
|
|
|
@ -125,6 +125,7 @@ func TestConfig_Get(t *testing.T) {
|
|||
ce.CreateIndex = 12
|
||||
ce.ModifyIndex = 13
|
||||
ce.EnterpriseMeta = acl.EnterpriseMeta{}
|
||||
ce.Hash = 0
|
||||
|
||||
out, err := a.srv.marshalJSON(req, obj)
|
||||
require.NoError(t, err)
|
||||
|
@ -450,6 +451,7 @@ func TestConfig_Apply_IngressGateway(t *testing.T) {
|
|||
},
|
||||
},
|
||||
EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
|
||||
Hash: got.GetHash(),
|
||||
}
|
||||
require.Equal(t, expect, got)
|
||||
}
|
||||
|
|
|
@ -35,3 +35,10 @@ func EqualID(e1, e2 structs.ConfigEntry) bool {
|
|||
e1.GetEnterpriseMeta().IsSame(e2.GetEnterpriseMeta()) &&
|
||||
e1.GetName() == e2.GetName()
|
||||
}
|
||||
|
||||
func SameHash(e1, e2 structs.ConfigEntry) bool {
|
||||
if e1.GetHash() == 0 || e2.GetHash() == 0 {
|
||||
return false
|
||||
}
|
||||
return e1.GetHash() == e2.GetHash()
|
||||
}
|
||||
|
|
|
@ -30,7 +30,9 @@ func diffConfigEntries(local []structs.ConfigEntry, remote []structs.ConfigEntry
|
|||
if configentry.EqualID(local[localIdx], remote[remoteIdx]) {
|
||||
// config is in both the local and remote state - need to check raft indices
|
||||
if remote[remoteIdx].GetRaftIndex().ModifyIndex > lastRemoteIndex {
|
||||
updates = append(updates, remote[remoteIdx])
|
||||
if !configentry.SameHash(local[localIdx], remote[remoteIdx]) {
|
||||
updates = append(updates, remote[remoteIdx])
|
||||
}
|
||||
}
|
||||
// increment both indices when equal
|
||||
localIdx += 1
|
||||
|
|
|
@ -6,6 +6,8 @@ package consul
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/oklog/ulid/v2"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
|
@ -268,3 +270,63 @@ func TestReplication_ConfigEntries_GraphValidationErrorDuringReplication(t *test
|
|||
checkSame(r)
|
||||
})
|
||||
}
|
||||
|
||||
func createConfigEntries(num int, indexStart int) []structs.ConfigEntry {
|
||||
entries := make([]structs.ConfigEntry, num)
|
||||
for i := range entries {
|
||||
entries[i] = &structs.ServiceConfigEntry{Name: ulid.Make().String(), RaftIndex: structs.RaftIndex{ModifyIndex: uint64(i + indexStart)}}
|
||||
}
|
||||
return entries
|
||||
}
|
||||
|
||||
func mutateIDs(e []structs.ConfigEntry, indexStart int) []structs.ConfigEntry {
|
||||
entries := make([]structs.ConfigEntry, len(e))
|
||||
for i := range entries {
|
||||
entries[i] = &structs.ServiceConfigEntry{Name: e[i].GetName(), RaftIndex: structs.RaftIndex{ModifyIndex: uint64(i + indexStart)}}
|
||||
}
|
||||
return entries
|
||||
}
|
||||
|
||||
func Test_diffConfigEntries(t *testing.T) {
|
||||
type args struct {
|
||||
local []structs.ConfigEntry
|
||||
remote []structs.ConfigEntry
|
||||
lastRemoteIndex uint64
|
||||
normalize bool
|
||||
}
|
||||
|
||||
entries1 := createConfigEntries(10, 10)
|
||||
entries2 := createConfigEntries(10, 20)
|
||||
entries3 := append(entries1, entries2...)
|
||||
entries4 := mutateIDs(entries1, 20)
|
||||
entries5 := mutateIDs(entries1, 0)
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
updated []structs.ConfigEntry
|
||||
deleted []structs.ConfigEntry
|
||||
}{
|
||||
{"empty", args{local: make([]structs.ConfigEntry, 0), remote: make([]structs.ConfigEntry, 0), lastRemoteIndex: 0, normalize: true}, nil, nil},
|
||||
{"same", args{local: entries1, remote: entries1, lastRemoteIndex: 0, normalize: true}, nil, nil},
|
||||
{"new remote", args{local: nil, remote: entries1, lastRemoteIndex: 0, normalize: true}, entries1, nil},
|
||||
{"extra remote", args{local: entries1, remote: entries3, lastRemoteIndex: 0, normalize: true}, entries2, nil},
|
||||
{"extra local", args{local: entries3, remote: entries1, lastRemoteIndex: 0, normalize: true}, nil, entries2},
|
||||
{"same, same size, different raft ID", args{local: entries1, remote: entries4, lastRemoteIndex: 0, normalize: true}, nil, nil},
|
||||
{"when hash is empty, avoid hash compare", args{local: entries5, remote: entries4, lastRemoteIndex: 0, normalize: false}, entries4, nil},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if tt.args.normalize {
|
||||
for _, l := range tt.args.local {
|
||||
require.NoError(t, l.Normalize())
|
||||
}
|
||||
for _, r := range tt.args.remote {
|
||||
require.NoError(t, r.Normalize())
|
||||
}
|
||||
}
|
||||
deletions, updates := diffConfigEntries(tt.args.local, tt.args.remote, tt.args.lastRemoteIndex)
|
||||
assert.Equalf(t, tt.updated, updates, "updated diffConfigEntries(%v, %v, %v)", tt.args.local, tt.args.remote, tt.args.lastRemoteIndex)
|
||||
assert.Equalf(t, tt.deleted, deletions, "deleted diffConfigEntries(%v, %v, %v)", tt.args.local, tt.args.remote, tt.args.lastRemoteIndex)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -815,14 +815,17 @@ func TestFSM_SnapshotRestore_CE(t *testing.T) {
|
|||
// Verify config entries are restored
|
||||
_, serviceConfEntry, err := fsm2.state.ConfigEntry(nil, structs.ServiceDefaults, "foo", structs.DefaultEnterpriseMetaInDefaultPartition())
|
||||
require.NoError(t, err)
|
||||
serviceConfig.SetHash(serviceConfEntry.GetHash())
|
||||
require.Equal(t, serviceConfig, serviceConfEntry)
|
||||
|
||||
_, proxyConfEntry, err := fsm2.state.ConfigEntry(nil, structs.ProxyDefaults, "global", structs.DefaultEnterpriseMetaInDefaultPartition())
|
||||
require.NoError(t, err)
|
||||
proxyConfig.SetHash(proxyConfEntry.GetHash())
|
||||
require.Equal(t, proxyConfig, proxyConfEntry)
|
||||
|
||||
_, ingressRestored, err := fsm2.state.ConfigEntry(nil, structs.IngressGateway, "ingress", structs.DefaultEnterpriseMetaInDefaultPartition())
|
||||
require.NoError(t, err)
|
||||
ingress.SetHash(ingressRestored.GetHash())
|
||||
require.Equal(t, ingress, ingressRestored)
|
||||
|
||||
_, restoredGatewayServices, err := fsm2.state.GatewayServices(nil, "ingress", structs.DefaultEnterpriseMetaInDefaultPartition())
|
||||
|
@ -856,11 +859,13 @@ func TestFSM_SnapshotRestore_CE(t *testing.T) {
|
|||
// Verify service-intentions is restored
|
||||
_, serviceIxnEntry, err := fsm2.state.ConfigEntry(nil, structs.ServiceIntentions, "foo", structs.DefaultEnterpriseMetaInDefaultPartition())
|
||||
require.NoError(t, err)
|
||||
serviceIxn.SetHash(serviceIxnEntry.GetHash())
|
||||
require.Equal(t, serviceIxn, serviceIxnEntry)
|
||||
|
||||
// Verify mesh config entry is restored
|
||||
_, meshConfigEntry, err := fsm2.state.ConfigEntry(nil, structs.MeshConfig, structs.MeshConfigMesh, structs.DefaultEnterpriseMetaInDefaultPartition())
|
||||
require.NoError(t, err)
|
||||
meshConfig.SetHash(meshConfigEntry.GetHash())
|
||||
require.Equal(t, meshConfig, meshConfigEntry)
|
||||
|
||||
_, restoredServiceNames, err := fsm2.state.ServiceNamesOfKind(nil, structs.ServiceKindTypical)
|
||||
|
|
|
@ -550,6 +550,7 @@ func TestIntentionApply_WithoutIDs(t *testing.T) {
|
|||
},
|
||||
},
|
||||
RaftIndex: entry.RaftIndex,
|
||||
Hash: entry.GetHash(),
|
||||
}
|
||||
|
||||
require.Equal(t, expect, entry)
|
||||
|
@ -689,6 +690,7 @@ func TestIntentionApply_WithoutIDs(t *testing.T) {
|
|||
},
|
||||
},
|
||||
RaftIndex: entry.RaftIndex,
|
||||
Hash: entry.GetHash(),
|
||||
}
|
||||
|
||||
require.Equal(t, expect, entry)
|
||||
|
@ -758,6 +760,7 @@ func TestIntentionApply_WithoutIDs(t *testing.T) {
|
|||
},
|
||||
},
|
||||
RaftIndex: entry.RaftIndex,
|
||||
Hash: entry.GetHash(),
|
||||
}
|
||||
|
||||
require.Equal(t, expect, entry)
|
||||
|
|
|
@ -2084,8 +2084,8 @@ func TestDatacenterSupportsIntentionsAsConfigEntries(t *testing.T) {
|
|||
LegacyUpdateTime: got.Sources[0].LegacyUpdateTime,
|
||||
},
|
||||
},
|
||||
|
||||
RaftIndex: got.RaftIndex,
|
||||
Hash: got.GetHash(),
|
||||
}
|
||||
|
||||
require.Equal(t, expect, got)
|
||||
|
|
|
@ -103,6 +103,13 @@ func (s *Snapshot) ConfigEntries() ([]structs.ConfigEntry, error) {
|
|||
|
||||
// ConfigEntry is used when restoring from a snapshot.
|
||||
func (s *Restore) ConfigEntry(c structs.ConfigEntry) error {
|
||||
// the hash is recalculated when restoring config entries
|
||||
// in case a new field is added in a newer version.
|
||||
h, err := structs.HashConfigEntry(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.SetHash(h)
|
||||
return insertConfigEntryWithTxn(s.tx, c.GetRaftIndex().ModifyIndex, c)
|
||||
}
|
||||
|
||||
|
|
|
@ -313,6 +313,7 @@ func testStore_IntentionMutation(t *testing.T, s *Store) {
|
|||
src.LegacyMeta = nil
|
||||
}
|
||||
}
|
||||
expect.SetHash(got.GetHash())
|
||||
require.Equal(t, expect, got)
|
||||
}
|
||||
|
||||
|
|
|
@ -95,6 +95,16 @@ type ConfigEntry interface {
|
|||
GetMeta() map[string]string
|
||||
GetEnterpriseMeta() *acl.EnterpriseMeta
|
||||
GetRaftIndex() *RaftIndex
|
||||
GetHash() uint64
|
||||
SetHash(h uint64)
|
||||
}
|
||||
|
||||
func HashConfigEntry(conf ConfigEntry) (uint64, error) {
|
||||
hash, err := hashstructure.Hash(conf, nil)
|
||||
if err != nil {
|
||||
return hash, err
|
||||
}
|
||||
return hash, nil
|
||||
}
|
||||
|
||||
// ControlledConfigEntry is an optional interface implemented by a ConfigEntry
|
||||
|
@ -168,8 +178,17 @@ type ServiceConfigEntry struct {
|
|||
EnvoyExtensions EnvoyExtensions `json:",omitempty" alias:"envoy_extensions"`
|
||||
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *ServiceConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *ServiceConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
func (e *ServiceConfigEntry) Clone() *ServiceConfigEntry {
|
||||
|
@ -224,6 +243,11 @@ func (e *ServiceConfigEntry) Normalize() error {
|
|||
}
|
||||
}
|
||||
}
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
|
||||
return validationErr
|
||||
}
|
||||
|
@ -409,8 +433,17 @@ type ProxyConfigEntry struct {
|
|||
PrioritizeByLocality *ServiceResolverPrioritizeByLocality `json:",omitempty" alias:"prioritize_by_locality"`
|
||||
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *ProxyConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *ProxyConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
func (e *ProxyConfigEntry) GetKind() string {
|
||||
|
@ -449,7 +482,13 @@ func (e *ProxyConfigEntry) Normalize() error {
|
|||
|
||||
e.EnterpriseMeta.Normalize()
|
||||
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func (e *ProxyConfigEntry) Validate() error {
|
||||
|
|
|
@ -79,8 +79,17 @@ type ServiceRouterConfigEntry struct {
|
|||
Routes []ServiceRoute
|
||||
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *ServiceRouterConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *ServiceRouterConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
func (e *ServiceRouterConfigEntry) GetKind() string {
|
||||
|
@ -129,6 +138,11 @@ func (e *ServiceRouterConfigEntry) Normalize() error {
|
|||
}
|
||||
}
|
||||
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -537,8 +551,17 @@ type ServiceSplitterConfigEntry struct {
|
|||
Splits []ServiceSplit
|
||||
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *ServiceSplitterConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *ServiceSplitterConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
func (e *ServiceSplitterConfigEntry) GetKind() string {
|
||||
|
@ -581,6 +604,11 @@ func (e *ServiceSplitterConfigEntry) Normalize() error {
|
|||
}
|
||||
}
|
||||
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -876,8 +904,17 @@ type ServiceResolverConfigEntry struct {
|
|||
LoadBalancer *LoadBalancer `json:",omitempty" alias:"load_balancer"`
|
||||
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *ServiceResolverConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *ServiceResolverConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
func (e *ServiceResolverConfigEntry) RelatedPeers() []string {
|
||||
|
@ -998,6 +1035,11 @@ func (e *ServiceResolverConfigEntry) Normalize() error {
|
|||
|
||||
e.EnterpriseMeta.Normalize()
|
||||
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,17 @@ type ExportedServicesConfigEntry struct {
|
|||
Services []ExportedService `json:",omitempty"`
|
||||
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *ExportedServicesConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *ExportedServicesConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
// ExportedService manages the exporting of a service in the local partition to
|
||||
|
@ -79,6 +88,11 @@ func (e *ExportedServicesConfigEntry) Normalize() error {
|
|||
for i := range e.Services {
|
||||
e.Services[i].Namespace = acl.NormalizeNamespace(e.Services[i].Namespace)
|
||||
}
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -45,8 +45,17 @@ type IngressGatewayConfigEntry struct {
|
|||
Defaults *IngressServiceConfig `json:",omitempty"`
|
||||
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *IngressGatewayConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *IngressGatewayConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
type IngressServiceConfig struct {
|
||||
|
@ -196,6 +205,12 @@ func (e *IngressGatewayConfigEntry) Normalize() error {
|
|||
e.Listeners[i] = listener
|
||||
}
|
||||
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -470,8 +485,17 @@ type TerminatingGatewayConfigEntry struct {
|
|||
Services []LinkedService
|
||||
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *TerminatingGatewayConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *TerminatingGatewayConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
// A LinkedService is a service represented by a terminating gateway
|
||||
|
@ -529,6 +553,11 @@ func (e *TerminatingGatewayConfigEntry) Normalize() error {
|
|||
e.Services[i].EnterpriseMeta.Normalize()
|
||||
}
|
||||
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -715,8 +744,17 @@ type APIGatewayConfigEntry struct {
|
|||
Status Status
|
||||
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *APIGatewayConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *APIGatewayConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
func (e *APIGatewayConfigEntry) GetKind() string { return APIGateway }
|
||||
|
@ -767,6 +805,11 @@ func (e *APIGatewayConfigEntry) Normalize() error {
|
|||
}
|
||||
}
|
||||
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -979,8 +1022,17 @@ type BoundAPIGatewayConfigEntry struct {
|
|||
Services ServiceRouteReferences
|
||||
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *BoundAPIGatewayConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *BoundAPIGatewayConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
func (e *BoundAPIGatewayConfigEntry) IsSame(other *BoundAPIGatewayConfigEntry) bool {
|
||||
|
@ -1072,6 +1124,12 @@ func (e *BoundAPIGatewayConfigEntry) Normalize() error {
|
|||
|
||||
e.Listeners[i] = listener
|
||||
}
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -31,13 +31,29 @@ type InlineCertificateConfigEntry struct {
|
|||
PrivateKey string
|
||||
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *InlineCertificateConfigEntry) GetKind() string { return InlineCertificate }
|
||||
func (e *InlineCertificateConfigEntry) GetName() string { return e.Name }
|
||||
func (e *InlineCertificateConfigEntry) Normalize() error { return nil }
|
||||
func (e *InlineCertificateConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *InlineCertificateConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
func (e *InlineCertificateConfigEntry) GetKind() string { return InlineCertificate }
|
||||
func (e *InlineCertificateConfigEntry) GetName() string { return e.Name }
|
||||
func (e *InlineCertificateConfigEntry) Normalize() error {
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
return nil
|
||||
}
|
||||
func (e *InlineCertificateConfigEntry) GetMeta() map[string]string { return e.Meta }
|
||||
func (e *InlineCertificateConfigEntry) GetEnterpriseMeta() *acl.EnterpriseMeta {
|
||||
return &e.EnterpriseMeta
|
||||
|
|
|
@ -26,7 +26,16 @@ type ServiceIntentionsConfigEntry struct {
|
|||
Meta map[string]string `json:",omitempty"` // formerly Intention.Meta
|
||||
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"` // formerly DestinationNS
|
||||
RaftIndex
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *ServiceIntentionsConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *ServiceIntentionsConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
var _ UpdatableConfigEntry = (*ServiceIntentionsConfigEntry)(nil)
|
||||
|
@ -577,6 +586,11 @@ func (e *ServiceIntentionsConfigEntry) normalize(legacyWrite bool) error {
|
|||
return e.Sources[i].Precedence > e.Sources[j].Precedence
|
||||
})
|
||||
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -68,8 +68,17 @@ type JWTProviderConfigEntry struct {
|
|||
CacheConfig *JWTCacheConfig `json:",omitempty" alias:"cache_config"`
|
||||
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *JWTProviderConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *JWTProviderConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
// JWTLocation is a location where the JWT could be present in requests.
|
||||
|
@ -546,5 +555,11 @@ func (e *JWTProviderConfigEntry) Normalize() error {
|
|||
e.ClockSkewSeconds = DefaultClockSkewSeconds
|
||||
}
|
||||
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -27,8 +27,17 @@ type MeshConfigEntry struct {
|
|||
Peering *PeeringMeshConfig `json:",omitempty"`
|
||||
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *MeshConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *MeshConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
// TransparentProxyMeshConfig contains cluster-wide options pertaining to
|
||||
|
@ -92,6 +101,13 @@ func (e *MeshConfigEntry) Normalize() error {
|
|||
}
|
||||
|
||||
e.EnterpriseMeta.Normalize()
|
||||
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,17 @@ type HTTPRouteConfigEntry struct {
|
|||
Meta map[string]string `json:",omitempty"`
|
||||
// Status is the asynchronous reconciliation status which an HTTPRoute propagates to the user.
|
||||
Status Status
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *HTTPRouteConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *HTTPRouteConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
func (e *HTTPRouteConfigEntry) GetKind() string { return HTTPRoute }
|
||||
|
@ -101,6 +110,12 @@ func (e *HTTPRouteConfigEntry) Normalize() error {
|
|||
e.Rules[i] = rule
|
||||
}
|
||||
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -484,8 +499,17 @@ type TCPRouteConfigEntry struct {
|
|||
Meta map[string]string `json:",omitempty"`
|
||||
// Status is the asynchronous reconciliation status which a TCPRoute propagates to the user.
|
||||
Status Status
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (e *TCPRouteConfigEntry) SetHash(h uint64) {
|
||||
e.Hash = h
|
||||
}
|
||||
|
||||
func (e *TCPRouteConfigEntry) GetHash() uint64 {
|
||||
return e.Hash
|
||||
}
|
||||
|
||||
func (e *TCPRouteConfigEntry) GetKind() string { return TCPRoute }
|
||||
|
@ -531,6 +555,11 @@ func (e *TCPRouteConfigEntry) Normalize() error {
|
|||
e.Services[i] = service
|
||||
}
|
||||
|
||||
h, err := HashConfigEntry(e)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.Hash = h
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,17 @@ type SamenessGroupConfigEntry struct {
|
|||
IncludeLocal bool `json:",omitempty" alias:"include_local"`
|
||||
Members []SamenessGroupMember
|
||||
Meta map[string]string `json:",omitempty"`
|
||||
Hash uint64 `json:",omitempty" hash:"ignore"`
|
||||
acl.EnterpriseMeta `hcl:",squash" mapstructure:",squash"`
|
||||
RaftIndex
|
||||
RaftIndex `hash:"ignore"`
|
||||
}
|
||||
|
||||
func (s *SamenessGroupConfigEntry) SetHash(h uint64) {
|
||||
s.Hash = h
|
||||
}
|
||||
|
||||
func (s *SamenessGroupConfigEntry) GetHash() uint64 {
|
||||
return s.Hash
|
||||
}
|
||||
|
||||
func (s *SamenessGroupConfigEntry) GetKind() string { return SamenessGroup }
|
||||
|
@ -45,6 +54,12 @@ func (s *SamenessGroupConfigEntry) Normalize() error {
|
|||
return fmt.Errorf("config entry is nil")
|
||||
}
|
||||
s.EnterpriseMeta.Normalize()
|
||||
h, err := HashConfigEntry(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s.Hash = h
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,20 @@ import (
|
|||
"github.com/hashicorp/consul/types"
|
||||
)
|
||||
|
||||
func TestNormalizeGenerateHash(t *testing.T) {
|
||||
for _, cType := range AllConfigEntryKinds {
|
||||
//this is an enterprise only config entry
|
||||
if cType == RateLimitIPConfig {
|
||||
continue
|
||||
}
|
||||
entry, err := MakeConfigEntry(cType, "global")
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, entry.Normalize())
|
||||
require.NotEmpty(t, entry.GetHash(), entry.GetKind())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestConfigEntries_ACLs(t *testing.T) {
|
||||
type testACL = configEntryTestACL
|
||||
type testcase = configEntryACLTestCase
|
||||
|
@ -3407,6 +3421,7 @@ func testConfigEntryNormalizeAndValidate(t *testing.T, cases map[string]configEn
|
|||
}
|
||||
|
||||
if tc.expected != nil {
|
||||
tc.expected.SetHash(tc.entry.GetHash())
|
||||
require.Equal(t, tc.expected, tc.entry)
|
||||
}
|
||||
|
||||
|
@ -3420,6 +3435,7 @@ func testConfigEntryNormalizeAndValidate(t *testing.T, cases map[string]configEn
|
|||
return a.IsSame(&b)
|
||||
}),
|
||||
}
|
||||
beforeNormalize.(ConfigEntry).SetHash(tc.entry.GetHash())
|
||||
if diff := cmp.Diff(beforeNormalize, tc.entry, opts); diff != "" {
|
||||
t.Fatalf("expect unchanged after Normalize, got diff:\n%s", diff)
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ func APIGatewayToStructs(s *APIGateway, t *structs.APIGatewayConfigEntry) {
|
|||
StatusToStructs(s.Status, &t.Status)
|
||||
}
|
||||
t.Meta = s.Meta
|
||||
t.Hash = s.Hash
|
||||
}
|
||||
func APIGatewayFromStructs(t *structs.APIGatewayConfigEntry, s *APIGateway) {
|
||||
if s == nil {
|
||||
|
@ -41,6 +42,7 @@ func APIGatewayFromStructs(t *structs.APIGatewayConfigEntry, s *APIGateway) {
|
|||
s.Status = &x
|
||||
}
|
||||
s.Meta = t.Meta
|
||||
s.Hash = t.Hash
|
||||
}
|
||||
func APIGatewayListenerToStructs(s *APIGatewayListener, t *structs.APIGatewayListener) {
|
||||
if s == nil {
|
||||
|
@ -116,6 +118,7 @@ func BoundAPIGatewayToStructs(s *BoundAPIGateway, t *structs.BoundAPIGatewayConf
|
|||
}
|
||||
t.Services = serviceRefsToStructs(s.Services)
|
||||
t.Meta = s.Meta
|
||||
t.Hash = s.Hash
|
||||
}
|
||||
func BoundAPIGatewayFromStructs(t *structs.BoundAPIGatewayConfigEntry, s *BoundAPIGateway) {
|
||||
if s == nil {
|
||||
|
@ -133,6 +136,7 @@ func BoundAPIGatewayFromStructs(t *structs.BoundAPIGatewayConfigEntry, s *BoundA
|
|||
}
|
||||
s.Services = serviceRefFromStructs(t.Services)
|
||||
s.Meta = t.Meta
|
||||
s.Hash = t.Hash
|
||||
}
|
||||
func BoundAPIGatewayListenerToStructs(s *BoundAPIGatewayListener, t *structs.BoundAPIGatewayListener) {
|
||||
if s == nil {
|
||||
|
@ -551,6 +555,7 @@ func HTTPRouteToStructs(s *HTTPRoute, t *structs.HTTPRouteConfigEntry) {
|
|||
if s.Status != nil {
|
||||
StatusToStructs(s.Status, &t.Status)
|
||||
}
|
||||
t.Hash = s.Hash
|
||||
}
|
||||
func HTTPRouteFromStructs(t *structs.HTTPRouteConfigEntry, s *HTTPRoute) {
|
||||
if s == nil {
|
||||
|
@ -583,6 +588,7 @@ func HTTPRouteFromStructs(t *structs.HTTPRouteConfigEntry, s *HTTPRoute) {
|
|||
StatusFromStructs(&t.Status, &x)
|
||||
s.Status = &x
|
||||
}
|
||||
s.Hash = t.Hash
|
||||
}
|
||||
func HTTPRouteRuleToStructs(s *HTTPRouteRule, t *structs.HTTPRouteRule) {
|
||||
if s == nil {
|
||||
|
@ -711,6 +717,7 @@ func IngressGatewayToStructs(s *IngressGateway, t *structs.IngressGatewayConfigE
|
|||
t.Defaults = &x
|
||||
}
|
||||
t.Meta = s.Meta
|
||||
t.Hash = s.Hash
|
||||
}
|
||||
func IngressGatewayFromStructs(t *structs.IngressGatewayConfigEntry, s *IngressGateway) {
|
||||
if s == nil {
|
||||
|
@ -737,6 +744,7 @@ func IngressGatewayFromStructs(t *structs.IngressGatewayConfigEntry, s *IngressG
|
|||
s.Defaults = &x
|
||||
}
|
||||
s.Meta = t.Meta
|
||||
s.Hash = t.Hash
|
||||
}
|
||||
func IngressListenerToStructs(s *IngressListener, t *structs.IngressListener) {
|
||||
if s == nil {
|
||||
|
@ -877,6 +885,7 @@ func InlineCertificateToStructs(s *InlineCertificate, t *structs.InlineCertifica
|
|||
t.Certificate = s.Certificate
|
||||
t.PrivateKey = s.PrivateKey
|
||||
t.Meta = s.Meta
|
||||
t.Hash = s.Hash
|
||||
}
|
||||
func InlineCertificateFromStructs(t *structs.InlineCertificateConfigEntry, s *InlineCertificate) {
|
||||
if s == nil {
|
||||
|
@ -885,6 +894,7 @@ func InlineCertificateFromStructs(t *structs.InlineCertificateConfigEntry, s *In
|
|||
s.Certificate = t.Certificate
|
||||
s.PrivateKey = t.PrivateKey
|
||||
s.Meta = t.Meta
|
||||
s.Hash = t.Hash
|
||||
}
|
||||
func IntentionHTTPHeaderPermissionToStructs(s *IntentionHTTPHeaderPermission, t *structs.IntentionHTTPHeaderPermission) {
|
||||
if s == nil {
|
||||
|
@ -1331,6 +1341,7 @@ func JWTProviderToStructs(s *JWTProvider, t *structs.JWTProviderConfigEntry) {
|
|||
t.CacheConfig = &x
|
||||
}
|
||||
t.Meta = s.Meta
|
||||
t.Hash = s.Hash
|
||||
}
|
||||
func JWTProviderFromStructs(t *structs.JWTProviderConfigEntry, s *JWTProvider) {
|
||||
if s == nil {
|
||||
|
@ -1365,6 +1376,7 @@ func JWTProviderFromStructs(t *structs.JWTProviderConfigEntry, s *JWTProvider) {
|
|||
s.CacheConfig = &x
|
||||
}
|
||||
s.Meta = t.Meta
|
||||
s.Hash = t.Hash
|
||||
}
|
||||
func LeastRequestConfigToStructs(s *LeastRequestConfig, t *structs.LeastRequestConfig) {
|
||||
if s == nil {
|
||||
|
@ -1466,6 +1478,7 @@ func MeshConfigToStructs(s *MeshConfig, t *structs.MeshConfigEntry) {
|
|||
t.Peering = &x
|
||||
}
|
||||
t.Meta = s.Meta
|
||||
t.Hash = s.Hash
|
||||
}
|
||||
func MeshConfigFromStructs(t *structs.MeshConfigEntry, s *MeshConfig) {
|
||||
if s == nil {
|
||||
|
@ -1493,6 +1506,7 @@ func MeshConfigFromStructs(t *structs.MeshConfigEntry, s *MeshConfig) {
|
|||
s.Peering = &x
|
||||
}
|
||||
s.Meta = t.Meta
|
||||
s.Hash = t.Hash
|
||||
}
|
||||
func MeshDirectionalTLSConfigToStructs(s *MeshDirectionalTLSConfig, t *structs.MeshDirectionalTLSConfig) {
|
||||
if s == nil {
|
||||
|
@ -1696,6 +1710,7 @@ func SamenessGroupToStructs(s *SamenessGroup, t *structs.SamenessGroupConfigEntr
|
|||
}
|
||||
}
|
||||
t.Meta = s.Meta
|
||||
t.Hash = s.Hash
|
||||
t.EnterpriseMeta = enterpriseMetaToStructs(s.EnterpriseMeta)
|
||||
}
|
||||
func SamenessGroupFromStructs(t *structs.SamenessGroupConfigEntry, s *SamenessGroup) {
|
||||
|
@ -1716,6 +1731,7 @@ func SamenessGroupFromStructs(t *structs.SamenessGroupConfigEntry, s *SamenessGr
|
|||
}
|
||||
}
|
||||
s.Meta = t.Meta
|
||||
s.Hash = t.Hash
|
||||
s.EnterpriseMeta = enterpriseMetaFromStructs(t.EnterpriseMeta)
|
||||
}
|
||||
func SamenessGroupMemberToStructs(s *SamenessGroupMember, t *structs.SamenessGroupMember) {
|
||||
|
@ -1765,6 +1781,7 @@ func ServiceDefaultsToStructs(s *ServiceDefaults, t *structs.ServiceConfigEntry)
|
|||
t.BalanceInboundConnections = s.BalanceInboundConnections
|
||||
t.EnvoyExtensions = EnvoyExtensionsToStructs(s.EnvoyExtensions)
|
||||
t.Meta = s.Meta
|
||||
t.Hash = s.Hash
|
||||
}
|
||||
func ServiceDefaultsFromStructs(t *structs.ServiceConfigEntry, s *ServiceDefaults) {
|
||||
if s == nil {
|
||||
|
@ -1805,6 +1822,7 @@ func ServiceDefaultsFromStructs(t *structs.ServiceConfigEntry, s *ServiceDefault
|
|||
s.BalanceInboundConnections = t.BalanceInboundConnections
|
||||
s.EnvoyExtensions = EnvoyExtensionsFromStructs(t.EnvoyExtensions)
|
||||
s.Meta = t.Meta
|
||||
s.Hash = t.Hash
|
||||
}
|
||||
func ServiceIntentionsToStructs(s *ServiceIntentions, t *structs.ServiceIntentionsConfigEntry) {
|
||||
if s == nil {
|
||||
|
@ -1826,6 +1844,7 @@ func ServiceIntentionsToStructs(s *ServiceIntentions, t *structs.ServiceIntentio
|
|||
t.JWT = &x
|
||||
}
|
||||
t.Meta = s.Meta
|
||||
t.Hash = s.Hash
|
||||
}
|
||||
func ServiceIntentionsFromStructs(t *structs.ServiceIntentionsConfigEntry, s *ServiceIntentions) {
|
||||
if s == nil {
|
||||
|
@ -1847,6 +1866,7 @@ func ServiceIntentionsFromStructs(t *structs.ServiceIntentionsConfigEntry, s *Se
|
|||
s.JWT = &x
|
||||
}
|
||||
s.Meta = t.Meta
|
||||
s.Hash = t.Hash
|
||||
}
|
||||
func ServiceResolverToStructs(s *ServiceResolver, t *structs.ServiceResolverConfigEntry) {
|
||||
if s == nil {
|
||||
|
@ -1891,6 +1911,7 @@ func ServiceResolverToStructs(s *ServiceResolver, t *structs.ServiceResolverConf
|
|||
t.LoadBalancer = &x
|
||||
}
|
||||
t.Meta = s.Meta
|
||||
t.Hash = s.Hash
|
||||
}
|
||||
func ServiceResolverFromStructs(t *structs.ServiceResolverConfigEntry, s *ServiceResolver) {
|
||||
if s == nil {
|
||||
|
@ -1939,6 +1960,7 @@ func ServiceResolverFromStructs(t *structs.ServiceResolverConfigEntry, s *Servic
|
|||
s.LoadBalancer = &x
|
||||
}
|
||||
s.Meta = t.Meta
|
||||
s.Hash = t.Hash
|
||||
}
|
||||
func ServiceResolverFailoverToStructs(s *ServiceResolverFailover, t *structs.ServiceResolverFailover) {
|
||||
if s == nil {
|
||||
|
@ -2180,6 +2202,7 @@ func TCPRouteToStructs(s *TCPRoute, t *structs.TCPRouteConfigEntry) {
|
|||
if s.Status != nil {
|
||||
StatusToStructs(s.Status, &t.Status)
|
||||
}
|
||||
t.Hash = s.Hash
|
||||
}
|
||||
func TCPRouteFromStructs(t *structs.TCPRouteConfigEntry, s *TCPRoute) {
|
||||
if s == nil {
|
||||
|
@ -2211,6 +2234,7 @@ func TCPRouteFromStructs(t *structs.TCPRouteConfigEntry, s *TCPRoute) {
|
|||
StatusFromStructs(&t.Status, &x)
|
||||
s.Status = &x
|
||||
}
|
||||
s.Hash = t.Hash
|
||||
}
|
||||
func TCPServiceToStructs(s *TCPService, t *structs.TCPService) {
|
||||
if s == nil {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -61,6 +61,7 @@ message MeshConfig {
|
|||
map<string, string> Meta = 4;
|
||||
PeeringMeshConfig Peering = 5;
|
||||
bool AllowEnablingPermissiveMutualTLS = 6;
|
||||
uint64 Hash = 7;
|
||||
}
|
||||
|
||||
// mog annotation:
|
||||
|
@ -132,6 +133,7 @@ message ServiceResolver {
|
|||
// mog: func-to=structs.DurationFromProto func-from=structs.DurationToProto
|
||||
google.protobuf.Duration RequestTimeout = 8;
|
||||
ServiceResolverPrioritizeByLocality PrioritizeByLocality = 9;
|
||||
uint64 Hash = 10;
|
||||
}
|
||||
|
||||
// mog annotation:
|
||||
|
@ -274,6 +276,7 @@ message IngressGateway {
|
|||
repeated IngressListener Listeners = 2;
|
||||
map<string, string> Meta = 3;
|
||||
IngressServiceConfig Defaults = 4;
|
||||
uint64 Hash = 5;
|
||||
}
|
||||
|
||||
// mog annotation:
|
||||
|
@ -377,6 +380,7 @@ message ServiceIntentions {
|
|||
repeated SourceIntention Sources = 1;
|
||||
map<string, string> Meta = 2;
|
||||
IntentionJWTRequirement JWT = 3;
|
||||
uint64 Hash = 4;
|
||||
}
|
||||
|
||||
// mog annotation:
|
||||
|
@ -512,6 +516,7 @@ message ServiceDefaults {
|
|||
repeated hashicorp.consul.internal.common.EnvoyExtension EnvoyExtensions = 14;
|
||||
// mog: func-to=mutualTLSModeToStructs func-from=mutualTLSModeFromStructs
|
||||
MutualTLSMode MutualTLSMode = 15;
|
||||
uint64 Hash = 17;
|
||||
}
|
||||
|
||||
enum ProxyMode {
|
||||
|
@ -662,6 +667,7 @@ message APIGateway {
|
|||
map<string, string> Meta = 1;
|
||||
repeated APIGatewayListener Listeners = 2;
|
||||
Status Status = 3;
|
||||
uint64 Hash = 4;
|
||||
}
|
||||
|
||||
// mog annotation:
|
||||
|
@ -747,6 +753,7 @@ message BoundAPIGateway {
|
|||
repeated BoundAPIGatewayListener Listeners = 2;
|
||||
// mog: func-to=serviceRefsToStructs func-from=serviceRefFromStructs
|
||||
map<string, ListOfResourceReference> Services = 3;
|
||||
uint64 Hash = 4;
|
||||
}
|
||||
|
||||
message ListOfResourceReference {
|
||||
|
@ -774,6 +781,7 @@ message InlineCertificate {
|
|||
map<string, string> Meta = 1;
|
||||
string Certificate = 2;
|
||||
string PrivateKey = 3;
|
||||
uint64 Hash = 4;
|
||||
}
|
||||
|
||||
// mog annotation:
|
||||
|
@ -788,6 +796,7 @@ message HTTPRoute {
|
|||
repeated HTTPRouteRule Rules = 3;
|
||||
repeated string Hostnames = 4;
|
||||
Status Status = 5;
|
||||
uint64 Hash = 6;
|
||||
}
|
||||
|
||||
// mog annotation:
|
||||
|
@ -937,6 +946,7 @@ message TCPRoute {
|
|||
repeated ResourceReference Parents = 2;
|
||||
repeated TCPService Services = 3;
|
||||
Status Status = 4;
|
||||
uint64 Hash = 5;
|
||||
}
|
||||
|
||||
// mog annotation:
|
||||
|
@ -964,6 +974,7 @@ message SamenessGroup {
|
|||
map<string, string> Meta = 5;
|
||||
// mog: func-to=enterpriseMetaToStructs func-from=enterpriseMetaFromStructs
|
||||
common.EnterpriseMeta EnterpriseMeta = 6;
|
||||
uint64 Hash = 7;
|
||||
}
|
||||
|
||||
// mog annotation:
|
||||
|
@ -992,6 +1003,7 @@ message JWTProvider {
|
|||
map<string, string> Meta = 7;
|
||||
// mog: func-to=int func-from=int32
|
||||
int32 ClockSkewSeconds = 8;
|
||||
uint64 Hash = 9;
|
||||
}
|
||||
|
||||
// mog annotation:
|
||||
|
|
Loading…
Reference in a new issue