Enable traffic for Calico network

Change-Id: I5bdb22e1441fde530754b263862d660280fbfe2b
This commit is contained in:
Dmytro Dovbii 2016-09-19 10:24:11 +03:00
parent b8719ff122
commit a35b9d38e7
5 changed files with 50 additions and 12 deletions

View File

@ -95,18 +95,6 @@ Methods:
FromPort: 7001
IpProtocol: tcp
External: false
- ToPort: 2379
FromPort: 2379
IpProtocol: tcp
External: false
- ToPort: 179
FromPort: 179
IpProtocol: tcp
External: false
- ToPort: 179
FromPort: 179
IpProtocol: udp
External: false
- ToPort: 10250
FromPort: 10250
IpProtocol: tcp

View File

@ -61,6 +61,7 @@ Methods:
- $resources: new(sys:Resources)
- $template: $resources.yaml('SetupCalicoNode.template').bind(dict(ip => $.getIp()))
- $.instance.agent.call($template, $resources)
- $._enableCalicoTraffic()
setupFlannel:
@ -85,6 +86,7 @@ Methods:
$this, 'Gateway {0} is now available at {1}'.format($.instance.name, $.getIp(true)))
- $.setAttr(nodeConfigured, true)
removeFromCluster:
Body:
- If: $.getAttr(nodeConfigured, false)

View File

@ -55,6 +55,7 @@ Methods:
- $resources: new(sys:Resources)
- $template: $resources.yaml('SetupCalicoMaster.template').bind(dict(ip => $.getIp()))
- $.instance.agent.call($template, $resources)
- $._enableCalicoTraffic()
setupFlannel:
@ -82,6 +83,7 @@ Methods:
- $ip: coalesce($.instance.floatingIpAddress, $.getIp())
- $._environment.reporter.report($this, $msg.format($ip))
isAvailable:
Body:
Return: $.instance.isDeployed()

View File

@ -69,6 +69,7 @@ Methods:
- $resources: new(sys:Resources)
- $template: $resources.yaml('SetupCalicoNode.template').bind(dict(ip => $.getIp()))
- $.instance.agent.call($template, $resources)
- $._enableCalicoTraffic()
setupFlannel:

View File

@ -49,3 +49,48 @@ Methods:
setupEtcd:
setupNode:
removeFromCluster:
# TODO(ddovbii): To enable traffic for Calico the SharedIp class
# from murano.io probably can be used. In future we need to
# investigate functionallity of this class and apply it instead
# of this workaround if it is possible
_enableCalicoTraffic:
Arguments:
- address:
Contract: $.string().notNull()
Default: '192.168.0.0/16'
Body:
- $environment: $.find(std:Environment)
- $securityGroupIngress:
- ToPort: 2379
FromPort: 2379
IpProtocol: tcp
External: false
- ToPort: 179
FromPort: 179
IpProtocol: tcp
External: false
- ToPort: 179
FromPort: 179
IpProtocol: udp
External: false
- $environment.securityGroupManager.addGroupIngress($securityGroupIngress)
- $stack: $environment.stack.current()
- $portName: $stack.resources.get($this.instance.name).properties.networks[0].port.get_resource
- $template:
resources:
$portName:
properties:
allowed_address_pairs:
- ip_address: $address
- $stack: $stack.mergeWith($template)
- $fiRecord:
ip_address: $this.instance.ipAddresses[0]
- $stack.resources[$portName].properties.fixed_ips[0]: $stack.resources[$portName].properties.fixed_ips[0] + $fiRecord
- $environment.stack.setTemplate($stack)