layout | title | category | publish | abstract | pageord |
---|---|---|---|---|---|
bt_wiki |
Openstack Plugin |
Plugins |
true |
Cloudify Openstack plugin description and configuration |
600 |
{%summary%} This section describes how to use OpenStack based cloud infrastructure in your services and applications. For more information about OpenStack, please refer to: https://www.openstack.org/. {%endsummary%}
{%tip title=Tip%}
Each type has one or both of the properties nova_config
and neutron_config
. These can be used to pass parameters for authenticating with the requested Openstack services. However, if the Cloudify bootstrap was done using Openstack Provider in the current region, there's no need to override these properties, and the authentication will take place with the same credentials that were used for the Cloudify bootstrap process. For more information, see the Misc section - Openstack authentication.
{%endtip%}
{%info title=Information%}
Each object of any type (with the exception of Floating IP) has a name on Openstack. This name can be set using the name
key under the relevant object property (e.g. server
for cloudify.openstack.server
, subnet
for cloudify.openstack.subnet
, etc.). If it isn't set, the Cloudify node ID will be used as the name.
{%endinfo%}
{%warning title=Warning%} It is important to ensure that Openstack names are unique (for a given type): While Openstack technically allows for same name objects for any type except Server, having identical names for objects of the same type will lead to ambiguities and errors. {%endwarning%}
Derived From: cloudify.types.host
Properties:
server
key-value server configuration as described in OpenStack compute create server API.- Notes:
- The
nics
key must not be used. To connect the server to networks, the Server node should be connected to Network nodes and/or Port nodes via relationships. These will then be translated into the appropriatenics
definitions automatically. - The
key_name
key needs to match the private key file whose path is set atcloudify_agent
'skey
property (see cloudify.types.host's properties). This should be the agents-keypair that was used in the bootstrap process. If the Cloudify bootstrap was done using Openstack Provider, there's no need to override this property, and it will be set automatically. - The server should use the agents security group. If Cloudify bootstrap wasn't done using the Openstack Provider, this group should be set by using the
security_groups
key. Otherwise, this group will be set for the server automatically, whether passed as part of thesecurity_groups
value or not (including the case where thesecurity_groups
key isn't passed at all).
- The
- Sugaring:
image_name
will automatically resolve the Openstack name of an image into animage_id
flavor_name
will automatically resolve the Openstack name of a flavor into aflavor_id
- the
userdata
key may receive either a string (passed as-is to Nova in the create server request), or a dictionary containing:- a field
type
whose value ishttp
- a field
url
whose value is a url to auserdata
script
- a field
- Notes:
management_network_name
Cloudify's management network name. Every server should be connected to the management network. If the Cloudify bootstrap was done using Openstack Provider, this is done automatically and there's no need to override this property. Otherwise, it is required to set the value of this property to the management network name as it was set in the bootstrap process. Note: When using a flat network (e.g. when using Openstack Folsom), don't set this property.nova_config
see Misc section - Openstack authenticationneutron_config
see Misc section - Openstack authentication
{%note title=Note%}
This type has the property neutron_config
as it requires communication with the Openstack Neutron service for connecting the server to networks.
{%endnote%}
Derived From: cloudify.openstack.server
This type has the same properties as the type above (as it derives from it). Use this type when working with a Windows server.
Derived From: cloudify.types.subnet
Properties:
subnet
key-value subnet configuration as described in OpenStack network create subnet API- Notes:
- The
network_id
key should not be used. Instead, the Subnet node should be connected to exactly one Network node via a relationship. It will then be placed on that network automatically.
- The
- Notes:
neutron_config
see Misc section - Openstack authentication
Derived From: cloudify.types.base
Properties:
security_group
key-value security_group configuration as described in OpenStack network create security group API- Sugaring:
port
key may be used instead of theport_range_max
andport_range_min
keys to limit the rule to a single port.remote_group_node
can be used instead ofremote_group_id
to specify a remote group, by supplying this key with a value which is the name of the remote security group node. Note that like theremote_group_id
key, this shouldn't be provided ifremote_ip_prefix
was provided.remote_group_name
will automatically resolve the Openstack name of a security group into aremote_group_id
. Note that like theremote_group_id
key, this shouldn't be provided ifremote_ip_prefix
was provided.
- Sugaring:
rules
key-value security_group_rule configuration as described in OpenStack network create security group ruledisable_egress
a flag for disallowing all egress traffic (as the default for Neutron security groups is to allow all egress traffic). Note: When using this flag, don't provide anyrules
whose direction value is egress. To simply limit the egress traffic, providerules
with direction value egress but without this flag, and the default rule for allowing all egress traffic will be automatically deleted before applying the provided egress rules.neutron_config
see Misc section - Openstack authentication
Derived From: cloudify.types.router
Properties:
router
key-value router configuration as described in OpenStack network create router API- Notes:
- Currently, a router must have an interface in the external network. The external network must be provided using the
external_gateway_info
key, unless Cloudify bootstrap was done using OpenStack provider (in which case the external network will be detected automatically).
- Currently, a router must have an interface in the external network. The external network must be provided using the
- Sugaring:
network_name
underexternal_gateway_info
will automatically resolve the Openstack name of a network into thenetwork_id
- Notes:
neutron_config
see Misc section - Openstack authentication
Derived From: cloudify.types.base
Properties:
port
key-value port configuration as described in OpenStack network create port API- Notes:
- The
network_id
key should not be used. Instead, the Port node should be connected to exactly one Network node via a relationship. It will then be placed on that network automatically.
- The
- Notes:
neutron_config
see Misc section - Openstack authentication
Derived From: cloudify.types.network
Properties:
network
key-value network configuration as described in OpenStack network create network APIneutron_config
see Misc section - Openstack authentication
Derived From: cloudify.types.base
Properties:
floatingip
key-value floatingip configuration as described in OpenStack network create floating ip API- Notes:
- a
floating_ip_address
key can be passed for using an existing allocated floating IP. The value is the existing floating IP address.
- a
- Sugaring:
floating_network_name
will automatically resolve the Openstack name of a network into thefloating_network_id
ip
equivalent of thefloating_ip_address
key
- Notes:
neutron_config
see Misc section - Openstack authentication
Description: A relationship for a port to a security group.
Description: A relationship for connecting a subnet to a router.
Description: A relationship for associating a floating ip with a server.
Description: A relationship for connecting a server to a port. Note: This is a marker relationship, and has no operations associated with it. A server will automatically be connected to any port whose node is connected to the server's node with any relationship.
Description: A relationship for associating a floating ip with a port. Note: This is a marker relationship, and has no operations associated with it. A floating ip will automatically be associated with any port whose node is connected to the floating ip's node with any relationship.
This example will show how to use most of the types in this plugin, as well as how to make the relationships between them.
We'll see how to create a server with a security group set on it and a floating_ip associated to it, on a subnet in a network.
{% togglecloak id=1 %} Example I {% endtogglecloak %}
{% gcloak 1 %}
The following is an excerpt from the blueprint's blueprint
.nodes
section:
{% highlight yaml %}
-
name: my_floating_ip type: cloudify.openstack.floatingip properties: floatingip: floating_network_name: Ext-Net
-
name: my_network type: cloudify.openstack.network properties: network: name: my_network_openstack_name
-
name: my_subnet type: cloudify.openstack.subnet properties: subnet: name: my_subnet_openstack_name cidr: 1.2.3.0/24 ip_version: 4 relationships:
- target: my_network type: cloudify.relationships.contained_in
-
name: my_security_group type: cloudify.openstack.security_group properties: security_group: name: my_security_group_openstack_name rules: - remote_ip_prefix: 0.0.0.0/0 port: 8080
-
name: my_server type: cloudify.openstack.server properties:
- server: name: my_server_openstack_name image: 8672f4c6-e33d-46f5-b6d8-ebbeba12fa02 flavor: 101 security_groups: [my_security_group_openstack_name] relationships:
- target: my_network type: cloudify.relationships.connected_to
- target: my_subnet type: cloudify.relationships.depends_on
- target: my_floating_ip type: cloudify.openstack.server_connected_to_floating_ip
- target: my_security_group type: cloudify.relationships.depends_on {%endhighlight%}
Node by node explanation:
-
Creates a floating IP, whose node name is
my_floating_ip
, and whose floating_network_name isExt-Net
(This value represents the name of the external network). -
Creates a network, whose node name is
my_network
, and whose name on Openstack ismy_network_openstack_name
. -
Creates a subnet, whose node name is
my_subnet
, and whose name on Openstack ismy_subnet_openstack_name
. The subnet's address range is defined to be 1.2.3.0 - 1.2.3.255 using thecidr
parameter, and the subnet's IP version is set to version 4. The subnet will be set on themy_network_openstack_name
network because of the relationship to themy_network
node. -
Creates a security_group, whose node name is
my_security_group
, and whose name on Openstack ismy_security_group_openstack_Name
. The security group is set with a single rule, which allows all traffic (since we use the address range0.0.0.0/0
) to port8080
(default direction is ingress). -
Creates a server, whose node name is
my_server
, and whose name on openstack ismy_server_openstack_name
. The server is set with an image and flavor IDs, as well as the security group we defined in step 4. The server is set with multiple relationships:
- A relationship to the
my_network
node: Through this relationship, the server will be automatically placed on themy_network_openstack_name
network. - A relationship to the
my_subnet
node: This relationship is strictly for ensuring the order of creation is correct, as the server requires themy_subnet_openstack_name
subnet to exist before it can be created on it. - A relationship to the
my_floating_ip
node: This designated relationship type will take care of associating the server with the floating IP represented by themy_floating_ip
node. - A relationship with the
my_security_group
node: This relationship is strictly for ensuring the order of creation is correct, as the server requires themy_security_group_openstack_name
security group to exist before it can be set with it. The actual link between the two is done via thesecurity_groups
key of theserver
property, {% endgcloak %}
This example will show how to use the router
and port
types, as well as some of the relationships that were missing from Example I.
We'll see how to create a server connected to a port, where the port is set on a subnet in a network, and has a security group set on it. Finally, we'll see how this subnet connects to a router and from there to the external network.
{% togglecloak id=2 %} Example II {% endtogglecloak %}
{% gcloak 2 %}
The following is an excerpt from the blueprint's blueprint
.nodes
section:
{% highlight yaml %}
-
name: my_network type: cloudify.openstack.network properties: network: name: my_network_openstack_name
-
name: my_security_group type: cloudify.openstack.security_group properties: security_group: name: my_security_group_openstack_name rules: - remote_ip_prefix: 0.0.0.0/0 port: 8080
-
name: my_subnet type: cloudify.openstack.subnet properties: subnet: cidr: 1.2.3.0/24 ip_version: 4 name: my_subnet_openstack_name relationships:
- target: my_network type: cloudify.relationships.contained_in
- target: my_router type: cloudify.openstack.subnet_connected_to_router
-
name: my_port type: cloudify.openstack.port properties: port: name: my_port_openstack_name relationships:
- target: my_network type: cloudify.relationships.contained_in
- target: my_subnet type: cloudify.relationships.depends_on
- target: my_security_group type: cloudify.openstack.port_connected_to_security_group
-
name: my_router type: cloudify.openstack.router properties: router: name: my_router_openstack_Name
-
name: my_server type: cloudify.openstack.server properties:
- server: image: 8672f4c6-e33d-46f5-b6d8-ebbeba12fa02 flavor: 101
- cloudify_agent: user: ubuntu relationships:
- target: my_port type: cloudify.openstack.server_connected_to_port {%endhighlight%}
Node by node explanation:
-
Creates a network. See Example I for more information.
-
Creates a security group. See Example I for more information.
-
Creates a subnet. This is again similar to what we've done in Example I. The difference here is that the subnet has an extra relationship set towards a router.
-
Creates a port, whose node name is
my_port
, and whose name on Openstack ismy_port_openstack_name
. The port is set with multiple relationships:
- A relationship to the
my_network
node: Through this relationship, the port will be automatically placed on themy_network_openstack_name
network. - A relationship to the
my_subnet
node: This relationship is strictly for ensuring the order of creation is correct, as the port requires themy_subnet_openstack_name
subnet to exist before it can be created on it. - A relationship to the
my_security_group
node: This designated relationship type will take care of setting themy_security_group_openstack_name
security group on the port.
-
Creates a router, whose node name is
my_router
, and whose name on Openstack ismy_router_openstack_name
. The router will automatically have an interface in the external network. -
Creates a server, whose node name is
my_server
, and whose name on Openstack is the node's ID (since noname
parameter was supplied under theserver
property). The server is set with an image and flavor IDs. It also overrides thecloudify_agent
property of its parent type to set the username that will be used to connect to the server for installing the Cloudify agent on it. Finally, it is set with a relationship to themy_port
node: This designated relationship type will take care of connecting the server tomy_port_openstack_name
. {% endgcloak %}
If the Cloudify bootstrap was done using the Openstack Provider in the current region, the authentication with Openstack will be taken care of automatically. The plugin does this by using configuration files the Openstack Provider created for it during the Cloudify bootstrap process.
However, if Cloudify bootstrap was done in a different method, or if there's a need to override the credentials and/or region configuration, this can be achieved by either creating these configuration files on the management server manually, or by supplying each object of the types in this plugin with the appropriate nova_config
and/or neutron_config
values, which will override the configuration files values for the authentication process.
The mentioned configuration files are two JSON files, where one holds the credentials and Nova region data, and the other holds the Neutron URL. Specifically, the first file (keystone config) is expected to look like so: {% highlight json %} { "username": "Enter-Openstack-Username-Here", "password": "Enter-Openstack-Password-Here", "tenant_name": "Enter-Openstack-Tenant-Name-Here", "auth_url": "Enter-Openstack-Auth-Url-Here", "region": "Enter-Openstack-Region-Here" } {%endhighlight%} and the second file (neutron config) is expected to look like this: {% highlight json %} { "url": "Enter-Neutron-Url-Here" } {%endhighlight%}
The plugin will look up these files in the following manner:
-
The plugin will look up an environment variable named
KEYSTONE_CONFIG_PATH
, and read the config from the path which is the value of that variable if the variable exists. -
If the variable does not exist, the plugin will resort to try and read the config from
~/keystone_config.json
. If the file not found, an error will be raised.
The same will be applied for the second file, but with the environment variable being named NEUTRON_CONFIG_PATH
, and the default path being ~/neutron_config.json
.
This plugin supports transformation of resource names according to the resources prefix feature. For more information on this feature, visit the CLI guide.