Add a global var to maintain swarm version

Currently Swarm version in magnum are appear in multiple files.
It's not easy for us to maintain.

This patch add a global var to store swarm image and its version.
so that we can update swarm image more easy.

Change-Id: I3063ff4350f8e2f3c96b0bc3700ed509edad206b
Closes-Bug: #1515567
This commit is contained in:
Xian Chaobo 2015-11-13 10:37:12 +08:00
parent f2ab0c7498
commit 7db6a70e71
4 changed files with 17 additions and 4 deletions

View File

@ -15,8 +15,8 @@ write_files:
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill swarm-agent
ExecStartPre=-/usr/bin/docker rm swarm-agent
ExecStartPre=-/usr/bin/docker pull swarm:1.0.0
ExecStart=/usr/bin/docker run -e http_proxy=$HTTP_PROXY -e https_proxy=$HTTPS_PROXY -e no_proxy=$NO_PROXY --name swarm-agent swarm:1.0.0 join --addr $NODE_IP:2375 etcd://$SWARM_MASTER_IP:2379/v2/keys/swarm/
ExecStartPre=-/usr/bin/docker pull swarm:$SWARM_VERSION
ExecStart=/usr/bin/docker run -e http_proxy=$HTTP_PROXY -e https_proxy=$HTTPS_PROXY -e no_proxy=$NO_PROXY --name swarm-agent swarm:$SWARM_VERSION join --addr $NODE_IP:2375 etcd://$SWARM_MASTER_IP:2379/v2/keys/swarm/
ExecStop=/usr/bin/docker stop swarm-agent
ExecStartPost=/usr/bin/curl -sf -X PUT -H 'Content-Type: application/json' \
--data-binary '{"Status": "SUCCESS", "Reason": "Setup complete", "Data": "OK", "UniqueId": "00000"}' \

View File

@ -11,14 +11,14 @@ OnFailure=swarm-manager-failure.service
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill swarm-manager
ExecStartPre=-/usr/bin/docker rm swarm-manager
ExecStartPre=-/usr/bin/docker pull swarm:1.0.0
ExecStartPre=-/usr/bin/docker pull swarm:$SWARM_VERSION
ExecStart=/usr/bin/docker run --name swarm-manager \\
-v /etc/docker:/etc/docker \\
-p 2376:2375 \\
-e http_proxy=$HTTP_PROXY \\
-e https_proxy=$HTTPS_PROXY \\
-e no_proxy=$NO_PROXY \\
swarm:1.0.0 \\
swarm:$SWARM_VERSION \\
manage -H tcp://0.0.0.0:2375 \\
END_SERVICE_TOP

View File

@ -116,6 +116,11 @@ parameters:
constraints:
- allowed_values: ["true", "false"]
swarm_version:
type: string
description: version of swarm used for swarm cluster
default: 1.0.0
resources:
cloud_init_wait_handle:
@ -330,6 +335,7 @@ resources:
"$HTTP_PROXY": {get_param: http_proxy}
"$HTTPS_PROXY": {get_param: https_proxy}
"$NO_PROXY": {get_param: no_proxy}
"$SWARM_VERSION": {get_param: swarm_version}
write_swarm_master_service:
type: "OS::Heat::SoftwareConfig"
@ -346,6 +352,7 @@ resources:
"$HTTPS_PROXY": {get_param: https_proxy}
"$NO_PROXY": {get_param: no_proxy}
"$TLS_DISABLED": {get_param: tls_disabled}
"$SWARM_VERSION": {get_param: swarm_version}
enable_services:
type: "OS::Heat::SoftwareConfig"

View File

@ -84,6 +84,11 @@ parameters:
type: boolean
description: whether or not to disable TLS
swarm_version:
type: string
description: version of swarm used for swarm cluster
default: 1.0.0
resources:
node_cloud_init_wait_handle:
@ -218,6 +223,7 @@ resources:
"$HTTP_PROXY": {get_param: http_proxy}
"$HTTPS_PROXY": {get_param: https_proxy}
"$NO_PROXY": {get_param: no_proxy}
"$SWARM_VERSION": {get_param: swarm_version}
enable_services:
type: "OS::Heat::SoftwareConfig"