84 lines
2.3 KiB
YAML
84 lines
2.3 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.network.dns
|
|
std: io.murano
|
|
res: io.murano.resources
|
|
sys: io.murano.system
|
|
conf: io.murano.configuration
|
|
|
|
Name: Bind
|
|
|
|
Extends: std:Application
|
|
|
|
Properties:
|
|
instance:
|
|
Contract: $.class(res:LinuxMuranoInstance)
|
|
|
|
zoneName:
|
|
Contract: $.string().notNull()
|
|
|
|
dnsSecKey:
|
|
Contract: $.string().notNull()
|
|
Usage: InOut
|
|
|
|
Methods:
|
|
.init:
|
|
Body:
|
|
- $.environment: $.find(std:Environment).require()
|
|
|
|
_createReplacements:
|
|
Body:
|
|
- Return:
|
|
"%PUBLIC_IP%": $.instance.floatingIpAddress
|
|
"%PRIVATE_IP%": $.instance.joinedNetworks.first().ipList.where($ != $this.instance.floatingIpAddress).first()
|
|
"%ZONE%": $.zoneName
|
|
"%DNSSEC_KEY%": $.dnsSecKey
|
|
"%PRIVATE_NETWORK_CIDR%": $.instance.joinedNetworks.first().network.describe().cidr
|
|
|
|
_addSecurityGroupRules:
|
|
Body:
|
|
- $rules:
|
|
# DNS
|
|
- FromPort: 53
|
|
ToPort: 53
|
|
IpProtocol: tcp
|
|
External: true
|
|
- FromPort: 53
|
|
ToPort: 53
|
|
IpProtocol: udp
|
|
External: true
|
|
- $.environment.securityGroupManager.addGroupIngress($rules)
|
|
|
|
deploy:
|
|
Body:
|
|
- If: not $.getAttr(deployed, false)
|
|
Then:
|
|
- $._report('DNS server deploy started')
|
|
- $._addSecurityGroupRules()
|
|
- $.instance.deploy()
|
|
- $._report('Run install script')
|
|
- $replacements: $._createReplacements()
|
|
- $file: sys:Resources.string('deployBind.sh').replace($replacements)
|
|
- conf:Linux.runCommand($.instance.agent, $file)
|
|
- $._report('BIND configured')
|
|
- $.setAttr(deployed, true)
|
|
|
|
_report:
|
|
Arguments:
|
|
- message:
|
|
Contract: $.string().notNull()
|
|
Body:
|
|
- $.environment.reporter.report($this, $message)
|
|
|