Move to testing. Add pgluster tofu.
This commit is contained in:
parent
964ddc523b
commit
1b93c0be15
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
""" Write out a puppet cosmos-modules.conf """
|
"""Write out a puppet cosmos-modules.conf"""
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
|
@ -20,11 +20,10 @@ try:
|
||||||
except OSError:
|
except OSError:
|
||||||
host_info = None
|
host_info = None
|
||||||
else:
|
else:
|
||||||
|
domainname = ".".join([x for x in fqdn.split(".")[:1]])
|
||||||
domainname = '.'.join([x for x in fqdn.split('.')[:1]])
|
hostname = fqdn.split(".")[0]
|
||||||
hostname = fqdn.split('.')[0]
|
instance, location, environment, function, number = hostname.split("-")
|
||||||
instance, location, environment, function, number = hostname.split('-')
|
service = fqdn.split(".")[1]
|
||||||
service = fqdn.split('.')[1]
|
|
||||||
|
|
||||||
host_info = {
|
host_info = {
|
||||||
"domainname": domainname,
|
"domainname": domainname,
|
||||||
|
@ -76,15 +75,20 @@ def create_file_content(modules):
|
||||||
expected checksum before writing anything
|
expected checksum before writing anything
|
||||||
"""
|
"""
|
||||||
file_lines = []
|
file_lines = []
|
||||||
file_lines.append("# Generated by {}\n".format( # pylint: disable=consider-using-f-string
|
file_lines.append(
|
||||||
os.path.basename(sys.argv[0])).encode("utf-8"))
|
"# Generated by {}\n".format( # pylint: disable=consider-using-f-string
|
||||||
|
os.path.basename(sys.argv[0])
|
||||||
|
).encode("utf-8")
|
||||||
|
)
|
||||||
for key in modules:
|
for key in modules:
|
||||||
file_lines.append("{0:11} {1} {2} {3}\n".format( # pylint: disable=consider-using-f-string
|
file_lines.append(
|
||||||
key,
|
"{0:11} {1} {2} {3}\n".format( # pylint: disable=consider-using-f-string
|
||||||
modules[key]["repo"],
|
key,
|
||||||
modules[key]["upgrade"],
|
modules[key]["repo"],
|
||||||
modules[key]["tag"],
|
modules[key]["upgrade"],
|
||||||
).encode("utf-8"))
|
modules[key]["tag"],
|
||||||
|
).encode("utf-8")
|
||||||
|
)
|
||||||
|
|
||||||
return file_lines
|
return file_lines
|
||||||
|
|
||||||
|
@ -119,40 +123,40 @@ def main():
|
||||||
"ufw": {
|
"ufw": {
|
||||||
"repo": "https://github.com/SUNET/puppet-module-ufw.git",
|
"repo": "https://github.com/SUNET/puppet-module-ufw.git",
|
||||||
"upgrade": "yes",
|
"upgrade": "yes",
|
||||||
"tag": "sunet-2*",
|
"tag": "sunet-2*",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
# When/if we want we can do stuff to modules here
|
# When/if we want we can do stuff to modules here
|
||||||
if host_info:
|
if host_info:
|
||||||
if host_info["fqdn"] == "internal-sto4-test-monitor-1.rut.sunet.se":
|
if host_info["fqdn"] == "internal-sto4-test-monitor-1.rut.sunet.se":
|
||||||
modules["sunet"]["tag"] = "testing*"
|
modules["sunet"]["tag"] = "testing*"
|
||||||
if "internal-sto4-test-k8sc" in host_info["fqdn"]:
|
if "internal-sto4-test-k8sc" in host_info["fqdn"]:
|
||||||
modules["sunet"]["tag"] = "mifr-nft-fixes*"
|
modules["sunet"]["tag"] = "testing*"
|
||||||
if "internal-sto4-test-k8sw" in host_info["fqdn"]:
|
if "internal-sto4-test-k8sw" in host_info["fqdn"]:
|
||||||
modules["sunet"]["tag"] = "mifr-nft-fixes*"
|
modules["sunet"]["tag"] = "testing*"
|
||||||
# if host_info["fqdn"] == "internal-sto1-test-forgejo-2.platform.sunet.se":
|
# if host_info["fqdn"] == "internal-sto1-test-forgejo-2.platform.sunet.se":
|
||||||
# modules["sunet"]["tag"] = "testing-2*"
|
# modules["sunet"]["tag"] = "testing-2*"
|
||||||
# if host_info["fqdn"] == "internal-sto3-test-monitor-1.platform.sunet.se":
|
# if host_info["fqdn"] == "internal-sto3-test-monitor-1.platform.sunet.se":
|
||||||
# modules["sunet"]["tag"] = "jocar-monitor-handle-legacy-scriptherder-2024-02-14-v10"
|
# modules["sunet"]["tag"] = "jocar-monitor-handle-legacy-scriptherder-2024-02-14-v10"
|
||||||
# if host_info["fqdn"] == "internal-sto1-test-actrunner-1.platform.sunet.se":
|
# if host_info["fqdn"] == "internal-sto1-test-actrunner-1.platform.sunet.se":
|
||||||
# modules["sunet"]["tag"] = "testing-2*"
|
# modules["sunet"]["tag"] = "testing-2*"
|
||||||
## modules["nagioscfg"]["tag"] = "*mifr-2*"
|
## modules["nagioscfg"]["tag"] = "*mifr-2*"
|
||||||
# # modules["stdlib"] = {
|
# # modules["stdlib"] = {
|
||||||
# # "tag": "sunet-2*",
|
# # "tag": "sunet-2*",
|
||||||
# # "upgrade": "yes",
|
# # "upgrade": "yes",
|
||||||
# "repo": "https://github.com/SUNET/puppetlabs-stdlib.git",
|
# "repo": "https://github.com/SUNET/puppetlabs-stdlib.git",
|
||||||
# }
|
# }
|
||||||
# modules["apt"] = {
|
# modules["apt"] = {
|
||||||
# "tag": "sunet-2*",
|
# "tag": "sunet-2*",
|
||||||
# "upgrade": "yes",
|
# "upgrade": "yes",
|
||||||
# "repo": "https://github.com/SUNET/puppetlabs-apt.git",
|
# "repo": "https://github.com/SUNET/puppetlabs-apt.git",
|
||||||
# }
|
# }
|
||||||
# modules["concat"] = {
|
# modules["concat"] = {
|
||||||
# "tag": "sunet-2*",
|
# "tag": "sunet-2*",
|
||||||
# "upgrade": "yes",
|
# "upgrade": "yes",
|
||||||
# "repo": "https://github.com/SUNET/puppetlabs-concat.git",
|
# "repo": "https://github.com/SUNET/puppetlabs-concat.git",
|
||||||
# }
|
# }
|
||||||
# if host_info:
|
# if host_info:
|
||||||
# if host_info["environment"] == "test":
|
# if host_info["environment"] == "test":
|
||||||
# modules["sunet"]["tag"] = "kano-mail-2*"
|
# modules["sunet"]["tag"] = "kano-mail-2*"
|
||||||
|
|
196
pgcluster.tf
196
pgcluster.tf
|
@ -1,198 +1,4 @@
|
||||||
resource "openstack_compute_servergroup_v2" "controllers" {
|
resource "openstack_compute_instance_v2" "pg-nodes" {
|
||||||
name = "controllers"
|
|
||||||
policies = ["anti-affinity"]
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "openstack_networking_secgroup_v2" "microk8s" {
|
|
||||||
name = "microk8s"
|
|
||||||
description = "Traffic to allow between microk8s hosts"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule1" {
|
|
||||||
#We never know where Richard is, so allow from all of the known internet
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv4"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 16443
|
|
||||||
port_range_max = 16443
|
|
||||||
remote_ip_prefix = "0.0.0.0/0"
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule2" {
|
|
||||||
#We never know where Richard is, so allow from all of the known internet
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv6"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 16443
|
|
||||||
port_range_max = 16443
|
|
||||||
remote_ip_prefix = "::/0"
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule3" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv4"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 10250
|
|
||||||
port_range_max = 10250
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule4" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv6"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 10250
|
|
||||||
port_range_max = 10250
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule5" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv4"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 10255
|
|
||||||
port_range_max = 10255
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule6" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv6"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 10255
|
|
||||||
port_range_max = 10255
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule7" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv4"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 25000
|
|
||||||
port_range_max = 25000
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule8" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv6"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 25000
|
|
||||||
port_range_max = 25000
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule9" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv4"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 12379
|
|
||||||
port_range_max = 12379
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule10" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv6"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 12379
|
|
||||||
port_range_max = 12379
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule11" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv4"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 10257
|
|
||||||
port_range_max = 10257
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule12" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv6"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 10257
|
|
||||||
port_range_max = 10257
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule13" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv4"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 10259
|
|
||||||
port_range_max = 10259
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule14" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv6"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 10259
|
|
||||||
port_range_max = 10259
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule15" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv4"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 19001
|
|
||||||
port_range_max = 19001
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule16" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv6"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 19001
|
|
||||||
port_range_max = 19001
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule17" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv4"
|
|
||||||
protocol = "udp"
|
|
||||||
port_range_min = 4789
|
|
||||||
port_range_max = 4789
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule18" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv6"
|
|
||||||
protocol = "udp"
|
|
||||||
port_range_min = 4789
|
|
||||||
port_range_max = 4789
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule19" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv4"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 16443
|
|
||||||
port_range_max = 16443
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
resource "openstack_networking_secgroup_rule_v2" "microk8s_rule20" {
|
|
||||||
direction = "ingress"
|
|
||||||
ethertype = "IPv6"
|
|
||||||
protocol = "tcp"
|
|
||||||
port_range_min = 16443
|
|
||||||
port_range_max = 16443
|
|
||||||
remote_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
security_group_id = openstack_networking_secgroup_v2.microk8s.id
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "openstack_compute_instance_v2" "controller-nodes" {
|
|
||||||
count = var.pgcluster_instance_count
|
count = var.pgcluster_instance_count
|
||||||
name = "${var.pgcluster_name}-${count.index}.${var.dns_suffix}"
|
name = "${var.pgcluster_name}-${count.index}.${var.dns_suffix}"
|
||||||
flavor_name = "${var.pgcluster_instance_type}"
|
flavor_name = "${var.pgcluster_instance_type}"
|
||||||
|
|
10
vars.tf
10
vars.tf
|
@ -4,6 +4,9 @@ variable "worker_instance_count" {
|
||||||
variable "controller_instance_count" {
|
variable "controller_instance_count" {
|
||||||
default = "3"
|
default = "3"
|
||||||
}
|
}
|
||||||
|
variable "pgcluster_instance_count" {
|
||||||
|
default = "3"
|
||||||
|
}
|
||||||
|
|
||||||
variable "controller_instance_type" {
|
variable "controller_instance_type" {
|
||||||
default = "b2.c2r4"
|
default = "b2.c2r4"
|
||||||
|
@ -20,6 +23,13 @@ variable "worker_name" {
|
||||||
variable "controller_name" {
|
variable "controller_name" {
|
||||||
default = "internal-sto4-test-k8sc"
|
default = "internal-sto4-test-k8sc"
|
||||||
}
|
}
|
||||||
|
variable "pgcluster_name" {
|
||||||
|
default = "internal-sto4-test-k8spg"
|
||||||
|
}
|
||||||
|
variable "pgcluster_instance_type"{
|
||||||
|
default = "b2.c2r8"
|
||||||
|
}
|
||||||
|
|
||||||
variable "dns_suffix" {
|
variable "dns_suffix" {
|
||||||
default = "rut.sunet.se"
|
default = "rut.sunet.se"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue