diff --git a/contrib/terraform/openstack/modules/network/main.tf b/contrib/terraform/openstack/modules/network/main.tf index 6448cffcdaa..2ec9067da2e 100644 --- a/contrib/terraform/openstack/modules/network/main.tf +++ b/contrib/terraform/openstack/modules/network/main.tf @@ -10,18 +10,16 @@ data "openstack_networking_router_v2" "k8s" { count = var.use_neutron == 1 && var.router_id != null ? 1 : 0 } -resource "openstack_networking_network_v2" "k8s" { +data "openstack_networking_network_v2" "k8s" { name = var.network_name - count = var.use_neutron - dns_domain = var.network_dns_domain != null ? var.network_dns_domain : null - admin_state_up = "true" - port_security_enabled = var.port_security_enabled + count = 1 + } resource "openstack_networking_subnet_v2" "k8s" { name = "${var.cluster_name}-internal-network" count = var.use_neutron - network_id = openstack_networking_network_v2.k8s[count.index].id + network_id = data.openstack_networking_network_v2.k8s[count.index].id subnetpool_id = var.subnetpool_id ip_version = 4 dns_nameservers = var.dns_nameservers diff --git a/contrib/terraform/openstack/modules/network/outputs.tf b/contrib/terraform/openstack/modules/network/outputs.tf index 0e8a5004f33..6b7a6a58395 100644 --- a/contrib/terraform/openstack/modules/network/outputs.tf +++ b/contrib/terraform/openstack/modules/network/outputs.tf @@ -3,7 +3,7 @@ output "router_id" { } output "network_id" { - value = element(concat(openstack_networking_network_v2.k8s.*.id, [""]),0) + value = element(concat(data.openstack_networking_network_v2.k8s.*.id, [""]),0) } output "router_internal_port_id" { diff --git a/inventory/kubejetstream/cluster.tfvars b/inventory/kubejetstream/cluster.tfvars index 7783d979178..ea11188df23 100644 --- a/inventory/kubejetstream/cluster.tfvars +++ b/inventory/kubejetstream/cluster.tfvars @@ -70,13 +70,19 @@ k8s_allowed_remote_ips = ["0.0.0.0/0"] # have Kubernetes traffic use the internal IP use_access_ip = 0 -# Uncomment below and edit to set dns-domain network property (the initial tg- is not necessary anymore) -# network_dns_domain = "xxxxxxxxx.projects.jetstream-cloud.org." +# This is now un-necessary because we use the auto_allocated_network which is preconfigured +# network_dns_domain = "xxx000000.projects.jetstream-cloud.org." # Reuse the auto allocated router, we do not want to waste floating IPs by having un-necessary routers # openstack router list, find the ID (first column) of the `auto_allocated_router` router_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +# networking +network_name = "auto_allocated_network" + +# Use a existing network with the name of network_name. Set to false to create a network with name of network_name. +use_existing_network = true + # Default subnetpool ID for JetStream2; Let neutron (openstack) do the CIDR # book-keeping for you subnetpool_id = "be988956-1bfb-4828-b511-a58229fbd4ac" diff --git a/inventory/kubejetstream/terraform_apply.sh b/inventory/kubejetstream/terraform_apply.sh index 2b0d1663fce..82cf3b68bf1 100644 --- a/inventory/kubejetstream/terraform_apply.sh +++ b/inventory/kubejetstream/terraform_apply.sh @@ -1 +1 @@ -terraform apply -auto-approve -var-file=cluster.tfvars -var="cluster_name=$CLUSTER" -var="network_name=${CLUSTER}-network" ../../contrib/terraform/openstack +terraform apply -var-file=cluster.tfvars -var="cluster_name=$CLUSTER" ../../contrib/terraform/openstack diff --git a/inventory/kubejetstream/terraform_destroy.sh b/inventory/kubejetstream/terraform_destroy.sh index 15f0037b4e1..baf3c7ddbe1 100644 --- a/inventory/kubejetstream/terraform_destroy.sh +++ b/inventory/kubejetstream/terraform_destroy.sh @@ -1 +1 @@ -terraform destroy -var-file=cluster.tfvars -var="cluster_name=$CLUSTER" -var="network_name=${CLUSTER}-network" ../../contrib/terraform/openstack +terraform destroy -var-file=cluster.tfvars -var="cluster_name=$CLUSTER" ../../contrib/terraform/openstack diff --git a/k8s_install_nginx.sh b/k8s_install_nginx.sh new file mode 100644 index 00000000000..279128c06f8 --- /dev/null +++ b/k8s_install_nginx.sh @@ -0,0 +1 @@ +ansible-playbook --become -i inventory/$CLUSTER/hosts cluster.yml -b -v --limit "${CLUSTER}*" --tags apps,ingress-nginx,ingress-controller