magnum/magnum/drivers/swarm_fedora_atomic_v1/templates
Feilong Wang 001b9c6101 Fix label fixed_network_cidr
Now the label `fixed_network_cidr` is not handled correctly, no matter
if the label is set, the default value '10.0.0.0/24' is used for
fixed network anyway. This patch fixes it and renamed it as
`fixed_subnet_cidr` to make less confusion. The new behaviour will be:
1. If the label `fixed_subnet_cidr` is set but no fixed subnet passed
   in, then a new subnet will be created with the given CIDR.
2. If a fixed subnet is passed in by user, then label `fixed_subnet_cidr`
   will be override with the CIDR from the given subnet.

Task: 39847
Story: 2007712

Change-Id: Id05e36696bf85297a556fcd959ed897fe47b7354
2020-06-11 13:54:59 +12:00
..
COPYING Bay driver implementation 2016-07-05 22:30:31 +02:00
README.md Bay driver implementation 2016-07-05 22:30:31 +02:00
cluster.yaml Fix label fixed_network_cidr 2020-06-11 13:54:59 +12:00
swarmmaster.yaml Fixing typos and spelling errors in driver template files 2019-10-10 22:18:58 -04:00
swarmnode.yaml Support soft-anti-affinity policy for nodes 2018-01-24 07:13:48 +13:00

README.md

A Docker swarm cluster with Heat

These Heat templates will deploy an N-node swarm cluster, where N is the value of the number_of_nodes parameter you specify when creating the stack.

Requirements

OpenStack

These templates will work with the Juno version of Heat.

Guest image

These templates will work with either CentOS Atomic Host or Fedora 21 Atomic.

Creating the stack

First, you must create a swarm token, which is used to uniquely identify the cluster to the global discovery service. This can be done by issuing a create call to the swarm CLI. Alternatively, if you have access to Docker you can use the dockerswarm/swarm image.

$ swarm create
afeb445bcb2f573aeb8ff3a199785f45

$ docker run dockerswarm/swarm create
d8cdfe5128af6e1075b34aa06ff1cc2c

Creating an environment file local.yaml with parameters specific to your environment:

parameters:
  ssh_key_name: testkey
  external_network: 028d70dd-67b8-4901-8bdd-0c62b06cce2d
  dns_nameserver: 192.168.200.1
  server_image: fedora-atomic-latest
  discovery_url: token://d8cdfe5128af6e1075b34aa06ff1cc2c

And then create the stack, referencing that environment file:

heat stack-create -f swarm.yaml -e local.yaml my-swarm-cluster

You must provide values for:

  • ssh_key_name
  • external_network
  • server_image
  • discovery_url

Interacting with Swarm

The Docker CLI interacts with the cluster through the swarm master listening on port 2376.

You can get the ip address of the swarm master using the heat output-show command:

$ heat output-show my-swarm-cluster swarm_master
"192.168.200.86"

Provide the Docker CLI with the address for the swarm master.

$ docker -H tcp://192.168.200.86:2376 info
Containers: 4
Nodes: 3
 swarm-master: 10.0.0.1:2375
 swarm-node1: 10.0.0.2:2375
 swarm-node2: 10.0.0.3:2375

Testing

You can test the swarm cluster with the Docker CLI by running a container. In the example below, a container is spawned in the cluster to ping 8.8.8.8.

$ docker -H tcp://192.168.200.86:2376 run -i cirros /bin/ping -c 4 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=127 time=40.749 ms
64 bytes from 8.8.8.8: seq=1 ttl=127 time=46.264 ms
64 bytes from 8.8.8.8: seq=2 ttl=127 time=42.808 ms
64 bytes from 8.8.8.8: seq=3 ttl=127 time=42.270 ms

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 40.749/43.022/46.264 ms

License

Copyright 2014 Lars Kellogg-Stedman lars@redhat.com Copyright 2015 Rackspace Hosting

Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.