k8s-docker-suite-app-murano/Kubernetes/KubernetesCluster/package/Classes/KubernetesMasterNode.yaml
Tetiana Lashchova f57eb2fa4c Update namespaces for k8s applications
Replace io.murano.apps with com.mirantis

bp fix-fqn-usage

Change-Id: I5bb6129a51beadffe124cd0fb289f41e05cd52c3
2016-06-17 12:36:17 +03:00

77 lines
2.5 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)
setupNode:
Body:
- If: not $.getAttr(nodeConfigured, false)
Then:
- $resources: new(sys:Resources)
- $._environment.reporter.report($this, 'Setup Flannel network on master node')
- $template: $resources.yaml('SetupFlannelMaster.template')
- $.instance.agent.call($template, $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()