summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdan Dobrelya <bdobreli@redhat.com>2017-10-17 10:12:59 +0200
committerGitHub <noreply@github.com>2017-10-17 10:12:59 +0200
commite89bd6b1cb32ad52f0109f80022e801943b51893 (patch)
tree2889d6ae935633c682819d4647252bfcc22203da
parentc0cf9c78786745bca2fd4b9abf81f1ad6fb55ddd (diff)
downloadopenshift-e89bd6b1cb32ad52f0109f80022e801943b51893.tar.gz
openshift-e89bd6b1cb32ad52f0109f80022e801943b51893.tar.bz2
openshift-e89bd6b1cb32ad52f0109f80022e801943b51893.tar.xz
openshift-e89bd6b1cb32ad52f0109f80022e801943b51893.zip
[WIP] Merge server with nofloating server heat templates (#761)
Merge server with nofloating server heat templates
-rw-r--r--roles/openstack-stack/tasks/generate-templates.yml6
-rw-r--r--roles/openstack-stack/templates/heat_stack.yaml.j242
-rw-r--r--roles/openstack-stack/templates/heat_stack_server.yaml.j212
-rw-r--r--roles/openstack-stack/templates/heat_stack_server_nofloating.yaml.j2225
4 files changed, 35 insertions, 250 deletions
diff --git a/roles/openstack-stack/tasks/generate-templates.yml b/roles/openstack-stack/tasks/generate-templates.yml
index 110da8444..0ff50a095 100644
--- a/roles/openstack-stack/tasks/generate-templates.yml
+++ b/roles/openstack-stack/tasks/generate-templates.yml
@@ -20,12 +20,6 @@
src: heat_stack_server.yaml.j2
dest: "{{ stack_template_pre.path }}/server.yaml"
-- name: generate HOT server w/o floating IPs template from jinja2 template
- template:
- src: heat_stack_server_nofloating.yaml.j2
- dest: "{{ stack_template_pre.path }}/server_nofloating.yaml"
- when: use_bastion|bool
-
- name: generate user_data from jinja2 template
template:
src: user_data.j2
diff --git a/roles/openstack-stack/templates/heat_stack.yaml.j2 b/roles/openstack-stack/templates/heat_stack.yaml.j2
index 1f1e33cf2..a69b7fc00 100644
--- a/roles/openstack-stack/templates/heat_stack.yaml.j2
+++ b/roles/openstack-stack/templates/heat_stack.yaml.j2
@@ -71,6 +71,9 @@ outputs:
value: { get_attr: [ dns, private_ip ] }
{% endif %}
+conditions:
+ no_floating: {% if provider_network or use_bastion|bool %}true{% else %}false{% endif %}
+
resources:
{% if not provider_network %}
@@ -504,11 +507,7 @@ resources:
properties:
count: {{ num_etcd }}
resource_def:
-{% if use_bastion|bool %}
- type: server_nofloating.yaml
-{% else %}
type: server.yaml
-{% endif %}
properties:
name:
str_replace:
@@ -543,8 +542,13 @@ resources:
secgrp:
- { get_resource: {% if openstack_flat_secgrp|default(False)|bool %}flat-secgrp{% else %}etcd-secgrp{% endif %} }
- { get_resource: common-secgrp }
-{% if not use_bastion|bool and not provider_network %}
- floating_network: {{ external_network }}
+ floating_network:
+ if:
+ - no_floating
+ - null
+ - {{ external_network }}
+{% if use_bastion|bool or provider_network %}
+ attach_float_net: false
{% endif %}
volume_size: {{ etcd_volume_size }}
{% if not provider_network %}
@@ -622,11 +626,7 @@ resources:
properties:
count: {{ num_masters }}
resource_def:
-{% if use_bastion|bool %}
- type: server_nofloating.yaml
-{% else %}
type: server.yaml
-{% endif %}
properties:
name:
str_replace:
@@ -674,8 +674,13 @@ resources:
{% endif %}
{% endif %}
- { get_resource: common-secgrp }
-{% if not use_bastion|bool and not provider_network %}
- floating_network: {{ external_network }}
+ floating_network:
+ if:
+ - no_floating
+ - null
+ - {{ external_network }}
+{% if use_bastion|bool or provider_network %}
+ attach_float_net: false
{% endif %}
volume_size: {{ master_volume_size }}
{% if master_server_group_policies|length > 0 %}
@@ -694,11 +699,7 @@ resources:
removal_policies:
- resource_list: {{ nodes_to_remove }}
resource_def:
-{% if use_bastion|bool %}
- type: server_nofloating.yaml
-{% else %}
type: server.yaml
-{% endif %}
properties:
name:
str_replace:
@@ -743,8 +744,13 @@ resources:
secgrp:
- { get_resource: {% if openstack_flat_secgrp|default(False)|bool %}flat-secgrp{% else %}node-secgrp{% endif %} }
- { get_resource: common-secgrp }
-{% if not use_bastion|bool and not provider_network %}
- floating_network: {{ external_network }}
+ floating_network:
+ if:
+ - no_floating
+ - null
+ - {{ external_network }}
+{% if use_bastion|bool or provider_network %}
+ attach_float_net: false
{% endif %}
volume_size: {{ node_volume_size }}
{% if not provider_network %}
diff --git a/roles/openstack-stack/templates/heat_stack_server.yaml.j2 b/roles/openstack-stack/templates/heat_stack_server.yaml.j2
index 6552e0a0d..9ffe721a5 100644
--- a/roles/openstack-stack/templates/heat_stack_server.yaml.j2
+++ b/roles/openstack-stack/templates/heat_stack_server.yaml.j2
@@ -95,9 +95,17 @@ parameters:
label: Security groups
description: Security group resources
+ attach_float_net:
+ type: boolean
+ default: true
+
+ label: Attach-float-net
+ description: A switch for floating network port connection
+
{% if not provider_network %}
floating_network:
type: string
+ default: ''
label: Floating network
description: Network to allocate floating IP from
{% endif %}
@@ -155,8 +163,9 @@ outputs:
{% endif %}
- addr
-{% if openshift_use_flannel|default(False)|bool %}
conditions:
+ no_floating: {not: { get_param: attach_float_net} }
+{% if openshift_use_flannel|default(False)|bool %}
no_data_subnet: {not: { get_param: attach_data_net} }
{% endif %}
@@ -238,6 +247,7 @@ resources:
{% if not provider_network %}
floating-ip:
+ condition: { not: no_floating }
type: OS::Neutron::FloatingIP
properties:
floating_network: { get_param: floating_network }
diff --git a/roles/openstack-stack/templates/heat_stack_server_nofloating.yaml.j2 b/roles/openstack-stack/templates/heat_stack_server_nofloating.yaml.j2
deleted file mode 100644
index 742d53649..000000000
--- a/roles/openstack-stack/templates/heat_stack_server_nofloating.yaml.j2
+++ /dev/null
@@ -1,225 +0,0 @@
-heat_template_version: 2016-10-14
-
-description: OpenShift cluster server w/o floating IP
-
-parameters:
-
- name:
- type: string
- label: Name
- description: Name
-
- group:
- type: string
- label: Host Group
- description: The Primary Ansible Host Group
- default: host
-
- cluster_env:
- type: string
- label: Cluster environment
- description: Environment of the cluster
-
- cluster_id:
- type: string
- label: Cluster ID
- description: Identifier of the cluster
-
- type:
- type: string
- label: Type
- description: Type master or node
-
- subtype:
- type: string
- label: Sub-type
- description: Sub-type compute or infra for nodes, default otherwise
- default: default
-
- key_name:
- type: string
- label: Key name
- description: Key name of keypair
-
- image:
- type: string
- label: Image
- description: Name of the image
-
- flavor:
- type: string
- label: Flavor
- description: Name of the flavor
-
- net:
- type: string
- label: Net ID
- description: Net resource
-
- net_name:
- type: string
- label: Net name
- description: Net name
-
- subnet:
- type: string
- label: Subnet ID
- description: Subnet resource
-
-{% if openshift_use_flannel|default(False)|bool %}
- attach_data_net:
- type: boolean
- default: false
- label: Attach-data-net
- description: A switch for data port connection
-
- data_net:
- type: string
- default: ''
- label: Net ID
- description: Net resource
-
- data_subnet:
- type: string
- default: ''
- label: Subnet ID
- description: Subnet resource
-{% endif %}
-
- secgrp:
- type: comma_delimited_list
- label: Security groups
- description: Security group resources
-
- availability_zone:
- type: string
- description: The Availability Zone to launch the instance.
- default: nova
-
- volume_size:
- type: number
- description: Size of the volume to be created.
- default: 1
- constraints:
- - range: { min: 1, max: 1024 }
- description: must be between 1 and 1024 Gb.
-
- node_labels:
- type: json
- description: OpenShift Node Labels
- default: {"region": "default" }
-
- scheduler_hints:
- type: json
- description: Server scheduler hints.
- default: {}
-
-outputs:
-
- name:
- description: Name of the server
- value: { get_attr: [ server_nofloating, name ] }
-
- private_ip:
- description: Private IP of the server
- value:
- get_attr:
- - server_nofloating
- - addresses
- - { get_param: net_name }
- - 0
- - addr
-
-{% if openshift_use_flannel|default(False)|bool %}
-conditions:
- no_data_subnet: {not: { get_param: attach_data_net} }
-{% endif %}
-
-resources:
-
- server_nofloating:
- type: OS::Nova::Server
- properties:
- name: { get_param: name }
- key_name: { get_param: key_name }
- image: { get_param: image }
- flavor: { get_param: flavor }
- networks:
-{% if openshift_use_flannel|default(False)|bool %}
- if:
- - no_data_subnet
-{% if use_trunk_ports|default(false)|bool %}
- - - port: { get_attr: [trunk-port, port_id] }
-{% else %}
- - - port: { get_resource: port }
-{% endif %}
-{% if use_trunk_ports|default(false)|bool %}
- - - port: { get_attr: [trunk-port, port_id] }
-{% else %}
- - - port: { get_resource: port }
- - port: { get_resource: data_port }
-{% endif %}
-
-{% else %}
-{% if use_trunk_ports|default(false)|bool %}
- - port: { get_attr: [trunk-port, port_id] }
-{% else %}
- - port: { get_resource: port }
-{% endif %}
-{% endif %}
- user_data:
- get_file: user-data
- user_data_format: RAW
- user_data_update_policy: IGNORE
- metadata:
- group: { get_param: group }
- environment: { get_param: cluster_env }
- clusterid: { get_param: cluster_id }
- host-type: { get_param: type }
- sub-host-type: { get_param: subtype }
- node_labels: { get_param: node_labels }
- scheduler_hints: { get_param: scheduler_hints }
-
-{% if use_trunk_ports|default(false)|bool %}
- trunk-port:
- type: OS::Neutron::Trunk
- properties:
- name: { get_param: name }
- port: { get_resource: port }
-{% endif %}
-
- port:
- type: OS::Neutron::Port
- properties:
- network: { get_param: net }
- fixed_ips:
- - subnet: { get_param: subnet }
- security_groups: { get_param: secgrp }
-
-{% if openshift_use_flannel|default(False)|bool %}
- data_port:
- type: OS::Neutron::Port
- condition: { not: no_data_subnet }
- properties:
- network: { get_param: data_net }
- port_security_enabled: false
-{% if not provider_network %}
- fixed_ips:
- - subnet: { get_param: data_subnet }
-{% endif %}
-{% endif %}
-
-{% if not ephemeral_volumes|default(false)|bool %}
- cinder_volume:
- type: OS::Cinder::Volume
- properties:
- size: { get_param: volume_size }
- availability_zone: { get_param: availability_zone }
-
- volume_attachment:
- type: OS::Cinder::VolumeAttachment
- properties:
- volume_id: { get_resource: cinder_volume }
- instance_uuid: { get_resource: server_nofloating }
- mountpoint: /dev/sdb
-{% endif %}