Skip to content

Commit

Permalink
adapt to new module structure
Browse files Browse the repository at this point in the history
Signed-off-by: Silvio Moioli <[email protected]>
  • Loading branch information
moio committed Dec 20, 2024
1 parent 7845ab0 commit e157cd6
Show file tree
Hide file tree
Showing 32 changed files with 487 additions and 1,649 deletions.
125 changes: 125 additions & 0 deletions darts/harvester.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Deploys Rancher and prepares it for performance tests

tofu_main_directory: ./tofu/main/harvester
tofu_parallelism: 100 # Harvester tolerates high values well

tofu_variables:
project_name: st
namespace: default

# Add the path to your Harvester kubeconfig. Get one with these instructions:
# https://docs.harvesterhci.io/v1.3/faq/#how-can-i-access-the-kubeconfig-file-of-the-harvester-cluster
kubeconfig: null # default to file pointed by the KUBECONFIG environment variable

ssh_public_key_path: ~/.ssh/id_ed25519.pub
ssh_private_key_path: ~/.ssh/id_ed25519
ssh_user: opensuse

# Must set the following bastion vars appropriately if there is a bastion between you and Harvester
# ssh_bastion_user: root
# ssh_bastion_host: # Must set this appropriately if there is a bastion between you and Harvester
# ssh_bastion_key_path: ~/.ssh/bastion_id_ed25519 # Must set this appropriately if there is a bastion between you and Harvester

# Set to false to skip the creation of the openSUSE Leap 15.6 image
create_image: true

network:
create: false
name: vmnet-shared
clusternetwork_name: vmnet
namespace: default
interface_type: bridge
interface_model: virtio
public: true
wait_for_lease: true

upstream_cluster:
server_count: 3
agent_count: 0
distro_version: v1.26.9+k3s1
public_ip: false
reserve_node_for_monitoring: false
enable_audit_log: false
node_module_variables:
cpu: 2
memory: 8
disks:
- name: "disk-0"
size: 35
type: "disk"
bus: "virtio"
image_name: null # openSUSE Leap 15.6. Change to a valid Harvester image name to override
image_namespace: null # default to the same namespace above
# ssh_shared_public_keys: # Set this to a shared key that exists inside of Harvester if desired
# - name: bullseye-qa
# namespace: bullseye
# password: linux # Non-SSH password
upstream_cluster_distro_module: generic/k3s

tester_cluster:
server_count: 1
agent_count: 0
distro_version: v1.26.9+k3s1
public_ip: false
reserve_node_for_monitoring: false
enable_audit_log: false
node_module_variables:
cpu: 2
memory: 4
disks:
- name: "disk-0"
size: 35
type: "disk"
bus: "virtio"
image_name: null # openSUSE Leap 15.6. Change to a valid Harvester image name to override
image_namespace: null # default to the same namespace above
tester_cluster_distro_module: generic/k3s

downstream_cluster_templates:
- cluster_count: 0
server_count: 1
agent_count: 0
distro_version: v1.26.9+k3s1
public_ip: false
reserve_node_for_monitoring: false
enable_audit_log: false
node_module_variables:
cpu: 2
memory: 8
disks:
- name: "disk-0"
size: 35
type: "disk"
bus: "virtio"
image_name: null # openSUSE Leap 15.6. Change to a valid Harvester image name to override
image_namespace: null # default to the same namespace above
downstream_cluster_distro_module: generic/k3s

first_kubernetes_api_port: 7445
first_app_http_port: 9080
first_app_https_port: 9443

chart_variables:
rancher_replicas: 1
downstream_rancher_monitoring: true
admin_password: adminadminadmin
rancher_monitoring_version: 104.1.0+up57.0.3 # see https://github.com/rancher/charts/tree/release-v2.9/assets/rancher-monitoring-crd
cert_manager_version: 1.8.0
tester_grafana_version: 6.56.5
rancher_version: 2.9.1
force_prime_registry: false

# Use the following for 2.8.6:
# rancher_version: 2.8.6
# rancher_monitoring_version: 103.1.1+up45.31.1 # see https://github.com/rancher/charts/tree/release-v2.8/assets/rancher-monitoring-crd

# Add the following to set a custom image:
# rancher_image_override: rancher/rancher
# rancher_image_tag_override: v2.8.6-debug-1

test_variables:
test_config_maps: 2000
test_secrets: 2000
test_roles: 20
test_users: 10
test_projects: 20
121 changes: 0 additions & 121 deletions darts/harvester_full.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions tofu/main/harvester/locals.tf

This file was deleted.

108 changes: 21 additions & 87 deletions tofu/main/harvester/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,95 +4,29 @@ provider "harvester" {

module "network" {
source = "../../modules/harvester/network"
create = var.network.create
network_name = var.network.name
clusternetwork_name = var.network.clusternetwork_name
project_name = var.project_name
namespace = var.namespace
network_details = var.network
ssh_public_key_path = var.ssh_public_key_path
create_image = var.create_image
ssh_bastion_host = var.ssh_bastion_host
ssh_bastion_user = var.ssh_bastion_user
ssh_bastion_key_path = var.ssh_bastion_key_path
}

module "images" {
source = "../../modules/harvester/images"
project_name = var.project_name
namespace = var.namespace
create = local.create_image
}

module "k3s_cluster" {
count = length(local.k3s_clusters)
source = "../../modules/harvester/k3s"
providers = {
harvester = harvester
}
project_name = var.project_name
name = local.k3s_clusters[count.index].name_prefix
namespace = var.namespace
default_image_id = module.images.opensuse156_id
image_name = local.k3s_clusters[count.index].image_name
image_namespace = coalesce(local.k3s_clusters[count.index].image_namespace, var.namespace)
tags = local.k3s_clusters[count.index].tags
cpu = local.k3s_clusters[count.index].cpu
memory = local.k3s_clusters[count.index].memory
disks = local.k3s_clusters[count.index].disks
server_count = local.k3s_clusters[count.index].server_count
agent_count = local.k3s_clusters[count.index].agent_count
agent_labels = local.k3s_clusters[count.index].reserve_node_for_monitoring ? [
[{ key : "monitoring", value : "true" }]
] : []
agent_taints = local.k3s_clusters[count.index].reserve_node_for_monitoring ? [
[{ key : "monitoring", value : "true", effect : "NoSchedule" }]
] : []
distro_version = local.k3s_clusters[count.index].distro_version
sans = ["${local.k3s_clusters[count.index].name_prefix}.local.gd"]
local_kubernetes_api_port = var.first_kubernetes_api_port + count.index
tunnel_app_http_port = var.first_app_http_port + count.index
tunnel_app_https_port = var.first_app_https_port + count.index
ssh_public_key = module.network.ssh_public_key
ssh_public_key_id = module.network.ssh_public_key_id
ssh_private_key_path = var.ssh_private_key_path
ssh_user = var.ssh_user
password = var.password
ssh_bastion_host = var.ssh_bastion_host
ssh_bastion_user = var.ssh_bastion_user
ssh_bastion_key_path = var.ssh_private_key_path
ssh_shared_public_keys = var.ssh_shared_public_keys
networks = [var.network]
}

module "rke2_cluster" {
count = length(local.rke2_clusters)
source = "../../modules/harvester/rke2"
project_name = var.project_name
name = local.rke2_clusters[count.index].name_prefix
namespace = var.namespace
default_image_id = module.images.opensuse156_id
image_name = local.rke2_clusters[count.index].image_name
image_namespace = coalesce(local.rke2_clusters[count.index].image_namespace, var.namespace)
tags = local.rke2_clusters[count.index].tags
cpu = local.rke2_clusters[count.index].cpu
memory = local.rke2_clusters[count.index].memory
disks = local.rke2_clusters[count.index].disks
server_count = local.rke2_clusters[count.index].server_count
agent_count = local.rke2_clusters[count.index].agent_count
agent_labels = local.rke2_clusters[count.index].reserve_node_for_monitoring ? [
[{ key : "monitoring", value : "true" }]
] : []
agent_taints = local.rke2_clusters[count.index].reserve_node_for_monitoring ? [
[{ key : "monitoring", value : "true", effect : "NoSchedule" }]
] : []
distro_version = local.rke2_clusters[count.index].distro_version
sans = ["${local.rke2_clusters[count.index].name_prefix}.local.gd"]
local_kubernetes_api_port = var.first_kubernetes_api_port + length(local.k3s_clusters) + count.index
tunnel_app_http_port = var.first_app_http_port + length(local.k3s_clusters) + count.index
tunnel_app_https_port = var.first_app_https_port + length(local.k3s_clusters) + count.index
ssh_public_key = module.network.ssh_public_key
ssh_public_key_id = module.network.ssh_public_key_id
ssh_private_key_path = var.ssh_private_key_path
ssh_user = var.ssh_user
password = var.password
ssh_bastion_host = var.ssh_bastion_host
ssh_bastion_user = var.ssh_bastion_user
ssh_bastion_key_path = var.ssh_private_key_path
ssh_shared_public_keys = var.ssh_shared_public_keys
networks = [var.network]
module "test_environment" {
source = "../../modules/generic/test_environment"
upstream_cluster = var.upstream_cluster
upstream_cluster_distro_module = var.upstream_cluster_distro_module
downstream_cluster_templates = var.downstream_cluster_templates
downstream_cluster_distro_module = var.downstream_cluster_distro_module
tester_cluster = var.tester_cluster
tester_cluster_distro_module = var.tester_cluster_distro_module
node_module = "aws/node"
ssh_user = var.ssh_user
ssh_private_key_path = var.ssh_private_key_path
network_config = module.network.config
first_kubernetes_api_port = var.first_kubernetes_api_port
first_app_http_port = var.first_app_http_port
first_app_https_port = var.first_app_https_port
}
Loading

0 comments on commit e157cd6

Please sign in to comment.