I'm using Openstack Heat with Juno release and I'm facing a problem.
I want to use AutoScalingGroup that will creates automatically some instances in a particular subnet. My Network topologie is one Network with many Subnets (each tiers is on its own subnet).
But this seems to be not possible with Juno release because we can't specify the subnet parameter in OS::Nova::Server / networks. The doc is here : http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Nova::Server-prop-networks-*-subnet
I wonder if someone have a workaround for this limitation in Juno.
When creating a standalone server it is possible to specify a OS::Neutron::Port with a reference to a subnet. But I can't find how to do that with AutoScaling.
Many thank's in advance,
J.M.
EDIT : The current stack. It works only with one server cause Port is created outside of OS:Heat::AutoScalingGroup
resources:
instance_port:
type: OS::Neutron::Port
properties:
name: { get_param : portName }
network_id: { get_param: networkId }
fixed_ips:
- subnet_id: { get_param: subnetId }
security_groups: { get_param: securityGroups }
asg_group:
depends_on: [ instance_port ]
type: OS::Heat::AutoScalingGroup
properties:
...
resource:
type: OS::Nova::Server
properties:
name: { get_param: asgName }
....
networks:
# TODO assign direct IP to the right subnet by decommenting this line. Will be available in Liberty
#- subnet: { get_param: subnetId } /!\ doesn't work in Juno
- port: { get_resource : instance-port } /!\ Works only with one server
A solution is to use nested stack with feature describe here : http://docs.openstack.org/developer/heat/template_guide/composition.html#define-a-new-resource-type
You have a nested stack with Port and Server and reference this stack into main stack. Example : mainstack
resources:
asg_group:
type: OS::Heat::AutoScalingGroup
properties:
min_size: { get_param: min }
desired_capacity: { get_param: desired }
max_size: { get_param: max }
rolling_updates: {"max_batch_size": 1, "min_in_service": 2, "pause_time": 60}
resource:
type: "lib::AsgInstance"
properties:
appli: { get_param: appli }
nested stack :
resources:
instance-port:
type: OS::Neutron::Port
properties:
name: { get_param : portName }
network_id: { get_param: networkId }
fixed_ips:
- subnet_id: { get_param: subnetId }
security_groups: { get_param: securityGroups }
instance:
type: OS::Nova::Server
properties:
name: { get_param: instanceName }
key_name: { get_param: keyName }
image: { get_param: imageName }
flavor: { get_param: flavorName }
networks:
# TODO assign direct IP to the right subnet by decommenting this line. Will be available in Liberty
#- subnet: { get_param: subnetId }
- port: { get_resource : instance-port }
and environment file :
resource_registry:
"lib::AsgInstance": lib/nestedstack.yaml