File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,16 @@ append_config() {
3636 echo " $1 " >> " /etc/rancher/rke2/config.yaml"
3737}
3838
39+ append_config_san () {
40+ grep " ^tls-san:$" /etc/rancher/rke2/config.yaml > /dev/null
41+ if [ $? -eq 0 ]; then
42+ sed -i " /^tls-san:$/a \ \ - ${server_url} " /etc/rancher/rke2/config.yaml
43+ return
44+ fi
45+ echo " tls-san:" >> /etc/rancher/rke2/config.yaml
46+ echo " - ${server_url} " >> /etc/rancher/rke2/config.yaml
47+ }
48+
3949# The most simple "leader election" you've ever seen in your life
4050elect_leader () {
4151 # Fetch other running instances in ASG
@@ -168,10 +178,7 @@ upload() {
168178 # Initialize server
169179 identify
170180
171- cat << EOF >> "/etc/rancher/rke2/config.yaml"
172- tls-san:
173- - ${server_url}
174- EOF
181+ append_config_san
175182
176183 if [ $SERVER_TYPE = " server" ]; then # additional server joining an existing cluster
177184 append_config ' server: https://${server_url}:9345'
You can’t perform that action at this time.
0 commit comments