Skip to content

Commit

Permalink
Merge pull request #22 from zonca/branch_v2.21.0_existing_network
Browse files Browse the repository at this point in the history
Branch v2.21.0 existing network
  • Loading branch information
zonca authored Mar 2, 2023
2 parents 527fdc1 + 3096853 commit 2bf0c6a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
10 changes: 4 additions & 6 deletions contrib/terraform/openstack/modules/network/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion contrib/terraform/openstack/modules/network/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
10 changes: 8 additions & 2 deletions inventory/kubejetstream/cluster.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion inventory/kubejetstream/terraform_apply.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion inventory/kubejetstream/terraform_destroy.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions k8s_install_nginx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ansible-playbook --become -i inventory/$CLUSTER/hosts cluster.yml -b -v --limit "${CLUSTER}*" --tags apps,ingress-nginx,ingress-controller

0 comments on commit 2bf0c6a

Please sign in to comment.