chore: entferne k8s-deployment und tf-konfiguration für native compose migration
This commit is contained in:
parent
576448a486
commit
a39d256d62
2 changed files with 0 additions and 149 deletions
64
.github/workflows/deploy.yml
vendored
64
.github/workflows/deploy.yml
vendored
|
|
@ -1,64 +0,0 @@
|
||||||
name: cloudmon GitOps Deploy
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "main" ]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: catthehacker/ubuntu:act-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Trust Local Nginx Certificate Inside Container
|
|
||||||
run: |
|
|
||||||
mkdir -p /usr/local/share/ca-certificates/
|
|
||||||
cp nginx_ssl/nginx.crt /usr/local/share/ca-certificates/nginx-sandbox.crt 2>/dev/null || echo "Nutze Workspace-Zertifikat"
|
|
||||||
update-ca-certificates
|
|
||||||
|
|
||||||
# Nutzt dein PAT für den schnellen, unkomplizierten Push via localhost:3005
|
|
||||||
- name: Log in to Local Registry
|
|
||||||
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login localhost:3005 -u ${{ github.actor }} --password-stdin
|
|
||||||
|
|
||||||
# Baut das schlanke Python-Image für das Dashboard
|
|
||||||
- name: Build Dashboard Image
|
|
||||||
run: |
|
|
||||||
docker build -t localhost:3005/${{ github.repository }}:${{ github.sha }} .
|
|
||||||
docker build -t localhost:3005/${{ github.repository }}:latest .
|
|
||||||
|
|
||||||
# Schiebt das Image über das unverschlüsselte Socket-Tor hoch
|
|
||||||
- name: Push Dashboard Image
|
|
||||||
run: |
|
|
||||||
docker push localhost:3005/${{ github.repository }}:${{ github.sha }}
|
|
||||||
docker push localhost:3005/${{ github.repository }}:latest
|
|
||||||
|
|
||||||
# Bereitet die echten K3s-Schlüssel aus dem automatischen Secret vor
|
|
||||||
- name: Prepare Kubernetes Access
|
|
||||||
run: |
|
|
||||||
echo "${{ secrets.KUBECONFIG_DATA }}" > ./kind_kubeconfig
|
|
||||||
chmod 600 ./kind_kubeconfig
|
|
||||||
|
|
||||||
- name: Terraform Deploy
|
|
||||||
run: |
|
|
||||||
# DIE RADIKALE RETTUNG: Zwingt Kubernetes, die Altlasten SOFORT und rückstandslos zu löschen!
|
|
||||||
docker exec local-k3s-platform kubectl delete ingress cloudmon-ingress -n default --ignore-not-found=true --force --grace-period=0 2>/dev/null || true
|
|
||||||
docker exec local-k3s-platform kubectl delete service cloudmon-service -n default --ignore-not-found=true --force --grace-period=0 2>/dev/null || true
|
|
||||||
docker exec local-k3s-platform kubectl delete deployment cloudmon -n default --ignore-not-found=true --force --grace-period=0 2>/dev/null || true
|
|
||||||
|
|
||||||
# Kurze Atempause für die Cluster-API (2 Sekunden)
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
terraform init
|
|
||||||
terraform apply -auto-approve -var="app_version=${{ github.sha }}"
|
|
||||||
|
|
||||||
|
|
||||||
- name: Verify Dashboard Health
|
|
||||||
run: |
|
|
||||||
echo "Warte auf die cloudmon-Pods und das Ingress-Routing..."
|
|
||||||
sleep 10
|
|
||||||
# Testet den Zugriff mit dem passenden Host-Header über das interne Netz
|
|
||||||
curl --fail --connect-timeout 5 -H "Host: cloudmon.local" http://local-k3s-platform:80/ || exit 1
|
|
||||||
echo "Erfolg: Das Boday-IT cloudmon Dashboard läuft fehlerfrei im Cluster!"
|
|
||||||
85
main.tf
85
main.tf
|
|
@ -1,85 +0,0 @@
|
||||||
terraform {
|
|
||||||
required_providers {
|
|
||||||
kubernetes = {
|
|
||||||
source = "hashicorp/kubernetes"
|
|
||||||
version = "~> 2.26"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "app_version" {
|
|
||||||
type = string
|
|
||||||
default = "latest"
|
|
||||||
}
|
|
||||||
|
|
||||||
provider "kubernetes" {
|
|
||||||
config_path = "./kind_kubeconfig"
|
|
||||||
host = "https://local-k3s-platform:6443"
|
|
||||||
insecure = true
|
|
||||||
}
|
|
||||||
|
|
||||||
# 1. DAS DASHBOARD DEPLOYMENT
|
|
||||||
resource "kubernetes_deployment_v1" "cloudmon" {
|
|
||||||
metadata {
|
|
||||||
name = "cloudmon"
|
|
||||||
namespace = "default"
|
|
||||||
labels = { app = "cloudmon" }
|
|
||||||
}
|
|
||||||
spec {
|
|
||||||
replicas = 1
|
|
||||||
selector { match_labels = { app = "cloudmon" } }
|
|
||||||
template {
|
|
||||||
metadata { labels = { app = "cloudmon" } }
|
|
||||||
spec {
|
|
||||||
container {
|
|
||||||
name = "dashboard"
|
|
||||||
image = "registry.local/bast/cloudmon:${var.app_version}"
|
|
||||||
image_pull_policy = "Always"
|
|
||||||
port { container_port = 8000 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# 2. DER KUBERNETES SERVICE (Port 8000 intern freischalten)
|
|
||||||
resource "kubernetes_service_v1" "cloudmon_service" {
|
|
||||||
metadata {
|
|
||||||
name = "cloudmon-service"
|
|
||||||
namespace = "default"
|
|
||||||
}
|
|
||||||
spec {
|
|
||||||
selector = { app = "cloudmon" }
|
|
||||||
port {
|
|
||||||
port = 80
|
|
||||||
target_port = 8000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# 3. DAS INGRESS ROUTING (Macht cloudmon unter cloudmon.local über Port 8080 erreichbar!)
|
|
||||||
resource "kubernetes_ingress_v1" "cloudmon_ingress" {
|
|
||||||
metadata {
|
|
||||||
name = "cloudmon-ingress"
|
|
||||||
namespace = "default"
|
|
||||||
annotations = { "kubernetes.io/ingress.class" = "nginx" }
|
|
||||||
}
|
|
||||||
spec {
|
|
||||||
rule {
|
|
||||||
host = "cloudmon.local"
|
|
||||||
http {
|
|
||||||
path {
|
|
||||||
path = "/"
|
|
||||||
path_type = "Prefix"
|
|
||||||
backend {
|
|
||||||
service {
|
|
||||||
name = kubernetes_service_v1.cloudmon_service.metadata[0].name
|
|
||||||
port { number = 80 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Loading…
Reference in a new issue