Fix no_proxy evaluation for Swarm clusters
At the moment, no_proxy variable is evaluated separately for docker
daemon and for swarm-manager container running in docker. Evaluated
value for swarm-manager is not getting into cloud-init script, because
$NODE_PROXY token is getting replaced by Heat str_replace function.
This commit is intended to unify NO_PROXY evaluation and also fix the
issue with swarm-manager.
Related-Bug: #1647815
Related-Bug: #1632698
Related-Bug: #1660562
Change-Id: I336024265008b6cae308bf7b614476b71b81fa01
(cherry picked from commit 35dc923d66
)
This commit is contained in:
parent
6df1b89cd0
commit
464186b7fa
@ -44,31 +44,20 @@ EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$NO_PROXY" ]; then
|
||||
cat <<EOF | sed "s/^ *//" > $DOCKER_NO_PROXY_CONF
|
||||
[Service]
|
||||
Environment=NO_PROXY=$NO_PROXY
|
||||
if [ -n "$HTTP_PROXY" -o -n "$HTTPS_PROXY" ]; then
|
||||
if [ -n "$NO_PROXY" ]; then
|
||||
cat <<EOF | sed "s/^ *//" > $DOCKER_NO_PROXY_CONF
|
||||
[Service]
|
||||
Environment=NO_PROXY=$NO_PROXY
|
||||
EOF
|
||||
|
||||
DOCKER_RESTART=1
|
||||
DOCKER_RESTART=1
|
||||
|
||||
if [ -f "$BASH_RC" ]; then
|
||||
echo "declare -x no_proxy=$NO_PROXY" >> $BASH_RC
|
||||
else
|
||||
echo "File $BASH_RC does not exist, not setting no_proxy"
|
||||
fi
|
||||
else
|
||||
cat <<EOF | sed "s/^ *//" > $DOCKER_NO_PROXY_CONF
|
||||
[Service]
|
||||
Environment=NO_PROXY=$SWARM_API_IP,$ETCD_SERVER_IP,$SWARM_NODE_IP
|
||||
EOF
|
||||
|
||||
DOCKER_RESTART=1
|
||||
|
||||
if [ -f "$BASH_RC" ]; then
|
||||
echo "declare -x no_proxy=$SWARM_API_IP,$ETCD_SERVER_IP,$SWARM_NODE_IP" >> $BASH_RC
|
||||
else
|
||||
echo "File $BASH_RC does not exist, not setting no_proxy"
|
||||
if [ -f "$BASH_RC" ]; then
|
||||
echo "declare -x no_proxy=$NO_PROXY" >> $BASH_RC
|
||||
else
|
||||
echo "File $BASH_RC does not exist, not setting no_proxy"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -16,10 +16,6 @@ if [ $TLS_DISABLED = 'True' ]; then
|
||||
ETCDCTL_OPTIONS=""
|
||||
fi
|
||||
|
||||
if [ -z "$NO_PROXY" ]; then
|
||||
NO_PROXY=$SWARM_API_IP,$ETCD_SERVER_IP,$SWARM_NODE_IP
|
||||
fi
|
||||
|
||||
cat > $CONF_FILE << EOF
|
||||
[Unit]
|
||||
Description=Swarm Agent
|
||||
|
@ -2,10 +2,6 @@
|
||||
|
||||
CERT_DIR=/etc/docker
|
||||
|
||||
if [ -z "$NO_PROXY" ]; then
|
||||
NO_PROXY=$SWARM_API_IP,$ETCD_SERVER_IP,$SWARM_NODE_IP
|
||||
fi
|
||||
|
||||
cat > /etc/systemd/system/swarm-manager.service << END_SERVICE_TOP
|
||||
[Unit]
|
||||
Description=Swarm Manager
|
||||
|
@ -205,6 +205,19 @@ resources:
|
||||
# software configs. these are components that are combined into
|
||||
# a multipart MIME user-data archive.
|
||||
#
|
||||
no_proxy_extended:
|
||||
type: OS::Heat::Value
|
||||
properties:
|
||||
type: string
|
||||
value:
|
||||
list_join:
|
||||
- ','
|
||||
- - {get_attr: [api_address_switch, private_ip]}
|
||||
- {get_attr: [swarm_master_eth0, fixed_ips, 0, ip_address]}
|
||||
- {get_attr: [etcd_address_switch, private_ip]}
|
||||
- {get_attr: [api_address_switch, public_ip]}
|
||||
- {get_param: no_proxy}
|
||||
|
||||
write_heat_params:
|
||||
type: "OS::Heat::SoftwareConfig"
|
||||
properties:
|
||||
@ -220,7 +233,7 @@ resources:
|
||||
"$ETCD_DISCOVERY_URL": {get_param: discovery_url}
|
||||
"$HTTP_PROXY": {get_param: http_proxy}
|
||||
"$HTTPS_PROXY": {get_param: https_proxy}
|
||||
"$NO_PROXY": {get_param: no_proxy}
|
||||
"$NO_PROXY": {get_attr: [no_proxy_extended, value]}
|
||||
"$SWARM_API_IP": {get_attr: [api_address_switch, private_ip]}
|
||||
"$SWARM_NODE_IP": {get_attr: [swarm_master_eth0, fixed_ips, 0, ip_address]}
|
||||
"$CLUSTER_UUID": {get_param: cluster_uuid}
|
||||
@ -322,7 +335,7 @@ resources:
|
||||
"$WAIT_CURL": {get_attr: [master_wait_handle, curl_cli]}
|
||||
"$HTTP_PROXY": {get_param: http_proxy}
|
||||
"$HTTPS_PROXY": {get_param: https_proxy}
|
||||
"$NO_PROXY": {get_param: no_proxy}
|
||||
"$NO_PROXY": {get_attr: [no_proxy_extended, value]}
|
||||
"$TLS_DISABLED": {get_param: tls_disabled}
|
||||
"$SWARM_VERSION": {get_param: swarm_version}
|
||||
"$SWARM_STRATEGY": {get_param: swarm_strategy}
|
||||
|
@ -183,6 +183,19 @@ resources:
|
||||
#
|
||||
# software configs. these are components that are combined into
|
||||
# a multipart MIME user-data archive.
|
||||
no_proxy_extended:
|
||||
type: OS::Heat::Value
|
||||
properties:
|
||||
type: string
|
||||
value:
|
||||
list_join:
|
||||
- ','
|
||||
- - {get_param: swarm_api_ip}
|
||||
- {get_attr: [swarm_node_eth0, fixed_ips, 0, ip_address]}
|
||||
- {get_param: etcd_server_ip}
|
||||
- {get_param: api_ip_address}
|
||||
- {get_param: no_proxy}
|
||||
|
||||
write_heat_params:
|
||||
type: "OS::Heat::SoftwareConfig"
|
||||
properties:
|
||||
@ -197,7 +210,7 @@ resources:
|
||||
"$DOCKER_STORAGE_DRIVER": {get_param: docker_storage_driver}
|
||||
"$HTTP_PROXY": {get_param: http_proxy}
|
||||
"$HTTPS_PROXY": {get_param: https_proxy}
|
||||
"$NO_PROXY": {get_param: no_proxy}
|
||||
"$NO_PROXY": {get_attr: [no_proxy_extended, value]}
|
||||
"$SWARM_API_IP": {get_param: swarm_api_ip}
|
||||
"$SWARM_NODE_IP": {get_attr: [swarm_node_eth0, fixed_ips, 0, ip_address]}
|
||||
"$CLUSTER_UUID": {get_param: cluster_uuid}
|
||||
|
Loading…
Reference in New Issue
Block a user