diff --git a/examples/tf-aws/launchpad/.terraform.lock.hcl b/examples/tf-aws/launchpad/.terraform.lock.hcl index d0cd8720..07a86279 100644 --- a/examples/tf-aws/launchpad/.terraform.lock.hcl +++ b/examples/tf-aws/launchpad/.terraform.lock.hcl @@ -2,81 +2,81 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/aws" { - version = "5.63.1" + version = "5.74.0" constraints = ">= 5.46.0, >= 5.55.0" hashes = [ - "h1:rrw/8ysju1jb5FrNr/1G336KL8njvW1BkcU2BUxtFMU=", - "zh:093adc21714d264005f66002464f4e9f48d6759adaaa88ca32db0c1134c2ca2b", - "zh:15505e01889d8da3e569ae3a8300cf12e8853822a5909a54eb07cf57f17daa74", - "zh:1c64ea9ab2c4a46a2e6eeafa4069106c1d9208aa2823264e58e826049b9417f7", - "zh:1ca7e98446f519f08ad684928b8bc22d480e419b6210955af8a31730d8dbc5ad", - "zh:3bd8fe53647e17fadcfe13536160009e4bb77e1c2fe224e991c82fb228ab4ece", - "zh:68d4bd6ffba3c6484c228a1756b1c7c16802ebd58a20b8d6bfb547d96a2eaa69", - "zh:68fbabfc04bde3655ded9919f5954ab8884a35d265d41aec53f95804e741ca7c", - "zh:69c2ea737c1cfb7252f22ca7a50d8cc7a4729ea288fc3833933c2380023ca605", - "zh:796caec3b4e8d177e5e4787d7b61a8a541993edc33db2c3ffffdfdbbad3967b5", - "zh:877a02805e1b4503b4e174a34084055873619af9d9e57e7098c27d0e0be0b592", + "h1:HMaN/L2hf1PN2YLdlQRbE49f4RF7VuqEVpqxNtJ2+18=", + "zh:1e2d65add4d63af5b396ae33d55c48303eca6c86bd1be0f6fae13267a9b47bc4", + "zh:20ddec3dac3d06a188f12e58b6428854949b1295e937c5d4dca4866dc1c937af", + "zh:35b72de4e6a3e3d69efc07184fb413406262fe447b2d82d57eaf8c787a068a06", + "zh:44eada24a50cd869aadc4b29f9e791fdf262d7f426921e9ac2893bbb86013176", + "zh:455e666e3a9a2312b3b9f434b87a404b6515d64a8853751e20566a6548f9df9e", + "zh:58b3ae74abfca7b9b61f42f0c8b10d97f9b01aff18bd1d4ab091129c9d203707", + "zh:840a8a32d5923f9e7422f9c80d165c3f89bb6ea370b8283095081e39050a8ea8", + "zh:87cb6dbbdbc1b73bdde4b8b5d6d780914a3e8f1df0385da4ea7323dc1a68468f", + "zh:8b8953e39b0e6e6156c5570d1ca653450bfa0d9b280e2475f01ee5c51a6554db", "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:d37f14e0807d73eff3a8384d694b4e770d41ae3286b5195927d9d809076a2d68", - "zh:e45279ca14b28647ac26dc8ca87f67da994f961e92ad316c9bc71be922c0a3fb", - "zh:e63eb4cc5b78319a26120bdce985f44ac4b1e71e43abac0eca4eaceb0af570f5", - "zh:f5c12695fcd777825434aa7aa560b6e1d851f823d75fda7c9df5c177071720a5", + "zh:9bd750262e2fb0187a8420a561e55b0a1da738f690f53f5c7df170cb1f380459", + "zh:9d2474c1432dfa5e1db197e2dd6cd61a6a15452e0bc7acd09ca86b3cdb228871", + "zh:b763ecaf471c7737a5c6e4cf257b5318e922a6610fd83b36ed8eb68582a8642e", + "zh:c1344cd8fe03ff7433a19b14b14a1898c2ca5ba22a468fb8e1687f0a7f564d52", + "zh:dc0e0abf3be7402d0d022ced82816884356115ed27646df9c7222609e96840e6", ] } provider "registry.terraform.io/hashicorp/local" { - version = "2.5.1" + version = "2.5.2" hashes = [ - "h1:8oTPe2VUL6E2d3OcrvqyjI4Nn/Y/UEQN26WLk5O/B0g=", - "zh:0af29ce2b7b5712319bf6424cb58d13b852bf9a777011a545fac99c7fdcdf561", - "zh:126063ea0d79dad1f68fa4e4d556793c0108ce278034f101d1dbbb2463924561", - "zh:196bfb49086f22fd4db46033e01655b0e5e036a5582d250412cc690fa7995de5", - "zh:37c92ec084d059d37d6cffdb683ccf68e3a5f8d2eb69dd73c8e43ad003ef8d24", - "zh:4269f01a98513651ad66763c16b268f4c2da76cc892ccfd54b401fff6cc11667", - "zh:51904350b9c728f963eef0c28f1d43e73d010333133eb7f30999a8fb6a0cc3d8", - "zh:73a66611359b83d0c3fcba2984610273f7954002febb8a57242bbb86d967b635", + "h1:JlMZD6nYqJ8sSrFfEAH0Vk/SL8WLZRmFaMUF9PJK5wM=", + "zh:136299545178ce281c56f36965bf91c35407c11897f7082b3b983d86cb79b511", + "zh:3b4486858aa9cb8163378722b642c57c529b6c64bfbfc9461d940a84cd66ebea", + "zh:4855ee628ead847741aa4f4fc9bed50cfdbf197f2912775dd9fe7bc43fa077c0", + "zh:4b8cd2583d1edcac4011caafe8afb7a95e8110a607a1d5fb87d921178074a69b", + "zh:52084ddaff8c8cd3f9e7bcb7ce4dc1eab00602912c96da43c29b4762dc376038", + "zh:71562d330d3f92d79b2952ffdda0dad167e952e46200c767dd30c6af8d7c0ed3", "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:7ae387993a92bcc379063229b3cce8af7eaf082dd9306598fcd42352994d2de0", - "zh:9e0f365f807b088646db6e4a8d4b188129d9ebdbcf2568c8ab33bddd1b82c867", - "zh:b5263acbd8ae51c9cbffa79743fbcadcb7908057c87eb22fd9048268056efbc4", - "zh:dfcd88ac5f13c0d04e24be00b686d069b4879cc4add1b7b1a8ae545783d97520", + "zh:805f81ade06ff68fa8b908d31892eaed5c180ae031c77ad35f82cb7a74b97cf4", + "zh:8b6b3ebeaaa8e38dd04e56996abe80db9be6f4c1df75ac3cccc77642899bd464", + "zh:ad07750576b99248037b897de71113cc19b1a8d0bc235eb99173cc83d0de3b1b", + "zh:b9f1c3bfadb74068f5c205292badb0661e17ac05eb23bfe8bd809691e4583d0e", + "zh:cc4cbcd67414fefb111c1bf7ab0bc4beb8c0b553d01719ad17de9a047adff4d1", ] } provider "registry.terraform.io/hashicorp/time" { - version = "0.12.0" + version = "0.12.1" hashes = [ - "h1:YV9bUZSUihGBKuwqNmRnm4wKQf11pr3hnYcarpoPoQQ=", - "zh:019a4c09af254ef80b72cf0d843dfe72d99483e227138cf5b514a1b9977ab4c3", - "zh:0ae310ec740ebc6f275529507d60bb747d0bf39e72fc5a2fa90d74486006132c", - "zh:13d6aec117f05237fbf8c7d91d6ebb19797b00aa87e7a812642d3ea4738a394e", - "zh:2e87abbc261f9317d0c2ef26e01d5fabf77679da7d2cac6f47df7d198f720989", - "zh:4a6d471176ce0264455aa7d5457b8702f78400010c201c1719708958a1b7b647", + "h1:6BhxSYBJdBBKyuqatOGkuPKVenfx6UmLdiI13Pb3his=", + "zh:090023137df8effe8804e81c65f636dadf8f9d35b79c3afff282d39367ba44b2", + "zh:26f1e458358ba55f6558613f1427dcfa6ae2be5119b722d0b3adb27cd001efea", + "zh:272ccc73a03384b72b964918c7afeb22c2e6be22460d92b150aaf28f29a7d511", + "zh:438b8c74f5ed62fe921bd1078abe628a6675e44912933100ea4fa26863e340e9", "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:8978d5474a6da30bc0ad21c17db188d6918cacf3df3f6506b72ef3a268d53e2e", - "zh:b109efe138dfcb45dc04a9cc6809d185ab8b0ebc12040847c2dac430fda5af68", - "zh:b58e039b9106ac0a8de3c07f53b5279d7f0215fb35f2d23df642dfce0875382f", - "zh:ba2cbb2e515922d13efe3a46647be84f5426fcfcaa0f1520b3efeab8db847ed3", - "zh:c6c1ef1f26f25bca3abb5e07fa33dca37ed39cc26d0ff877964f2ffe5edd618c", - "zh:f8e171f923b7d2e789abd034072465dec3e6133c3a7644b7a7a965a74d52224e", + "zh:85c8bd8eefc4afc33445de2ee7fbf33a7807bc34eb3734b8eefa4e98e4cddf38", + "zh:98bbe309c9ff5b2352de6a047e0ec6c7e3764b4ed3dfd370839c4be2fbfff869", + "zh:9c7bf8c56da1b124e0e2f3210a1915e778bab2be924481af684695b52672891e", + "zh:d2200f7f6ab8ecb8373cda796b864ad4867f5c255cff9d3b032f666e4c78f625", + "zh:d8c7926feaddfdc08d5ebb41b03445166df8c125417b28d64712dccd9feef136", + "zh:e2412a192fc340c61b373d6c20c9d805d7d3dee6c720c34db23c2a8ff0abd71b", + "zh:e6ac6bba391afe728a099df344dbd6481425b06d61697522017b8f7a59957d44", ] } provider "registry.terraform.io/hashicorp/tls" { - version = "4.0.5" + version = "4.0.6" hashes = [ - "h1:e4LBdJoZJNOQXPWgOAG0UuPBVhCStu98PieNlqJTmeU=", - "zh:01cfb11cb74654c003f6d4e32bbef8f5969ee2856394a96d127da4949c65153e", - "zh:0472ea1574026aa1e8ca82bb6df2c40cd0478e9336b7a8a64e652119a2fa4f32", - "zh:1a8ddba2b1550c5d02003ea5d6cdda2eef6870ece86c5619f33edd699c9dc14b", - "zh:1e3bb505c000adb12cdf60af5b08f0ed68bc3955b0d4d4a126db5ca4d429eb4a", - "zh:6636401b2463c25e03e68a6b786acf91a311c78444b1dc4f97c539f9f78de22a", - "zh:76858f9d8b460e7b2a338c477671d07286b0d287fd2d2e3214030ae8f61dd56e", - "zh:a13b69fb43cb8746793b3069c4d897bb18f454290b496f19d03c3387d1c9a2dc", - "zh:a90ca81bb9bb509063b736842250ecff0f886a91baae8de65c8430168001dad9", - "zh:c4de401395936e41234f1956ebadbd2ed9f414e6908f27d578614aaa529870d4", - "zh:c657e121af8fde19964482997f0de2d5173217274f6997e16389e7707ed8ece8", - "zh:d68b07a67fbd604c38ec9733069fbf23441436fecf554de6c75c032f82e1ef19", + "h1:dYSb3V94K5dDMtrBRLPzBpkMTPn+3cXZ/kIJdtFL+2M=", + "zh:10de0d8af02f2e578101688fd334da3849f56ea91b0d9bd5b1f7a243417fdda8", + "zh:37fc01f8b2bc9d5b055dc3e78bfd1beb7c42cfb776a4c81106e19c8911366297", + "zh:4578ca03d1dd0b7f572d96bd03f744be24c726bfd282173d54b100fd221608bb", + "zh:6c475491d1250050765a91a493ef330adc24689e8837a0f07da5a0e1269e11c1", + "zh:81bde94d53cdababa5b376bbc6947668be4c45ab655de7aa2e8e4736dfd52509", + "zh:abdce260840b7b050c4e401d4f75c7a199fafe58a8b213947a258f75ac18b3e8", + "zh:b754cebfc5184873840f16a642a7c9ef78c34dc246a8ae29e056c79939963c7a", + "zh:c928b66086078f9917aef0eec15982f2e337914c5c4dbc31dd4741403db7eb18", + "zh:cded27bee5f24de6f2ee0cfd1df46a7f88e84aaffc2ecbf3ff7094160f193d50", + "zh:d65eb3867e8f69aaf1b8bb53bd637c99c6b649ba3db16ded50fa9a01076d1a27", + "zh:ecb0c8b528c7a619fa71852bb3fb5c151d47576c5aab2bf3af4db52588722eeb", "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", ] } diff --git a/examples/tf-aws/launchpad/launchpad.tf b/examples/tf-aws/launchpad/launchpad.tf index 56df6da2..b11c45e8 100644 --- a/examples/tf-aws/launchpad/launchpad.tf +++ b/examples/tf-aws/launchpad/launchpad.tf @@ -151,6 +151,13 @@ spec: useHTTPS: ${h.winrm_useHTTPS} insecure: ${h.winrm_insecure} %{~endfor} + mcr: + version: ${var.launchpad.mcr_version} + repoURL: https://repos.mirantis.com + installURLLinux: https://get.mirantis.com/ + installURLWindows: https://get.mirantis.com/install.ps1 + channel: stable + prune: true mke: version: ${var.launchpad.mke_version} imageRepo: docker.io/mirantis @@ -163,13 +170,6 @@ spec: upgradeFlags: - "--force-recent-backup" - "--force-minimums" - mcr: - version: ${var.launchpad.mcr_version} - repoURL: https://repos.mirantis.com - installURLLinux: https://get.mirantis.com/ - installURLWindows: https://get.mirantis.com/install.ps1 - channel: stable - prune: true %{if local.has_msr} msr: version: ${var.launchpad.msr_version} diff --git a/examples/tf-aws/launchpad/provision.tf b/examples/tf-aws/launchpad/provision.tf index 9af7dbf1..6f408719 100644 --- a/examples/tf-aws/launchpad/provision.tf +++ b/examples/tf-aws/launchpad/provision.tf @@ -11,11 +11,13 @@ module "provision" { name = var.name common_tags = local.tags network = var.network - + subnets = var.subnets // pass in a mix of nodegroups with the platform information nodegroups = { for k, ngd in local.nodegroups_wplatform : k => { - ami : ngd.ami + source_image : { + ami : ngd.ami + } count : ngd.count type : ngd.type keypair_id : module.key.keypair_id diff --git a/examples/tf-aws/launchpad/terraform.tfvars b/examples/tf-aws/launchpad/terraform.tfvars index b45741e5..69d5b2d3 100644 --- a/examples/tf-aws/launchpad/terraform.tfvars +++ b/examples/tf-aws/launchpad/terraform.tfvars @@ -1,5 +1,5 @@ // used to name infrastructure (CHANGE THIS) -name = "smoke-test" +#name = "mcc-smoke-test" aws = { region = "us-east-1" } @@ -7,8 +7,8 @@ aws = { launchpad = { drain = false - mcr_version = "23.0.7" - mke_version = "3.7.3" + mcr_version = "23.0.15" + mke_version = "3.7.15" msr_version = "" mke_connect = { @@ -22,45 +22,44 @@ launchpad = { network = { cidr = "172.31.0.0/16" } - subnets = { "Main" = { cidr = "172.31.0.0/17" - nodegroups = ["ACon", "AWrk_Ubu22", "AWrk_Windows2022"] + nodegroups = ["ACon", "AWrk_Ubu22", "AWrk_Roc9", "AWrk_Win2022"] private = false } } -// one definition for each group of machines to include in the stack + +// machine node groups by role & platform nodegroups = { "ACon" = { // managers for A group - platform = "ubuntu_22.04" - count = 1 - type = "m6a.2xlarge" - volume_size = 100 - role = "manager" - public = true - user_data = "" + role = "manager" + platform = "ubuntu_22.04" + count = 1 + type = "m6a.2xlarge" }, "AWrk_Ubu22" = { // workers for A group + role = "worker" platform = "ubuntu_22.04" count = 1 type = "c6a.xlarge" volume_size = 100 - public = true - role = "worker" - user_data = "" }, - "AWrk_Windows2022" = { - "platform" : "windows_core_2022", - "count" : 1, - "type" : "c6a.xlarge", - "volume_size" : "100", - "role" : "worker", - "public" : true, - "user_data" : "", + "AWrk_Roc9" = { // workers for A group + role = "worker" + platform = "rocky_9" + count = 1 + type = "c6a.xlarge" + volume_size = 100 }, + // "AWrk_Win2022" = { + // role = "worker" + // platform = "windows_core_2022" + // count = 1 + // type = "c6a.xlarge" + // }, } // set a windows password, if you have windows nodes -# windows_password = "testp@ss!" +windows_password = "testp@ss!" diff --git a/examples/tf-aws/launchpad/variables.tf b/examples/tf-aws/launchpad/variables.tf index 645fb27b..381526a7 100644 --- a/examples/tf-aws/launchpad/variables.tf +++ b/examples/tf-aws/launchpad/variables.tf @@ -14,34 +14,46 @@ variable "name" { type = string } +# === Networking === variable "network" { description = "Network configuration" type = object({ - cidr = string - public_subnet_count = number - private_subnet_count = number - enable_vpn_gateway = bool - enable_nat_gateway = bool + cidr = string + enable_nat_gateway = optional(bool, false) + enable_vpn_gateway = optional(bool, false) + tags = optional(map(string), {}) }) default = { - cidr = "172.31.0.0/16" - public_subnet_count = 3 - private_subnet_count = 3 - enable_vpn_gateway = false - enable_nat_gateway = false + enable_nat_gateway = false + enable_vpn_gateway = false + cidr = "172.31.0.0/16" + tags = {} } } +# === subnets === +variable "subnets" { + description = "The subnets configuration" + type = map(object({ + cidr = string + nodegroups = list(string) + private = optional(bool, false) + })) + default = {} +} + +# === Machines === + variable "nodegroups" { description = "A map of machine group definitions" type = map(object({ + role = string platform = string type = string - count = number - volume_size = number - role = string - public = bool - user_data = string + count = optional(number, 1) + volume_size = optional(number, 100) + public = optional(bool, true) + user_data = optional(string, "") })) } diff --git a/pkg/kubeclient/testutil.go b/pkg/kubeclient/testutil.go index 971c4a38..b6551c67 100644 --- a/pkg/kubeclient/testutil.go +++ b/pkg/kubeclient/testutil.go @@ -62,11 +62,11 @@ func CreateUnstructuredTestMSR(t *testing.T, version string, withReadyStatus boo "apiVersion": "msr.mirantis.com/v1", "kind": "MSR", "metadata": map[string]interface{}{ - "name": "msr-test", + "name": "msr-test", }, "spec": map[string]interface{}{ "image": map[string]interface{}{ - "tag": version, + "tag": version, }, }, "nginx": map[string]interface{}{ @@ -76,7 +76,6 @@ func CreateUnstructuredTestMSR(t *testing.T, version string, withReadyStatus boo }, } - if withReadyStatus { msr["status"] = map[string]interface{}{ "conditions": []interface{}{ diff --git a/test/integration/integration_test.go b/test/integration/integration_test.go index e9a8a8d8..4def4f4b 100644 --- a/test/integration/integration_test.go +++ b/test/integration/integration_test.go @@ -28,19 +28,22 @@ var MKE_CONNECT = map[string]interface{}{ var LAUNCHPAD = map[string]interface{}{ "drain": false, - "mcr_version": "23.0.9", - "mke_version": "3.7.5", + "mcr_version": "23.0.15", + "mke_version": "3.7.15", "msr_version": "", "mke_connect": MKE_CONNECT, } // configure the network stack var NETWORK = map[string]interface{}{ - "cidr": "172.31.0.0/16", - "public_subnet_count": 1, - "private_subnet_count": 0, // if 0 then no private nodegroups allowed - "enable_vpn_gateway": false, - "enable_nat_gateway": false, + "cidr": "172.31.0.0/16", +} +var SUBNETS = map[string]interface{}{ + "main": map[string]interface{}{ + "cidr": "172.31.0.0/17", + "private": false, + "nodegroups": []string{"MngrUbuntu22", "WrkRhel9"}, + }, } // TestMain function to control the test execution @@ -59,9 +62,7 @@ func TestMain(m *testing.M) { name := fmt.Sprintf("smoke-%s", uTestId) - rndPassword := test.GenerateRandomAlphaNumericString(12) - - MKE_CONNECT["password"] = rndPassword + MKE_CONNECT["password"] = test.GenerateRandomAlphaNumericString(12) options := terraform.Options{ // The path to where the Terraform tf chart is located @@ -71,6 +72,7 @@ func TestMain(m *testing.M) { "aws": AWS, "launchpad": LAUNCHPAD, "network": NETWORK, + "subnets": SUBNETS, "ssh_pk_location": tempSSHKeyPathDir, "nodegroups": nodegroups, }, diff --git a/test/smoke/smoke_test.go b/test/smoke/smoke_test.go index 33e24227..5bc4f354 100644 --- a/test/smoke/smoke_test.go +++ b/test/smoke/smoke_test.go @@ -32,11 +32,14 @@ var LAUNCHPAD = map[string]interface{}{ // configure the network stack var NETWORK = map[string]interface{}{ - "cidr": "172.31.0.0/16", - "public_subnet_count": 1, - "private_subnet_count": 0, // if 0 then no private nodegroups allowed - "enable_vpn_gateway": false, - "enable_nat_gateway": false, + "cidr": "172.31.0.0/16", +} +var SUBNETS = map[string]interface{}{ + "main": map[string]interface{}{ + "cidr": "172.31.0.0/17", + "private": false, + "nodegroups": []string{"MngrUbuntu22", "MngrRocky9", "MngrSles15", "MngrCentos7", "MngrRhel9", "WrkUbuntu22", "WrkRocky9", "WrkSles15", "WrkCentos7", "WrkRhel9"}, + }, } // TestSmallCluster deploys a small test cluster @@ -67,6 +70,7 @@ func TestSmallCluster(t *testing.T) { "aws": AWS, "launchpad": LAUNCHPAD, "network": NETWORK, + "subnets": SUBNETS, "ssh_pk_location": tempSSHKeyPathDir, "nodegroups": nodegroups, },