murano-apps/Clearwater/package/Classes/Clearwater.yaml

186 lines
5.0 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.clearwater
std: io.murano
res: io.murano.resources
meta: io.murano.metadata
dns: com.mirantis.network.dns
cwBase: com.mirantis.clearwater.components.base
components: com.mirantis.clearwater.components
Name: Clearwater
Extends: std:Application
Properties:
dnsApp:
Contract: $.class(dns:Bind).notNull()
instanceTemplate:
Contract: $.template(res:LinuxInstance)
components:
Contract:
- $.class(cwBase:ClearwaterComponentBase).notNull()
Usage: Out
etcdClusterIp:
Contract: $.string().notNull()
Default: ""
Usage: Out
bonoClusterSize:
Contract: $.int().notNull()
Default: 1
sproutClusterSize:
Contract: $.int().notNull()
Default: 1
homerClusterSize:
Contract: $.int().notNull()
Default: 1
homesteadClusterSize:
Contract: $.int().notNull()
Default: 1
Methods:
.init:
Body:
- $._environment: $.find(std:Environment).require()
- If: not $.components
Then:
- $.components:
- new(components:Ellis, $this, 'Ellis')
- new(components:Ralf, $this, Ralf, allowedFailures => 'quorum')
- new(components:Bono, $this, Bono, allowedFailures => 'quorum', clusterSize => $this.bonoClusterSize)
- new(components:Sprout, $this, Sprout, allowedFailures => 'quorum', clusterSize => $this.sproutClusterSize)
- new(components:Homer, $this, Homer, allowedFailures => 'quorum', clusterSize => $this.homerClusterSize)
- new(components:Homestead, $this, Homestead, allowedFailures => 'quorum', clusterSize => $this.homesteadClusterSize)
getSecurityGroupRules:
Body:
- $rules:
- FromPort: 22
ToPort: 22
IpProtocol: tcp
External: true
# SNMP
- FromPort: 161
ToPort: 161
IpProtocol: udp
External: true
# etcd
- FromPort: 2380
ToPort: 2380
IpProtocol: tcp
External: false
- FromPort: 4000
ToPort: 4000
IpProtocol: tcp
External: false
- Return: $rules
setEtcdClusterIp:
Arguments:
- ip:
Contract: $.string().notNull()
Body:
- $.etcdClusterIp: $ip
deploy:
Body:
- $this._report('Start Clearwater deploy')
- $this._environment.securityGroupManager.addGroupIngress($this.getSecurityGroupRules())
- $this.dnsApp.deploy()
- $this.components.pselect($.deploy())
- $ellisFloatingIp: $this.components.where($ is components:Ellis).cluster.items.first().floatingIpAddress
- $this._report(format('Use Ellis at {0} for create account and manage identities', $ellisFloatingIp))
- $edgeProxyIp: $this.components.where($ is components:Bono).first().cluster.items.first().floatingIpAddress
- $this._report(format('Outbound edge proxy IP is {0}', $edgeProxyIp))
_report:
Arguments:
- message:
Contract: $.string().notNull()
Body:
- $._environment.reporter.report($this, $message)
# Lifecycle management
scaleOutSprout:
Meta:
- meta:Title:
text: "Scale out Sprout"
Scope: Public
Body:
- $this.components.where($ is components:Sprout).first().scaleOut()
scaleOutBono:
Meta:
- meta:Title:
text: "Scale out Bono"
Scope: Public
Body:
- $this.components.where($ is components:Bono).first().scaleOut()
scaleOutHomestead:
Meta:
- meta:Title:
text: "Scale out Homestead"
Scope: Public
Body:
- $this.components.where($ is components:Homestead).first().scaleOut()
scaleOutRalf:
Meta:
- meta:Title:
text: "Scale out Ralf"
Scope: Public
Body:
- $this.components.where($ is components:Ralf).first().scaleOut()
scaleInSprout:
Meta:
- meta:Title:
text: "Scale in Sprout"
Scope: Public
Body:
- $this.components.where($ is components:Sprout).first().scaleIn()
scaleInBono:
Meta:
- meta:Title:
text: "Scale in Bono"
Scope: Public
Body:
- $this.components.where($ is components:Bono).first().scaleIn()
scaleInHomestead:
Meta:
- meta:Title:
text: "Scale in Homestead"
Scope: Public
Body:
- $this.components.where($ is components:Homestead).first().scaleIn()
scaleInRalf:
Meta:
- meta:Title:
text: "Scale in Ralf"
Scope: Public
Body:
- $this.components.where($ is components:Ralf).first().scaleIn()