mirror of https://github.com/status-im/consul.git
Merge pull request #10843 from hashicorp/partitions/rename-default
oss: Rename default partition
This commit is contained in:
commit
fa5df0349d
|
@ -1296,6 +1296,7 @@ func TestMigrateIntentions(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
anyTime := time.Now().UTC()
|
anyTime := time.Now().UTC()
|
||||||
|
entMeta := NodeEnterpriseMetaInDefaultPartition()
|
||||||
|
|
||||||
cases := map[string]testcase{
|
cases := map[string]testcase{
|
||||||
"nil": {},
|
"nil": {},
|
||||||
|
@ -1318,15 +1319,17 @@ func TestMigrateIntentions(t *testing.T) {
|
||||||
},
|
},
|
||||||
expect: []*ServiceIntentionsConfigEntry{
|
expect: []*ServiceIntentionsConfigEntry{
|
||||||
{
|
{
|
||||||
Kind: ServiceIntentions,
|
Kind: ServiceIntentions,
|
||||||
Name: "bar",
|
Name: "bar",
|
||||||
|
EnterpriseMeta: *entMeta,
|
||||||
Sources: []*SourceIntention{
|
Sources: []*SourceIntention{
|
||||||
{
|
{
|
||||||
LegacyID: legacyIDs[0],
|
LegacyID: legacyIDs[0],
|
||||||
Description: "desc",
|
Description: "desc",
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Type: IntentionSourceConsul,
|
EnterpriseMeta: *entMeta,
|
||||||
Action: IntentionActionAllow,
|
Type: IntentionSourceConsul,
|
||||||
|
Action: IntentionActionAllow,
|
||||||
LegacyMeta: map[string]string{
|
LegacyMeta: map[string]string{
|
||||||
"key1": "val1",
|
"key1": "val1",
|
||||||
},
|
},
|
||||||
|
@ -1370,15 +1373,17 @@ func TestMigrateIntentions(t *testing.T) {
|
||||||
},
|
},
|
||||||
expect: []*ServiceIntentionsConfigEntry{
|
expect: []*ServiceIntentionsConfigEntry{
|
||||||
{
|
{
|
||||||
Kind: ServiceIntentions,
|
Kind: ServiceIntentions,
|
||||||
Name: "bar",
|
Name: "bar",
|
||||||
|
EnterpriseMeta: *entMeta,
|
||||||
Sources: []*SourceIntention{
|
Sources: []*SourceIntention{
|
||||||
{
|
{
|
||||||
LegacyID: legacyIDs[0],
|
LegacyID: legacyIDs[0],
|
||||||
Description: "desc",
|
Description: "desc",
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Type: IntentionSourceConsul,
|
EnterpriseMeta: *entMeta,
|
||||||
Action: IntentionActionAllow,
|
Type: IntentionSourceConsul,
|
||||||
|
Action: IntentionActionAllow,
|
||||||
LegacyMeta: map[string]string{
|
LegacyMeta: map[string]string{
|
||||||
"key1": "val1",
|
"key1": "val1",
|
||||||
},
|
},
|
||||||
|
@ -1386,11 +1391,12 @@ func TestMigrateIntentions(t *testing.T) {
|
||||||
LegacyUpdateTime: &anyTime,
|
LegacyUpdateTime: &anyTime,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
LegacyID: legacyIDs[1],
|
LegacyID: legacyIDs[1],
|
||||||
Description: "desc2",
|
Description: "desc2",
|
||||||
Name: "*",
|
Name: "*",
|
||||||
Type: IntentionSourceConsul,
|
EnterpriseMeta: *entMeta,
|
||||||
Action: IntentionActionDeny,
|
Type: IntentionSourceConsul,
|
||||||
|
Action: IntentionActionDeny,
|
||||||
LegacyMeta: map[string]string{
|
LegacyMeta: map[string]string{
|
||||||
"key2": "val2",
|
"key2": "val2",
|
||||||
},
|
},
|
||||||
|
@ -1434,15 +1440,17 @@ func TestMigrateIntentions(t *testing.T) {
|
||||||
},
|
},
|
||||||
expect: []*ServiceIntentionsConfigEntry{
|
expect: []*ServiceIntentionsConfigEntry{
|
||||||
{
|
{
|
||||||
Kind: ServiceIntentions,
|
Kind: ServiceIntentions,
|
||||||
Name: "bar",
|
Name: "bar",
|
||||||
|
EnterpriseMeta: *entMeta,
|
||||||
Sources: []*SourceIntention{
|
Sources: []*SourceIntention{
|
||||||
{
|
{
|
||||||
LegacyID: legacyIDs[0],
|
LegacyID: legacyIDs[0],
|
||||||
Description: "desc",
|
Description: "desc",
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
Type: IntentionSourceConsul,
|
EnterpriseMeta: *entMeta,
|
||||||
Action: IntentionActionAllow,
|
Type: IntentionSourceConsul,
|
||||||
|
Action: IntentionActionAllow,
|
||||||
LegacyMeta: map[string]string{
|
LegacyMeta: map[string]string{
|
||||||
"key1": "val1",
|
"key1": "val1",
|
||||||
},
|
},
|
||||||
|
@ -1452,15 +1460,17 @@ func TestMigrateIntentions(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Kind: ServiceIntentions,
|
Kind: ServiceIntentions,
|
||||||
Name: "bar2",
|
Name: "bar2",
|
||||||
|
EnterpriseMeta: *entMeta,
|
||||||
Sources: []*SourceIntention{
|
Sources: []*SourceIntention{
|
||||||
{
|
{
|
||||||
LegacyID: legacyIDs[1],
|
LegacyID: legacyIDs[1],
|
||||||
Description: "desc2",
|
Description: "desc2",
|
||||||
Name: "*",
|
Name: "*",
|
||||||
Type: IntentionSourceConsul,
|
EnterpriseMeta: *entMeta,
|
||||||
Action: IntentionActionDeny,
|
Type: IntentionSourceConsul,
|
||||||
|
Action: IntentionActionDeny,
|
||||||
LegacyMeta: map[string]string{
|
LegacyMeta: map[string]string{
|
||||||
"key2": "val2",
|
"key2": "val2",
|
||||||
},
|
},
|
||||||
|
|
|
@ -80,11 +80,11 @@ func (m *EnterpriseMeta) NamespaceOrEmpty() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *EnterpriseMeta) PartitionOrDefault() string {
|
func (m *EnterpriseMeta) PartitionOrDefault() string {
|
||||||
return ""
|
return "default"
|
||||||
}
|
}
|
||||||
|
|
||||||
func PartitionOrDefault(_ string) string {
|
func PartitionOrDefault(_ string) string {
|
||||||
return ""
|
return "default"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *EnterpriseMeta) PartitionOrEmpty() string {
|
func (m *EnterpriseMeta) PartitionOrEmpty() string {
|
||||||
|
|
|
@ -1153,8 +1153,8 @@ func TestAPI_CatalogGatewayServices_Terminating(t *testing.T) {
|
||||||
|
|
||||||
expect := []*GatewayService{
|
expect := []*GatewayService{
|
||||||
{
|
{
|
||||||
Service: CompoundServiceName{Name: "api", Namespace: defaultNamespace},
|
Service: CompoundServiceName{Name: "api", Namespace: defaultNamespace, Partition: defaultPartition},
|
||||||
Gateway: CompoundServiceName{Name: "terminating", Namespace: defaultNamespace},
|
Gateway: CompoundServiceName{Name: "terminating", Namespace: defaultNamespace, Partition: defaultPartition},
|
||||||
GatewayKind: ServiceKindTerminatingGateway,
|
GatewayKind: ServiceKindTerminatingGateway,
|
||||||
CAFile: "api/ca.crt",
|
CAFile: "api/ca.crt",
|
||||||
CertFile: "api/client.crt",
|
CertFile: "api/client.crt",
|
||||||
|
@ -1162,8 +1162,8 @@ func TestAPI_CatalogGatewayServices_Terminating(t *testing.T) {
|
||||||
SNI: "my-domain",
|
SNI: "my-domain",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Service: CompoundServiceName{Name: "redis", Namespace: defaultNamespace},
|
Service: CompoundServiceName{Name: "redis", Namespace: defaultNamespace, Partition: defaultPartition},
|
||||||
Gateway: CompoundServiceName{Name: "terminating", Namespace: defaultNamespace},
|
Gateway: CompoundServiceName{Name: "terminating", Namespace: defaultNamespace, Partition: defaultPartition},
|
||||||
GatewayKind: ServiceKindTerminatingGateway,
|
GatewayKind: ServiceKindTerminatingGateway,
|
||||||
CAFile: "ca.crt",
|
CAFile: "ca.crt",
|
||||||
CertFile: "client.crt",
|
CertFile: "client.crt",
|
||||||
|
@ -1221,15 +1221,15 @@ func TestAPI_CatalogGatewayServices_Ingress(t *testing.T) {
|
||||||
|
|
||||||
expect := []*GatewayService{
|
expect := []*GatewayService{
|
||||||
{
|
{
|
||||||
Service: CompoundServiceName{Name: "api", Namespace: defaultNamespace},
|
Service: CompoundServiceName{Name: "api", Namespace: defaultNamespace, Partition: defaultPartition},
|
||||||
Gateway: CompoundServiceName{Name: "ingress", Namespace: defaultNamespace},
|
Gateway: CompoundServiceName{Name: "ingress", Namespace: defaultNamespace, Partition: defaultPartition},
|
||||||
GatewayKind: ServiceKindIngressGateway,
|
GatewayKind: ServiceKindIngressGateway,
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
Port: 8888,
|
Port: 8888,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Service: CompoundServiceName{Name: "redis", Namespace: defaultNamespace},
|
Service: CompoundServiceName{Name: "redis", Namespace: defaultNamespace, Partition: defaultPartition},
|
||||||
Gateway: CompoundServiceName{Name: "ingress", Namespace: defaultNamespace},
|
Gateway: CompoundServiceName{Name: "ingress", Namespace: defaultNamespace, Partition: defaultPartition},
|
||||||
GatewayKind: ServiceKindIngressGateway,
|
GatewayKind: ServiceKindIngressGateway,
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
Port: 9999,
|
Port: 9999,
|
||||||
|
|
|
@ -223,6 +223,7 @@ func TestAPI_HealthChecks(t *testing.T) {
|
||||||
ServiceName: "foo",
|
ServiceName: "foo",
|
||||||
ServiceTags: []string{"bar"},
|
ServiceTags: []string{"bar"},
|
||||||
Type: "ttl",
|
Type: "ttl",
|
||||||
|
Partition: defaultPartition,
|
||||||
Namespace: defaultNamespace,
|
Namespace: defaultNamespace,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,3 +3,4 @@
|
||||||
package api
|
package api
|
||||||
|
|
||||||
var defaultNamespace = ""
|
var defaultNamespace = ""
|
||||||
|
var defaultPartition = ""
|
||||||
|
|
|
@ -181,6 +181,7 @@ func TestAPI_ClientTxn(t *testing.T) {
|
||||||
ID: "foo1",
|
ID: "foo1",
|
||||||
CreateIndex: ret.Results[3].Service.CreateIndex,
|
CreateIndex: ret.Results[3].Service.CreateIndex,
|
||||||
ModifyIndex: ret.Results[3].Service.CreateIndex,
|
ModifyIndex: ret.Results[3].Service.CreateIndex,
|
||||||
|
Partition: defaultPartition,
|
||||||
Namespace: defaultNamespace,
|
Namespace: defaultNamespace,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -199,6 +200,7 @@ func TestAPI_ClientTxn(t *testing.T) {
|
||||||
DeregisterCriticalServiceAfterDuration: 20 * time.Second,
|
DeregisterCriticalServiceAfterDuration: 20 * time.Second,
|
||||||
},
|
},
|
||||||
Type: "tcp",
|
Type: "tcp",
|
||||||
|
Partition: defaultPartition,
|
||||||
Namespace: defaultNamespace,
|
Namespace: defaultNamespace,
|
||||||
CreateIndex: ret.Results[4].Check.CreateIndex,
|
CreateIndex: ret.Results[4].Check.CreateIndex,
|
||||||
ModifyIndex: ret.Results[4].Check.CreateIndex,
|
ModifyIndex: ret.Results[4].Check.CreateIndex,
|
||||||
|
@ -219,13 +221,14 @@ func TestAPI_ClientTxn(t *testing.T) {
|
||||||
DeregisterCriticalServiceAfterDuration: 160 * time.Second,
|
DeregisterCriticalServiceAfterDuration: 160 * time.Second,
|
||||||
},
|
},
|
||||||
Type: "tcp",
|
Type: "tcp",
|
||||||
|
Partition: defaultPartition,
|
||||||
Namespace: defaultNamespace,
|
Namespace: defaultNamespace,
|
||||||
CreateIndex: ret.Results[4].Check.CreateIndex,
|
CreateIndex: ret.Results[4].Check.CreateIndex,
|
||||||
ModifyIndex: ret.Results[4].Check.CreateIndex,
|
ModifyIndex: ret.Results[4].Check.CreateIndex,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
require.Equal(t, ret.Results, expected)
|
require.Equal(t, expected, ret.Results)
|
||||||
|
|
||||||
retry.Run(t, func(r *retry.R) {
|
retry.Run(t, func(r *retry.R) {
|
||||||
// Run a read-only transaction.
|
// Run a read-only transaction.
|
||||||
|
|
|
@ -39,7 +39,7 @@ load helpers
|
||||||
@test "s1 proxy should have been configured with one rbac listener filter at L4" {
|
@test "s1 proxy should have been configured with one rbac listener filter at L4" {
|
||||||
LISTEN_FILTERS=$(get_envoy_listener_filters localhost:19000)
|
LISTEN_FILTERS=$(get_envoy_listener_filters localhost:19000)
|
||||||
PUB=$(echo "$LISTEN_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ' )
|
PUB=$(echo "$LISTEN_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ' )
|
||||||
UPS=$(echo "$LISTEN_FILTERS" | grep -E "^(\/default\/)?s2:" | cut -f 2 -d ' ' )
|
UPS=$(echo "$LISTEN_FILTERS" | grep -E "^(default\/default\/)?s2:" | cut -f 2 -d ' ' )
|
||||||
|
|
||||||
echo "LISTEN_FILTERS = $LISTEN_FILTERS"
|
echo "LISTEN_FILTERS = $LISTEN_FILTERS"
|
||||||
echo "PUB = $PUB"
|
echo "PUB = $PUB"
|
||||||
|
|
|
@ -36,7 +36,7 @@ load helpers
|
||||||
@test "s1 proxy should have been configured with http connection managers" {
|
@test "s1 proxy should have been configured with http connection managers" {
|
||||||
LISTEN_FILTERS=$(get_envoy_listener_filters localhost:19000)
|
LISTEN_FILTERS=$(get_envoy_listener_filters localhost:19000)
|
||||||
PUB=$(echo "$LISTEN_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ' )
|
PUB=$(echo "$LISTEN_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ' )
|
||||||
UPS=$(echo "$LISTEN_FILTERS" | grep -E "^(\/default\/)?s2:" | cut -f 2 -d ' ' )
|
UPS=$(echo "$LISTEN_FILTERS" | grep -E "^(default\/default\/)?s2:" | cut -f 2 -d ' ' )
|
||||||
|
|
||||||
echo "LISTEN_FILTERS = $LISTEN_FILTERS"
|
echo "LISTEN_FILTERS = $LISTEN_FILTERS"
|
||||||
echo "PUB = $PUB"
|
echo "PUB = $PUB"
|
||||||
|
@ -59,7 +59,7 @@ load helpers
|
||||||
@test "s1 proxy should have been configured with http rbac filters" {
|
@test "s1 proxy should have been configured with http rbac filters" {
|
||||||
HTTP_FILTERS=$(get_envoy_http_filters localhost:19000)
|
HTTP_FILTERS=$(get_envoy_http_filters localhost:19000)
|
||||||
PUB=$(echo "$HTTP_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ' )
|
PUB=$(echo "$HTTP_FILTERS" | grep -E "^public_listener:" | cut -f 2 -d ' ' )
|
||||||
UPS=$(echo "$HTTP_FILTERS" | grep -E "^(\/default\/)?s2:" | cut -f 2 -d ' ' )
|
UPS=$(echo "$HTTP_FILTERS" | grep -E "^(default\/default\/)?s2:" | cut -f 2 -d ' ' )
|
||||||
|
|
||||||
echo "HTTP_FILTERS = $HTTP_FILTERS"
|
echo "HTTP_FILTERS = $HTTP_FILTERS"
|
||||||
echo "PUB = $PUB"
|
echo "PUB = $PUB"
|
||||||
|
|
Loading…
Reference in New Issue