Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: TLS_ENABLED might not be defined #1291

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ enable_display_sql_execution_vttablets=false
enable_read_write_split_for_read_only_txn=false
enable_interception_for_dml_without_where=true

{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
mysql_server_ssl_ca=/etc/pki/tls/ca.pem
mysql_server_ssl_cert=/etc/pki/tls/cert.pem
mysql_server_ssl_key=/etc/pki/tls/key.pem
Expand Down
2 changes: 1 addition & 1 deletion addons/apecloud-mysql/config/mysql8-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ relay_log_index=relay-bin.index
pid_file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysqld/mysqld.sock

{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
# tls
# require_secure_transport=ON
ssl_ca=/etc/pki/tls/ca.pem
Expand Down
2 changes: 1 addition & 1 deletion addons/apecloud-postgresql/config/pg14-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ session_replication_role = 'origin'
sql_firewall.firewall = 'disable'
shared_buffers = '{{ printf "%d%s" $shared_buffers $buffer_unit }}'
# shared_preload_libraries = 'pg_stat_statements,auto_explain,bg_mon,pgextwlist,pg_auth_mon,set_user,pg_cron,pg_stat_kcache'
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
ssl = 'True'
ssl_ca_file = '/etc/pki/tls/ca.pem'
ssl_cert_file = '/etc/pki/tls/cert.pem'
Expand Down
8 changes: 4 additions & 4 deletions addons/clickhouse/configs/00_default_overrides.xml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- $namespace := $.cluster.metadata.namespace }}
<clickhouse>
<listen_host>0.0.0.0</listen_host>
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
<https_port replace="replace" from_env="CLICKHOUSE_HTTPS_PORT"/>
<tcp_port_secure replace="replace" from_env="CLICKHOUSE_TCP_SECURE_PORT"/>
<interserver_https_port replace="replace" from_env="CLICKHOUSE_INTERSERVER_HTTPS_PORT"/>
Expand Down Expand Up @@ -31,7 +31,7 @@
{{- range $_, $host := splitList "," .CLICKHOUSE_POD_FQDN_LIST }}
<replica>
<host>{{ $host }}</host>
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index $ "TLS_ENABLED") (eq (index $ "TLS_ENABLED") "true") }}
<port replace="replace" from_env="CLICKHOUSE_TCP_SECURE_PORT"/>
<secure>1</secure>
{{- else }}
Expand All @@ -48,7 +48,7 @@
{{- range $_, $host := splitList "," .CH_KEEPER_POD_FQDN_LIST }}
<node>
<host>{{ $host }}</host>
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index $ "TLS_ENABLED") (eq (index $ "TLS_ENABLED") "true") }}
<port replace="replace" from_env="CLICKHOUSE_KEEPER_TCP_TLS_PORT"/>
<secure>1</secure>
{{- else }}
Expand All @@ -67,7 +67,7 @@
<asynchronous_metrics>true</asynchronous_metrics>
</prometheus>
<!-- tls configuration -->
{{- if eq $.TLS_ENABLED "true" -}}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") -}}
{{- $CA_FILE := /etc/pki/tls/ca.pem -}}
{{- $CERT_FILE := /etc/pki/tls/cert.pem -}}
{{- $KEY_FILE := /etc/pki/tls/key.pem }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- $namespace := $.cluster.metadata.namespace }}
<clickhouse>
<listen_host>0.0.0.0</listen_host>
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
<https_port replace="replace" from_env="CLICKHOUSE_HTTPS_PORT"/>
<tcp_port_secure replace="replace" from_env="CLICKHOUSE_TCP_SECURE_PORT"/>
<interserver_https_port replace="replace" from_env="CLICKHOUSE_INTERSERVER_HTTPS_PORT"/>
Expand All @@ -15,7 +15,7 @@
<interserver_http_port replace="replace" from_env="CLICKHOUSE_INTERSERVER_HTTP_PORT"/>
{{- end }}
<keeper_server>
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
<tcp_port_secure replace="replace" from_env="CLICKHOUSE_KEEPER_TCP_TLS_PORT"/>
<secure>1</secure>
{{- else }}
Expand All @@ -30,14 +30,14 @@
<raft_logs_level>warning</raft_logs_level>
</coordination_settings>
<raft_configuration>
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

render failed with nest scope, define a var to resolve it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

<secure>true</secure>
{{- end }}
{{- range $id, $host := splitList "," .CH_KEEPER_POD_FQDN_LIST }}
<server>
<id>{{ $id }}</id>
<hostname>{{ $host }}</hostname>
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index $ "TLS_ENABLED") (eq (index $ "TLS_ENABLED") "true") }}
<port replace="replace" from_env="CLICKHOUSE_KEEPER_RAFT_TLS_PORT"/>
{{- else }}
<port replace="replace" from_env="CLICKHOUSE_KEEPER_RAFT_PORT"/>
Expand All @@ -55,7 +55,7 @@
<asynchronous_metrics>true</asynchronous_metrics>
</prometheus>
<!-- tls configuration -->
{{- if eq $.TLS_ENABLED "true" -}}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") -}}
{{- $CA_FILE := /etc/pki/tls/ca.pem -}}
{{- $CERT_FILE := /etc/pki/tls/cert.pem -}}
{{- $KEY_FILE := /etc/pki/tls/key.pem -}}
Expand Down
2 changes: 1 addition & 1 deletion addons/clickhouse/configs/client.xml.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<config>
<user>admin</user>
<password from_env="CLICKHOUSE_ADMIN_PASSWORD"/>
{{- if eq $.TLS_ENABLED "true" -}}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") -}}
{{- $CA_FILE := /etc/pki/tls/ca.pem -}}
{{- $CERT_FILE := /etc/pki/tls/cert.pem -}}
{{- $KEY_FILE := /etc/pki/tls/key.pem }}
Expand Down
8 changes: 4 additions & 4 deletions addons/etcd/config/etcd.conf.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

{{- $peer_protocol := "http" }}
{{- $client_protocol := "http" }}
{{- if and (eq $.TLS_ENABLED "true") (eq .PEER_TLS "true") }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") (eq .PEER_TLS "true") }}
{{- $peer_protocol = "https" }}
{{- end }}
{{- if and (eq $.TLS_ENABLED "true") (eq .CLIENT_TLS "true") }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") (eq .CLIENT_TLS "true") }}
{{- $client_protocol = "https" }}
{{- end }}

Expand Down Expand Up @@ -69,7 +69,7 @@ discovery-srv:

{{- define "init_peers" }}
{{- $peer_protocol := "http" }}
{{- if and (eq $.TLS_ENABLED "true") (eq .PEER_TLS "true") }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") (eq .PEER_TLS "true") }}
{{- $peer_protocol = "https" }}
{{- end }}
{{- if (index . "PEER_ENDPOINT") }}
Expand Down Expand Up @@ -128,7 +128,7 @@ proxy-write-timeout: 5000
# Time (in milliseconds) for a read to timeout.
proxy-read-timeout: 0

{{ if eq $.TLS_ENABLED "true" -}}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
{{- if eq $client_protocol "https" }}
client-transport-security:
# Path to the client server TLS cert file.
Expand Down
2 changes: 1 addition & 1 deletion addons/orioledb/config/orioledb-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ session_replication_role = 'origin'
sql_firewall.firewall = 'disable'
shared_buffers = '{{ printf "%d%s" $shared_buffers $buffer_unit }}'
shared_preload_libraries = 'orioledb,pg_stat_statements,auto_explain'
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
ssl = 'True'
ssl_ca_file = '/etc/pki/tls/ca.pem'
ssl_cert_file = '/etc/pki/tls/cert.pem'
Expand Down
2 changes: 1 addition & 1 deletion addons/postgresql/config/pg12-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ session_replication_role = 'origin'
sql_firewall.firewall = 'disable'
shared_buffers = '{{ printf "%d%s" $shared_buffers $buffer_unit }}'
shared_preload_libraries = 'pg_stat_statements,auto_explain,bg_mon,pgextwlist,pg_auth_mon,set_user,pg_cron,pg_stat_kcache,timescaledb,pgaudit'
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
ssl = 'True'
ssl_ca_file = '/etc/pki/tls/ca.pem'
ssl_cert_file = '/etc/pki/tls/cert.pem'
Expand Down
2 changes: 1 addition & 1 deletion addons/postgresql/config/pg14-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ session_replication_role = 'origin'
sql_firewall.firewall = 'disable'
shared_buffers = '{{ printf "%d%s" $shared_buffers $buffer_unit }}'
shared_preload_libraries = 'pg_stat_statements,auto_explain,bg_mon,pgextwlist,pg_auth_mon,set_user,pg_cron,pg_stat_kcache,timescaledb,pgaudit'
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
ssl = 'True'
ssl_ca_file = '/etc/pki/tls/ca.pem'
ssl_cert_file = '/etc/pki/tls/cert.pem'
Expand Down
2 changes: 1 addition & 1 deletion addons/postgresql/config/pg15-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ session_replication_role = 'origin'
sql_firewall.firewall = 'disable'
shared_buffers = '{{ printf "%d%s" $shared_buffers $buffer_unit }}'
shared_preload_libraries = 'pg_stat_statements,auto_explain,bg_mon,pgextwlist,pg_auth_mon,set_user,pg_cron,pg_stat_kcache,timescaledb,pgaudit'
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
ssl = 'True'
ssl_ca_file = '/etc/pki/tls/ca.pem'
ssl_cert_file = '/etc/pki/tls/cert.pem'
Expand Down
2 changes: 1 addition & 1 deletion addons/postgresql/config/pg16-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
sql_firewall.firewall = 'disable'
shared_buffers = '{{ printf "%d%s" $shared_buffers $buffer_unit }}'
shared_preload_libraries = 'pg_stat_statements,auto_explain,bg_mon,pgextwlist,pg_auth_mon,set_user,pg_cron,pg_stat_kcache,timescaledb,pgaudit'
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
ssl = 'True'
ssl_ca_file = '/etc/pki/tls/ca.pem'
ssl_cert_file = '/etc/pki/tls/cert.pem'
Expand Down
2 changes: 1 addition & 1 deletion addons/vanilla-postgresql/config/pg12-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ row_security = 'True'
session_replication_role = 'origin'
shared_buffers = '{{ printf "%d%s" $shared_buffers $buffer_unit }}'
shared_preload_libraries = 'pg_stat_statements,auto_explain'
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
ssl = 'True'
ssl_ca_file = '/etc/pki/tls/ca.pem'
ssl_cert_file = '/etc/pki/tls/cert.pem'
Expand Down
2 changes: 1 addition & 1 deletion addons/vanilla-postgresql/config/pg14-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ row_security = 'True'
session_replication_role = 'origin'
shared_buffers = '{{ printf "%d%s" $shared_buffers $buffer_unit }}'
shared_preload_libraries = 'pg_stat_statements,auto_explain'
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
ssl = 'True'
ssl_ca_file = '/etc/pki/tls/ca.pem'
ssl_cert_file = '/etc/pki/tls/cert.pem'
Expand Down
2 changes: 1 addition & 1 deletion addons/vanilla-postgresql/config/pg15-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ row_security = 'True'
session_replication_role = 'origin'
shared_buffers = '{{ printf "%d%s" $shared_buffers $buffer_unit }}'
shared_preload_libraries = 'pg_stat_statements,auto_explain'
{{- if eq $.TLS_ENABLED "true" }}
{{- if and (index . "TLS_ENABLED") (eq .TLS_ENABLED "true") }}
ssl = 'True'
ssl_ca_file = '/etc/pki/tls/ca.pem'
ssl_cert_file = '/etc/pki/tls/cert.pem'
Expand Down
Loading