ci-cd-pipeline-app-murano/murano-apps/LBaaS-interface/package/Classes/LoadBalancer.yaml
Sergey Kraynev 6a5a03c192 Fix indentation warnings LBaaS
After patch Ia2498bdb0f7c310ec3d2c2f11f5d3fc08c8b352c there is
possible to run check for yaml and shell syntax.
This patch is oriented to fix some similar Warnings reported in yaml
syntax check for LBaaS apps, like "(indentation)".

Change-Id: I6f2b1af8ab7cee75d153c8f18bbea8ac67cc65b4
2016-08-03 17:14:54 +03:00

141 lines
4.1 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:
=: io.murano.apps.lbaas
std: io.murano
res: io.murano.resources
sys: io.murano.system
Name: LBaaS
Extends: std:Application
Properties:
name:
Contract: $.string().notNull()
instance:
Contract: $.class(res:Instance).notNull()
implementation:
Contract: $.string()
Default: null
environment:
Contract: $.class(std:Environment)
Usage: Runtime
url:
Contract: $.string()
Usage: Out
Methods:
.init:
Body:
- $.environment: $.find(std:Environment).require()
deploy:
Body:
- If: $.getAttr(deployed, false)
Then:
Return: 0
- $.environment.reporter.report($this, 'Creating security groups...')
- $securityGroupIngress:
- ToPort: 65535
FromPort: 1
IpProtocol: tcp
External: true
- $.environment.securityGroupManager.addGroupIngress($securityGroupIngress)
- $.environment.reporter.report($this, 'Creating instance for LBaaS...')
- $.instance.deploy()
- $.environment.reporter.report($this, 'Instance is created.')
- $resources: new(sys:Resources)
- $.installLoadBalancer()
- $lbaas: $.installLBaaS()
- $.configureLBaaS()
- $.startLBaaS()
- If: $.instance.assignFloatingIp
Then:
- $host: $.instance.floatingIpAddress
Else:
- $host: $.instance.ipAddresses[0]
- $.url: format("http://{0}:{1}{2}", $host, $lbaas.port, $lbaas.path)
- $.environment.reporter.report($this, format("LBaaS is available at {0}", $.url))
- $.setAttr(deployed, true)
getCredentials:
Usage: Action
Body:
- Return:
credentials:
uri: $.url
getOptionalConfig:
# Returns a list of dicts containing 'section', 'key' and 'value' keys.
Body:
- Return: []
setConfigValue:
Arguments:
- section:
Contract: $.string().notNull()
- key:
Contract: $.string().notNull()
- value:
Contract: $.string().notNull()
Body:
- $.environment.reporter.report(
$this,
'Setting value [{0}] {1} = {2}'.format($section, $key, $value)
)
- $resources: new(sys:Resources)
- $template: $resources.yaml('SetConfigValue.template').bind(dict(
section => $section,
key => $key,
value => $value))
- $.instance.agent.call($template, $resources)
installLoadBalancer:
# Installs Load Balancer related stuff (e.g. system packages).
installLBaaS:
# Installs LBaaS itself and its drivers on an instance.
Body:
- $resources: new(sys:Resources)
- $template: $resources.yaml('DeployLBaaS.template')
- $.environment.reporter.report($this, 'Installing LBaaS...')
- $.instance.agent.call($template, $resources)
- $.setConfigValue('lbaas', 'impl', $.implementation)
- $.environment.reporter.report($this, 'LBaaS is installed.')
- Return:
port: 8993
path: /v1
configureLBaaS:
Body:
- $.environment.reporter.report($this, 'Configuring LBaaS...')
# Call setConfigValue for each item in OptionalConfig.
- $.getOptionalConfig().select($this.setConfigValue($.section, $.key, $.value))
- $.environment.reporter.report($this, 'Configured.')
startLBaaS:
Body:
- $resources: new(sys:Resources)
- $template: $resources.yaml('StartLBaaS.template')
- $.environment.reporter.report($this, 'Starting LBaaS...')
- $.instance.agent.call($template, $resources)
- $.environment.reporter.report($this, 'LBaaS is started.')