62c1f10e7b
Adds a PluginLoader which loads classes defined as stevedore plugins at io.murano.extension namespace and registers them as MuranoPL classes in class loader. Modifies the ClientManager class to make the _get_client method public, so other code may use it to add custom clients. This is useful for plugins which may define their own clients. Modifies the configuration settings adding 'enabled_plugins' parameter to control which of the installed plugins are active. Adds an example plugin which encapsulates Glance interaction logic to: * List all available glance images * Get Image by ID * Get Image by Name * Output image info with murano-related metadata Adds a demo application which demonstrates the usage of plugin. The app consist of the following components: * An 'ImageValidatorMixin' class which inherits generic instance class (io.murano.resources.Instance) and adds a method capable to validate Instance's image for having appropriate murano metadata type. This class may be used as a mixin when added to inheritance hierarchy of concrete instance classes. * A concrete class called DemoInstance which inherits from io.murano.resources.LinuxMuranoInstance and ImageValidatorMixin to add the image validation logic to standard Murano-enabled Linux-based instance. * An application which deploys a single VM using the DemoInstance class if the tag on user-supplied image matches the user-supplied constant. The ImageValidatorMixin demonstrates the instantiation of plugin-provided class and its usage, as well as handling of exception which may be thrown if the plugin is not installed in the environment. Change-Id: I978339d87033bbe38dad4c2102612d8f3a1eb3c3 Implements-blueprint: plugable-classes
82 lines
2.8 KiB
YAML
82 lines
2.8 KiB
YAML
Version: 2
|
|
|
|
Application:
|
|
?:
|
|
type: io.murano.apps.example.plugin.DemoApp
|
|
name: $.appConfiguration.name
|
|
instance:
|
|
?:
|
|
type: io.murano.apps.example.plugin.DemoInstance
|
|
name: generateHostname($.instanceConfiguration.unitNamingPattern, 1)
|
|
flavor: $.instanceConfiguration.flavor
|
|
image: $.instanceConfiguration.osImage
|
|
requiredType: $.appConfiguration.requiredType
|
|
assignFloatingIp: $.appConfiguration.assignFloatingIP
|
|
keyname: $.instanceConfiguration.keyPair
|
|
|
|
Forms:
|
|
- appConfiguration:
|
|
fields:
|
|
- name: name
|
|
type: string
|
|
label: Application Name
|
|
initial: Demo
|
|
description: >-
|
|
Enter a desired name for the application. Just A-Z, a-z, 0-9, dash and
|
|
underline are allowed
|
|
- name: requiredType
|
|
type: string
|
|
label: Required MuranoImage Type
|
|
initial: linux
|
|
description: >-
|
|
Enter a value to be matched against 'type' field of MuranoImage metadata
|
|
- name: assignFloatingIP
|
|
type: boolean
|
|
label: Assign Floating IP
|
|
description: >-
|
|
Select to true to assign floating IP automatically
|
|
initial: false
|
|
required: false
|
|
widgetMedia:
|
|
css: {all: ['muranodashboard/css/checkbox.css']}
|
|
- instanceConfiguration:
|
|
fields:
|
|
- name: title
|
|
type: string
|
|
required: false
|
|
hidden: true
|
|
description: Specify some instance parameters on which the application would be created
|
|
- name: flavor
|
|
type: flavor
|
|
label: Instance flavor
|
|
description: >-
|
|
Select registered in Openstack flavor. Consider that application performance
|
|
depends on this parameter.
|
|
required: false
|
|
- name: osImage
|
|
type: image
|
|
imageType: linux
|
|
label: Instance image
|
|
description: >-
|
|
Select a valid image for the application. Image should already be prepared and
|
|
registered in glance.
|
|
- name: keyPair
|
|
type: keypair
|
|
label: Key Pair
|
|
description: >-
|
|
Select a Key Pair to control access to instances. You can login to
|
|
instances using this KeyPair after the deployment of application.
|
|
required: false
|
|
- name: availabilityZone
|
|
type: azone
|
|
label: Availability zone
|
|
description: Select availability zone where the application would be installed.
|
|
required: false
|
|
- name: unitNamingPattern
|
|
label: Hostname
|
|
type: string
|
|
required: false
|
|
widgetMedia:
|
|
js: ['muranodashboard/js/support_placeholder.js']
|
|
css: {all: ['muranodashboard/css/support_placeholder.css']}
|