From 888f056957c404c9ea5f78fe4ddfbdb513148227 Mon Sep 17 00:00:00 2001 From: jianli-97 Date: Fri, 8 Sep 2023 14:44:03 +0800 Subject: [PATCH] add secgroup ports in tf template --- app/apis/nkd/const.go | 2 +- data/terraform/master.tf.template | 56 +++++++++++++++++++++++++++++++ data/terraform/worker.tf.template | 56 +++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 1 deletion(-) diff --git a/app/apis/nkd/const.go b/app/apis/nkd/const.go index a8a25ef..6b13d83 100644 --- a/app/apis/nkd/const.go +++ b/app/apis/nkd/const.go @@ -47,7 +47,7 @@ var ( Openstack_Region = "" Openstack_Internal_network = "" Openstack_External_network = "" - Openstack_Master_ip = []string{"", "", ""} + Openstack_Master_ip = []string{"10.1.10.51", "", ""} Openstack_Flavor_Name = "" Openstack_Glance_Name = "" Availability_zone = "" diff --git a/data/terraform/master.tf.template b/data/terraform/master.tf.template index 920861b..4ddcbf6 100644 --- a/data/terraform/master.tf.template +++ b/data/terraform/master.tf.template @@ -53,6 +53,62 @@ resource "openstack_compute_secgroup_v2" "secgroup" { ip_protocol = "icmp" cidr = "0.0.0.0/0" } + + rule { + from_port = 80 + to_port = 80 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 443 + to_port = 443 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 2379 + to_port = 2380 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 179 + to_port = 179 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 6443 + to_port = 6443 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 10250 + to_port = 10250 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 30000 + to_port = 32767 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 30000 + to_port = 32767 + ip_protocol = "udp" + cidr = "0.0.0.0/0" + } } resource "openstack_compute_instance_v2" "instance" { diff --git a/data/terraform/worker.tf.template b/data/terraform/worker.tf.template index a3a41d6..7c8c2ba 100644 --- a/data/terraform/worker.tf.template +++ b/data/terraform/worker.tf.template @@ -53,6 +53,62 @@ resource "openstack_compute_secgroup_v2" "secgroup" { ip_protocol = "icmp" cidr = "0.0.0.0/0" } + + rule { + from_port = 80 + to_port = 80 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 443 + to_port = 443 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 2379 + to_port = 2380 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 179 + to_port = 179 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 6443 + to_port = 6443 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 10250 + to_port = 10250 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 30000 + to_port = 32767 + ip_protocol = "tcp" + cidr = "0.0.0.0/0" + } + + rule { + from_port = 30000 + to_port = 32767 + ip_protocol = "udp" + cidr = "0.0.0.0/0" + } } resource "openstack_compute_instance_v2" "instance" { -- Gitee