diff --git a/examples/chart/teleport-cluster/templates/proxy/config.yaml b/examples/chart/teleport-cluster/templates/proxy/config.yaml index 0d98cb99ce149..8cd7788ad0c47 100644 --- a/examples/chart/teleport-cluster/templates/proxy/config.yaml +++ b/examples/chart/teleport-cluster/templates/proxy/config.yaml @@ -1,5 +1,8 @@ {{- $proxy := mustMergeOverwrite (mustDeepCopy .Values) .Values.proxy -}} {{- $configTemplate := printf "teleport-cluster.proxy.config.%s" $proxy.chartMode -}} +{{- if (contains ":" $proxy.clusterName) -}} + {{- fail "clusterName must not contain a colon, you can override the cluster's public address with publicAddr" -}} +{{- end -}} apiVersion: v1 kind: ConfigMap metadata: diff --git a/examples/chart/teleport-cluster/tests/__snapshot__/proxy_config_test.yaml.snap b/examples/chart/teleport-cluster/tests/__snapshot__/proxy_config_test.yaml.snap index ea55919113818..7765a078da150 100644 --- a/examples/chart/teleport-cluster/tests/__snapshot__/proxy_config_test.yaml.snap +++ b/examples/chart/teleport-cluster/tests/__snapshot__/proxy_config_test.yaml.snap @@ -1,3 +1,33 @@ +generates a config with a clusterName containing a regular string: + 1: | + |- + auth_service: + enabled: false + proxy_service: + enabled: true + kube_listen_addr: 0.0.0.0:3026 + listen_addr: 0.0.0.0:3023 + mysql_listen_addr: 0.0.0.0:3036 + public_addr: helm-test.example.com:443 + tunnel_listen_addr: 0.0.0.0:3024 + ssh_service: + enabled: false + teleport: + auth_server: RELEASE-NAME-auth.NAMESPACE.svc.cluster.local:3025 + join_params: + method: kubernetes + token_name: RELEASE-NAME-proxy + log: + format: + extra_fields: + - timestamp + - level + - component + - caller + output: text + output: stderr + severity: INFO + version: v3 matches snapshot for acme-on.yaml: 1: | |- diff --git a/examples/chart/teleport-cluster/tests/proxy_config_test.yaml b/examples/chart/teleport-cluster/tests/proxy_config_test.yaml index 23727d44cc07c..3c6b93938204f 100644 --- a/examples/chart/teleport-cluster/tests/proxy_config_test.yaml +++ b/examples/chart/teleport-cluster/tests/proxy_config_test.yaml @@ -137,3 +137,28 @@ tests: of: ConfigMap - matchSnapshot: path: data.teleport\.yaml + + - it: generates a config with a clusterName containing a regular string + set: + clusterName: "helm-test.example.com" + asserts: + - hasDocuments: + count: 1 + - isKind: + of: ConfigMap + - matchSnapshot: + path: data.teleport\.yaml + + - it: fails when clusterName contains a regular string and a colon + set: + clusterName: "helm-test:cluster-1" + asserts: + - failedTemplate: + errorMessage: "clusterName must not contain a colon, you can override the cluster's public address with publicAddr" + + - it: fails when clusterName contains a port + set: + clusterName: "helm-test.example.com:443" + asserts: + - failedTemplate: + errorMessage: "clusterName must not contain a colon, you can override the cluster's public address with publicAddr"