blob: d4a97f4ce8ed4531d8cac18309e2497bec9980f7 [file] [log] [blame]
---
# ============LICENSE_START=======================================================
# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
heat_template_version: pike
description: Kubespray cluster template to deploy ONAP
parameters:
# parameteres for jumphost instance
jumphost_image:
type: string
label: Image name or ID
description: Image to use for jumphost instance
jumphost_flavor:
type: string
label: Flavor
description: Flavor to use for jumphost instance
jumphost_volume_size:
type: string
label: Volume size of the jumphost
description: Size of the volume
default: 0
# parameters for master instances
no_of_master_nodes:
type: number
label: No of k8s master nodes
description: Number of master nodes in cluster
master_image:
type: string
label: Image name or ID
description: Image to use for master instances
master_flavor:
type: string
label: Flavor
description: Flavor to use for master instances
master_volume_size:
type: string
label: Volume size of the master nodes
description: Size of the volume
default: 0
# parameters for worker instances
no_of_worker_nodes:
type: number
label: No of k8s worker nodes
description: Number of worker nodes in cluster
worker_image:
type: string
label: Image name or ID
description: Image to use for worker instances
worker_flavor:
type: string
label: Flavor
description: Flavor to use for worker instances
worker_volume_size:
type: string
label: Volume size of the worker nodes
description: Size of the volume
default: 0
# common parameters
keypair:
type: string
label: Key name
description: Keypair to use for instances
public_network:
type: string
label: Public Network
description: Public network
dns_nameservers:
type: comma_delimited_list
label: DNS nameservers
description: DNS nameservers
use_tenant_network:
type: boolean
label: Use private tenant network or not
description: Use private tenant network or public flat
default: true
conditions:
use_private_network: {equals: [{get_param: use_tenant_network}, true]}
resources:
# create external security group
external_security_group:
type: OS::Neutron::SecurityGroup
properties:
name:
list_join: ['.', ['external-sg', {get_param: 'OS::stack_name'}]]
description: |
Security Group to place jumphost in
rules: [
{
remote_ip_prefix: 0.0.0.0/0,
protocol: tcp,
port_range_min: 22,
port_range_max: 22
}
]
# create internal security group
internal_security_group:
type: OS::Neutron::SecurityGroup
properties:
name:
list_join: ['.', ['internal-sg', {get_param: 'OS::stack_name'}]]
description: |
Security Group to place jumphost and cluster instances in
rules: [
{
remote_ip_prefix: 0.0.0.0/0,
direction: ingress,
protocol: icmp
}
]
# create tcp security group rule for internal_security_group
internal_security_group_rule_tcp:
type: OS::Neutron::SecurityGroupRule
properties:
security_group: {get_resource: internal_security_group}
remote_group: {get_resource: internal_security_group}
direction: ingress
protocol: tcp
# create udp security group rule for internal_security_group
internal_security_group_rule_udp:
type: OS::Neutron::SecurityGroupRule
properties:
security_group: {get_resource: internal_security_group}
remote_group: {get_resource: internal_security_group}
direction: ingress
protocol: udp
# create private network subnet
private_network:
type: OS::Neutron::Net
properties:
name:
list_join: ['.', ['network', {get_param: 'OS::stack_name'}]]
private_subnet:
type: OS::Neutron::Subnet
properties:
name:
list_join: ['.', ['subnet', {get_param: 'OS::stack_name'}]]
network_id: {get_resource: private_network}
cidr: 10.1.0.0/24
dns_nameservers: {get_param: dns_nameservers}
router:
type: OS::Neutron::Router
properties:
name:
list_join: ['.', ['router', {get_param: 'OS::stack_name'}]]
external_gateway_info:
network: {get_param: public_network}
router_interface:
type: OS::Neutron::RouterInterface
properties:
router_id: {get_resource: router}
subnet: {get_resource: private_subnet}
# create jumphost
jumphost:
type: OS::Heat::ResourceGroup
properties:
resource_def:
type: heat-jumphost.yaml
properties:
instance_name:
list_join: ['.', ['jumphost', {get_param: 'OS::stack_name'}]]
image: {get_param: jumphost_image}
flavor: {get_param: jumphost_flavor}
volume_size: {get_param: jumphost_volume_size}
keypair: {get_param: keypair}
private_network: {get_resource: private_network}
public_network: {get_param: public_network}
internal_security_group: {get_resource: internal_security_group}
external_security_group: {get_resource: external_security_group}
depends_on:
- router_interface
# create master nodes
master_nodes:
type: OS::Heat::ResourceGroup
properties:
count: {get_param: no_of_master_nodes}
resource_def:
type: heat-server.yaml
properties:
instance_name:
list_join: ['.', ['master%index%', {get_param: 'OS::stack_name'}]]
image: {get_param: master_image}
flavor: {get_param: master_flavor}
volume_size: {get_param: master_volume_size}
keypair: {get_param: keypair}
private_network: {get_resource: private_network}
public_network: {get_param: public_network}
internal_security_group: {get_resource: internal_security_group}
external_security_group: {get_resource: external_security_group}
use_network: {if: ["use_private_network", "private", "public"]}
# create worker nodes
worker_nodes:
type: OS::Heat::ResourceGroup
properties:
count: {get_param: no_of_worker_nodes}
resource_def:
type: heat-server.yaml
properties:
instance_name:
list_join: ['.', ['worker%index%', {get_param: 'OS::stack_name'}]]
image: {get_param: worker_image}
flavor: {get_param: worker_flavor}
volume_size: {get_param: worker_volume_size}
keypair: {get_param: keypair}
private_network: {get_resource: private_network}
public_network: {get_param: public_network}
internal_security_group: {get_resource: internal_security_group}
external_security_group: {get_resource: external_security_group}
use_network: {if: ["use_private_network", "private", "public"]}
outputs:
jumphost_public_ip:
value: {get_attr: [jumphost, instance_public_ip]}
jumphost_private_ip:
value: {get_attr: [jumphost, instance_private_ip]}
master_private_ip:
value: {get_attr: [master_nodes, instance_private_ip]}
worker_private_ip:
value: {get_attr: [worker_nodes, instance_private_ip]}
# vim: set ts=2 sw=2 expandtab: