Merge "Support for multi-regional apps was added"
This commit is contained in:
commit
5e6107ca21
55
meta/io.murano/Classes/CloudRegion.yaml
Normal file
55
meta/io.murano/Classes/CloudRegion.yaml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
Namespaces:
|
||||||
|
res: io.murano.resources
|
||||||
|
sys: io.murano.system
|
||||||
|
=: io.murano
|
||||||
|
|
||||||
|
Name: CloudRegion
|
||||||
|
|
||||||
|
Properties:
|
||||||
|
name:
|
||||||
|
Contract: $.string()
|
||||||
|
|
||||||
|
agentListener:
|
||||||
|
Contract: $.class(sys:AgentListener)
|
||||||
|
Usage: Runtime
|
||||||
|
|
||||||
|
stack:
|
||||||
|
Contract: $.class(sys:HeatStack)
|
||||||
|
Usage: Runtime
|
||||||
|
|
||||||
|
defaultNetworks:
|
||||||
|
Contract:
|
||||||
|
environment: $.class(res:Network)
|
||||||
|
flat: $.class(res:Network)
|
||||||
|
|
||||||
|
securityGroupManager:
|
||||||
|
Contract: $.class(sys:SecurityGroupManager)
|
||||||
|
Usage: Runtime
|
||||||
|
|
||||||
|
Methods:
|
||||||
|
getConfig:
|
||||||
|
Body:
|
||||||
|
- Return: $._environment.regionConfigs.get(
|
||||||
|
$.name, $._environment.regionConfigs.get(''))
|
||||||
|
|
||||||
|
.init:
|
||||||
|
Body:
|
||||||
|
- $._environment: $.find(Environment).require()
|
||||||
|
- $generatedStackName: $.getAttr(generatedStackName)
|
||||||
|
- If: $generatedStackName = null
|
||||||
|
Then:
|
||||||
|
- $generatedStackName: list($.name, randomName()).join('-')
|
||||||
|
- $.setAttr(generatedStackName, $generatedStackName)
|
||||||
|
- $this.agentListener: new(sys:AgentListener, $this, name => $generatedStackName)
|
||||||
|
- $stackDescriptionFormat: 'This stack was generated by Murano for environment {0} (ID: {1}) - region {2}'
|
||||||
|
- $this.stack: new(sys:HeatStack, $this,
|
||||||
|
name => 'murano-' + $generatedStackName,
|
||||||
|
description => $stackDescriptionFormat.format($._environment.name, id($._environment), $.name))
|
||||||
|
|
||||||
|
- $this.securityGroupManager:
|
||||||
|
coalesce($.defaultNetworks.environment, $.defaultNetworks.flat)?.
|
||||||
|
generateSecurityGroupManager()
|
||||||
|
|
||||||
|
.destroy:
|
||||||
|
Body:
|
||||||
|
- $.stack.delete()
|
29
meta/io.murano/Classes/CloudResource.yaml
Normal file
29
meta/io.murano/Classes/CloudResource.yaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
Namespaces:
|
||||||
|
=: io.murano
|
||||||
|
|
||||||
|
Name: CloudResource
|
||||||
|
|
||||||
|
Properties:
|
||||||
|
regionName:
|
||||||
|
Contract: $.string()
|
||||||
|
|
||||||
|
Methods:
|
||||||
|
.init:
|
||||||
|
Body:
|
||||||
|
$._region: null
|
||||||
|
|
||||||
|
getRegion:
|
||||||
|
Meta:
|
||||||
|
'io.murano.metadata.engine.Synchronize':
|
||||||
|
onThis: false
|
||||||
|
Body:
|
||||||
|
- If: $._region = null
|
||||||
|
Then:
|
||||||
|
- $env: $.find(Environment).require()
|
||||||
|
- $regionName: generate($this, $ != null, $.find(CloudResource)).
|
||||||
|
select($.regionName).where($ != null).first($env.region)
|
||||||
|
- $._region: $.find(CloudRegion)
|
||||||
|
- If: $._region = null or $._region.name != $regionName
|
||||||
|
Then:
|
||||||
|
$._region: $env.regions[$regionName]
|
||||||
|
- Return: $._region
|
@ -38,9 +38,8 @@ Properties:
|
|||||||
|
|
||||||
defaultNetworks:
|
defaultNetworks:
|
||||||
Contract:
|
Contract:
|
||||||
environment: $.class(res:Network)
|
environment: $.template(res:Network)
|
||||||
flat: $.class(res:Network)
|
flat: $.template(res:Network)
|
||||||
Usage: In
|
|
||||||
|
|
||||||
securityGroupManager:
|
securityGroupManager:
|
||||||
Contract: $.class(sys:SecurityGroupManager)
|
Contract: $.class(sys:SecurityGroupManager)
|
||||||
@ -67,33 +66,53 @@ Properties:
|
|||||||
Contract: $.string()
|
Contract: $.string()
|
||||||
Usage: InOut
|
Usage: InOut
|
||||||
|
|
||||||
|
homeRegionName:
|
||||||
|
Contract: $.string()
|
||||||
|
Usage: Runtime
|
||||||
|
|
||||||
|
regions:
|
||||||
|
Contract:
|
||||||
|
$.string(): $.class(CloudRegion)
|
||||||
|
Usage: InOut
|
||||||
|
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
initialize:
|
.init:
|
||||||
Body:
|
Body:
|
||||||
|
- $.homeRegionName: config(home_region) or ''
|
||||||
- $._assignRegions()
|
- $._assignRegions()
|
||||||
- $generatedEnvironmentName: $.getAttr(generatedEnvironmentName)
|
- $.instanceNotifier: new(sys:InstanceNotifier, environment => $this)
|
||||||
- If: $generatedEnvironmentName = null
|
- $.reporter: new(sys:StatusReporter, environment => $this)
|
||||||
|
- $.regions: $.regions + $.regionConfigs.keys().
|
||||||
|
where($ and not $this.regions.containsKey($)).
|
||||||
|
select($this._createRegion($)).
|
||||||
|
toDict($.name)
|
||||||
|
- If: not $.regions.containsKey(null)
|
||||||
Then:
|
Then:
|
||||||
- $generatedEnvironmentName: randomName()
|
- If: $.homeRegionName
|
||||||
- $.setAttr(generatedEnvironmentName, $generatedEnvironmentName)
|
Then:
|
||||||
- $this.agentListener: new(sys:AgentListener, $this, name => $generatedEnvironmentName)
|
$.regions['']: $.regions[$.homeRegionName]
|
||||||
- $stackDescriptionFormat: 'This stack was generated by Murano for environment {0} (ID: {1})'
|
Else:
|
||||||
- $this.stack: new(sys:HeatStack, $this,
|
$.regions['']: $._createRegion('')
|
||||||
name => 'murano-' + $generatedEnvironmentName,
|
|
||||||
description => $stackDescriptionFormat.format($.name, $.id()))
|
- $defaultRegion: $.regions['']
|
||||||
- $this.instanceNotifier: new(sys:InstanceNotifier, environment => $this)
|
- $.stack: $defaultRegion.stack
|
||||||
- $this.reporter: new(sys:StatusReporter, environment => $this)
|
- $.securityGroupManager: $defaultRegion.securityGroupManager
|
||||||
- $net: null
|
|
||||||
- If: $.defaultNetworks.environment != null
|
_createRegion:
|
||||||
Then:
|
Arguments:
|
||||||
- $net: $.defaultNetworks.environment
|
regionName:
|
||||||
- If: $.defaultNetworks.flat != null
|
Contract: $.string()
|
||||||
Then:
|
Body:
|
||||||
- $net: $.defaultNetworks.flat
|
- $envNet: $.defaultNetworks.environment?.set(regionName => $regionName)
|
||||||
- If: $net != null
|
- $flatNet: $.defaultNetworks.flat?.set(regionName => $regionName)
|
||||||
Then:
|
- Return: new(CloudRegion, $this,
|
||||||
- $this.securityGroupManager: $net.generateSecurityGroupManager($this)
|
name => $regionName,
|
||||||
|
defaultNetworks => {
|
||||||
|
environment => $envNet,
|
||||||
|
flat => $flatNet
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
Usage: Action
|
Usage: Action
|
||||||
@ -106,10 +125,9 @@ Methods:
|
|||||||
|
|
||||||
_assignRegions:
|
_assignRegions:
|
||||||
Body:
|
Body:
|
||||||
- $homeRegion: config(home_region)
|
|
||||||
- If: $.region = null
|
- If: $.region = null
|
||||||
Then:
|
Then:
|
||||||
$.region: $homeRegion
|
$.region: $.homeRegionName
|
||||||
|
|
||||||
- $defaultRegionConfig:
|
- $defaultRegionConfig:
|
||||||
agentRabbitMq:
|
agentRabbitMq:
|
||||||
@ -120,10 +138,10 @@ Methods:
|
|||||||
virtual_host: config(rabbitmq, virtual_host)
|
virtual_host: config(rabbitmq, virtual_host)
|
||||||
ssl: config(rabbitmq, ssl)
|
ssl: config(rabbitmq, ssl)
|
||||||
|
|
||||||
- If: not (null in $.regionConfigs.keys())
|
- If: not $.regionConfigs.containsKey('')
|
||||||
Then:
|
Then:
|
||||||
- $.regionConfigs: $.regionConfigs.set(null => $defaultRegionConfig)
|
- $.regionConfigs: $.regionConfigs.set('' => $defaultRegionConfig)
|
||||||
|
|
||||||
- If: $homeRegion != null and not ($homeRegion in $.regionConfigs.keys())
|
- If: $.homeRegionName and not $.regionConfigs.containsKey($.homeRegionName)
|
||||||
Then:
|
Then:
|
||||||
- $.regionConfigs: $.regionConfigs.set($homeRegion => $defaultRegionConfig)
|
- $.regionConfigs: $.regionConfigs.set($.homeRegionName => $defaultRegionConfig)
|
||||||
|
@ -29,8 +29,9 @@ Properties:
|
|||||||
Methods:
|
Methods:
|
||||||
initialize:
|
initialize:
|
||||||
Body:
|
Body:
|
||||||
- $.environment: $.find(Environment).require()
|
- $._environment: $.find(Environment).require()
|
||||||
- $.network: $.environment.defaultNetworks.environment
|
- $._region: $.getRegion()
|
||||||
|
- $.network: $._environment.defaultNetworks.environment
|
||||||
- $.instances: []
|
- $.instances: []
|
||||||
|
|
||||||
|
|
||||||
@ -38,10 +39,10 @@ Methods:
|
|||||||
Body:
|
Body:
|
||||||
- If: not $.getAttr(deployed, false)
|
- If: not $.getAttr(deployed, false)
|
||||||
Then:
|
Then:
|
||||||
- $reporter: $.environment.reporter
|
- $reporter: $._environment.reporter
|
||||||
- $.network.deploy()
|
- $.network.deploy()
|
||||||
- $networkData: $.network.describe()
|
- $networkData: $.network.describe()
|
||||||
- $aapPortName: format('AllowedAddressPairsPort-{0}', $.id())
|
- $aapPortName: format('AllowedAddressPairsPort-{0}', id($))
|
||||||
- $template:
|
- $template:
|
||||||
resources:
|
resources:
|
||||||
$aapPortName:
|
$aapPortName:
|
||||||
@ -55,12 +56,12 @@ Methods:
|
|||||||
$aapPortName+'-virtualIp':
|
$aapPortName+'-virtualIp':
|
||||||
value:
|
value:
|
||||||
get_attr: [$aapPortName, fixed_ips, 0, ip_address]
|
get_attr: [$aapPortName, fixed_ips, 0, ip_address]
|
||||||
description: format('SharedIP Address of SharedIp group {0}', $.id())
|
description: format('SharedIP Address of SharedIp group {0}', id($))
|
||||||
- $.environment.stack.updateTemplate($template)
|
- $._region.stack.updateTemplate($template)
|
||||||
- If: $.assignFloatingIp
|
- If: $.assignFloatingIp
|
||||||
Then:
|
Then:
|
||||||
- $extNetId: $networkData.floatingIpNetId
|
- $extNetId: $networkData.floatingIpNetId
|
||||||
- $fipName: format('Shared-Floating-ip-{0}', $.id())
|
- $fipName: format('Shared-Floating-ip-{0}', id($))
|
||||||
|
|
||||||
- $template:
|
- $template:
|
||||||
resources:
|
resources:
|
||||||
@ -75,13 +76,13 @@ Methods:
|
|||||||
value:
|
value:
|
||||||
get_attr: [$fipName, floating_ip_address]
|
get_attr: [$fipName, floating_ip_address]
|
||||||
description: Shared Floating IP assigned
|
description: Shared Floating IP assigned
|
||||||
- $.environment.stack.updateTemplate($template)
|
- $._region.stack.updateTemplate($template)
|
||||||
|
|
||||||
- $reporter.report($this, 'Allocating shared ip address')
|
- $reporter.report($this, 'Allocating shared ip address')
|
||||||
- $.environment.stack.push()
|
- $._region.stack.push()
|
||||||
- $outputs: $.environment.stack.output()
|
- $outputs: $._region.stack.output()
|
||||||
- $.virtualIp: $outputs.get(format('AllowedAddressPairsPort-{0}-virtualIp', $.id()))
|
- $.virtualIp: $outputs.get(format('AllowedAddressPairsPort-{0}-virtualIp', id($)))
|
||||||
- $.floatingIpAddress: $outputs.get(format('Shared-Floating-ip-{0}-val', $.id()))
|
- $.floatingIpAddress: $outputs.get(format('Shared-Floating-ip-{0}-val', id($)))
|
||||||
- $reporter.report($this, format('Shared IP allocated at {0}', $.virtualIp))
|
- $reporter.report($this, format('Shared IP allocated at {0}', $.virtualIp))
|
||||||
- If: $.assignFloatingIp
|
- If: $.assignFloatingIp
|
||||||
Then:
|
Then:
|
||||||
@ -91,21 +92,21 @@ Methods:
|
|||||||
|
|
||||||
getSharedIpRef:
|
getSharedIpRef:
|
||||||
Body:
|
Body:
|
||||||
- $aapPortName: format('AllowedAddressPairsPort-{0}', $.id())
|
- $aapPortName: format('AllowedAddressPairsPort-{0}', id($))
|
||||||
- Return:
|
- Return:
|
||||||
get_attr: [$aapPortName, fixed_ips, 0, ip_address]
|
get_attr: [$aapPortName, fixed_ips, 0, ip_address]
|
||||||
|
|
||||||
|
|
||||||
releaseResources:
|
releaseResources:
|
||||||
Body:
|
Body:
|
||||||
- $template: $.environment.stack.current()
|
- $template: $._region.stack.current()
|
||||||
- $template.resources: $template.resources.delete(format('AllowedAddressPairsPort-{0}', id($)))
|
- $template.resources: $template.resources.delete(format('AllowedAddressPairsPort-{0}', id($)))
|
||||||
- $template.outputs: $template.outputs.delete(format('AllowedAddressPairsPort-{0}-virtualIp', id($)))
|
- $template.outputs: $template.outputs.delete(format('AllowedAddressPairsPort-{0}-virtualIp', id($)))
|
||||||
- If: $.assignFloatingIp
|
- If: $.assignFloatingIp
|
||||||
Then:
|
Then:
|
||||||
- $template.resources: $template.resources.delete(format('Shared-Floating-ip-{0}', id($)))
|
- $template.resources: $template.resources.delete(format('Shared-Floating-ip-{0}', id($)))
|
||||||
- $template.outputs: $template.outputs.delete(format('Shared-Floating-ip-{0}-val', id($)))
|
- $template.outputs: $template.outputs.delete(format('Shared-Floating-ip-{0}-val', id($)))
|
||||||
- $._environment.stack.setTemplate($template)
|
- $._region.stack.setTemplate($template)
|
||||||
- $._environment.stack.push()
|
- $._region.stack.push()
|
||||||
- $.floatingIpAddress: null
|
- $.floatingIpAddress: null
|
||||||
- $.virtualIp: null
|
- $.virtualIp: null
|
||||||
|
@ -52,6 +52,7 @@ Methods:
|
|||||||
.init:
|
.init:
|
||||||
Body:
|
Body:
|
||||||
- $._environment: $.find(std:Environment).require()
|
- $._environment: $.find(std:Environment).require()
|
||||||
|
- $._region: $.getRegion()
|
||||||
|
|
||||||
buildResourceDefinition:
|
buildResourceDefinition:
|
||||||
Body:
|
Body:
|
||||||
@ -111,11 +112,11 @@ Methods:
|
|||||||
- $snippet: $.buildResourceDefinition()
|
- $snippet: $.buildResourceDefinition()
|
||||||
- If: $.getAttr(lastTemplate) != $snippet
|
- If: $.getAttr(lastTemplate) != $snippet
|
||||||
Then:
|
Then:
|
||||||
- $template: $._environment.stack.current()
|
- $template: $._region.stack.current()
|
||||||
- $template: $template.mergeWith($snippet, maxLevels => 2)
|
- $template: $template.mergeWith($snippet, maxLevels => 2)
|
||||||
- $._environment.stack.setTemplate($template)
|
- $._region.stack.setTemplate($template)
|
||||||
- $._environment.stack.push()
|
- $._region.stack.push()
|
||||||
- $outputs: $._environment.stack.output()
|
- $outputs: $._region.stack.output()
|
||||||
- $.openstackId: $outputs.get(format('vol-{0}-id', id($)))
|
- $.openstackId: $outputs.get(format('vol-{0}-id', id($)))
|
||||||
- $.setAttr(lastTemplate, $snippet)
|
- $.setAttr(lastTemplate, $snippet)
|
||||||
|
|
||||||
@ -123,11 +124,11 @@ Methods:
|
|||||||
Body:
|
Body:
|
||||||
- If: $.getAttr(lastTemplate) != null
|
- If: $.getAttr(lastTemplate) != null
|
||||||
Then:
|
Then:
|
||||||
- $template: $._environment.stack.current()
|
- $template: $._region.stack.current()
|
||||||
- $template.resources: $template.resources.delete(format('vol-{0}', id($)))
|
- $template.resources: $template.resources.delete(format('vol-{0}', id($)))
|
||||||
- $template.outputs: $template.outputs.delete(format('vol-{0}-id', id($)))
|
- $template.outputs: $template.outputs.delete(format('vol-{0}-id', id($)))
|
||||||
- $._environment.stack.setTemplate($template)
|
- $._region.stack.setTemplate($template)
|
||||||
- $._environment.stack.push()
|
- $._region.stack.push()
|
||||||
- $.setAttr(lastTemplate, null)
|
- $.setAttr(lastTemplate, null)
|
||||||
- $.openstackId: null
|
- $.openstackId: null
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ Methods:
|
|||||||
- userData:
|
- userData:
|
||||||
Contract: $.string().notNull()
|
Contract: $.string().notNull()
|
||||||
Body:
|
Body:
|
||||||
- $environment: $.find(std:Environment).require()
|
- $region: $.getRegion()
|
||||||
- $cloudInitConf: $.generateCloudConfig()
|
- $cloudInitConf: $.generateCloudConfig()
|
||||||
- $bootConfigResourceName: format('boot_config_{0}', $.name)
|
- $bootConfigResourceName: format('boot_config_{0}', $.name)
|
||||||
- $bootScriptResourceName: format('boot_script_{0}', $.name)
|
- $bootScriptResourceName: format('boot_script_{0}', $.name)
|
||||||
@ -44,14 +44,13 @@ Methods:
|
|||||||
- config: {get_resource: $bootConfigResourceName}
|
- config: {get_resource: $bootConfigResourceName}
|
||||||
- config: {get_resource: $bootScriptResourceName}
|
- config: {get_resource: $bootScriptResourceName}
|
||||||
|
|
||||||
- $environment.stack.updateTemplate($template)
|
- $region.stack.updateTemplate($template)
|
||||||
- Return: {get_resource: $userDataResourceName}
|
- Return: {get_resource: $userDataResourceName}
|
||||||
|
|
||||||
|
|
||||||
generateCloudConfig:
|
generateCloudConfig:
|
||||||
Body:
|
Body:
|
||||||
- $resources: new(sys:Resources)
|
- $cloudConfigData: cast($, LinuxMuranoInstance).generateCloudConfig()
|
||||||
- $cloudConfigData: $.cast(LinuxMuranoInstance).generateCloudConfig()
|
- $confLang: sys:Resources.yaml('conflang.conf')
|
||||||
- $confLang: $resources.yaml('conflang.conf')
|
- $cloudInitConf: $cloudConfigData.mergeWith($confLang)
|
||||||
- $cloudInitConf: $cloudConfigData.mergeWith($confLang)
|
- Return: $cloudInitConf
|
||||||
- Return: $cloudInitConf
|
|
||||||
|
@ -130,7 +130,7 @@ Workflow:
|
|||||||
- If: $assignFloatingIp
|
- If: $assignFloatingIp
|
||||||
Then:
|
Then:
|
||||||
- $floatingIpNetRef: $._externalNetworkId
|
- $floatingIpNetRef: $._externalNetworkId
|
||||||
- $fipName: format('fip-{0}-{1}', $.id(), $instance.name)
|
- $fipName: format('fip-{0}-{1}', id($), $instance.name)
|
||||||
|
|
||||||
- Return: $.joinInstanceToNetwork(
|
- Return: $.joinInstanceToNetwork(
|
||||||
instance => $instance,
|
instance => $instance,
|
||||||
|
@ -124,7 +124,6 @@ Methods:
|
|||||||
instanceTemplate:
|
instanceTemplate:
|
||||||
Contract: {}
|
Contract: {}
|
||||||
Body:
|
Body:
|
||||||
- $environment: $.find(std:Environment)
|
|
||||||
- For: fragment
|
- For: fragment
|
||||||
In: $.softwareConfigs
|
In: $.softwareConfigs
|
||||||
Do:
|
Do:
|
||||||
@ -139,13 +138,13 @@ Methods:
|
|||||||
|
|
||||||
releaseResources:
|
releaseResources:
|
||||||
Body:
|
Body:
|
||||||
- $environment: $.find(std:Environment)
|
- $region: $.getRegion()
|
||||||
- $template: $environment.stack.current()
|
- $template: $region.stack.current()
|
||||||
- If: bool($template.resources) and bool($template.outputs)
|
- If: $template.get(resources) and $template.get(outputs)
|
||||||
Then:
|
Then:
|
||||||
- $template.resources: $template.resources.deleteAll($.getAttr(scResources, []))
|
- $template.resources: $template.resources.deleteAll($.getAttr(scResources, []))
|
||||||
- $template.outputs: $template.outputs.deleteAll($.getAttr(scOutputs, []))
|
- $template.outputs: $template.outputs.deleteAll($.getAttr(scOutputs, []))
|
||||||
- $environment.stack.setTemplate($template)
|
- $region.stack.setTemplate($template)
|
||||||
- $.super($.releaseResources())
|
- super($, $.releaseResources())
|
||||||
- $.setAttr(scResources, [])
|
- $.setAttr(scResources, [])
|
||||||
- $.setAttr(scOutputs, [])
|
- $.setAttr(scOutputs, [])
|
||||||
|
@ -17,7 +17,7 @@ Namespaces:
|
|||||||
|
|
||||||
|
|
||||||
Name: Instance
|
Name: Instance
|
||||||
|
Extends: std:CloudResource
|
||||||
|
|
||||||
Properties:
|
Properties:
|
||||||
name:
|
name:
|
||||||
@ -80,7 +80,7 @@ Properties:
|
|||||||
Methods:
|
Methods:
|
||||||
initialize:
|
initialize:
|
||||||
Body:
|
Body:
|
||||||
- $.environment: $.find(std:Environment).require()
|
- $._environment: $.find(std:Environment).require()
|
||||||
- $.agent: new(sys:Agent, host => $)
|
- $.agent: new(sys:Agent, host => $)
|
||||||
- $.resources: new(sys:Resources)
|
- $.resources: new(sys:Resources)
|
||||||
- $.instanceTemplate: {}
|
- $.instanceTemplate: {}
|
||||||
@ -106,26 +106,28 @@ Methods:
|
|||||||
beginDeploy:
|
beginDeploy:
|
||||||
Body:
|
Body:
|
||||||
- $.validateBootSource()
|
- $.validateBootSource()
|
||||||
|
- $region: $.getRegion()
|
||||||
- $securityGroupName: coalesce(
|
- $securityGroupName: coalesce(
|
||||||
$.securityGroupName,
|
$.securityGroupName,
|
||||||
$.environment.securityGroupManager.defaultGroupName
|
$region.securityGroupManager.defaultGroupName
|
||||||
)
|
)
|
||||||
- $.createDefaultInstanceSecurityGroupRules($securityGroupName)
|
- $.createDefaultInstanceSecurityGroupRules($securityGroupName)
|
||||||
- $.detectPrimaryNetwork()
|
- $.detectPrimaryNetwork()
|
||||||
- $.ensureSharedIpsDeployed()
|
- $.ensureSharedIpsDeployed()
|
||||||
- $.ensureNetworksDeployed()
|
- $.ensureNetworksDeployed()
|
||||||
- If: $.networks.useEnvironmentNetwork and $.environment.defaultNetworks.environment!=null
|
- If: $.networks.useEnvironmentNetwork and $region.defaultNetworks.environment!=null
|
||||||
Then:
|
Then:
|
||||||
$.joinNet($.environment.defaultNetworks.environment, $securityGroupName)
|
$.joinNet($region.defaultNetworks.environment, $securityGroupName)
|
||||||
- If: $.networks.useFlatNetwork and $.environment.defaultNetworks.flat!=null
|
- If: $.networks.useFlatNetwork and $region.defaultNetworks.flat!=null
|
||||||
Then:
|
Then:
|
||||||
$.joinNet($.environment.defaultNetworks.flat, $securityGroupName)
|
$.joinNet($region.defaultNetworks.flat, $securityGroupName)
|
||||||
- $.networks.customNetworks.select($this.joinNet($, $securityGroupName))
|
- $.networks.customNetworks.select($this.joinNet($, $securityGroupName))
|
||||||
|
|
||||||
- $preparedUserData: $.prepareUserData()
|
- $preparedUserData: $.prepareUserData()
|
||||||
# Create MQ queue to communicate with the VM
|
# Create MQ queue to communicate with the VM
|
||||||
- $.agent.prepare()
|
- $.agent.prepare()
|
||||||
- $properties:
|
- $properties:
|
||||||
|
name: $.name
|
||||||
flavor: $.flavor
|
flavor: $.flavor
|
||||||
availability_zone: $.availabilityZone
|
availability_zone: $.availabilityZone
|
||||||
user_data: $preparedUserData.data
|
user_data: $preparedUserData.data
|
||||||
@ -161,12 +163,13 @@ Methods:
|
|||||||
|
|
||||||
# Any additional template preparation
|
# Any additional template preparation
|
||||||
- $.instanceTemplate: $.prepareStackTemplate($.instanceTemplate)
|
- $.instanceTemplate: $.prepareStackTemplate($.instanceTemplate)
|
||||||
- $.environment.stack.updateTemplate($.instanceTemplate)
|
- $region.stack.updateTemplate($.instanceTemplate)
|
||||||
|
|
||||||
endDeploy:
|
endDeploy:
|
||||||
Body:
|
Body:
|
||||||
- $.environment.stack.push()
|
- $region: $.getRegion()
|
||||||
- $outputs: $.environment.stack.output()
|
- $region.stack.push()
|
||||||
|
- $outputs: $region.stack.output()
|
||||||
- $.ipAddresses: $outputs.get(format('{0}-assigned-ips', $this.name)).values().flatten().distinct()
|
- $.ipAddresses: $outputs.get(format('{0}-assigned-ips', $this.name)).values().flatten().distinct()
|
||||||
- $.openstackId: $outputs.get(format('{0}-id', $this.name))
|
- $.openstackId: $outputs.get(format('{0}-id', $this.name))
|
||||||
- If: $._floatingIpOutputName != null
|
- If: $._floatingIpOutputName != null
|
||||||
@ -174,7 +177,7 @@ Methods:
|
|||||||
- $.floatingIpAddress: $outputs.get($._floatingIpOutputName)
|
- $.floatingIpAddress: $outputs.get($._floatingIpOutputName)
|
||||||
- If: $.floatingIpAddress != null
|
- If: $.floatingIpAddress != null
|
||||||
Then: $.setAttr(fipAssigned, true)
|
Then: $.setAttr(fipAssigned, true)
|
||||||
- $.environment.instanceNotifier.trackCloudInstance($this)
|
- $._environment.instanceNotifier.trackCloudInstance($this)
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
Body:
|
Body:
|
||||||
@ -183,18 +186,19 @@ Methods:
|
|||||||
|
|
||||||
detectPrimaryNetwork:
|
detectPrimaryNetwork:
|
||||||
Body:
|
Body:
|
||||||
|
- $region: $.getRegion()
|
||||||
- $._primaryNetwork: null
|
- $._primaryNetwork: null
|
||||||
- If: $.networks.primaryNetwork != null
|
- If: $.networks.primaryNetwork != null
|
||||||
Then:
|
Then:
|
||||||
- $._primaryNetwork: $.networks.primaryNetwork
|
- $._primaryNetwork: $.networks.primaryNetwork
|
||||||
Else:
|
Else:
|
||||||
- If: $.networks.useEnvironmentNetwork and $.environment.defaultNetworks.environment!=null
|
- If: $.networks.useEnvironmentNetwork and $region.defaultNetworks.environment!=null
|
||||||
Then:
|
Then:
|
||||||
- $._primaryNetwork: $.environment.defaultNetworks.environment
|
- $._primaryNetwork: $region.defaultNetworks.environment
|
||||||
Else:
|
Else:
|
||||||
- If: $.networks.useFlatNetwork and $.environment.defaultNetworks.flat!=null
|
- If: $.networks.useFlatNetwork and $region.defaultNetworks.flat!=null
|
||||||
Then:
|
Then:
|
||||||
- $._primaryNetwork: $.environment.defaultNetworks.flat
|
- $._primaryNetwork: $region.defaultNetworks.flat
|
||||||
Else:
|
Else:
|
||||||
- If: $.networks.customNetworks!= null
|
- If: $.networks.customNetworks!= null
|
||||||
Then:
|
Then:
|
||||||
@ -202,12 +206,13 @@ Methods:
|
|||||||
|
|
||||||
ensureNetworksDeployed:
|
ensureNetworksDeployed:
|
||||||
Body:
|
Body:
|
||||||
- If: $.networks.useEnvironmentNetwork and $.environment.defaultNetworks.environment!=null
|
- $region: $.getRegion()
|
||||||
|
- If: $.networks.useEnvironmentNetwork and $region.defaultNetworks.environment!=null
|
||||||
Then:
|
Then:
|
||||||
- $.environment.defaultNetworks.environment.deploy()
|
- $region.defaultNetworks.environment.deploy()
|
||||||
- If: $.networks.useFlatNetwork and $.environment.defaultNetworks.flat!=null
|
- If: $.networks.useFlatNetwork and $region.defaultNetworks.flat!=null
|
||||||
Then:
|
Then:
|
||||||
- $.environment.defaultNetworks.flat.deploy()
|
- $region.defaultNetworks.flat.deploy()
|
||||||
- $.networks.customNetworks.pselect($.deploy())
|
- $.networks.customNetworks.pselect($.deploy())
|
||||||
|
|
||||||
ensureSharedIpsDeployed:
|
ensureSharedIpsDeployed:
|
||||||
@ -250,7 +255,7 @@ Methods:
|
|||||||
- port:
|
- port:
|
||||||
$joinResult.portRef
|
$joinResult.portRef
|
||||||
- $.instanceTemplate: $.instanceTemplate.mergeWith($template)
|
- $.instanceTemplate: $.instanceTemplate.mergeWith($template)
|
||||||
- If: $joinResult.secGroupName != null
|
- If: $joinResult.get(secGroupName) != null
|
||||||
Then:
|
Then:
|
||||||
- $template:
|
- $template:
|
||||||
resources:
|
resources:
|
||||||
@ -293,29 +298,31 @@ Methods:
|
|||||||
|
|
||||||
beginReleaseResources:
|
beginReleaseResources:
|
||||||
Body:
|
Body:
|
||||||
- $template: $.environment.stack.current()
|
- $region: $.getRegion()
|
||||||
- If: bool($template.resources) and bool($template.outputs)
|
- $template: $region.stack.current()
|
||||||
|
- If: $template.get(resources) and $template.get(outputs)
|
||||||
Then:
|
Then:
|
||||||
- $resourcesToDelete: list($.name).concat($.getAttr(instanceResources, []))
|
- $resourcesToDelete: list($.name).concat($.getAttr(instanceResources, []))
|
||||||
- $lenBefore: len($template.resources)
|
- $lenBefore: len($template.resources)
|
||||||
- $template.resources: $template.resources.deleteAll($resourcesToDelete)
|
- $template.resources: $template.resources.deleteAll($resourcesToDelete)
|
||||||
- If: $lenBefore > len($template.resources)
|
- If: $lenBefore > len($template.resources)
|
||||||
Then:
|
Then:
|
||||||
- $.environment.instanceNotifier.untrackCloudInstance($this)
|
- $._environment.instanceNotifier.untrackCloudInstance($this)
|
||||||
|
|
||||||
- $outputsToDelete: list(
|
- $outputsToDelete: list(
|
||||||
'{0}-assigned-ips'.format($.name),
|
'{0}-assigned-ips'.format($.name),
|
||||||
'{0}-id'.format($.name)).concat($.getAttr(instanceOutputs, []))
|
'{0}-id'.format($.name)).concat($.getAttr(instanceOutputs, []))
|
||||||
- $template.outputs: $template.outputs.deleteAll($outputsToDelete)
|
- $template.outputs: $template.outputs.deleteAll($outputsToDelete)
|
||||||
|
|
||||||
- $.environment.stack.setTemplate($template)
|
- $region.stack.setTemplate($template)
|
||||||
|
|
||||||
endReleaseResources:
|
endReleaseResources:
|
||||||
Body:
|
Body:
|
||||||
- $template: $.environment.stack.current()
|
- $region: $.getRegion()
|
||||||
- If: bool($template.resources) and bool($template.outputs)
|
- $template: $region.stack.current()
|
||||||
|
- If: $template.get(resources) and $template.get(outputs)
|
||||||
Then:
|
Then:
|
||||||
- $.environment.stack.push()
|
- $region.stack.push()
|
||||||
- $.setAttr(instanceResources, [])
|
- $.setAttr(instanceResources, [])
|
||||||
- $.setAttr(instanceOutputs, [])
|
- $.setAttr(instanceOutputs, [])
|
||||||
- $.setAttr(fipAssigned, false)
|
- $.setAttr(fipAssigned, false)
|
||||||
@ -360,8 +367,9 @@ Methods:
|
|||||||
|
|
||||||
isDeployed:
|
isDeployed:
|
||||||
Body:
|
Body:
|
||||||
- $template: $.environment.stack.current()
|
- $region: $.getRegion()
|
||||||
- Return: $template.resources != null and $.name in $template.resources
|
- $template: $region.stack.current()
|
||||||
|
- Return: $template.get(resources, {}).containsKey($.name)
|
||||||
|
|
||||||
getRef:
|
getRef:
|
||||||
Body:
|
Body:
|
||||||
|
@ -24,11 +24,11 @@ Methods:
|
|||||||
- groupName:
|
- groupName:
|
||||||
Contract: $.string().notNull()
|
Contract: $.string().notNull()
|
||||||
Body:
|
Body:
|
||||||
- $environment: $.find(std:Environment).require()
|
- $region: $.getRegion()
|
||||||
- $rules:
|
- $rules:
|
||||||
- ToPort: 22
|
- ToPort: 22
|
||||||
IpProtocol: tcp
|
IpProtocol: tcp
|
||||||
FromPort: 22
|
FromPort: 22
|
||||||
External: true
|
External: true
|
||||||
- $environment.securityGroupManager.addGroupIngress(
|
- $region.securityGroupManager.addGroupIngress(
|
||||||
rules => $rules, groupName => $groupName)
|
rules => $rules, groupName => $groupName)
|
||||||
|
@ -21,7 +21,7 @@ Methods:
|
|||||||
- userData:
|
- userData:
|
||||||
Contract: $.string().notNull()
|
Contract: $.string().notNull()
|
||||||
Body:
|
Body:
|
||||||
- $environment: $.find(std:Environment).require()
|
- $region: $.getRegion()
|
||||||
- $resources: new(sys:Resources)
|
- $resources: new(sys:Resources)
|
||||||
- $muranoInitConf: $.generateCloudConfig()
|
- $muranoInitConf: $.generateCloudConfig()
|
||||||
- $bootScriptResourceName: format('boot_script_{0}', $.name)
|
- $bootScriptResourceName: format('boot_script_{0}', $.name)
|
||||||
@ -46,7 +46,7 @@ Methods:
|
|||||||
- config: {get_resource: $bootScriptResourceName}
|
- config: {get_resource: $bootScriptResourceName}
|
||||||
|
|
||||||
- $.setAttr(resourceCloudConfig, [$bootScriptResourceName, $userDataResourceName, $bootConfigResourceName])
|
- $.setAttr(resourceCloudConfig, [$bootScriptResourceName, $userDataResourceName, $bootConfigResourceName])
|
||||||
- $environment.stack.updateTemplate($template)
|
- $region.stack.updateTemplate($template)
|
||||||
- Return: {get_resource: $userDataResourceName}
|
- Return: {get_resource: $userDataResourceName}
|
||||||
|
|
||||||
|
|
||||||
@ -58,9 +58,8 @@ Methods:
|
|||||||
|
|
||||||
generateUserData:
|
generateUserData:
|
||||||
Body:
|
Body:
|
||||||
- $environment: $.find(std:Environment).require()
|
- $region: $.getRegion()
|
||||||
- $rabbitMqParams: $environment.regionConfigs.get($environment.region,
|
- $rabbitMqParams: $region.getConfig().agentRabbitMq
|
||||||
$environment.regionConfigs.get(null)).agentRabbitMq
|
|
||||||
- $resources: new(sys:Resources)
|
- $resources: new(sys:Resources)
|
||||||
- $configFile: $resources.string('Agent-v2.template')
|
- $configFile: $resources.string('Agent-v2.template')
|
||||||
- $initScript: $resources.string('linux-init.sh')
|
- $initScript: $resources.string('linux-init.sh')
|
||||||
@ -77,7 +76,7 @@ Methods:
|
|||||||
"%RABBITMQ_SSL%": str($rabbitMqParams.ssl).toLower()
|
"%RABBITMQ_SSL%": str($rabbitMqParams.ssl).toLower()
|
||||||
"%RABBITMQ_INSECURE%": str($rabbitMqParams.insecure).toLower()
|
"%RABBITMQ_INSECURE%": str($rabbitMqParams.insecure).toLower()
|
||||||
"%RABBITMQ_INPUT_QUEUE%": $.agent.queueName()
|
"%RABBITMQ_INPUT_QUEUE%": $.agent.queueName()
|
||||||
"%RESULT_QUEUE%": $environment.agentListener.queueName()
|
"%RESULT_QUEUE%": $region.agentListener.queueName()
|
||||||
- $scriptReplacements:
|
- $scriptReplacements:
|
||||||
"%AGENT_CONFIG_BASE64%": base64encode($configFile.replace($configReplacements))
|
"%AGENT_CONFIG_BASE64%": base64encode($configFile.replace($configReplacements))
|
||||||
"%INTERNAL_HOSTNAME%": $.name
|
"%INTERNAL_HOSTNAME%": $.name
|
||||||
@ -97,12 +96,12 @@ Methods:
|
|||||||
|
|
||||||
releaseResources:
|
releaseResources:
|
||||||
Body:
|
Body:
|
||||||
- $environment: $.find(std:Environment).require()
|
- $region: $.getRegion()
|
||||||
- $template: $environment.stack.current()
|
- $template: $region.stack.current()
|
||||||
- If: bool($template.resources) and bool($template.outputs)
|
- If: $template.get(resources) and $template.get(outputs)
|
||||||
Then:
|
Then:
|
||||||
- $resourcesToDelete: $.getAttr(resourceCloudConfig, [])
|
- $resourcesToDelete: $.getAttr(resourceCloudConfig, [])
|
||||||
- $template.resources: $template.resources.deleteAll($resourcesToDelete)
|
- $template.resources: $template.resources.deleteAll($resourcesToDelete)
|
||||||
- $environment.stack.setTemplate($template)
|
- $region.stack.setTemplate($template)
|
||||||
|
|
||||||
- $.super($.releaseResources())
|
- super($, $.releaseResources())
|
@ -15,6 +15,7 @@ Namespaces:
|
|||||||
std: io.murano
|
std: io.murano
|
||||||
|
|
||||||
Name: Network
|
Name: Network
|
||||||
|
Extends: std:CloudResource
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
deploy:
|
deploy:
|
||||||
@ -32,8 +33,5 @@ Methods:
|
|||||||
- $.class(std:SharedIp)
|
- $.class(std:SharedIp)
|
||||||
|
|
||||||
generateSecurityGroupManager:
|
generateSecurityGroupManager:
|
||||||
Arguments:
|
|
||||||
- environment:
|
|
||||||
Contract: $.class(std:Environment).notNull()
|
|
||||||
|
|
||||||
describe:
|
describe:
|
@ -50,10 +50,10 @@ Properties:
|
|||||||
Usage: InOut
|
Usage: InOut
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
initialize:
|
.init:
|
||||||
Body:
|
Body:
|
||||||
- $._environment: $.find(std:Environment).require()
|
- $._region: $.getRegion()
|
||||||
- $._netExplorer: new(sys:NetworkExplorer, $._environment)
|
- $._netExplorer: new(sys:NetworkExplorer, $this)
|
||||||
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
@ -69,16 +69,16 @@ Methods:
|
|||||||
- $.externalRouterId: $._netExplorer.getDefaultRouter()
|
- $.externalRouterId: $._netExplorer.getDefaultRouter()
|
||||||
- If: $.autogenerateSubnet and (not bool($.subnetCidr))
|
- If: $.autogenerateSubnet and (not bool($.subnetCidr))
|
||||||
Then:
|
Then:
|
||||||
- $.subnetCidr: $._netExplorer.getAvailableCidr($.externalRouterId, $.id())
|
- $.subnetCidr: $._netExplorer.getAvailableCidr($.externalRouterId, id($))
|
||||||
|
|
||||||
- $template: $template.mergeWith($._createSubnet())
|
- $template: $template.mergeWith($._createSubnet())
|
||||||
- If: $.externalRouterId != null
|
- If: $.externalRouterId != null
|
||||||
Then:
|
Then:
|
||||||
- $template: $template.mergeWith($._createRouterInterface())
|
- $template: $template.mergeWith($._createRouterInterface())
|
||||||
|
|
||||||
- $._environment.stack.updateTemplate($template)
|
- $._region.stack.updateTemplate($template)
|
||||||
- $._environment.stack.push()
|
- $._region.stack.push()
|
||||||
- $outputs: $._environment.stack.output()
|
- $outputs: $._region.stack.output()
|
||||||
- $.openstackId: $outputs.get(format('{0}-id', $this.name))
|
- $.openstackId: $outputs.get(format('{0}-id', $this.name))
|
||||||
- $.setAttr(deployed, true)
|
- $.setAttr(deployed, true)
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ Methods:
|
|||||||
$netName:
|
$netName:
|
||||||
type: 'OS::Neutron::Net'
|
type: 'OS::Neutron::Net'
|
||||||
properties:
|
properties:
|
||||||
name: format('{0}-{1}', $.name, $.id())
|
name: format('{0}-{1}', $.name, id($))
|
||||||
outputs:
|
outputs:
|
||||||
format('{0}-id', $.name):
|
format('{0}-id', $.name):
|
||||||
description: format('ID of {0} network', $.name)
|
description: format('ID of {0} network', $.name)
|
||||||
@ -144,7 +144,7 @@ Methods:
|
|||||||
- If: $assignFloatingIp
|
- If: $assignFloatingIp
|
||||||
Then:
|
Then:
|
||||||
- $extNetId: $._getExternalNetId()
|
- $extNetId: $._getExternalNetId()
|
||||||
- $fipName: format('fip-{0}-{1}', $.id(), $instance.name)
|
- $fipName: format('fip-{0}-{1}', id($), $instance.name)
|
||||||
|
|
||||||
- $result: $.joinInstanceToNetwork(
|
- $result: $.joinInstanceToNetwork(
|
||||||
instance => $instance,
|
instance => $instance,
|
||||||
@ -186,9 +186,9 @@ Methods:
|
|||||||
|
|
||||||
releaseResources:
|
releaseResources:
|
||||||
Body:
|
Body:
|
||||||
- $template: $.environment.stack.current()
|
- $template: $._region.stack.current()
|
||||||
|
|
||||||
- $template.resources: $template.resources.delete(format('{0}-{1}', $.name, $.id()))
|
- $template.resources: $template.resources.delete(format('{0}-{1}', $.name, id($)))
|
||||||
- $template.resources: $template.resources.delete($._getSubnetName())
|
- $template.resources: $template.resources.delete($._getSubnetName())
|
||||||
|
|
||||||
- $template.outputs: $template.outputs.delete(format('{0}-id', $.name))
|
- $template.outputs: $template.outputs.delete(format('{0}-id', $.name))
|
||||||
@ -197,24 +197,24 @@ Methods:
|
|||||||
Then:
|
Then:
|
||||||
$template.resources: $template.resources.delete($._getRouterInterfaceName())
|
$template.resources: $template.resources.delete($._getRouterInterfaceName())
|
||||||
|
|
||||||
- $._environment.stack.setTemplate($template)
|
- $._regiont.stack.setTemplate($template)
|
||||||
- $._environment.stack.push()
|
- $._region.stack.push()
|
||||||
- $.openstackId: null
|
- $.openstackId: null
|
||||||
|
|
||||||
|
|
||||||
_getRouterInterfaceName:
|
_getRouterInterfaceName:
|
||||||
Body:
|
Body:
|
||||||
Return: format('ri-{0}', $.id())
|
Return: format('ri-{0}', id($))
|
||||||
|
|
||||||
|
|
||||||
_getNetworkName:
|
_getNetworkName:
|
||||||
Body:
|
Body:
|
||||||
Return: format('network-{0}', $.id())
|
Return: format('network-{0}', id($))
|
||||||
|
|
||||||
|
|
||||||
_getSubnetName:
|
_getSubnetName:
|
||||||
Body:
|
Body:
|
||||||
Return: format('subnet-{0}', $.id())
|
Return: format('subnet-{0}', id($))
|
||||||
|
|
||||||
|
|
||||||
_getExternalNetId:
|
_getExternalNetId:
|
||||||
|
@ -20,8 +20,10 @@ Name: NeutronNetworkBase
|
|||||||
Extends: Network
|
Extends: Network
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
initialize:
|
.init:
|
||||||
Body:
|
Body:
|
||||||
|
- $._environment: $.find(std:Environment)
|
||||||
|
- $._region: $.getRegion()
|
||||||
- $._netExplorer: new(sys:NetworkExplorer, $this)
|
- $._netExplorer: new(sys:NetworkExplorer, $this)
|
||||||
- $._securityGroupsEnabled: $._netExplorer.listNeutronExtensions().alias.contains('security-group')
|
- $._securityGroupsEnabled: $._netExplorer.listNeutronExtensions().alias.contains('security-group')
|
||||||
|
|
||||||
@ -43,7 +45,7 @@ Methods:
|
|||||||
- floatingIpNetRef:
|
- floatingIpNetRef:
|
||||||
Contract: $
|
Contract: $
|
||||||
Body:
|
Body:
|
||||||
- $portName: format('port-{0}-{1}', $.id(), $instance.name)
|
- $portName: format('port-{0}-{1}', id($), $instance.name)
|
||||||
- $patchTemplate:
|
- $patchTemplate:
|
||||||
resources:
|
resources:
|
||||||
$portName:
|
$portName:
|
||||||
@ -108,13 +110,10 @@ Methods:
|
|||||||
|
|
||||||
|
|
||||||
generateSecurityGroupManager:
|
generateSecurityGroupManager:
|
||||||
Arguments:
|
|
||||||
- environment:
|
|
||||||
Contract: $.class(std:Environment).notNull()
|
|
||||||
Body:
|
Body:
|
||||||
- If: $this._securityGroupsEnabled
|
- If: $this._securityGroupsEnabled
|
||||||
Then:
|
Then:
|
||||||
- Return: new(sys:NeutronSecurityGroupManager, environment => $environment)
|
- Return: new(sys:NeutronSecurityGroupManager, $._region)
|
||||||
Else:
|
Else:
|
||||||
- $environment.reporter.report($this, "Warning! Security groups are disabled!")
|
- $._environment.reporter.report($this, "Warning! Security groups are disabled!")
|
||||||
- Return: new(sys:DummySecurityGroupManager, environment => $environment)
|
- Return: new(sys:DummySecurityGroupManager, $._region)
|
||||||
|
@ -69,11 +69,8 @@ Methods:
|
|||||||
|
|
||||||
|
|
||||||
generateSecurityGroupManager:
|
generateSecurityGroupManager:
|
||||||
Arguments:
|
|
||||||
- environment:
|
|
||||||
Contract: $.class(std:Environment).notNull()
|
|
||||||
Body:
|
Body:
|
||||||
- Return: new(sys:AwsSecurityGroupManager, environment => $environment)
|
- Return: new(sys:AwsSecurityGroupManager)
|
||||||
|
|
||||||
|
|
||||||
describe:
|
describe:
|
||||||
|
@ -12,9 +12,11 @@
|
|||||||
|
|
||||||
Namespaces:
|
Namespaces:
|
||||||
=: io.murano.resources
|
=: io.murano.resources
|
||||||
|
std: io.murano
|
||||||
|
|
||||||
|
|
||||||
Name: Volume
|
Name: Volume
|
||||||
|
Extends: std:CloudResource
|
||||||
|
|
||||||
|
|
||||||
Properties:
|
Properties:
|
||||||
|
@ -19,6 +19,11 @@ Name: AwsSecurityGroupManager
|
|||||||
Extends: SecurityGroupManager
|
Extends: SecurityGroupManager
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
|
.init:
|
||||||
|
Body:
|
||||||
|
- $._environment: $.find(std:Environment)
|
||||||
|
- $._region: $.find(std:CloudRegion).require()
|
||||||
|
|
||||||
addGroupIngress:
|
addGroupIngress:
|
||||||
Arguments:
|
Arguments:
|
||||||
- rules:
|
- rules:
|
||||||
@ -82,19 +87,19 @@ Methods:
|
|||||||
Message: $msg
|
Message: $msg
|
||||||
- $groupDirection: dict(egress => SecurityGroupEgress).get($direction, SecurityGroupIngress)
|
- $groupDirection: dict(egress => SecurityGroupEgress).get($direction, SecurityGroupIngress)
|
||||||
|
|
||||||
- $stack: $.environment.stack
|
- $stack: $._region.stack
|
||||||
- $template:
|
- $template:
|
||||||
resources:
|
resources:
|
||||||
$groupName:
|
$groupName:
|
||||||
type: 'AWS::EC2::SecurityGroup'
|
type: 'AWS::EC2::SecurityGroup'
|
||||||
properties:
|
properties:
|
||||||
GroupDescription: format('Composite security group of Murano environment {0}', $.environment.name)
|
GroupDescription: format('Composite security group of Murano environment {0}', $._environment.name)
|
||||||
$groupDirection:
|
$groupDirection:
|
||||||
- FromPort: '-1'
|
- FromPort: '-1'
|
||||||
ToPort: '-1'
|
ToPort: '-1'
|
||||||
IpProtocol: icmp
|
IpProtocol: icmp
|
||||||
CidrIp: '0.0.0.0/0'
|
CidrIp: '0.0.0.0/0'
|
||||||
- $.environment.stack.updateTemplate($template)
|
- $._region.stack.updateTemplate($template)
|
||||||
|
|
||||||
- $rulesList: $rules.select(dict(
|
- $rulesList: $rules.select(dict(
|
||||||
FromPort => str($.FromPort),
|
FromPort => str($.FromPort),
|
||||||
@ -109,4 +114,4 @@ Methods:
|
|||||||
type: 'AWS::EC2::SecurityGroup'
|
type: 'AWS::EC2::SecurityGroup'
|
||||||
properties:
|
properties:
|
||||||
$groupDirection: $rulesList
|
$groupDirection: $rulesList
|
||||||
- $.environment.stack.updateTemplate($template)
|
- $._region.stack.updateTemplate($template)
|
||||||
|
@ -19,6 +19,11 @@ Name: NeutronSecurityGroupManager
|
|||||||
Extends: SecurityGroupManager
|
Extends: SecurityGroupManager
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
|
.init:
|
||||||
|
Body:
|
||||||
|
- $._environment: $.find(std:Environment)
|
||||||
|
- $._region: $.find(std:CloudRegion).require()
|
||||||
|
|
||||||
addGroupIngress:
|
addGroupIngress:
|
||||||
Arguments:
|
Arguments:
|
||||||
- rules:
|
- rules:
|
||||||
@ -71,17 +76,18 @@ Methods:
|
|||||||
ext_key: remote_mode
|
ext_key: remote_mode
|
||||||
ext_val: remote_group_id
|
ext_val: remote_group_id
|
||||||
|
|
||||||
- $stack: $.environment.stack
|
|
||||||
- $template:
|
- $template:
|
||||||
resources:
|
resources:
|
||||||
$groupName:
|
$groupName:
|
||||||
type: 'OS::Neutron::SecurityGroup'
|
type: 'OS::Neutron::SecurityGroup'
|
||||||
properties:
|
properties:
|
||||||
description: format('Composite security group of Murano environment {0}', $.environment.name)
|
description: format(
|
||||||
|
'Composite security group of Murano environment {0}',
|
||||||
|
$._environment.name)
|
||||||
rules:
|
rules:
|
||||||
- protocol: icmp
|
- protocol: icmp
|
||||||
remote_ip_prefix: '0.0.0.0/0'
|
remote_ip_prefix: '0.0.0.0/0'
|
||||||
- $.environment.stack.updateTemplate($template)
|
- $._region.stack.updateTemplate($template)
|
||||||
|
|
||||||
- $rulesList: $rules.select(dict(
|
- $rulesList: $rules.select(dict(
|
||||||
port_range_min => $.FromPort,
|
port_range_min => $.FromPort,
|
||||||
@ -98,4 +104,4 @@ Methods:
|
|||||||
type: 'OS::Neutron::SecurityGroup'
|
type: 'OS::Neutron::SecurityGroup'
|
||||||
properties:
|
properties:
|
||||||
rules: $rulesList
|
rules: $rulesList
|
||||||
- $.environment.stack.updateTemplate($template)
|
- $._region.stack.updateTemplate($template)
|
@ -17,12 +17,9 @@ Namespaces:
|
|||||||
Name: SecurityGroupManager
|
Name: SecurityGroupManager
|
||||||
|
|
||||||
Properties:
|
Properties:
|
||||||
environment:
|
|
||||||
Contract: $.class(std:Environment).notNull()
|
|
||||||
|
|
||||||
defaultGroupName:
|
defaultGroupName:
|
||||||
Contract: $.string()
|
Contract: $.string()
|
||||||
Default: format('MuranoSecurityGroup-{0}', $.environment.id())
|
Default: id($.find(std:CloudRegion))
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
addGroupIngress:
|
addGroupIngress:
|
||||||
|
@ -46,11 +46,8 @@ Methods:
|
|||||||
- Return: {}
|
- Return: {}
|
||||||
|
|
||||||
generateSecurityGroupManager:
|
generateSecurityGroupManager:
|
||||||
Arguments:
|
|
||||||
- environment:
|
|
||||||
Contract: $.class(std:Environment).notNull()
|
|
||||||
Body:
|
Body:
|
||||||
- Return: new(sys:SecurityGroupManager, environment => $environment)
|
- Return: new(sys:DummySecurityGroupManager)
|
||||||
|
|
||||||
describe:
|
describe:
|
||||||
Body:
|
Body:
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
Format: 1.1
|
Format: 1.4
|
||||||
|
|
||||||
Type: Library
|
Type: Library
|
||||||
|
|
||||||
@ -28,6 +28,8 @@ Tags: [MuranoPL]
|
|||||||
Classes:
|
Classes:
|
||||||
io.murano.Object: Object.yaml
|
io.murano.Object: Object.yaml
|
||||||
io.murano.Environment: Environment.yaml
|
io.murano.Environment: Environment.yaml
|
||||||
|
io.murano.CloudRegion: CloudRegion.yaml
|
||||||
|
io.murano.CloudResource: CloudResource.yaml
|
||||||
io.murano.Application: Application.yaml
|
io.murano.Application: Application.yaml
|
||||||
io.murano.Exception: Exception.yaml
|
io.murano.Exception: Exception.yaml
|
||||||
io.murano.StackTrace: StackTrace.yaml
|
io.murano.StackTrace: StackTrace.yaml
|
||||||
|
@ -162,9 +162,10 @@ class MuranoObjectInterface(dsl_types.MuranoObjectInterface):
|
|||||||
def func(*args, **kwargs):
|
def func(*args, **kwargs):
|
||||||
self._insert_instruction()
|
self._insert_instruction()
|
||||||
with helpers.with_object_store(self.__object_store):
|
with helpers.with_object_store(self.__object_store):
|
||||||
return self.__object.type.invoke(
|
context = helpers.get_context()
|
||||||
|
return to_mutable(self.__object.type.invoke(
|
||||||
item, self.__object, args, kwargs,
|
item, self.__object, args, kwargs,
|
||||||
helpers.get_context())
|
context), helpers.get_yaql_engine(context))
|
||||||
return func
|
return func
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -193,7 +193,7 @@ def get_current_method(context=None):
|
|||||||
|
|
||||||
def get_yaql_engine(context=None):
|
def get_yaql_engine(context=None):
|
||||||
context = context or get_context()
|
context = context or get_context()
|
||||||
return context[constants.CTX_YAQL_ENGINE]
|
return None if context is None else context[constants.CTX_YAQL_ENGINE]
|
||||||
|
|
||||||
|
|
||||||
def get_current_exception(context=None):
|
def get_current_exception(context=None):
|
||||||
|
@ -47,10 +47,10 @@ class Agent(object):
|
|||||||
'by the server configuration')
|
'by the server configuration')
|
||||||
return
|
return
|
||||||
|
|
||||||
self._environment = host.find_owner('io.murano.Environment')
|
self._host = host
|
||||||
self._enabled = True
|
self._enabled = True
|
||||||
self._queue = str('e%s-h%s' % (
|
env = host.find_owner('io.murano.Environment')
|
||||||
self._environment.id, host.id)).lower()
|
self._queue = str('e%s-h%s' % (env.id, host.id)).lower()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def enabled(self):
|
def enabled(self):
|
||||||
@ -63,7 +63,8 @@ class Agent(object):
|
|||||||
'by the server configuration')
|
'by the server configuration')
|
||||||
return
|
return
|
||||||
|
|
||||||
with common.create_rmq_client(self._environment) as client:
|
region = dsl.MuranoObjectInterface.create(self._host().getRegion())
|
||||||
|
with common.create_rmq_client(region) as client:
|
||||||
client.declare(self._queue, enable_ha=True, ttl=86400000)
|
client.declare(self._queue, enable_ha=True, ttl=86400000)
|
||||||
|
|
||||||
def queue_name(self):
|
def queue_name(self):
|
||||||
@ -83,14 +84,15 @@ class Agent(object):
|
|||||||
|
|
||||||
def _send(self, template, wait_results, timeout):
|
def _send(self, template, wait_results, timeout):
|
||||||
"""Send a message over the MQ interface."""
|
"""Send a message over the MQ interface."""
|
||||||
|
region = self._host().getRegion()
|
||||||
msg_id = template.get('ID', uuid.uuid4().hex)
|
msg_id = template.get('ID', uuid.uuid4().hex)
|
||||||
if wait_results:
|
if wait_results:
|
||||||
event = eventlet.event.Event()
|
event = eventlet.event.Event()
|
||||||
listener = self._environment['agentListener']
|
listener = region['agentListener']
|
||||||
listener().subscribe(msg_id, event)
|
listener().subscribe(msg_id, event)
|
||||||
|
|
||||||
msg = self._prepare_message(template, msg_id)
|
msg = self._prepare_message(template, msg_id)
|
||||||
with common.create_rmq_client(self._environment) as client:
|
with common.create_rmq_client(region) as client:
|
||||||
client.send(message=msg, key=self._queue)
|
client.send(message=msg, key=self._queue)
|
||||||
|
|
||||||
if wait_results:
|
if wait_results:
|
||||||
|
@ -68,7 +68,7 @@ class AgentListener(object):
|
|||||||
lambda: self.stop())
|
lambda: self.stop())
|
||||||
self._receive_thread = dsl.spawn(
|
self._receive_thread = dsl.spawn(
|
||||||
self._receive,
|
self._receive,
|
||||||
dsl.get_this().find_owner('io.murano.Environment'))
|
dsl.get_this().find_owner('io.murano.CloudRegion'))
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
if CONF.engine.disable_murano_agent:
|
if CONF.engine.disable_murano_agent:
|
||||||
@ -94,8 +94,8 @@ class AgentListener(object):
|
|||||||
self._check_enabled()
|
self._check_enabled()
|
||||||
self._subscriptions.pop(message_id)
|
self._subscriptions.pop(message_id)
|
||||||
|
|
||||||
def _receive(self, environment):
|
def _receive(self, region):
|
||||||
with common.create_rmq_client(environment) as client:
|
with common.create_rmq_client(region) as client:
|
||||||
client.declare(self._results_queue, enable_ha=True, ttl=86400000)
|
client.declare(self._results_queue, enable_ha=True, ttl=86400000)
|
||||||
with client.open(self._results_queue) as subscription:
|
with client.open(self._results_queue) as subscription:
|
||||||
while True:
|
while True:
|
||||||
|
@ -20,10 +20,8 @@ from murano.common.messaging import mqclient
|
|||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
|
||||||
def create_rmq_client(environment):
|
def create_rmq_client(region):
|
||||||
region_name = environment['region']
|
region_config = region().getConfig()
|
||||||
region_configs = environment['regionConfigs']
|
rmq_settings = dict(region_config['agentRabbitMq'])
|
||||||
region_config = region_configs.get(region_name, region_configs[None])
|
|
||||||
rmq_settings = region_config['agentRabbitMq'].copy()
|
|
||||||
rmq_settings['ca_certs'] = CONF.rabbitmq.ca_certs.strip() or None
|
rmq_settings['ca_certs'] = CONF.rabbitmq.ca_certs.strip() or None
|
||||||
return mqclient.MqClient(**rmq_settings)
|
return mqclient.MqClient(**rmq_settings)
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
import json
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
import heatclient.client as hclient
|
import heatclient.client as hclient
|
||||||
@ -50,7 +51,7 @@ class HeatStack(object):
|
|||||||
self._description = description
|
self._description = description
|
||||||
self._last_stack_timestamps = (None, None)
|
self._last_stack_timestamps = (None, None)
|
||||||
self._tags = ''
|
self._tags = ''
|
||||||
self._owner = this.find_owner('io.murano.Environment')
|
self._owner = this.find_owner('io.murano.CloudRegion')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _create_client(session, region_name):
|
def _create_client(session, region_name):
|
||||||
@ -61,7 +62,7 @@ class HeatStack(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def _client(self):
|
def _client(self):
|
||||||
region = None if self._owner is None else self._owner['region']
|
region = None if self._owner is None else self._owner['name']
|
||||||
return self._get_client(region)
|
return self._get_client(region)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -72,7 +73,7 @@ class HeatStack(object):
|
|||||||
|
|
||||||
def _get_token_client(self):
|
def _get_token_client(self):
|
||||||
ks_session = auth_utils.get_token_client_session(conf=CONF.heat)
|
ks_session = auth_utils.get_token_client_session(conf=CONF.heat)
|
||||||
region = None if self._owner is None else self._owner['region']
|
region = None if self._owner is None else self._owner['name']
|
||||||
return self._create_client(ks_session, region)
|
return self._create_client(ks_session, region)
|
||||||
|
|
||||||
def current(self):
|
def current(self):
|
||||||
@ -212,7 +213,7 @@ class HeatStack(object):
|
|||||||
self._template['description'] = self._description
|
self._template['description'] = self._description
|
||||||
|
|
||||||
template = copy.deepcopy(self._template)
|
template = copy.deepcopy(self._template)
|
||||||
LOG.debug('Pushing: {template}'.format(template=template))
|
LOG.debug('Pushing: {template}'.format(template=json.dumps(template)))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
@ -40,7 +40,7 @@ class NetworkExplorer(object):
|
|||||||
self._project_id = session.project_id
|
self._project_id = session.project_id
|
||||||
self._settings = CONF.networking
|
self._settings = CONF.networking
|
||||||
self._available_cidrs = self._generate_possible_cidrs()
|
self._available_cidrs = self._generate_possible_cidrs()
|
||||||
self._owner = this.find_owner('io.murano.Environment')
|
self._region = this.find_owner('io.murano.CloudRegion')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@session_local_storage.execution_session_memoize
|
@session_local_storage.execution_session_memoize
|
||||||
@ -52,7 +52,7 @@ class NetworkExplorer(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def _client(self):
|
def _client(self):
|
||||||
region = None if self._owner is None else self._owner['region']
|
region = None if self._region is None else self._region['name']
|
||||||
return self._get_client(region)
|
return self._get_client(region)
|
||||||
|
|
||||||
# NOTE(starodubcevna): to avoid simultaneous router requests we use retry
|
# NOTE(starodubcevna): to avoid simultaneous router requests we use retry
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
Name: AgentTests
|
|
||||||
|
|
||||||
Namespaces:
|
|
||||||
sys: io.murano.system
|
|
||||||
|
|
||||||
Properties:
|
|
||||||
agent:
|
|
||||||
Contract: $.class(sys:Agent)
|
|
||||||
Usage: Runtime
|
|
||||||
|
|
||||||
|
|
||||||
Methods:
|
|
||||||
testAgent:
|
|
||||||
Body:
|
|
||||||
- $.agent: new(sys:Agent, host => $)
|
|
||||||
- Return: $.agent
|
|
@ -60,36 +60,20 @@ class TestAgentListener(test_case.DslTestCase):
|
|||||||
|
|
||||||
|
|
||||||
class TestAgent(test_case.DslTestCase):
|
class TestAgent(test_case.DslTestCase):
|
||||||
def setUp(self):
|
|
||||||
super(TestAgent, self).setUp()
|
|
||||||
|
|
||||||
# Register Agent class
|
|
||||||
self.package_loader.load_package('io.murano', None).register_class(
|
|
||||||
agent.Agent)
|
|
||||||
model = om.Object(
|
|
||||||
'AgentTests')
|
|
||||||
self.runner = self.new_runner(model)
|
|
||||||
|
|
||||||
def test_agent_enabled(self):
|
def test_agent_enabled(self):
|
||||||
self.override_config('disable_murano_agent', False, 'engine')
|
self.override_config('disable_murano_agent', False, 'engine')
|
||||||
m = mock.MagicMock()
|
|
||||||
# Necessary because otherwise there'll be an Environment lookup
|
|
||||||
agent_cls = 'murano.engine.system.agent.Agent'
|
agent_cls = 'murano.engine.system.agent.Agent'
|
||||||
obj_if_cls = 'murano.dsl.dsl.MuranoObjectInterface'
|
a = agent.Agent(mock.MagicMock())
|
||||||
with mock.patch(obj_if_cls + '.find_owner') as f:
|
self.assertTrue(a.enabled)
|
||||||
f.return_value = m
|
|
||||||
a = self.runner.testAgent().extension
|
|
||||||
self.assertTrue(a.enabled)
|
|
||||||
self.assertEqual(m, a._environment)
|
|
||||||
|
|
||||||
with mock.patch(agent_cls + '._send') as s:
|
with mock.patch(agent_cls + '._send') as s:
|
||||||
s.return_value = mock.MagicMock()
|
s.return_value = mock.MagicMock()
|
||||||
a.send_raw({})
|
a.send_raw({})
|
||||||
s.assert_called_with({}, False, 0)
|
s.assert_called_with({}, False, 0)
|
||||||
|
|
||||||
def test_agent_disabled(self):
|
def test_agent_disabled(self):
|
||||||
self.override_config('disable_murano_agent', True, 'engine')
|
self.override_config('disable_murano_agent', True, 'engine')
|
||||||
a = self.runner.testAgent().extension
|
a = agent.Agent(mock.MagicMock())
|
||||||
self.assertFalse(a.enabled)
|
self.assertFalse(a.enabled)
|
||||||
self.assertRaises(exc.PolicyViolationException, a.call, {}, None)
|
self.assertRaises(exc.PolicyViolationException, a.call, {}, None)
|
||||||
self.assertRaises(exc.PolicyViolationException, a.send, {}, None)
|
self.assertRaises(exc.PolicyViolationException, a.send, {}, None)
|
||||||
|
14
releasenotes/notes/multi-regional-apps-b64afbaeafd5b9c5.yaml
Normal file
14
releasenotes/notes/multi-regional-apps-b64afbaeafd5b9c5.yaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- Support for application deployment across OpenStack regions was added.
|
||||||
|
Now all OpenStack resource classes inherit CloudResource that provides
|
||||||
|
getRegion method and regionName property. This allows to assign resources
|
||||||
|
to different regions. getRegion() returns CloudRegion instance that
|
||||||
|
resource or it parent belong to. CloudRegion has the similar interface
|
||||||
|
to Environment class and is the correct way to get HeatStack instance
|
||||||
|
associated with the regoin, default network configuration, security
|
||||||
|
group manager and agent listener instances. Environment acts as the
|
||||||
|
default region so backward compatibility is not broken. However new
|
||||||
|
applications should not use environment to set security group rules but
|
||||||
|
rather a region(s) of their instance(s) in order to work correctly when
|
||||||
|
their instances were configured to use region other then the default.
|
Loading…
Reference in New Issue
Block a user