05e6967318
this commit provides ability to choose the network. Calico is default. Change-Id: I9dd97385d981db91791cc51ebb9f3265188fa984
98 lines
2.7 KiB
YAML
98 lines
2.7 KiB
YAML
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file 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.
|
|
|
|
Namespaces:
|
|
=: com.mirantis.docker.kubernetes
|
|
std: io.murano
|
|
res: io.murano.resources
|
|
sys: io.murano.system
|
|
|
|
Name: KubernetesNode
|
|
|
|
|
|
Properties:
|
|
instance:
|
|
Contract: $.class(res:LinuxMuranoInstance).notNull()
|
|
|
|
|
|
Methods:
|
|
getIp:
|
|
Arguments:
|
|
- preferFloatingIp:
|
|
Contract: $.bool().notNull()
|
|
Default: false
|
|
Body:
|
|
- $ip: $.instance.ipAddresses[0]
|
|
- If: $preferFloatingIp
|
|
Then:
|
|
- Return: coalesce($.instance.floatingIpAddress, $ip)
|
|
Else:
|
|
- Return: $.instance.ipAddresses[0]
|
|
|
|
|
|
deployInstance:
|
|
Body:
|
|
- $.instance.deploy()
|
|
|
|
|
|
setupFlannel:
|
|
setupCalico:
|
|
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)
|