Skip to content

Commit

Permalink
PRODENG-2778 TF and test fix
Browse files Browse the repository at this point in the history
- Terraform fix for latest upstream provision
- smoke and integration test fix for upstream provision

Signed-off-by: James Nesbitt <[email protected]>
  • Loading branch information
james-nesbitt committed Nov 1, 2024
1 parent 8d74bda commit 9e55faf
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 122 deletions.
110 changes: 55 additions & 55 deletions examples/tf-aws/launchpad/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions examples/tf-aws/launchpad/launchpad.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
Expand Down
6 changes: 4 additions & 2 deletions examples/tf-aws/launchpad/provision.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
49 changes: 24 additions & 25 deletions examples/tf-aws/launchpad/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// used to name infrastructure (CHANGE THIS)
name = "smoke-test"
#name = "mcc-smoke-test"
aws = {
region = "us-east-1"
}

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 = {
Expand All @@ -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!"
42 changes: 27 additions & 15 deletions examples/tf-aws/launchpad/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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, "")
}))
}

Expand Down
5 changes: 2 additions & 3 deletions pkg/kubeclient/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}{
Expand All @@ -76,7 +76,6 @@ func CreateUnstructuredTestMSR(t *testing.T, version string, withReadyStatus boo
},
}


if withReadyStatus {
msr["status"] = map[string]interface{}{
"conditions": []interface{}{
Expand Down
22 changes: 12 additions & 10 deletions test/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -71,6 +72,7 @@ func TestMain(m *testing.M) {
"aws": AWS,
"launchpad": LAUNCHPAD,
"network": NETWORK,
"subnets": SUBNETS,
"ssh_pk_location": tempSSHKeyPathDir,
"nodegroups": nodegroups,
},
Expand Down
Loading

0 comments on commit 9e55faf

Please sign in to comment.