Browse Source

Merge "Fix no_proxy evaluation for Swarm clusters" into stable/pike

Jenkins 1 year ago
parent
commit
fed947d400

+ 11
- 22
magnum/drivers/common/templates/swarm/fragments/add-proxy.sh View File

@@ -44,31 +44,20 @@ EOF
44 44
     fi
45 45
 fi
46 46
 
47
-if [ -n "$NO_PROXY" ]; then
48
-    cat <<EOF | sed "s/^ *//" > $DOCKER_NO_PROXY_CONF
49
-    [Service]
50
-    Environment=NO_PROXY=$NO_PROXY
51
-EOF
52
-
53
-    DOCKER_RESTART=1
54
-
55
-    if [ -f "$BASH_RC" ]; then
56
-        echo "declare -x no_proxy=$NO_PROXY" >> $BASH_RC
57
-    else
58
-        echo "File $BASH_RC does not exist, not setting no_proxy"
59
-    fi
60
-else
61
-    cat <<EOF | sed "s/^ *//" > $DOCKER_NO_PROXY_CONF
62
-    [Service]
63
-    Environment=NO_PROXY=$SWARM_API_IP,$ETCD_SERVER_IP,$SWARM_NODE_IP
47
+if [ -n "$HTTP_PROXY" -o -n "$HTTPS_PROXY" ]; then
48
+    if [ -n "$NO_PROXY" ]; then
49
+        cat <<EOF | sed "s/^ *//" > $DOCKER_NO_PROXY_CONF
50
+        [Service]
51
+        Environment=NO_PROXY=$NO_PROXY
64 52
 EOF
65 53
 
66
-    DOCKER_RESTART=1
54
+        DOCKER_RESTART=1
67 55
 
68
-    if [ -f "$BASH_RC" ]; then
69
-        echo "declare -x no_proxy=$SWARM_API_IP,$ETCD_SERVER_IP,$SWARM_NODE_IP" >> $BASH_RC
70
-    else
71
-        echo "File $BASH_RC does not exist, not setting no_proxy"
56
+        if [ -f "$BASH_RC" ]; then
57
+            echo "declare -x no_proxy=$NO_PROXY" >> $BASH_RC
58
+        else
59
+            echo "File $BASH_RC does not exist, not setting no_proxy"
60
+        fi
72 61
     fi
73 62
 fi
74 63
 

+ 0
- 4
magnum/drivers/common/templates/swarm/fragments/write-swarm-agent-service.sh View File

@@ -16,10 +16,6 @@ if [ $TLS_DISABLED = 'True'  ]; then
16 16
     ETCDCTL_OPTIONS=""
17 17
 fi
18 18
 
19
-if [ -z "$NO_PROXY" ]; then
20
-    NO_PROXY=$SWARM_API_IP,$ETCD_SERVER_IP,$SWARM_NODE_IP
21
-fi
22
-
23 19
 cat > $CONF_FILE << EOF
24 20
 [Unit]
25 21
 Description=Swarm Agent

+ 0
- 4
magnum/drivers/common/templates/swarm/fragments/write-swarm-master-service.sh View File

@@ -2,10 +2,6 @@
2 2
 
3 3
 CERT_DIR=/etc/docker
4 4
 
5
-if [ -z "$NO_PROXY" ]; then
6
-    NO_PROXY=$SWARM_API_IP,$ETCD_SERVER_IP,$SWARM_NODE_IP
7
-fi
8
-
9 5
 cat > /etc/systemd/system/swarm-manager.service << END_SERVICE_TOP
10 6
 [Unit]
11 7
 Description=Swarm Manager

+ 15
- 2
magnum/drivers/swarm_fedora_atomic_v1/templates/swarmmaster.yaml View File

@@ -205,6 +205,19 @@ resources:
205 205
   # software configs.  these are components that are combined into
206 206
   # a multipart MIME user-data archive.
207 207
   #
208
+  no_proxy_extended:
209
+    type: OS::Heat::Value
210
+    properties:
211
+      type: string
212
+      value:
213
+        list_join:
214
+          - ','
215
+          - - {get_attr: [api_address_switch, private_ip]}
216
+            - {get_attr: [swarm_master_eth0, fixed_ips, 0, ip_address]}
217
+            - {get_attr: [etcd_address_switch, private_ip]}
218
+            - {get_attr: [api_address_switch, public_ip]}
219
+            - {get_param: no_proxy}
220
+
208 221
   write_heat_params:
209 222
     type: "OS::Heat::SoftwareConfig"
210 223
     properties:
@@ -220,7 +233,7 @@ resources:
220 233
             "$ETCD_DISCOVERY_URL": {get_param: discovery_url}
221 234
             "$HTTP_PROXY": {get_param: http_proxy}
222 235
             "$HTTPS_PROXY": {get_param: https_proxy}
223
-            "$NO_PROXY": {get_param: no_proxy}
236
+            "$NO_PROXY": {get_attr: [no_proxy_extended, value]}
224 237
             "$SWARM_API_IP": {get_attr: [api_address_switch, private_ip]}
225 238
             "$SWARM_NODE_IP": {get_attr: [swarm_master_eth0, fixed_ips, 0, ip_address]}
226 239
             "$CLUSTER_UUID": {get_param: cluster_uuid}
@@ -322,7 +335,7 @@ resources:
322 335
             "$WAIT_CURL": {get_attr: [master_wait_handle, curl_cli]}
323 336
             "$HTTP_PROXY": {get_param: http_proxy}
324 337
             "$HTTPS_PROXY": {get_param: https_proxy}
325
-            "$NO_PROXY": {get_param: no_proxy}
338
+            "$NO_PROXY": {get_attr: [no_proxy_extended, value]}
326 339
             "$TLS_DISABLED": {get_param: tls_disabled}
327 340
             "$SWARM_VERSION": {get_param: swarm_version}
328 341
             "$SWARM_STRATEGY": {get_param: swarm_strategy}

+ 14
- 1
magnum/drivers/swarm_fedora_atomic_v1/templates/swarmnode.yaml View File

@@ -183,6 +183,19 @@ resources:
183 183
   #
184 184
   # software configs.  these are components that are combined into
185 185
   # a multipart MIME user-data archive.
186
+  no_proxy_extended:
187
+    type: OS::Heat::Value
188
+    properties:
189
+      type: string
190
+      value:
191
+        list_join:
192
+          - ','
193
+          - - {get_param: swarm_api_ip}
194
+            - {get_attr: [swarm_node_eth0, fixed_ips, 0, ip_address]}
195
+            - {get_param: etcd_server_ip}
196
+            - {get_param: api_ip_address}
197
+            - {get_param: no_proxy}
198
+
186 199
   write_heat_params:
187 200
     type: "OS::Heat::SoftwareConfig"
188 201
     properties:
@@ -197,7 +210,7 @@ resources:
197 210
             "$DOCKER_STORAGE_DRIVER": {get_param: docker_storage_driver}
198 211
             "$HTTP_PROXY": {get_param: http_proxy}
199 212
             "$HTTPS_PROXY": {get_param: https_proxy}
200
-            "$NO_PROXY": {get_param: no_proxy}
213
+            "$NO_PROXY": {get_attr: [no_proxy_extended, value]}
201 214
             "$SWARM_API_IP": {get_param: swarm_api_ip}
202 215
             "$SWARM_NODE_IP": {get_attr: [swarm_node_eth0, fixed_ips, 0, ip_address]}
203 216
             "$CLUSTER_UUID": {get_param: cluster_uuid}

Loading…
Cancel
Save