Closed ghsbhatia closed 11 months ago
It's this:
config() {
mkdir -p "/etc/rancher/rke2"
cat <<EOF >> "/etc/rancher/rke2/config.yaml"
# Additional user defined configuration
${config}
EOF
}
and this:
if [ $TYPE = "server" ]; then
# Initialize server
identify
cat <<EOF >> "/etc/rancher/rke2/config.yaml"
tls-san:
- ${server_url}
EOF
The module allows the user to pass arbitrary config values, which may include tls-san
, but then creates it anyway because the ${server_url}
refers to the DNS name assigned by AWS to the control plane load balancer, which isn't known until it gets created. I suspect we'll have to expose a variable to set additional SANs for the API server directly and then explain in bold-face font somewhere that this particular key can't be passed as additional config without breaking the setup. The way this script currently works doesn't make it possible to assign your own DNS name to your API server, which isn't a great idea. We got pretty lucky that it took over three years for someone to encounter this.
@adamacosta @joshrwolf - Please take a look at the pull request. Thanks!
Fixed in v2.4.1
The rke2 server configuration allows for multiple entries to be specified for tls-san, however the script rke2-init.sh is creating an invalid yaml by creating a new entry for tls-san rather than appending to user provided list.
server config passed to TF module:
server config on server node:
This causes errors when invoking kubectl as follows: