Skip to content

Commit

Permalink
Revert "Add validation that externalServers.hosts is not set to HCP-m…
Browse files Browse the repository at this point in the history
…anaged cluster's addresses when global.cloud.enabled" (#3314)

Revert "Add validation that externalServers.hosts is not set to HCP-managed cluster's addresses when global.cloud.enabled (#3218)"

This reverts commit 7f79d29.
  • Loading branch information
zalimeni authored Dec 6, 2023
1 parent 7f79d29 commit 0d1adcc
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 34 deletions.
3 changes: 0 additions & 3 deletions .changelog/3218.txt

This file was deleted.

1 change: 0 additions & 1 deletion charts/consul/templates/connect-inject-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{{- if and .Values.global.peering.enabled (not .Values.connectInject.enabled) }}{{ fail "setting global.peering.enabled to true requires connectInject.enabled to be true" }}{{ end }}
{{- if and .Values.global.peering.enabled (not .Values.global.tls.enabled) }}{{ fail "setting global.peering.enabled to true requires global.tls.enabled to be true" }}{{ end }}
{{- if and .Values.global.peering.enabled (not .Values.meshGateway.enabled) }}{{ fail "setting global.peering.enabled to true requires meshGateway.enabled to be true" }}{{ end }}
{{- if and .Values.externalServers.enabled .Values.global.cloud.enabled (gt (len .Values.externalServers.hosts) 0) (regexMatch ".+.hashicorp.cloud$" ( first .Values.externalServers.hosts )) }}{{fail "global.cloud.enabled cannot be used in combination with an HCP-managed cluster address in externalServers.hosts. global.cloud.enabled is for linked self-managed clusters."}}{{- end }}
{{- if (or (and (ne (.Values.connectInject.enabled | toString) "-") .Values.connectInject.enabled) (and (eq (.Values.connectInject.enabled | toString) "-") .Values.global.enabled)) }}
{{- if and .Values.global.adminPartitions.enabled (not .Values.global.enableConsulNamespaces) }}{{ fail "global.enableConsulNamespaces must be true if global.adminPartitions.enabled=true" }}{{ end }}
{{ template "consul.validateVaultWebhookCertConfiguration" . }}
Expand Down
24 changes: 0 additions & 24 deletions charts/consul/test/unit/connect-inject-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2639,30 +2639,6 @@ reservedNameTest() {
[ "${actual}" = "true" ]
}

@test "connectInject/Deployment: validates that externalServers.hosts is not set with an HCP-managed cluster's address" {
cd `chart_dir`
run helm template \
-s templates/connect-inject-deployment.yaml \
--set 'global.enabled=false' \
--set 'connectInject.enabled=true' \
--set 'global.tls.enabled=true' \
--set 'global.tls.enableAutoEncrypt=true' \
--set 'externalServers.enabled=true' \
--set 'externalServers.hosts[0]=abc.aws.hashicorp.cloud' \
--set 'global.cloud.enabled=true' \
--set 'global.cloud.clientId.secretName=client-id-name' \
--set 'global.cloud.clientId.secretKey=client-id-key' \
--set 'global.cloud.clientSecret.secretName=client-secret-id-name' \
--set 'global.cloud.clientSecret.secretKey=client-secret-id-key' \
--set 'global.cloud.resourceId.secretName=resource-id-name' \
--set 'global.cloud.resourceId.secretKey=resource-id-key' \
. > /dev/stderr

[ "$status" -eq 1 ]

[[ "$output" =~ "global.cloud.enabled cannot be used in combination with an HCP-managed cluster address in externalServers.hosts. global.cloud.enabled is for linked self-managed clusters." ]]
}

@test "connectInject/Deployment: can provide a TLS server name for the sidecar-injector when global.cloud.enabled is set" {
cd `chart_dir`
local env=$(helm template \
Expand Down
8 changes: 2 additions & 6 deletions charts/consul/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -655,12 +655,8 @@ global:
# Enables installing an HCP Consul Central self-managed cluster.
# Requires Consul v1.14+.
cloud:
# If true, the Helm chart will link a [self-managed cluster to HCP](https://developer.hashicorp.com/hcp/docs/consul/self-managed).
# This can either be used to [configure a new cluster](https://developer.hashicorp.com/hcp/docs/consul/self-managed/new)
# or [link an existing one](https://developer.hashicorp.com/hcp/docs/consul/self-managed/existing).
#
# Note: this setting should not be enabled for [HashiCorp-managed clusters](https://developer.hashicorp.com/hcp/docs/consul/hcp-managed).
# It is strictly for linking self-managed clusters.
# If true, the Helm chart will enable the installation of an HCP Consul Central
# self-managed cluster.
enabled: false

# The resource id of the HCP Consul Central cluster to link to. Eg:
Expand Down

0 comments on commit 0d1adcc

Please sign in to comment.