From 948c4fb811246a892d8b2fcb3d6711eb074a6ede Mon Sep 17 00:00:00 2001 From: Ricardo Diaz Date: Wed, 17 Feb 2021 12:41:18 +0100 Subject: [PATCH] M #-: Add Firecracker to oneprovision for packet (#823) Signed-off-by: Ricardo Diaz --- share/oneprovision/ansible/packet.yml | 3 +- .../providers/packet/packet-ams1.yml | 24 ++++++ .../providers/packet/packet-ewr1.yml | 26 +++++++ .../providers/packet/packet-nrt1.yml | 26 +++++++ .../providers/packet/packet-sjc1.yml | 26 +++++++ .../provisions/packet.d/datastores.yml | 46 +++++++++++ .../provisions/packet.d/defaults.yml | 24 ++++++ .../provisions/packet.d/inputs.yml | 38 ++++++++++ .../provisions/packet.d/networks.yml | 40 ++++++++++ .../hybrid+_firecracker/provisions/packet.yml | 76 +++++++++++++++++++ 10 files changed, 328 insertions(+), 1 deletion(-) create mode 100644 share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-ams1.yml create mode 100644 share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-ewr1.yml create mode 100644 share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-nrt1.yml create mode 100644 share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-sjc1.yml create mode 100644 share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/datastores.yml create mode 100644 share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/defaults.yml create mode 100644 share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/inputs.yml create mode 100644 share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/networks.yml create mode 100644 share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.yml diff --git a/share/oneprovision/ansible/packet.yml b/share/oneprovision/ansible/packet.yml index d6d70447d6..abac9e95f3 100644 --- a/share/oneprovision/ansible/packet.yml +++ b/share/oneprovision/ansible/packet.yml @@ -9,7 +9,8 @@ roles: - ddc - opennebula-repository - - opennebula-node-kvm + - { role: opennebula-node-kvm, when: oneprovision_hypervisor == 'kvm' } + - { role: opennebula-node-firecracker, when: oneprovision_hypervisor == 'firecracker' } - opennebula-ssh - role: iptables iptables_base_rules_services: diff --git a/share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-ams1.yml b/share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-ams1.yml new file mode 100644 index 0000000000..5aa2932599 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-ams1.yml @@ -0,0 +1,24 @@ +name: 'packet-amsterdam' + +description: 'Elastic cluster on Packet in Amsterdam' +provider: 'packet' + +plain: + provision_type: 'hybrid+' + image: 'EQUINIX.webp' + +location_key: 'facility' +connection: + token: 'Packet token' + project: 'Packet project' + facility: 'ams1' + +inputs: + - name: 'packet_os' + type: 'list' + options: + - 'centos_8' + - name: 'packet_plan' + type: 'list' + options: + - 'baremetal_0' diff --git a/share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-ewr1.yml b/share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-ewr1.yml new file mode 100644 index 0000000000..fa1135da6b --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-ewr1.yml @@ -0,0 +1,26 @@ +name: 'packet-ewr1' + +description: 'Elastic cluster on Packet in Parsippany, USA, NJ' +provider: 'packet' + +plain: + provision_type: 'hybrid+' + image: 'EQUINIX.webp' + +location_key: 'facility' +connection: + token: 'Packet token' + project: 'Packet project' + facility: 'ewr1' + +inputs: + - name: 'packet_os' + type: 'list' + options: + - 'centos_8' + - name: 'packet_plan' + type: 'list' + options: + - 't1.small' + - 'c1.small' + - 'm1.xlarge' diff --git a/share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-nrt1.yml b/share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-nrt1.yml new file mode 100644 index 0000000000..c4c5388988 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-nrt1.yml @@ -0,0 +1,26 @@ +name: 'packet-nrt1' + +description: 'Elastic cluster on Packet in Tokyo, Japan' +provider: 'packet' + +plain: + provision_type: 'hybrid+' + image: 'EQUINIX.webp' + +location_key: 'facility' +connection: + token: 'Packet token' + project: 'Packet project' + facility: 'nrt1' + +inputs: + - name: 'packet_os' + type: 'list' + options: + - 'centos_8' + - name: 'packet_plan' + type: 'list' + options: + - 't1.small' + - 'c1.small' + - 'm1.xlarge' diff --git a/share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-sjc1.yml b/share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-sjc1.yml new file mode 100644 index 0000000000..09937442f1 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_firecracker/providers/packet/packet-sjc1.yml @@ -0,0 +1,26 @@ +name: 'packet-sjc1' + +description: 'Elastic cluster on Packet in Sunnyvale, USA, CA' +provider: 'packet' + +plain: + provision_type: 'hybrid+' + image: 'EQUINIX.webp' + +location_key: 'facility' +connection: + token: 'Packet token' + project: 'Packet project' + facility: 'sjc1' + +inputs: + - name: 'packet_os' + type: 'list' + options: + - 'centos_8' + - name: 'packet_plan' + type: 'list' + options: + - 't1.small' + - 'c1.small' + - 'm1.xlarge' diff --git a/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/datastores.yml b/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/datastores.yml new file mode 100644 index 0000000000..7dfdf89bc5 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/datastores.yml @@ -0,0 +1,46 @@ +--- +# ---------------------------------------------------------------------------- # +# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems # +# # +# 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. # +# ---------------------------------------------------------------------------- # + +#------------------------------------------------------------------------------- +# datastores: Defines the storage area for the cluster using the SSH replication +# drivers. It creates the following datastores, using Replica driver: +# 1. Image datastore, ${cluster_name}-image +# 2. System datastore, ${cluster_name}-system +# 3. File datastore, ${cluster_name}-files +# +# Configuration/Input attributes: +# - replica_host: The host that will hold the cluster replicas and snapshots. +#------------------------------------------------------------------------------- +datastores: + + - name: "${provision}-image" + type: 'image_ds' + ds_mad: 'fs' + tm_mad: 'ssh' + safe_dirs: "/var/tmp /tmp" + + - name: "${provision}-system" + type: 'system_ds' + tm_mad: 'ssh' + safe_dirs: "/var/tmp /tmp" + replica_host: "use-first-host" + + - name: "${provision}-files" + type: 'file_ds' + ds_mad: 'fs' + tm_mad: 'ssh' + safe_dirs: "/var/tmp /tmp" diff --git a/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/defaults.yml b/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/defaults.yml new file mode 100644 index 0000000000..8b6295f4d8 --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/defaults.yml @@ -0,0 +1,24 @@ +--- +# ---------------------------------------------------------------------------- # +# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems # +# # +# 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. # +# ---------------------------------------------------------------------------- # + +#------------------------------------------------------------------------------- +# defaults: Common configuration attributes for provision objects +#-------------------------------------------------------------------------------- +# configuration: Ansible role parameters. +#-------------------------------------------------------------------------------- +# Check defaults/main.yml in each role for the available variables +#------------------------------------------------------------------------------- diff --git a/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/inputs.yml b/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/inputs.yml new file mode 100644 index 0000000000..2af11a55bc --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/inputs.yml @@ -0,0 +1,38 @@ +--- +# ---------------------------------------------------------------------------- # +# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems # +# # +# 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. # +# ---------------------------------------------------------------------------- # + +inputs: + - name: 'number_hosts' + type: text + description: "Number of metal servers to create" + default: '1' + + - name: 'number_public_ips' + type: text + description: 'Number of public IPs to get' + default: '1' + + - name: 'packet_plan' + type: text + description: "Packet plan (device type)" + default: 'baremetal_0' + + - name: 'packet_os' + type: text + description: "Packet host operating system" + default: 'centos_8' + diff --git a/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/networks.yml b/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/networks.yml new file mode 100644 index 0000000000..f4c5d1ca1f --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.d/networks.yml @@ -0,0 +1,40 @@ +--- +# ---------------------------------------------------------------------------- # +# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems # +# # +# 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. # +# ---------------------------------------------------------------------------- # + +networks: + - name: "${provision}-public" + vn_mad: 'elastic' + bridge: 'br0' + netrole: 'public' + provision: + count: "${input.number_public_ips}" + ar: + - provison_id: "${provision_id}" + size: '1' + packet_ip_type: 'public_ipv4' + ipam_mad: 'packet' + +vntemplates: + - name: "${provision}-private" + vn_mad: 'vxlan' + phydev: 'bond0' + automatic_vlan_id: 'yes' + netrole: 'private' + vxlan_mode: 'evpn' + vxlan_tep: 'dev' + ip_link_conf: 'nolearning=' + cluster_ids: "${cluster.0.id}" diff --git a/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.yml b/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.yml new file mode 100644 index 0000000000..2026c3318b --- /dev/null +++ b/share/oneprovision/provisions/hybrid+_firecracker/provisions/packet.yml @@ -0,0 +1,76 @@ +--- +# ---------------------------------------------------------------------------- # +# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems # +# # +# 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. # +# ---------------------------------------------------------------------------- # + +#------------------------------------------------------------------------------- +# This is the canonical description file for a cluster build with 'Packet' +# resources using the KVM hypervisor. +# ------------------------------------------------------------------------------ + +name: 'packet-cluster' +provision_type: 'hybrid+_firecracker' +provider: 'packet' + +image: 'OPENNEBULA-EQUINIX.png' + +extends: + - common.d/defaults.yml + - common.d/resources.yml + - common.d/firecracker_hosts.yml + - packet.d/defaults.yml + - packet.d/datastores.yml + - packet.d/inputs.yml + - packet.d/networks.yml + +#------------------------------------------------------------------------------- +# playbook: Ansible playbook used for hosts configuration.The packet playbook +# include the following roles: +# - ddc +# - opennebula-repository +# - opennebula-node-kvm +# - opennebula-ssh +# - tuntap +# - bridged-networking +# - iptables +#------------------------------------------------------------------------------- +playbook: + - packet + +#------------------------------------------------------------------------------- +# defaults: Common configuration attributes for provision objects +#-------------------------------------------------------------------------------- +defaults: + provision: + provider_name: 'packet' + plan: "${input.packet_plan}" + os: "${input.packet_os}" + +#------------------------------------------------------------------------------- +# cluster: Parameters for the OpenNebula cluster. Applies to all the Hosts +#-------------------------------------------------------------------------------- +# name: of the cluster +# description: Additional information +# reserved_cpu: In percentage. It will be subtracted from the TOTAL CPU +# reserved_memory: In percentage. It will be subtracted from the TOTAL MEM +#-------------------------------------------------------------------------------- +cluster: + name: "${provision}" + description: 'Packet cluster' + datastores: + - 1 + - 2 + reserved_cpu: '0' + reserved_mem: '0'