Move to testing. Add pgluster tofu.
This commit is contained in:
parent
964ddc523b
commit
1b93c0be15
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
""" Write out a puppet cosmos-modules.conf """
|
||||
"""Write out a puppet cosmos-modules.conf"""
|
||||
|
||||
import hashlib
|
||||
import os
|
||||
|
@ -20,11 +20,10 @@ try:
|
|||
except OSError:
|
||||
host_info = None
|
||||
else:
|
||||
|
||||
domainname = '.'.join([x for x in fqdn.split('.')[:1]])
|
||||
hostname = fqdn.split('.')[0]
|
||||
instance, location, environment, function, number = hostname.split('-')
|
||||
service = fqdn.split('.')[1]
|
||||
domainname = ".".join([x for x in fqdn.split(".")[:1]])
|
||||
hostname = fqdn.split(".")[0]
|
||||
instance, location, environment, function, number = hostname.split("-")
|
||||
service = fqdn.split(".")[1]
|
||||
|
||||
host_info = {
|
||||
"domainname": domainname,
|
||||
|
@ -76,15 +75,20 @@ def create_file_content(modules):
|
|||
expected checksum before writing anything
|
||||
"""
|
||||
file_lines = []
|
||||
file_lines.append("# Generated by {}\n".format( # pylint: disable=consider-using-f-string
|
||||
os.path.basename(sys.argv[0])).encode("utf-8"))
|
||||
file_lines.append(
|
||||
"# Generated by {}\n".format( # pylint: disable=consider-using-f-string
|
||||
os.path.basename(sys.argv[0])
|
||||
).encode("utf-8")
|
||||
)
|
||||
for key in modules:
|
||||
file_lines.append("{0:11} {1} {2} {3}\n".format( # pylint: disable=consider-using-f-string
|
||||
key,
|
||||
modules[key]["repo"],
|
||||
modules[key]["upgrade"],
|
||||
modules[key]["tag"],
|
||||
).encode("utf-8"))
|
||||
file_lines.append(
|
||||
"{0:11} {1} {2} {3}\n".format( # pylint: disable=consider-using-f-string
|
||||
key,
|
||||
modules[key]["repo"],
|
||||
modules[key]["upgrade"],
|
||||
modules[key]["tag"],
|
||||
).encode("utf-8")
|
||||
)
|
||||
|
||||
return file_lines
|
||||
|
||||
|
@ -119,43 +123,43 @@ def main():
|
|||
"ufw": {
|
||||
"repo": "https://github.com/SUNET/puppet-module-ufw.git",
|
||||
"upgrade": "yes",
|
||||
"tag": "sunet-2*",
|
||||
"tag": "sunet-2*",
|
||||
},
|
||||
}
|
||||
|
||||
# When/if we want we can do stuff to modules here
|
||||
if host_info:
|
||||
if host_info["fqdn"] == "internal-sto4-test-monitor-1.rut.sunet.se":
|
||||
modules["sunet"]["tag"] = "testing*"
|
||||
if "internal-sto4-test-k8sc" in host_info["fqdn"]:
|
||||
modules["sunet"]["tag"] = "mifr-nft-fixes*"
|
||||
if "internal-sto4-test-k8sw" in host_info["fqdn"]:
|
||||
modules["sunet"]["tag"] = "mifr-nft-fixes*"
|
||||
# if host_info["fqdn"] == "internal-sto1-test-forgejo-2.platform.sunet.se":
|
||||
# modules["sunet"]["tag"] = "testing-2*"
|
||||
# if host_info["fqdn"] == "internal-sto3-test-monitor-1.platform.sunet.se":
|
||||
# modules["sunet"]["tag"] = "jocar-monitor-handle-legacy-scriptherder-2024-02-14-v10"
|
||||
# if host_info["fqdn"] == "internal-sto1-test-actrunner-1.platform.sunet.se":
|
||||
# modules["sunet"]["tag"] = "testing-2*"
|
||||
## modules["nagioscfg"]["tag"] = "*mifr-2*"
|
||||
# # modules["stdlib"] = {
|
||||
# # "tag": "sunet-2*",
|
||||
# # "upgrade": "yes",
|
||||
# "repo": "https://github.com/SUNET/puppetlabs-stdlib.git",
|
||||
# }
|
||||
# modules["apt"] = {
|
||||
# "tag": "sunet-2*",
|
||||
# "upgrade": "yes",
|
||||
# "repo": "https://github.com/SUNET/puppetlabs-apt.git",
|
||||
# }
|
||||
# modules["concat"] = {
|
||||
# "tag": "sunet-2*",
|
||||
# "upgrade": "yes",
|
||||
# "repo": "https://github.com/SUNET/puppetlabs-concat.git",
|
||||
# }
|
||||
if host_info["fqdn"] == "internal-sto4-test-monitor-1.rut.sunet.se":
|
||||
modules["sunet"]["tag"] = "testing*"
|
||||
if "internal-sto4-test-k8sc" in host_info["fqdn"]:
|
||||
modules["sunet"]["tag"] = "testing*"
|
||||
if "internal-sto4-test-k8sw" in host_info["fqdn"]:
|
||||
modules["sunet"]["tag"] = "testing*"
|
||||
# if host_info["fqdn"] == "internal-sto1-test-forgejo-2.platform.sunet.se":
|
||||
# modules["sunet"]["tag"] = "testing-2*"
|
||||
# if host_info["fqdn"] == "internal-sto3-test-monitor-1.platform.sunet.se":
|
||||
# modules["sunet"]["tag"] = "jocar-monitor-handle-legacy-scriptherder-2024-02-14-v10"
|
||||
# if host_info["fqdn"] == "internal-sto1-test-actrunner-1.platform.sunet.se":
|
||||
# modules["sunet"]["tag"] = "testing-2*"
|
||||
## modules["nagioscfg"]["tag"] = "*mifr-2*"
|
||||
# # modules["stdlib"] = {
|
||||
# # "tag": "sunet-2*",
|
||||
# # "upgrade": "yes",
|
||||
# "repo": "https://github.com/SUNET/puppetlabs-stdlib.git",
|
||||
# }
|
||||
# modules["apt"] = {
|
||||
# "tag": "sunet-2*",
|
||||
# "upgrade": "yes",
|
||||
# "repo": "https://github.com/SUNET/puppetlabs-apt.git",
|
||||
# }
|
||||
# modules["concat"] = {
|
||||
# "tag": "sunet-2*",
|
||||
# "upgrade": "yes",
|
||||
# "repo": "https://github.com/SUNET/puppetlabs-concat.git",
|
||||
# }
|
||||
# if host_info:
|
||||
# if host_info["environment"] == "test":
|
||||
# modules["sunet"]["tag"] = "kano-mail-2*"
|
||||
# modules["sunet"]["tag"] = "kano-mail-2*"
|
||||
# if os_info:
|
||||
# if os_info["ID"] == "debian" and os_info["VERSION_ID"] == "12":
|
||||
# modules["augeas"]["repo"] = "https://github.com/SUNET/puppetlabs-augeas_core"
|
||||
|
|
196
pgcluster.tf
196
pgcluster.tf
|
@ -1,198 +1,4 @@
|
|||
resource "openstack_compute_servergroup_v2" "controllers" {
|
||||
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" {
|
||||
resource "openstack_compute_instance_v2" "pg-nodes" {
|
||||
count = var.pgcluster_instance_count
|
||||
name = "${var.pgcluster_name}-${count.index}.${var.dns_suffix}"
|
||||
flavor_name = "${var.pgcluster_instance_type}"
|
||||
|
|
10
vars.tf
10
vars.tf
|
@ -4,6 +4,9 @@ variable "worker_instance_count" {
|
|||
variable "controller_instance_count" {
|
||||
default = "3"
|
||||
}
|
||||
variable "pgcluster_instance_count" {
|
||||
default = "3"
|
||||
}
|
||||
|
||||
variable "controller_instance_type" {
|
||||
default = "b2.c2r4"
|
||||
|
@ -20,6 +23,13 @@ variable "worker_name" {
|
|||
variable "controller_name" {
|
||||
default = "internal-sto4-test-k8sc"
|
||||
}
|
||||
variable "pgcluster_name" {
|
||||
default = "internal-sto4-test-k8spg"
|
||||
}
|
||||
variable "pgcluster_instance_type"{
|
||||
default = "b2.c2r8"
|
||||
}
|
||||
|
||||
variable "dns_suffix" {
|
||||
default = "rut.sunet.se"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue