Add flannel's host-gw backend option

Allow configuring Flannel with 3 different backends

Magnum deploys k8s/swarm over a dedicated neutron private network,
possibly using flannel.  Flannel's `host-gw` backend gives the best
performance in this topopolgy (private layer2): no packet processing
overhead, no reduction to MTU, scales to many hosts as well as the
alternatives.  The performance difference is significant, see bug for
performance numbers for the 3 backend options.

Note that part of this change involves relaxing the minion IP spoofing
rules to allow traffic from all dynamically-allocated flannel subnets.
This is morally equivalent to what we were doing previously with
encapsulation - only now neutron is able to see the inner IP header
directly.

This patch repurposes the label "flannel_use_vxlan" when the network
driver is flannel.

1. Rename the label flannel_use_vxlan to flannel_backend
2. Redefine the value of this label from "yes/no"
   to "udp/vxlan/host-gw"

For example, to create a bay model with flannel as network driver:
--network-driver flannel --labels flannel_backend=host-gw

Other backend options are udp and vxlan.

Co-Authored-By: Ton Ngo <ton@us.ibm.com>
Partial-Bug: #1518605
Closes-Bug: #1516789
Change-Id: I6d2441664ad1baaca14d0e6ff4bcddbe75bee094
This commit is contained in:
Angus Lees 2015-11-05 15:12:43 +11:00 committed by Ton Ngo
parent 473b99710f
commit 14909f0944
23 changed files with 95 additions and 133 deletions

View File

@ -482,7 +482,7 @@ class K8sTemplateDefinition(BaseTemplateDefinition):
extra_params['discovery_url'] = self.get_discovery_url(bay) extra_params['discovery_url'] = self.get_discovery_url(bay)
label_list = ['flannel_network_cidr', 'flannel_use_vxlan', label_list = ['flannel_network_cidr', 'flannel_backend',
'flannel_network_subnetlen'] 'flannel_network_subnetlen']
for label in label_list: for label in label_list:
extra_params[label] = baymodel.labels.get(label) extra_params[label] = baymodel.labels.get(label)
@ -597,7 +597,7 @@ class AtomicSwarmTemplateDefinition(BaseTemplateDefinition):
extra_params['user_token'] = self._get_user_token(context, osc, bay) extra_params['user_token'] = self._get_user_token(context, osc, bay)
extra_params['magnum_url'] = osc.magnum_url() extra_params['magnum_url'] = osc.magnum_url()
label_list = ['flannel_network_cidr', 'flannel_use_vxlan', label_list = ['flannel_network_cidr', 'flannel_backend',
'flannel_network_subnetlen'] 'flannel_network_subnetlen']
for label in label_list: for label in label_list:

View File

@ -26,11 +26,6 @@ work with Juno as well as soon as [#1402894][] is resolved.
These templates will work with either CentOS Atomic Host or Fedora 21 These templates will work with either CentOS Atomic Host or Fedora 21
Atomic. Atomic.
You can enable the VXLAN backend for flannel by setting the
"flannel_use_vxlan" parameter to "true", but I have run into kernel
crashes using that backend with CentOS 7. It seems to work fine with
Fedora 21.
You can enable docker registry v2 by setting the "registry_enabled" You can enable docker registry v2 by setting the "registry_enabled"
parameter to "true". parameter to "true".
@ -146,4 +141,3 @@ When submitting pull requests:
stylistic/formatting/cleanup changes. stylistic/formatting/cleanup changes.
[github repository]: https://github.com/larsks/heat-kubernetes/ [github repository]: https://github.com/larsks/heat-kubernetes/

View File

@ -5,28 +5,15 @@
FLANNEL_JSON=/etc/sysconfig/flannel-network.json FLANNEL_JSON=/etc/sysconfig/flannel-network.json
if [ "$FLANNEL_USE_VXLAN" == "true" ]; then
use_vxlan=1
fi
# Generate a flannel configuration that we will # Generate a flannel configuration that we will
# store into etcd using curl. # store into etcd using curl.
cat > $FLANNEL_JSON <<EOF cat > $FLANNEL_JSON <<EOF
{ {
"Network": "$FLANNEL_NETWORK_CIDR", "Network": "$FLANNEL_NETWORK_CIDR",
"Subnetlen": $FLANNEL_NETWORK_SUBNETLEN "Subnetlen": $FLANNEL_NETWORK_SUBNETLEN,
EOF
if [ "$use_vxlan" = 1 ]; then
cat >> $FLANNEL_JSON <<EOF
,
"Backend": { "Backend": {
"Type": "vxlan" "Type": "$FLANNEL_BACKEND"
} }
EOF
fi
cat >> $FLANNEL_JSON <<EOF
} }
EOF EOF

View File

@ -14,7 +14,7 @@ write_files:
NETWORK_DRIVER="$NETWORK_DRIVER" NETWORK_DRIVER="$NETWORK_DRIVER"
FLANNEL_NETWORK_CIDR="$FLANNEL_NETWORK_CIDR" FLANNEL_NETWORK_CIDR="$FLANNEL_NETWORK_CIDR"
FLANNEL_NETWORK_SUBNETLEN="$FLANNEL_NETWORK_SUBNETLEN" FLANNEL_NETWORK_SUBNETLEN="$FLANNEL_NETWORK_SUBNETLEN"
FLANNEL_USE_VXLAN="$FLANNEL_USE_VXLAN" FLANNEL_BACKEND="$FLANNEL_BACKEND"
PORTAL_NETWORK_CIDR="$PORTAL_NETWORK_CIDR" PORTAL_NETWORK_CIDR="$PORTAL_NETWORK_CIDR"
ETCD_DISCOVERY_URL="$ETCD_DISCOVERY_URL" ETCD_DISCOVERY_URL="$ETCD_DISCOVERY_URL"
AUTH_URL="$AUTH_URL" AUTH_URL="$AUTH_URL"

View File

@ -25,18 +25,13 @@ write_files:
exit 0 exit 0
fi fi
backend_type=udp
if [ "$FLANNEL_USE_VXLAN" == "true" ]; then
backend_type=vxlan
fi
FLANNEL_JSON=/etc/sysconfig/flannel-network.json FLANNEL_JSON=/etc/sysconfig/flannel-network.json
cat > $FLANNEL_JSON <<EOF cat > $FLANNEL_JSON <<EOF
{ {
"Network": "$FLANNEL_NETWORK_CIDR", "Network": "$FLANNEL_NETWORK_CIDR",
"Subnetlen": $FLANNEL_NETWORK_SUBNETLEN, "Subnetlen": $FLANNEL_NETWORK_SUBNETLEN,
"Backend": { "Backend": {
"Type": "$backend_type" "Type": "$FLANNEL_BACKEND"
} }
} }
EOF EOF

View File

@ -10,35 +10,19 @@ fi
FLANNEL_JSON=/etc/sysconfig/flannel-network.json FLANNEL_JSON=/etc/sysconfig/flannel-network.json
FLANNELD_CONFIG=/etc/sysconfig/flanneld FLANNELD_CONFIG=/etc/sysconfig/flanneld
FLANNEL_NETWORK_CIDR="$FLANNEL_NETWORK_CIDR"
FLANNEL_NETWORK_SUBNETLEN="$FLANNEL_NETWORK_SUBNETLEN"
FLANNEL_USE_VXLAN="$FLANNEL_USE_VXLAN"
sed -i ' sed -i '
/^FLANNEL_ETCD=/ s/=.*/="http:\/\/127.0.0.1:2379"/ /^FLANNEL_ETCD=/ s/=.*/="http:\/\/127.0.0.1:2379"/
' /etc/sysconfig/flanneld ' /etc/sysconfig/flanneld
if [ "$FLANNEL_USE_VXLAN" == "true" ]; then
use_vxlan=1
fi
# Generate a flannel configuration that we will # Generate a flannel configuration that we will
# store into etcd using curl. # store into etcd using curl.
cat > $FLANNEL_JSON <<EOF cat > $FLANNEL_JSON <<EOF
{ {
"Network": "$FLANNEL_NETWORK_CIDR", "Network": "$FLANNEL_NETWORK_CIDR",
"Subnetlen": $FLANNEL_NETWORK_SUBNETLEN "Subnetlen": $FLANNEL_NETWORK_SUBNETLEN,
EOF
if [ "$use_vxlan" = 1 ]; then
cat >> $FLANNEL_JSON <<EOF
,
"Backend": { "Backend": {
"Type": "vxlan" "Type": "$FLANNEL_BACKEND"
} }
EOF
fi
cat >> $FLANNEL_JSON <<EOF
} }
EOF EOF

View File

@ -72,14 +72,13 @@ parameters:
description: size of subnet assigned to each minion description: size of subnet assigned to each minion
default: 24 default: 24
flannel_use_vxlan: flannel_backend:
type: string type: string
description: > description: >
if true use the vxlan backend, otherwise use the default specify the backend for flannel, default udp backend
udp backend default: "udp"
default: "false"
constraints: constraints:
- allowed_values: ["true", "false"] - allowed_values: ["udp", "vxlan", "host-gw"]
kube_allow_priv: kube_allow_priv:
type: string type: string
@ -203,7 +202,7 @@ resources:
kube_allow_priv: {get_param: kube_allow_priv} kube_allow_priv: {get_param: kube_allow_priv}
flannel_network_cidr: {get_param: flannel_network_cidr} flannel_network_cidr: {get_param: flannel_network_cidr}
flannel_network_subnetlen: {get_param: flannel_network_subnetlen} flannel_network_subnetlen: {get_param: flannel_network_subnetlen}
flannel_use_vxlan: {get_param: flannel_use_vxlan} flannel_backend: {get_param: flannel_backend}
portal_network_cidr: {get_param: portal_network_cidr} portal_network_cidr: {get_param: portal_network_cidr}
fixed_network: {get_resource: fixed_network} fixed_network: {get_resource: fixed_network}
fixed_subnet: {get_resource: fixed_subnet} fixed_subnet: {get_resource: fixed_subnet}
@ -234,6 +233,7 @@ resources:
minion_flavor: {get_param: minion_flavor} minion_flavor: {get_param: minion_flavor}
fixed_network: {get_resource: fixed_network} fixed_network: {get_resource: fixed_network}
fixed_subnet: {get_resource: fixed_subnet} fixed_subnet: {get_resource: fixed_subnet}
flannel_network_cidr: {get_param: flannel_network_cidr}
kube_master_ip: {"Fn::Select": [0, {get_attr: [kube_master, kube_master_ip]}]} kube_master_ip: {"Fn::Select": [0, {get_attr: [kube_master, kube_master_ip]}]}
external_network: {get_param: external_network} external_network: {get_param: external_network}
kube_allow_priv: {get_param: kube_allow_priv} kube_allow_priv: {get_param: kube_allow_priv}

View File

@ -54,14 +54,13 @@ parameters:
description: size of subnet assigned to each minion description: size of subnet assigned to each minion
default: 24 default: 24
flannel_use_vxlan: flannel_backend:
type: string type: string
description: > description: >
if true use the vxlan backend, otherwise use the default specify the backend for flannel, default udp backend
udp backend default: "udp"
default: "false"
constraints: constraints:
- allowed_values: ["true", "false"] - allowed_values: ["udp", "vxlan", "host-gw"]
kube_allow_priv: kube_allow_priv:
type: string type: string
@ -161,7 +160,7 @@ resources:
wait_condition_timeout: {get_param: wait_condition_timeout} wait_condition_timeout: {get_param: wait_condition_timeout}
flannel_network_cidr: {get_param: flannel_network_cidr} flannel_network_cidr: {get_param: flannel_network_cidr}
flannel_network_subnetlen: {get_param: flannel_network_subnetlen} flannel_network_subnetlen: {get_param: flannel_network_subnetlen}
flannel_use_vxlan: {get_param: flannel_use_vxlan} flannel_backend: {get_param: flannel_backend}
portal_network_cidr: {get_param: portal_network_cidr} portal_network_cidr: {get_param: portal_network_cidr}
fixed_network: {get_resource: fixed_network} fixed_network: {get_resource: fixed_network}
auth_url: {get_param: auth_url} auth_url: {get_param: auth_url}

View File

@ -71,14 +71,13 @@ parameters:
description: size of subnet assigned to each minion description: size of subnet assigned to each minion
default: 24 default: 24
flannel_use_vxlan: flannel_backend:
type: string type: string
description: > description: >
if true use the vxlan backend, otherwise use the default specify the backend for flannel, default udp backend
udp backend default: "udp"
default: "false"
constraints: constraints:
- allowed_values: ["true", "false"] - allowed_values: ["udp", "vxlan", "host-gw"]
kube_allow_priv: kube_allow_priv:
type: string type: string
@ -431,7 +430,7 @@ resources:
network_driver: {get_param: network_driver} network_driver: {get_param: network_driver}
flannel_network_cidr: {get_param: flannel_network_cidr} flannel_network_cidr: {get_param: flannel_network_cidr}
flannel_network_subnetlen: {get_param: flannel_network_subnetlen} flannel_network_subnetlen: {get_param: flannel_network_subnetlen}
flannel_use_vxlan: {get_param: flannel_use_vxlan} flannel_backend: {get_param: flannel_backend}
portal_network_cidr: {get_param: portal_network_cidr} portal_network_cidr: {get_param: portal_network_cidr}
discovery_url: {get_param: discovery_url} discovery_url: {get_param: discovery_url}
user_token: {get_param: user_token} user_token: {get_param: user_token}
@ -476,6 +475,7 @@ resources:
fixed_network: {get_resource: fixed_network} fixed_network: {get_resource: fixed_network}
fixed_subnet: {get_resource: fixed_subnet} fixed_subnet: {get_resource: fixed_subnet}
network_driver: {get_param: network_driver} network_driver: {get_param: network_driver}
flannel_network_cidr: {get_param: flannel_network_cidr}
kube_master_ip: {get_attr: [api_pool, vip, address]} kube_master_ip: {get_attr: [api_pool, vip, address]}
etcd_server_ip: {get_attr: [etcd_pool, vip, address]} etcd_server_ip: {get_attr: [etcd_pool, vip, address]}
external_network: {get_param: external_network} external_network: {get_param: external_network}

View File

@ -59,14 +59,13 @@ parameters:
description: size of subnet assigned to each master description: size of subnet assigned to each master
default: 24 default: 24
flannel_use_vxlan: flannel_backend:
type: string type: string
description: > description: >
if true use the vxlan backend, otherwise use the default specify the backend for flannel, default udp backend
udp backend default: "udp"
default: "false"
constraints: constraints:
- allowed_values: ["true", "false"] - allowed_values: ["udp", "vxlan", "host-gw"]
fixed_network: fixed_network:
type: string type: string
@ -162,7 +161,7 @@ resources:
"$KUBE_ALLOW_PRIV": {get_param: kube_allow_priv} "$KUBE_ALLOW_PRIV": {get_param: kube_allow_priv}
"$FLANNEL_NETWORK_CIDR": {get_param: flannel_network_cidr} "$FLANNEL_NETWORK_CIDR": {get_param: flannel_network_cidr}
"$FLANNEL_NETWORK_SUBNETLEN": {get_param: flannel_network_subnetlen} "$FLANNEL_NETWORK_SUBNETLEN": {get_param: flannel_network_subnetlen}
"$FLANNEL_USE_VXLAN": {get_param: flannel_use_vxlan} "$FLANNEL_BACKEND": {get_param: flannel_backend}
"$PORTAL_NETWORK_CIDR": {get_param: portal_network_cidr} "$PORTAL_NETWORK_CIDR": {get_param: portal_network_cidr}
"$CLUSTER_SUBNET": {get_param: fixed_subnet} "$CLUSTER_SUBNET": {get_param: fixed_subnet}
"$ETCD_DISCOVERY_URL": {get_param: discovery_url} "$ETCD_DISCOVERY_URL": {get_param: discovery_url}
@ -319,6 +318,8 @@ resources:
- {get_resource: secgroup_kubernetes} - {get_resource: secgroup_kubernetes}
fixed_ips: fixed_ips:
- subnet: {get_param: fixed_subnet} - subnet: {get_param: fixed_subnet}
allowed_address_pairs:
- ip_address: {get_param: flannel_network_cidr}
replacement_policy: AUTO replacement_policy: AUTO
kube_master_floating: kube_master_floating:

View File

@ -45,14 +45,13 @@ parameters:
description: size of subnet assigned to each minion description: size of subnet assigned to each minion
default: 24 default: 24
flannel_use_vxlan: flannel_backend:
type: string type: string
description: > description: >
if true use the vxlan backend, otherwise use the default specify the backend for flannel, default udp backend
udp backend default: "udp"
default: "false"
constraints: constraints:
- allowed_values: ["true", "false"] - allowed_values: ["udp", "vxlan", "host-gw"]
kube_allow_priv: kube_allow_priv:
type: string type: string
@ -147,7 +146,7 @@ resources:
"$KUBE_ALLOW_PRIV": {get_param: kube_allow_priv} "$KUBE_ALLOW_PRIV": {get_param: kube_allow_priv}
"$FLANNEL_NETWORK_CIDR": {get_param: flannel_network_cidr} "$FLANNEL_NETWORK_CIDR": {get_param: flannel_network_cidr}
"$FLANNEL_NETWORK_SUBNETLEN": {get_param: flannel_network_subnetlen} "$FLANNEL_NETWORK_SUBNETLEN": {get_param: flannel_network_subnetlen}
"$FLANNEL_USE_VXLAN": {get_param: flannel_use_vxlan} "$FLANNEL_BACKEND": {get_param: flannel_backend}
"$PORTAL_NETWORK_CIDR": {get_param: portal_network_cidr} "$PORTAL_NETWORK_CIDR": {get_param: portal_network_cidr}
"$AUTH_URL": {get_param: auth_url} "$AUTH_URL": {get_param: auth_url}
"$USERNAME": {get_param: username} "$USERNAME": {get_param: username}

View File

@ -56,14 +56,13 @@ parameters:
description: size of subnet assigned to each master description: size of subnet assigned to each master
default: 24 default: 24
flannel_use_vxlan: flannel_backend:
type: string type: string
description: > description: >
if true use the vxlan backend, otherwise use the default specify the backend for flannel, default udp backend
udp backend default: "udp"
default: "false"
constraints: constraints:
- allowed_values: ["true", "false"] - allowed_values: ["udp", "vxlan", "host-gw"]
discovery_url: discovery_url:
type: string type: string
@ -190,7 +189,7 @@ resources:
"$NETWORK_DRIVER": {get_param: network_driver} "$NETWORK_DRIVER": {get_param: network_driver}
"$FLANNEL_NETWORK_CIDR": {get_param: flannel_network_cidr} "$FLANNEL_NETWORK_CIDR": {get_param: flannel_network_cidr}
"$FLANNEL_NETWORK_SUBNETLEN": {get_param: flannel_network_subnetlen} "$FLANNEL_NETWORK_SUBNETLEN": {get_param: flannel_network_subnetlen}
"$FLANNEL_USE_VXLAN": {get_param: flannel_use_vxlan} "$FLANNEL_BACKEND": {get_param: flannel_backend}
"$PORTAL_NETWORK_CIDR": {get_param: portal_network_cidr} "$PORTAL_NETWORK_CIDR": {get_param: portal_network_cidr}
"$ETCD_DISCOVERY_URL": {get_param: discovery_url} "$ETCD_DISCOVERY_URL": {get_param: discovery_url}
"$AUTH_URL": {get_param: auth_url} "$AUTH_URL": {get_param: auth_url}
@ -370,6 +369,8 @@ resources:
- {get_param: secgroup_kube_master_id} - {get_param: secgroup_kube_master_id}
fixed_ips: fixed_ips:
- subnet: {get_param: fixed_subnet} - subnet: {get_param: fixed_subnet}
allowed_address_pairs:
- ip_address: {get_param: flannel_network_cidr}
replacement_policy: AUTO replacement_policy: AUTO
kube_master_floating: kube_master_floating:

View File

@ -63,6 +63,9 @@ parameters:
fixed_subnet: fixed_subnet:
type: string type: string
description: Subnet from which to allocate fixed addresses. description: Subnet from which to allocate fixed addresses.
flannel_network_cidr:
type: string
description: network range for flannel overlay network
resources: resources:
@ -191,6 +194,8 @@ resources:
- get_resource: secgroup_all_open - get_resource: secgroup_all_open
fixed_ips: fixed_ips:
- subnet: {get_param: fixed_subnet} - subnet: {get_param: fixed_subnet}
allowed_address_pairs:
- ip_address: {get_param: flannel_network_cidr}
replacement_policy: AUTO replacement_policy: AUTO
kube_minion_floating: kube_minion_floating:

View File

@ -81,6 +81,9 @@ parameters:
network_driver: network_driver:
type: string type: string
description: network driver to use for instantiating container networks description: network driver to use for instantiating container networks
flannel_network_cidr:
type: string
description: network range for flannel overlay network
wait_condition_timeout: wait_condition_timeout:
type: number type: number
description : > description : >
@ -359,6 +362,8 @@ resources:
- get_param: secgroup_kube_minion_id - get_param: secgroup_kube_minion_id
fixed_ips: fixed_ips:
- subnet: {get_param: fixed_subnet} - subnet: {get_param: fixed_subnet}
allowed_address_pairs:
- ip_address: {get_param: flannel_network_cidr}
replacement_policy: AUTO replacement_policy: AUTO
kube_minion_floating: kube_minion_floating:

View File

@ -20,7 +20,7 @@ write_files:
NETWORK_DRIVER="$NETWORK_DRIVER" NETWORK_DRIVER="$NETWORK_DRIVER"
FLANNEL_NETWORK_CIDR="$FLANNEL_NETWORK_CIDR" FLANNEL_NETWORK_CIDR="$FLANNEL_NETWORK_CIDR"
FLANNEL_NETWORK_SUBNETLEN="$FLANNEL_NETWORK_SUBNETLEN" FLANNEL_NETWORK_SUBNETLEN="$FLANNEL_NETWORK_SUBNETLEN"
FLANNEL_USE_VXLAN="$FLANNEL_USE_VXLAN" FLANNEL_BACKEND="$FLANNEL_BACKEND"
ETCD_SERVER_IP="$ETCD_SERVER_IP" ETCD_SERVER_IP="$ETCD_SERVER_IP"
API_IP_ADDRESS="$API_IP_ADDRESS" API_IP_ADDRESS="$API_IP_ADDRESS"
SWARM_VERSION="$SWARM_VERSION" SWARM_VERSION="$SWARM_VERSION"

View File

@ -7,31 +7,16 @@ if [ "$NETWORK_DRIVER" != "flannel" ]; then
fi fi
FLANNEL_JSON=/etc/sysconfig/flannel-network.json FLANNEL_JSON=/etc/sysconfig/flannel-network.json
FLANNEL_NETWORK_CIDR="$FLANNEL_NETWORK_CIDR"
FLANNEL_NETWORK_SUBNETLEN="$FLANNEL_NETWORK_SUBNETLEN"
FLANNEL_USE_VXLAN="$FLANNEL_USE_VXLAN"
if [ "$FLANNEL_USE_VXLAN" == "true" ]; then
use_vxlan=1
fi
# Generate a flannel configuration that we will # Generate a flannel configuration that we will
# store into etcd using curl. # store into etcd using curl.
cat > $FLANNEL_JSON <<EOF cat > $FLANNEL_JSON <<EOF
{ {
"Network": "$FLANNEL_NETWORK_CIDR", "Network": "$FLANNEL_NETWORK_CIDR",
"Subnetlen": $FLANNEL_NETWORK_SUBNETLEN "Subnetlen": $FLANNEL_NETWORK_SUBNETLEN,
EOF
if [ "$use_vxlan" = 1 ]; then
cat >> $FLANNEL_JSON <<EOF
,
"Backend": { "Backend": {
"Type": "vxlan" "Type": "$FLANNEL_BACKEND"
} }
EOF
fi
cat >> $FLANNEL_JSON <<EOF
} }
EOF EOF

View File

@ -110,14 +110,13 @@ parameters:
description: size of subnet assigned to each master description: size of subnet assigned to each master
default: 24 default: 24
flannel_use_vxlan: flannel_backend:
type: string type: string
description: > description: >
if true use the vxlan backend, otherwise use the default specify the backend for flannel, default udp backend
udp backend default: "udp"
default: "false"
constraints: constraints:
- allowed_values: ["true", "false"] - allowed_values: ["udp", "vxlan", "host-gw"]
docker_volume_size: docker_volume_size:
type: number type: number
@ -318,7 +317,7 @@ resources:
network_driver: {get_param: network_driver} network_driver: {get_param: network_driver}
flannel_network_cidr: {get_param: flannel_network_cidr} flannel_network_cidr: {get_param: flannel_network_cidr}
flannel_network_subnetlen: {get_param: flannel_network_subnetlen} flannel_network_subnetlen: {get_param: flannel_network_subnetlen}
flannel_use_vxlan: {get_param: flannel_use_vxlan} flannel_backend: {get_param: flannel_backend}
swarm_port: {get_param: swarm_port} swarm_port: {get_param: swarm_port}
api_pool_id: {get_resource: api_pool} api_pool_id: {get_resource: api_pool}
etcd_pool_id: {get_resource: etcd_pool} etcd_pool_id: {get_resource: etcd_pool}
@ -352,6 +351,7 @@ resources:
magnum_url: {get_param: magnum_url} magnum_url: {get_param: magnum_url}
tls_disabled: {get_param: tls_disabled} tls_disabled: {get_param: tls_disabled}
secgroup_swarm_node_id: {get_resource: secgroup_manager} secgroup_swarm_node_id: {get_resource: secgroup_manager}
flannel_network_cidr: {get_param: flannel_network_cidr}
network_driver: {get_param: network_driver} network_driver: {get_param: network_driver}
etcd_server_ip: {get_attr: [etcd_pool, vip, address]} etcd_server_ip: {get_attr: [etcd_pool, vip, address]}
api_ip_address: {get_attr: [api_pool_floating, floating_ip_address]} api_ip_address: {get_attr: [api_pool_floating, floating_ip_address]}

View File

@ -88,13 +88,12 @@ parameters:
type: string type: string
description: size of subnet assigned to each master description: size of subnet assigned to each master
flannel_use_vxlan: flannel_backend:
type: string type: string
description: > description: >
if true use the vxlan backend, otherwise use the default specify the backend for flannel, default udp backend
udp backend
constraints: constraints:
- allowed_values: ["true", "false"] - allowed_values: ["udp", "vxlan", "host-gw"]
swarm_version: swarm_version:
type: string type: string
@ -175,7 +174,7 @@ resources:
"$NETWORK_DRIVER": {get_param: network_driver} "$NETWORK_DRIVER": {get_param: network_driver}
"$FLANNEL_NETWORK_CIDR": {get_param: flannel_network_cidr} "$FLANNEL_NETWORK_CIDR": {get_param: flannel_network_cidr}
"$FLANNEL_NETWORK_SUBNETLEN": {get_param: flannel_network_subnetlen} "$FLANNEL_NETWORK_SUBNETLEN": {get_param: flannel_network_subnetlen}
"$FLANNEL_USE_VXLAN": {get_param: flannel_use_vxlan} "$FLANNEL_BACKEND": {get_param: flannel_backend}
"$ETCD_SERVER_IP": {get_param: etcd_server_ip} "$ETCD_SERVER_IP": {get_param: etcd_server_ip}
"$API_IP_ADDRESS": {get_param: api_ip_address} "$API_IP_ADDRESS": {get_param: api_ip_address}
"$SWARM_VERSION": {get_param: swarm_version} "$SWARM_VERSION": {get_param: swarm_version}
@ -343,6 +342,8 @@ resources:
fixed_ips: fixed_ips:
- subnet_id: - subnet_id:
get_param: fixed_subnet_id get_param: fixed_subnet_id
allowed_address_pairs:
- ip_address: {get_param: flannel_network_cidr}
swarm_master_floating: swarm_master_floating:
type: "OS::Neutron::FloatingIP" type: "OS::Neutron::FloatingIP"

View File

@ -41,6 +41,10 @@ parameters:
type: string type: string
description: network driver to use for instantiating container networks description: network driver to use for instantiating container networks
flannel_network_cidr:
type: string
description: network range for flannel overlay network
discovery_url: discovery_url:
type: string type: string
description: url provided for node discovery description: url provided for node discovery
@ -272,6 +276,8 @@ resources:
fixed_ips: fixed_ips:
- subnet_id: - subnet_id:
get_param: fixed_subnet_id get_param: fixed_subnet_id
allowed_address_pairs:
- ip_address: {get_param: flannel_network_cidr}
swarm_node_floating: swarm_node_floating:
type: "OS::Neutron::FloatingIP" type: "OS::Neutron::FloatingIP"

View File

@ -41,7 +41,7 @@ class TestBayConductorWithK8s(base.TestCase):
'no_proxy': 'no_proxy', 'no_proxy': 'no_proxy',
'labels': {'flannel_network_cidr': '10.101.0.0/16', 'labels': {'flannel_network_cidr': '10.101.0.0/16',
'flannel_network_subnetlen': '26', 'flannel_network_subnetlen': '26',
'flannel_use_vxlan': 'yes'}, 'flannel_backend': 'vxlan'},
'tls_disabled': False, 'tls_disabled': False,
'server_type': 'vm' 'server_type': 'vm'
} }
@ -114,7 +114,7 @@ class TestBayConductorWithK8s(base.TestCase):
'discovery_url': 'discovery_url', 'discovery_url': 'discovery_url',
'labels': {'flannel_network_cidr': '10.101.0.0/16', 'labels': {'flannel_network_cidr': '10.101.0.0/16',
'flannel_network_subnetlen': '26', 'flannel_network_subnetlen': '26',
'flannel_use_vxlan': 'yes'}, 'flannel_backend': 'vxlan'},
'http_proxy': 'http_proxy', 'http_proxy': 'http_proxy',
'https_proxy': 'https_proxy', 'https_proxy': 'https_proxy',
'no_proxy': 'no_proxy', 'no_proxy': 'no_proxy',
@ -137,7 +137,7 @@ class TestBayConductorWithK8s(base.TestCase):
'discovery_url': 'https://discovery.etcd.io/test', 'discovery_url': 'https://discovery.etcd.io/test',
'flannel_network_cidr': '10.101.0.0/16', 'flannel_network_cidr': '10.101.0.0/16',
'flannel_network_subnetlen': '26', 'flannel_network_subnetlen': '26',
'flannel_use_vxlan': 'yes', 'flannel_backend': 'vxlan',
'http_proxy': 'http_proxy', 'http_proxy': 'http_proxy',
'https_proxy': 'https_proxy', 'https_proxy': 'https_proxy',
'no_proxy': 'no_proxy', 'no_proxy': 'no_proxy',
@ -188,7 +188,7 @@ class TestBayConductorWithK8s(base.TestCase):
'no_proxy': 'no_proxy', 'no_proxy': 'no_proxy',
'flannel_network_cidr': '10.101.0.0/16', 'flannel_network_cidr': '10.101.0.0/16',
'flannel_network_subnetlen': '26', 'flannel_network_subnetlen': '26',
'flannel_use_vxlan': 'yes', 'flannel_backend': 'vxlan',
'tls_disabled': False, 'tls_disabled': False,
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f', 'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f',
'trustee_username': 'fake_trustee', 'trustee_username': 'fake_trustee',
@ -233,7 +233,7 @@ class TestBayConductorWithK8s(base.TestCase):
'no_proxy': 'no_proxy', 'no_proxy': 'no_proxy',
'flannel_network_cidr': '10.101.0.0/16', 'flannel_network_cidr': '10.101.0.0/16',
'flannel_network_subnetlen': '26', 'flannel_network_subnetlen': '26',
'flannel_use_vxlan': 'yes', 'flannel_backend': 'vxlan',
'tls_disabled': False, 'tls_disabled': False,
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f', 'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f',
'trustee_username': 'fake_trustee', 'trustee_username': 'fake_trustee',
@ -347,7 +347,7 @@ class TestBayConductorWithK8s(base.TestCase):
'no_proxy': 'no_proxy', 'no_proxy': 'no_proxy',
'flannel_network_cidr': '10.101.0.0/16', 'flannel_network_cidr': '10.101.0.0/16',
'flannel_network_subnetlen': '26', 'flannel_network_subnetlen': '26',
'flannel_use_vxlan': 'yes', 'flannel_backend': 'vxlan',
'tenant_name': 'fake_tenant', 'tenant_name': 'fake_tenant',
'username': 'fake_user', 'username': 'fake_user',
'user_token': 'fake_token', 'user_token': 'fake_token',

View File

@ -44,7 +44,7 @@ class TestBayConductorWithSwarm(base.TestCase):
'network_driver': 'network_driver', 'network_driver': 'network_driver',
'labels': {'flannel_network_cidr': '10.101.0.0/16', 'labels': {'flannel_network_cidr': '10.101.0.0/16',
'flannel_network_subnetlen': '26', 'flannel_network_subnetlen': '26',
'flannel_use_vxlan': 'yes'} 'flannel_backend': 'vxlan'}
} }
self.bay_dict = { self.bay_dict = {
'id': 1, 'id': 1,
@ -108,7 +108,7 @@ class TestBayConductorWithSwarm(base.TestCase):
'network_driver': 'network_driver', 'network_driver': 'network_driver',
'flannel_network_cidr': '10.101.0.0/16', 'flannel_network_cidr': '10.101.0.0/16',
'flannel_network_subnetlen': '26', 'flannel_network_subnetlen': '26',
'flannel_use_vxlan': 'yes', 'flannel_backend': 'vxlan',
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f', 'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f',
'trustee_username': 'fake_trustee', 'trustee_username': 'fake_trustee',
'trustee_password': 'fake_trustee_password', 'trustee_password': 'fake_trustee_password',
@ -151,7 +151,7 @@ class TestBayConductorWithSwarm(base.TestCase):
'tls_disabled': False, 'tls_disabled': False,
'flannel_network_cidr': u'10.101.0.0/16', 'flannel_network_cidr': u'10.101.0.0/16',
'flannel_network_subnetlen': u'26', 'flannel_network_subnetlen': u'26',
'flannel_use_vxlan': u'yes', 'flannel_backend': u'vxlan',
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f', 'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f',
'trustee_username': 'fake_trustee', 'trustee_username': 'fake_trustee',
'trustee_password': 'fake_trustee_password', 'trustee_password': 'fake_trustee_password',

View File

@ -193,7 +193,7 @@ class AtomicK8sTemplateDefinitionTestCase(base.TestCase):
flannel_cidr = mock_baymodel.labels.get('flannel_network_cidr') flannel_cidr = mock_baymodel.labels.get('flannel_network_cidr')
flannel_subnet = mock_baymodel.labels.get('flannel_network_subnetlen') flannel_subnet = mock_baymodel.labels.get('flannel_network_subnetlen')
flannel_vxlan = mock_baymodel.labels.get('flannel_use_vxlan') flannel_backend = mock_baymodel.labels.get('flannel_backend')
k8s_def = tdef.AtomicK8sTemplateDefinition() k8s_def = tdef.AtomicK8sTemplateDefinition()
@ -204,8 +204,8 @@ class AtomicK8sTemplateDefinitionTestCase(base.TestCase):
'minions_to_remove': removal_nodes, 'minions_to_remove': removal_nodes,
'discovery_url': 'fake_discovery_url', 'discovery_url': 'fake_discovery_url',
'flannel_network_cidr': flannel_cidr, 'flannel_network_cidr': flannel_cidr,
'flannel_use_vxlan': flannel_subnet, 'flannel_network_subnetlen': flannel_subnet,
'flannel_network_subnetlen': flannel_vxlan, 'flannel_backend': flannel_backend,
'username': 'fake_user', 'username': 'fake_user',
'tenant_name': 'fake_tenant', 'tenant_name': 'fake_tenant',
'magnum_url': mock_osc.magnum_url.return_value, 'magnum_url': mock_osc.magnum_url.return_value,
@ -244,7 +244,7 @@ class AtomicK8sTemplateDefinitionTestCase(base.TestCase):
flannel_cidr = mock_baymodel.labels.get('flannel_network_cidr') flannel_cidr = mock_baymodel.labels.get('flannel_network_cidr')
flannel_subnet = mock_baymodel.labels.get('flannel_network_subnetlen') flannel_subnet = mock_baymodel.labels.get('flannel_network_subnetlen')
flannel_vxlan = mock_baymodel.labels.get('flannel_use_vxlan') flannel_backend = mock_baymodel.labels.get('flannel_backend')
k8s_def = tdef.AtomicK8sTemplateDefinition() k8s_def = tdef.AtomicK8sTemplateDefinition()
@ -255,8 +255,8 @@ class AtomicK8sTemplateDefinitionTestCase(base.TestCase):
'minions_to_remove': removal_nodes, 'minions_to_remove': removal_nodes,
'discovery_url': 'fake_discovery_url', 'discovery_url': 'fake_discovery_url',
'flannel_network_cidr': flannel_cidr, 'flannel_network_cidr': flannel_cidr,
'flannel_use_vxlan': flannel_subnet, 'flannel_network_subnetlen': flannel_subnet,
'flannel_network_subnetlen': flannel_vxlan, 'flannel_backend': flannel_backend,
'username': 'fake_user', 'username': 'fake_user',
'tenant_name': 'fake_tenant', 'tenant_name': 'fake_tenant',
'magnum_url': mock_osc.magnum_url.return_value, 'magnum_url': mock_osc.magnum_url.return_value,
@ -418,7 +418,7 @@ class AtomicSwarmTemplateDefinitionTestCase(base.TestCase):
flannel_cidr = mock_baymodel.labels.get('flannel_network_cidr') flannel_cidr = mock_baymodel.labels.get('flannel_network_cidr')
flannel_subnet = mock_baymodel.labels.get('flannel_network_subnetlen') flannel_subnet = mock_baymodel.labels.get('flannel_network_subnetlen')
flannel_vxlan = mock_baymodel.labels.get('flannel_use_vxlan') flannel_backend = mock_baymodel.labels.get('flannel_backend')
swarm_def = tdef.AtomicSwarmTemplateDefinition() swarm_def = tdef.AtomicSwarmTemplateDefinition()
@ -429,8 +429,8 @@ class AtomicSwarmTemplateDefinitionTestCase(base.TestCase):
'user_token': mock_context.auth_token, 'user_token': mock_context.auth_token,
'magnum_url': mock_osc.magnum_url.return_value, 'magnum_url': mock_osc.magnum_url.return_value,
'flannel_network_cidr': flannel_cidr, 'flannel_network_cidr': flannel_cidr,
'flannel_use_vxlan': flannel_subnet, 'flannel_backend': flannel_backend,
'flannel_network_subnetlen': flannel_vxlan}} 'flannel_network_subnetlen': flannel_subnet}}
mock_get_params.assert_called_once_with(mock_context, mock_baymodel, mock_get_params.assert_called_once_with(mock_context, mock_baymodel,
mock_bay, **expected_kwargs) mock_bay, **expected_kwargs)

View File

@ -225,7 +225,7 @@ Proposed Changes
--network-driver flannel \ --network-driver flannel \
--labels flannel_network_cidr=10.0.0.0/8,\ --labels flannel_network_cidr=10.0.0.0/8,\
flannel_network_subnetlen=22,\ flannel_network_subnetlen=22,\
flannel_use_vxlan=vxlan flannel_backend=vxlan
With Magnum's current implementation, this document would support With Magnum's current implementation, this document would support
labels for the Kubernetes COE type. However, labels are applicable labels for the Kubernetes COE type. However, labels are applicable