Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch v2.21.0 auto alloc zonca #24

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contrib/terraform/openstack/modules/compute/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ resource "openstack_networking_port_v2" "k8s_master_port" {
port_security_enabled = var.force_null_port_security ? null : var.port_security_enabled
security_group_ids = var.port_security_enabled ? local.master_sec_groups : null
no_security_groups = var.port_security_enabled ? null : false
dns_name = "${var.cluster_name}-${count.index + 1}"
dynamic "fixed_ip" {
for_each = var.private_subnet_id == "" ? [] : [true]
content {
Expand Down
9 changes: 3 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,15 @@ 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
8 changes: 6 additions & 2 deletions inventory/kubejetstream/cluster.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,15 @@ k8s_allowed_remote_ips = ["0.0.0.0/0"]
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."
network_dns_domain = "cis230085.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"
router_id = "15cc195f-02d4-4d9b-ae24-5b2e9e52a13a"

# Reuse the auto-allocated network
use_existing_network = true
network_name = "auto_allocated_network"

# Default subnetpool ID for JetStream2; Let neutron (openstack) do the CIDR
# book-keeping for you
Expand Down
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