a35b9d38e7
Change-Id: I5bdb22e1441fde530754b263862d660280fbfe2b
91 lines
2.9 KiB
YAML
91 lines
2.9 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: KubernetesMasterNode
|
|
|
|
Extends: KubernetesNode
|
|
|
|
Methods:
|
|
.init:
|
|
Body:
|
|
- $._environment: $.find(std:Environment).require()
|
|
|
|
|
|
deployInstance:
|
|
Body:
|
|
- If: not $.getAttr(instanceDeployed, false)
|
|
Then:
|
|
- $._environment.reporter.report($this, 'Creating Kubernetes Master')
|
|
- super($, $.deployInstance())
|
|
- $.setAttr(instanceDeployed, true)
|
|
|
|
|
|
setupEtcd:
|
|
Body:
|
|
- If: not $.getAttr(etcdConfigured, false)
|
|
Then:
|
|
- $._environment.reporter.report($, 'Configuring etcd master node')
|
|
- $resources: new(sys:Resources)
|
|
- $template: $resources.yaml('MasterEtcdSetup.template').bind(dict(
|
|
name => $.instance.name,
|
|
ip => $.getIp()
|
|
))
|
|
- $.instance.agent.call($template, $resources)
|
|
- $.setAttr(etcdConfigured, true)
|
|
|
|
|
|
setupCalico:
|
|
Body:
|
|
- $._environment.reporter.report($this, 'Setup Calico network on master node')
|
|
- $resources: new(sys:Resources)
|
|
- $template: $resources.yaml('SetupCalicoMaster.template').bind(dict(ip => $.getIp()))
|
|
- $.instance.agent.call($template, $resources)
|
|
- $._enableCalicoTraffic()
|
|
|
|
|
|
setupFlannel:
|
|
Body:
|
|
- $._environment.reporter.report($this, 'Setup Flannel network on master node')
|
|
- $resources: new(sys:Resources)
|
|
- $template: $resources.yaml('SetupFlannelMaster.template')
|
|
- $.instance.agent.call($template, $resources)
|
|
|
|
|
|
setupNode:
|
|
Body:
|
|
- If: not $.getAttr(nodeConfigured, false)
|
|
Then:
|
|
- $resources: new(sys:Resources)
|
|
- $._environment.reporter.report($this, 'Setup Kubernetes API host')
|
|
- $resources: new(sys:Resources)
|
|
- $template: $resources.yaml('KubeMasterSetup.template').bind(dict(
|
|
name => $.instance.name,
|
|
ip => $.getIp()
|
|
))
|
|
- $.instance.agent.call($template, $resources)
|
|
- $.setAttr(nodeConfigured, true)
|
|
- $msg: 'Kubernetes API is now available at http://{0}:8080'
|
|
- $ip: coalesce($.instance.floatingIpAddress, $.getIp())
|
|
- $._environment.reporter.report($this, $msg.format($ip))
|
|
|
|
|
|
isAvailable:
|
|
Body:
|
|
Return: $.instance.isDeployed()
|
|
|