ci/cd - remove useless files and prepare for update

This commit is contained in:
fl0ppy-d1sk 2024-02-21 17:52:05 +01:00
parent 86ac600c44
commit 99f7ba5688
No known key found for this signature in database
GPG key ID: 93EE47CC3D061500
13 changed files with 1 additions and 276 deletions

View file

@ -30,7 +30,7 @@ jobs:
uses: azure/setup-kubectl@901a10e89ea615cf61f57ac05cecdf23e7de06d8 # v3.2
if: inputs.TYPE == 'k8s'
with:
version: "v1.28.2"
version: "v1.28.6"
- name: Set up Python 3.12
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
if: inputs.TYPE != 'k8s'
@ -46,7 +46,6 @@ jobs:
- run: ./tests/create.sh ${{ inputs.TYPE }}
env:
CICD_SECRETS: ${{ secrets.CICD_SECRETS }}
K8S_IP: ${{ secrets.K8S_IP }}
- run: |
tar -cf terraform.tar /tmp/${{ inputs.TYPE }}
echo "$SECRET_KEY" > /tmp/.secret_key

View file

@ -85,7 +85,6 @@ jobs:
secrets:
CICD_SECRETS: ${{ secrets.CICD_SECRETS }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
K8S_IP: ${{ secrets.K8S_IP }}
prepare-tests-core:
runs-on: ubuntu-latest
steps:

View file

@ -2,7 +2,6 @@
# drop and export secrets
echo "${CICD_SECRETS}" > /opt/.env
echo "export TF_VAR_k8s_ip=${K8S_IP}" >> /opt/.env
chmod +x /opt/.env
# shellcheck disable=SC1091
. /opt/.env

View file

@ -1,41 +0,0 @@
# Variables
variable "autoconf_ip" {
type = string
nullable = false
}
# Create cicd_bw_autoconf SSH key
resource "openstack_compute_keypair_v2" "ssh_key" {
provider = openstack.openstack
name = "cicd_bw_autoconf"
public_key = file("~/.ssh/id_rsa.pub")
}
# Create cicd_bw_autoconf instance
resource "openstack_compute_instance_v2" "instance" {
provider = openstack.openstack
name = "cicd_bw_autoconf"
image_name = "Debian 11"
flavor_name = "d2-4"
region = "SBG5"
key_pair = openstack_compute_keypair_v2.ssh_key.name
network {
name = "Ext-Net"
}
}
# Attach failover IP to cicd_bw_autoconf instance
#resource "ovh_cloud_project_failover_ip_attach" "failover_ip" {
# provider = ovh.ovh
# ip = var.autoconf_ip
# routed_to = openstack_compute_instance_v2.instance.name
#}
# Create Ansible inventory file
resource "local_file" "ansible_inventory" {
content = templatefile("templates/autoconf_inventory.tftpl", {
public_ip = openstack_compute_instance_v2.instance.access_ip_v4,
failover_ip = var.autoconf_ip
})
filename = "/tmp/autoconf_inventory"
}

View file

@ -1,41 +0,0 @@
# Variables
variable "docker_ip" {
type = string
nullable = false
}
# Create cicd_bw_docker SSH key
resource "openstack_compute_keypair_v2" "ssh_key" {
provider = openstack.openstack
name = "cicd_bw_docker"
public_key = file("~/.ssh/id_rsa.pub")
}
# Create cicd_bw_docker instance
resource "openstack_compute_instance_v2" "instance" {
provider = openstack.openstack
name = "cicd_bw_docker"
image_name = "Debian 11"
flavor_name = "d2-4"
region = "SBG5"
key_pair = openstack_compute_keypair_v2.ssh_key.name
network {
name = "Ext-Net"
}
}
# Attach failover IP to cicd_bw_docker instance
#resource "ovh_cloud_project_failover_ip_attach" "failover_ip" {
# provider = ovh.ovh
# ip = var.docker_ip
# routed_to = openstack_compute_instance_v2.instance.name
#}
# Create Ansible inventory file
resource "local_file" "ansible_inventory" {
content = templatefile("templates/docker_inventory.tftpl", {
public_ip = openstack_compute_instance_v2.instance.access_ip_v4,
failover_ip = var.docker_ip
})
filename = "/tmp/docker_inventory"
}

View file

@ -1,51 +0,0 @@
# Create cicd_bw_k8s network
resource "ovh_cloud_project_network_private" "network" {
provider = ovh.ovh
name = "cicd_bw_k8s"
regions = ["SBG5"]
vlan_id = 60
}
resource "ovh_cloud_project_network_private_subnet" "subnet" {
provider = ovh.ovh
depends_on = [ovh_cloud_project_network_private.network]
network_id = ovh_cloud_project_network_private.network.id
start = "192.168.42.100"
end = "192.168.42.200"
network = "192.168.42.0/24"
region = "SBG5"
dhcp = true
no_gateway = false
}
# Create k8s cluster
resource "ovh_cloud_project_kube" "cluster" {
provider = ovh.ovh
depends_on = [ovh_cloud_project_network_private_subnet.subnet]
name = "cicd_bw_k8s"
region = "SBG5"
version = "1.24"
private_network_id = tolist(ovh_cloud_project_network_private.network.regions_attributes[*].openstackid)[0]
private_network_configuration {
default_vrack_gateway = ""
private_network_routing_as_default = false
}
}
# Create nodepool
resource "ovh_cloud_project_kube_nodepool" "pool" {
provider = ovh.ovh
kube_id = ovh_cloud_project_kube.cluster.id
name = "pool"
flavor_name = "d2-4"
desired_nodes = 3
min_nodes = 3
max_nodes = 3
monthly_billed = false
autoscale = false
}
# Get kubeconfig file
resource "local_file" "kubeconfig" {
content = ovh_cloud_project_kube.cluster.kubeconfig
filename = "/tmp/kubeconfig"
}

View file

@ -1,41 +0,0 @@
# Variables
variable "linux_ip" {
type = string
nullable = false
}
# Create cicd_bw_linux SSH key
resource "openstack_compute_keypair_v2" "ssh_key" {
provider = openstack.openstack
name = "cicd_bw_linux"
public_key = file("~/.ssh/id_rsa.pub")
}
# Create cicd_bw_linux instance
resource "openstack_compute_instance_v2" "instance" {
provider = openstack.openstack
name = "cicd_bw_linux"
image_name = "Debian 11"
flavor_name = "d2-4"
region = "SBG5"
key_pair = openstack_compute_keypair_v2.ssh_key.name
network {
name = "Ext-Net"
}
}
# Attach failover IP to cicd_bw_linux instance
#resource "ovh_cloud_project_failover_ip_attach" "failover_ip" {
# provider = ovh.ovh
# ip = var.linux_ip
# routed_to = openstack_compute_instance_v2.instance.name
#}
# Create Ansible inventory file
resource "local_file" "ansible_inventory" {
content = templatefile("templates/linux_inventory.tftpl", {
public_ip = openstack_compute_instance_v2.instance.access_ip_v4,
failover_ip = var.linux_ip
})
filename = "/tmp/linux_inventory"
}

View file

@ -1,22 +0,0 @@
terraform {
required_version = ">= 0.14.0"
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "~> 1.48.0"
}
ovh = {
source = "ovh/ovh"
version = ">= 0.13.0"
}
}
}
provider "openstack" {
alias = "openstack"
}
provider "ovh" {
alias = "ovh"
}

View file

@ -1,64 +0,0 @@
# Variables
variable "swarm_ips" {
type = list(string)
nullable = false
}
# Create cicd_bw_swarm SSH key
resource "openstack_compute_keypair_v2" "ssh_key" {
provider = openstack.openstack
name = "cicd_bw_swarm"
public_key = file("~/.ssh/id_rsa.pub")
}
# Create cicd_bw_swarm network
resource "ovh_cloud_project_network_private" "network" {
provider = ovh.ovh
name = "cicd_bw_swarm"
regions = ["SBG5"]
vlan_id = 50
}
resource "ovh_cloud_project_network_private_subnet" "subnet" {
provider = ovh.ovh
network_id = ovh_cloud_project_network_private.network.id
start = "192.168.42.1"
end = "192.168.42.254"
network = "192.168.42.0/24"
region = "SBG5"
no_gateway = true
}
# Create cicd_bw_swarm_[1-3] instances
resource "openstack_compute_instance_v2" "instances" {
provider = openstack.openstack
depends_on = [ovh_cloud_project_network_private_subnet.subnet]
count = 3
name = "cicd_bw_swarm_${count.index}"
image_name = "Debian 11"
flavor_name = "d2-4"
region = "SBG5"
key_pair = openstack_compute_keypair_v2.ssh_key.name
network {
name = "Ext-Net"
}
network {
name = ovh_cloud_project_network_private.network.name
}
}
# Attach failover IPs to cicd_bw_swarm_[1-3] instances
#resource "ovh_cloud_project_failover_ip_attach" "failover_ip" {
# provider = ovh.ovh
# count = 3
# ip = var.swarm_ips[${count.index}]
# routed_to = openstack_compute_instance_v2.instances[${count.index}]
#}
# Create Ansible inventory file
resource "local_file" "ansible_inventory" {
content = templatefile("templates/swarm_inventory.tftpl", {
instances = openstack_compute_instance_v2.instances,
failover_ips = var.swarm_ips
})
filename = "/tmp/swarm_inventory"
}

View file

@ -1,2 +0,0 @@
[autoconf]
autoconf ansible_host=${public_ip} ansible_user=debian failover_ip=${failover_ip}

View file

@ -1,2 +0,0 @@
[docker]
docker ansible_host=${public_ip} ansible_user=debian failover_ip=${failover_ip}

View file

@ -1,2 +0,0 @@
[linux]
linux ansible_host=${public_ip} ansible_user=debian failover_ip=${failover_ip}

View file

@ -1,6 +0,0 @@
[managers]
manager ansible_host=${instances[0].access_ip_v4} ansible_user=debian failover_ip=${failover_ips[0]} local_ip=192.168.42.100
[workers]
worker1 ansible_host=${instances[1].access_ip_v4} ansible_user=debian failover_ip=${failover_ips[1]} local_ip=192.168.42.101
worker2 ansible_host=${instances[2].access_ip_v4} ansible_user=debian failover_ip=${failover_ips[2]} local_ip=192.168.42.102