Added MuranoPL infrastructure for advanced networking scenarios
Base class 'Network' (io.murano.resources.Network) was added to core package. This class is an abstract class for network interaction, to be inherited by engine-specific implementations. 'Environment' class got a 'defaultNetworks' input parameter, containing two different instances of Network class for two initially supported networking use-cases: 'environment' for a topology when each environment has an isolated network 'flat' for a single network per multiple environments 'Instance' class got a 'networks' input parameter with a default value. This is a composite parameter indicating which networks the instance should join If 'useEnvironmentNetwork' is set to 'true' the instance should join an isolated network of current environment if 'useFlatNetwork' is set to 'true' the instance should join a single shared network Both values may be enabled, so the instance will join both networks. 'customNetworks' field of the same data structure may be used to specify custom network resources to join Same commit includes a temporary workaround for bug #1313694 The workaround is needed to properly use default of 'networks' field The actual implementation of io.murano.resources.Network class should be done in a separate package, which should be added to app-incubator repo Change-Id: If2ae332a61900b0dd94cec94c1c140c54079441f Partial-Bug: #1308921
This commit is contained in:
parent
961818d505
commit
b7aec89493
@ -1,5 +1,6 @@
|
||||
Namespaces:
|
||||
=: io.murano
|
||||
res: io.murano.resources
|
||||
sys: io.murano.system
|
||||
|
||||
Name: Environment
|
||||
@ -23,6 +24,12 @@ Properties:
|
||||
Contract: $.class(sys:InstanceNotifier)
|
||||
Usage: Runtime
|
||||
|
||||
defaultNetworks:
|
||||
Contract:
|
||||
environment: $.class(res:Network)
|
||||
flat: $.class(res:Network)
|
||||
Usage: In
|
||||
|
||||
Workflow:
|
||||
initialize:
|
||||
Body:
|
||||
|
@ -20,6 +20,15 @@ Properties:
|
||||
ipAddresses:
|
||||
Contract: [$.string()]
|
||||
Usage: Out
|
||||
networks:
|
||||
Contract:
|
||||
useEnvironmentNetwork: $.bool().notNull()
|
||||
useFlatNetwork: $.bool().notNull()
|
||||
customNetworks: [$.class(Network).notNull()]
|
||||
Default:
|
||||
useEnvironmentNetwork: true
|
||||
useFlatNetwork: false
|
||||
customNetworks: []
|
||||
|
||||
Workflow:
|
||||
initialize:
|
||||
@ -30,6 +39,14 @@ Workflow:
|
||||
|
||||
deploy:
|
||||
Body:
|
||||
- If: $.networks.useEnvironmentNetwork
|
||||
Then:
|
||||
$.joinNet($.environment.defaultNetworks.environment)
|
||||
- If: $.networks.useFlatNetwork
|
||||
Then:
|
||||
$.joinNet($.environment.defaultNetworks.flat)
|
||||
- $.networks.customNetworks.select($this.joinNet($))
|
||||
|
||||
- $userData: $.prepareUserData()
|
||||
- $template:
|
||||
Resources:
|
||||
@ -43,15 +60,22 @@ Workflow:
|
||||
format('{0}-PublicIp', $.name):
|
||||
Value:
|
||||
- Fn::GetAtt: [$.name, PublicIp]
|
||||
|
||||
- $.environment.stack.updateTemplate($template)
|
||||
- $.environment.stack.push()
|
||||
|
||||
- $outputs: $.environment.stack.output()
|
||||
- $.ipAddresses: $outputs.get(format('{0}-PublicIp', $this.name))
|
||||
|
||||
- $.environment.instanceNotifier.trackApplication($this)
|
||||
|
||||
joinNet:
|
||||
Arguments:
|
||||
- net:
|
||||
Contract: $.class(Network)
|
||||
Body:
|
||||
- If: $net != null
|
||||
Then:
|
||||
$net.addHostToNetwork($)
|
||||
|
||||
destroy:
|
||||
Body:
|
||||
- $template: $.environment.stack.current()
|
||||
|
10
meta/io.murano/Classes/resources/Network.yaml
Normal file
10
meta/io.murano/Classes/resources/Network.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
Namespaces:
|
||||
=: io.murano.resources
|
||||
|
||||
Name: Network
|
||||
|
||||
Workflow:
|
||||
addHostToNetwork:
|
||||
Arguments:
|
||||
- instance:
|
||||
Contract: $.class(Instance).notNull()
|
@ -18,4 +18,5 @@ Classes:
|
||||
io.murano.Environment: Environment.yaml
|
||||
io.murano.Application: Application.yaml
|
||||
|
||||
io.murano.resources.Instance: resources/Instance.yaml
|
||||
io.murano.resources.Network: resources/Network.yaml
|
||||
io.murano.resources.Instance: resources/Instance.yaml
|
||||
|
@ -262,6 +262,13 @@ class TypeScheme(object):
|
||||
|
||||
def __call__(self, data, context, this, object_store,
|
||||
namespace_resolver, default):
|
||||
# TODO(ativelkov, slagun): temporary fix, need a better way of handling
|
||||
# composite defaults
|
||||
# A bug (#1313694) has been filed
|
||||
|
||||
if data is NoValue:
|
||||
data = default
|
||||
|
||||
context = self.prepare_context(
|
||||
context, this, object_store, namespace_resolver,
|
||||
default)
|
||||
|
Loading…
x
Reference in New Issue
Block a user