From a00f938c2db33cd4c8cd9555a9a5c735367f9b6b Mon Sep 17 00:00:00 2001 From: Luke Kysow <1034429+lkysow@users.noreply.github.com> Date: Wed, 13 Apr 2022 11:02:59 -0700 Subject: [PATCH] Allow the consul namespace to be a destination. (#1163) * Allow the consul namespace to be a destination. With upcoming consul-enterprise this ns will be valid. --- CHANGELOG.md | 1 + charts/consul/templates/_helpers.tpl | 2 +- charts/consul/test/unit/connect-inject-deployment.bats | 4 ---- charts/consul/test/unit/partition-init-job.bats | 4 ---- charts/consul/test/unit/sync-catalog-deployment.bats | 4 ---- 5 files changed, 2 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed550dc4f9..965eb13c5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ BUG FIXES: IMPROVEMENTS: * Helm * API Gateway: Allow controller to read ReferencePolicy in order to determine if route is allowed for backend in different namespace. [[GH-1148](https://github.com/hashicorp/consul-k8s/pull/1148)] + * Allow `consul` to be a destination namespace. [[GH-1163](https://github.com/hashicorp/consul-k8s/pull/1163)] ## 0.42.0 (April 04, 2022) diff --git a/charts/consul/templates/_helpers.tpl b/charts/consul/templates/_helpers.tpl index 11d4998f03..e07b693ba3 100644 --- a/charts/consul/templates/_helpers.tpl +++ b/charts/consul/templates/_helpers.tpl @@ -215,7 +215,7 @@ Usage: {{ template "consul.reservedNamesFailer" (list .Values.key "key") }} {{- define "consul.reservedNamesFailer" -}} {{- $name := index . 0 -}} {{- $key := index . 1 -}} -{{- if or (eq "system" $name) (eq "universal" $name) (eq "consul" $name) (eq "operator" $name) (eq "root" $name) }} +{{- if or (eq "system" $name) (eq "universal" $name) (eq "operator" $name) (eq "root" $name) }} {{- fail (cat "The name" $name "set for key" $key "is reserved by Consul for future use." ) }} {{- end }} {{- end -}} diff --git a/charts/consul/test/unit/connect-inject-deployment.bats b/charts/consul/test/unit/connect-inject-deployment.bats index 9ea21184ec..d7719dc004 100755 --- a/charts/consul/test/unit/connect-inject-deployment.bats +++ b/charts/consul/test/unit/connect-inject-deployment.bats @@ -1926,10 +1926,6 @@ EOF reservedNameTest "universal" } -@test "connectInject/Deployment: fails when consulDestinationNamespace=consul" { - reservedNameTest "consul" -} - @test "connectInject/Deployment: fails when consulDestinationNamespace=operator" { reservedNameTest "operator" } diff --git a/charts/consul/test/unit/partition-init-job.bats b/charts/consul/test/unit/partition-init-job.bats index a907884afb..77cbf709b4 100644 --- a/charts/consul/test/unit/partition-init-job.bats +++ b/charts/consul/test/unit/partition-init-job.bats @@ -174,10 +174,6 @@ load _helpers reservedNameTest "universal" } -@test "partitionInit/Job: fails when adminPartitions.name=consul" { - reservedNameTest "consul" -} - @test "partitionInit/Job: fails when adminPartitions.name=operator" { reservedNameTest "operator" } diff --git a/charts/consul/test/unit/sync-catalog-deployment.bats b/charts/consul/test/unit/sync-catalog-deployment.bats index 18171942af..461ffd84f2 100755 --- a/charts/consul/test/unit/sync-catalog-deployment.bats +++ b/charts/consul/test/unit/sync-catalog-deployment.bats @@ -1358,10 +1358,6 @@ load _helpers reservedNameTest "universal" } -@test "syncCatalog/Deployment: fails when consulDestinationNamespace=consul" { - reservedNameTest "consul" -} - @test "syncCatalog/Deployment: fails when consulDestinationNamespace=operator" { reservedNameTest "operator" }