-
Notifications
You must be signed in to change notification settings - Fork 5
docs: add VMO cluster deployment DOC-1358 #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
addetz
wants to merge
11
commits into
main
Choose a base branch
from
add-vmo-cluster-doc-1358
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4698a97
docs: add vmo cluster deployment DOC-1358
addetz 56eabe0
Saving-Work
kenheaslip-sc 499a2ed
First PR for initial comments
kenheaslip-sc 43e6159
variables-added
kenheaslip-sc 0b8f638
new variables, validations, and working manifests added.
kenheaslip-sc 8ff7d8f
PR-Review
kenheaslip-sc 50b11bb
Draft-RC1
kenheaslip-sc defb64d
RC2
kenheaslip-sc cd5867f
RC3
kenheaslip-sc 6b9fc27
feat: vmo with terraform
kenheaslip-sc a1b530f
Final-Commit
kenheaslip-sc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cbb0d660a09cc0c47851ef59ac7f0c5fca177371:terraform/vmo-cluster/manifests/k8s-values.yaml:generic-api-key:114 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Deploy and Manage VMs using Palette VMO | ||
|
||
This folder contains the demo code for the [Deploy and Manage VMs using Palette VMO](https://docs.spectrocloud.com/tutorials/vmo/vmo-maas/) tutorial. | ||
|
||
The Terraform code has two main toggle variables that you can use to deploy resources to [Canonical MAAS](https://maas.io/docs). | ||
|
||
| Variable | Provider | Description | Default | | ||
| ---------------- | -------- | ------------------------------------------------- | ------- | | ||
| `deploy-maas` | MAAS | Enable to deploy a cluster to MAAS. | `false` | | ||
| `deploy-maas-vm` | MAAS | Enable to deploy a VM to a deployed MAAS cluster. | `false` | | ||
|
||
|
||
To get started, open the **terraform.tfvars** file. Toggle the provider variable as specified in the table and provide values to your cloud provider variables, replacing all instances of the string `REPLACE_ME`. | ||
|
||
|
||
<!-- BEGIN_TF_DOCS --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.9 | | ||
| <a name="requirement_local"></a> [local](#requirement\_local) | 2.4.1 | | ||
| <a name="requirement_spectrocloud"></a> [spectrocloud](#requirement\_spectrocloud) | 0.23.6 | | ||
| <a name="requirement_tls"></a> [tls](#requirement\_tls) | 4.0.4 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_spectrocloud"></a> [spectrocloud](#provider\_spectrocloud) | 0.23.6 | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [spectrocloud_cluster_maas.maas-cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/0.23.6/docs/resources/cluster_maas) | resource | | ||
| [spectrocloud_cluster_profile.maas-vmo-profile](https://registry.terraform.io/providers/spectrocloud/spectrocloud/0.23.6/docs/resources/cluster_profile) | resource | | ||
| [spectrocloud_virtual_machine.virtual-machine](https://registry.terraform.io/providers/spectrocloud/spectrocloud/0.23.6/docs/resources/virtual_machine) | resource | | ||
| [spectrocloud_cloudaccount_maas.account](https://registry.terraform.io/providers/spectrocloud/spectrocloud/0.23.6/docs/data-sources/cloudaccount_maas) | data source | | ||
| [spectrocloud_cluster.maas_vmo_cluster](https://registry.terraform.io/providers/spectrocloud/spectrocloud/0.23.6/docs/data-sources/cluster) | data source | | ||
| [spectrocloud_pack.maas_cni](https://registry.terraform.io/providers/spectrocloud/spectrocloud/0.23.6/docs/data-sources/pack) | data source | | ||
| [spectrocloud_pack.maas_csi](https://registry.terraform.io/providers/spectrocloud/spectrocloud/0.23.6/docs/data-sources/pack) | data source | | ||
| [spectrocloud_pack.maas_k8s](https://registry.terraform.io/providers/spectrocloud/spectrocloud/0.23.6/docs/data-sources/pack) | data source | | ||
| [spectrocloud_pack.maas_metallb](https://registry.terraform.io/providers/spectrocloud/spectrocloud/0.23.6/docs/data-sources/pack) | data source | | ||
| [spectrocloud_pack.maas_ubuntu](https://registry.terraform.io/providers/spectrocloud/spectrocloud/0.23.6/docs/data-sources/pack) | data source | | ||
| [spectrocloud_pack.maas_vmo](https://registry.terraform.io/providers/spectrocloud/spectrocloud/0.23.6/docs/data-sources/pack) | data source | | ||
| [spectrocloud_registry.public_registry](https://registry.terraform.io/providers/spectrocloud/spectrocloud/0.23.6/docs/data-sources/registry) | data source | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_deploy-maas"></a> [deploy-maas](#input\_deploy-maas) | A flag for enabling a deployment on MAAS. | `bool` | n/a | yes | | ||
| <a name="input_deploy-maas-vm"></a> [deploy-maas-vm](#input\_deploy-maas-vm) | A flag for enabling a VM creation on the MAAS cluster. | `bool` | n/a | yes | | ||
| <a name="input_host-vlans"></a> [host-vlans](#input\_host-vlans) | Node Allowed VLANs | `string` | `"1"` | no | | ||
| <a name="input_maas-control-node-min-cpu"></a> [maas-control-node-min-cpu](#input\_maas-control-node-min-cpu) | Minimum number of CPU cores allocated to the Control Plane node. | `number` | n/a | yes | | ||
| <a name="input_maas-control-node-min-memory-mb"></a> [maas-control-node-min-memory-mb](#input\_maas-control-node-min-memory-mb) | Minimum amount of RAM allocated to the Control Plane node. | `number` | n/a | yes | | ||
| <a name="input_maas-control-plane-azs"></a> [maas-control-plane-azs](#input\_maas-control-plane-azs) | Set of AZs for the MAAS control plane nodes. | `set(string)` | n/a | yes | | ||
| <a name="input_maas-control-plane-node-tags"></a> [maas-control-plane-node-tags](#input\_maas-control-plane-node-tags) | Set of node tags for the MAAS control plane nodes. | `set(string)` | n/a | yes | | ||
| <a name="input_maas-control-plane-resource-pool"></a> [maas-control-plane-resource-pool](#input\_maas-control-plane-resource-pool) | Resource pool for the MAAS control plane nodes. | `string` | n/a | yes | | ||
| <a name="input_maas-domain"></a> [maas-domain](#input\_maas-domain) | MAAS domain | `string` | n/a | yes | | ||
| <a name="input_maas-worker-azs"></a> [maas-worker-azs](#input\_maas-worker-azs) | Set of AZs for the MAAS worker nodes. | `set(string)` | n/a | yes | | ||
| <a name="input_maas-worker-node-min-cpu"></a> [maas-worker-node-min-cpu](#input\_maas-worker-node-min-cpu) | Minimum number of CPU cores allocated to the worker node. | `number` | n/a | yes | | ||
| <a name="input_maas-worker-node-min-memory-mb"></a> [maas-worker-node-min-memory-mb](#input\_maas-worker-node-min-memory-mb) | Minimum amount of RAM allocated to the worker node. | `number` | n/a | yes | | ||
| <a name="input_maas-worker-node-tags"></a> [maas-worker-node-tags](#input\_maas-worker-node-tags) | Set of node tags for the MAAS worker nodes. | `set(string)` | n/a | yes | | ||
| <a name="input_maas-worker-resource-pool"></a> [maas-worker-resource-pool](#input\_maas-worker-resource-pool) | Resource pool for the MAAS worker nodes. | `string` | n/a | yes | | ||
| <a name="input_metallb-ip-pool"></a> [metallb-ip-pool](#input\_metallb-ip-pool) | CIDR notation subnets or IP range ex. 192.168.1.0/24 or 192.168.1.0-192.168.1.255 | `string` | n/a | yes | | ||
| <a name="input_node-network"></a> [node-network](#input\_node-network) | The subnet the Ubuntu nodes will use. | `string` | n/a | yes | | ||
| <a name="input_palette-project"></a> [palette-project](#input\_palette-project) | The name of your project in Palette. | `string` | n/a | yes | | ||
| <a name="input_palette-user-id"></a> [palette-user-id](#input\_palette-user-id) | The name of your project in Palette. | `string` | n/a | yes | | ||
| <a name="input_pcg-name"></a> [pcg-name](#input\_pcg-name) | The name of the PCG that will be used to deploy the cluster. | `string` | n/a | yes | | ||
| <a name="input_tags"></a> [tags](#input\_tags) | The default tags to apply to Palette resources. | `list(string)` | <pre>[<br/> "spectro-cloud-education",<br/> "spectrocloud:tutorials",<br/> "terraform_managed:true",<br/> "tutorial:vmo-cluster-deployment"<br/>]</pre> | no | | ||
| <a name="input_vm-cpu-cores"></a> [vm-cpu-cores](#input\_vm-cpu-cores) | Number of CPU cores to allocate to your VM. | `number` | `1` | no | | ||
| <a name="input_vm-cpu-sockets"></a> [vm-cpu-sockets](#input\_vm-cpu-sockets) | Number of CPU sockets the assigned CPU cores should be spread across. | `number` | `1` | no | | ||
| <a name="input_vm-cpu-threads"></a> [vm-cpu-threads](#input\_vm-cpu-threads) | Number of CPU threads your VM can use. | `number` | `1` | no | | ||
| <a name="input_vm-deploy-name"></a> [vm-deploy-name](#input\_vm-deploy-name) | The namespace where your VMs will be deployed. | `string` | `"vmo-tutorial-vm"` | no | | ||
| <a name="input_vm-deploy-namespace"></a> [vm-deploy-namespace](#input\_vm-deploy-namespace) | The namespace where your VMs will be deployed. | `string` | `"virtual-machines"` | no | | ||
| <a name="input_vm-labels"></a> [vm-labels](#input\_vm-labels) | The labels that will be applied to your VM. | `set(string)` | <pre>[<br/> "vmo-tutorial-vm"<br/>]</pre> | no | | ||
| <a name="input_vm-memory-Gi"></a> [vm-memory-Gi](#input\_vm-memory-Gi) | The amount of storage to provision for your VM in Gi. | `string` | n/a | yes | | ||
| <a name="input_vm-storage-Gi"></a> [vm-storage-Gi](#input\_vm-storage-Gi) | The amount of storage to provision for your VM in Gi. | `string` | n/a | yes | | ||
| <a name="input_vm-vlans"></a> [vm-vlans](#input\_vm-vlans) | VM allowed VLANs. | `string` | `"1"` | no | | ||
| <a name="input_vmo-cluster-name"></a> [vmo-cluster-name](#input\_vmo-cluster-name) | The name of the cluster. | `string` | `"vmo-tutorial-cluster"` | no | | ||
| <a name="input_vmo-network-interface"></a> [vmo-network-interface](#input\_vmo-network-interface) | The host network interface VMO will use for VM traffic. | `string` | `"br0"` | no | | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
<!-- END_TF_DOCS --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
########################## | ||
# MAAS VMO Cluster Profile | ||
########################## | ||
resource "spectrocloud_cluster_profile" "maas-vmo-profile" { | ||
count = var.deploy-maas ? 1 : 0 | ||
|
||
name = "tf-maas-vmo-profile" | ||
description = "A basic cluster profile for MAAS VMO" | ||
tags = concat(var.tags, ["env:maas"]) | ||
cloud = "maas" | ||
type = "cluster" | ||
version = "1.0.0" | ||
|
||
pack { | ||
name = data.spectrocloud_pack.maas_ubuntu.name | ||
tag = data.spectrocloud_pack.maas_ubuntu.version | ||
uid = data.spectrocloud_pack.maas_ubuntu.id | ||
values = templatefile("manifests/ubuntu-values.yaml", { | ||
node-network = var.node-network | ||
}) | ||
type = "spectro" | ||
} | ||
|
||
pack { | ||
name = data.spectrocloud_pack.maas_k8s.name | ||
tag = data.spectrocloud_pack.maas_k8s.version | ||
uid = data.spectrocloud_pack.maas_k8s.id | ||
values = file("manifests/k8s-values.yaml") | ||
type = "spectro" | ||
} | ||
|
||
pack { | ||
name = data.spectrocloud_pack.maas_cni.name | ||
tag = data.spectrocloud_pack.maas_cni.version | ||
uid = data.spectrocloud_pack.maas_cni.id | ||
values = file("manifests/cni-values.yaml") | ||
type = "spectro" | ||
} | ||
|
||
pack { | ||
name = data.spectrocloud_pack.maas_csi.name | ||
tag = data.spectrocloud_pack.maas_csi.version | ||
uid = data.spectrocloud_pack.maas_csi.id | ||
values = file("manifests/csi-values.yaml") | ||
type = "spectro" | ||
} | ||
|
||
pack { | ||
name = data.spectrocloud_pack.maas_metallb.name | ||
tag = data.spectrocloud_pack.maas_metallb.version | ||
uid = data.spectrocloud_pack.maas_metallb.id | ||
values = templatefile("manifests/metallb-values.yaml", { | ||
metallb-ip-pool = var.metallb-ip-pool | ||
}) | ||
kenheaslip-sc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type = "spectro" | ||
} | ||
|
||
pack { | ||
name = data.spectrocloud_pack.maas_vmo.name | ||
tag = data.spectrocloud_pack.maas_vmo.version | ||
uid = data.spectrocloud_pack.maas_vmo.id | ||
values = templatefile("manifests/vmo-values.yaml", { | ||
vmo-network-interface = var.vmo-network-interface, | ||
vm-vlans = var.vm-vlans, | ||
host-vlans = var.host-vlans | ||
}) | ||
kenheaslip-sc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type = "spectro" | ||
} | ||
|
||
pack { | ||
name = "vmo-extras" | ||
type = "manifest" | ||
tag = "1.0.0" | ||
values = file("manifests/vmo-extras-values.yaml") | ||
manifest { | ||
name = "vmo-extras" | ||
content = templatefile("manifests/vmo-extras-manifest.yaml", { | ||
palette-user-id = var.palette-user-id | ||
}) | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright (c) Spectro Cloud | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
################ | ||
# MAAS Cluster | ||
################ | ||
|
||
resource "spectrocloud_cluster_maas" "maas-cluster" { | ||
count = var.deploy-maas ? 1 : 0 | ||
|
||
name = "vmo-tutorial-cluster" | ||
tags = concat(var.tags, ["env:maas"]) | ||
cloud_account_id = data.spectrocloud_cloudaccount_maas.account[0].id | ||
pause_agent_upgrades = "unlock" | ||
|
||
cloud_config { | ||
domain = var.maas-domain | ||
} | ||
|
||
cluster_profile { | ||
id = resource.spectrocloud_cluster_profile.maas-vmo-profile[0].id | ||
} | ||
|
||
machine_pool { | ||
name = "maas-control-plane" | ||
count = 1 | ||
control_plane = true | ||
azs = var.maas-control-plane-azs | ||
node_tags = var.maas-control-plane-node-tags | ||
instance_type { | ||
min_cpu = var.maas-control-node-min-cpu | ||
min_memory_mb = var.maas-control-node-min-memory-mb | ||
} | ||
placement { | ||
resource_pool = var.maas-control-plane-resource-pool | ||
} | ||
} | ||
|
||
machine_pool { | ||
name = "maas-worker-basic" | ||
count = 1 | ||
azs = var.maas-worker-azs | ||
node_tags = var.maas-worker-node-tags | ||
instance_type { | ||
min_cpu = var.maas-worker-node-min-cpu | ||
min_memory_mb = var.maas-worker-node-min-memory-mb | ||
} | ||
placement { | ||
resource_pool = var.maas-worker-resource-pool | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright (c) Spectro Cloud | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
######################################## | ||
# Data resources for the cluster profile | ||
######################################## | ||
data "spectrocloud_registry" "public_registry" { | ||
name = "Public Repo" | ||
} | ||
|
||
data "spectrocloud_cloudaccount_maas" "account" { | ||
count = var.deploy-maas ? 1 : 0 | ||
name = var.pcg-name | ||
} | ||
|
||
data "spectrocloud_pack" "maas_ubuntu" { | ||
name = "ubuntu-maas" | ||
version = "22.04" | ||
registry_uid = data.spectrocloud_registry.public_registry.id | ||
} | ||
|
||
data "spectrocloud_pack" "maas_k8s" { | ||
name = "kubernetes" | ||
version = "1.32.2" | ||
registry_uid = data.spectrocloud_registry.public_registry.id | ||
} | ||
|
||
data "spectrocloud_pack" "maas_cni" { | ||
name = "cni-cilium-oss" | ||
version = "1.17.1" | ||
registry_uid = data.spectrocloud_registry.public_registry.id | ||
} | ||
|
||
data "spectrocloud_pack" "maas_csi" { | ||
name = "csi-rook-ceph-helm" | ||
version = "1.16.3" | ||
registry_uid = data.spectrocloud_registry.public_registry.id | ||
} | ||
|
||
data "spectrocloud_pack" "maas_metallb" { | ||
name = "lb-metallb-helm" | ||
version = "0.14.9" | ||
registry_uid = data.spectrocloud_registry.public_registry.id | ||
} | ||
|
||
data "spectrocloud_pack" "maas_vmo" { | ||
name = "virtual-machine-orchestrator" | ||
version = "4.6.3" | ||
registry_uid = data.spectrocloud_registry.public_registry.id | ||
} | ||
|
||
data "spectrocloud_cluster" "maas_vmo_cluster" { | ||
count = var.deploy-maas-vm ? 1 : 0 | ||
depends_on = [spectrocloud_cluster_maas.maas-cluster] | ||
addetz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name = "vmo-tutorial-cluster" | ||
context = "project" | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.