30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
import paramiko
|
|
import sys
|
|
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
|
|
key_path = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet"
|
|
|
|
# 1. Aerodrome: delete technitium-npm-vip-service
|
|
cAero = paramiko.SSHClient()
|
|
cAero.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
cAero.connect("140.44.4.11", username="root", key_filename=key_path, timeout=5)
|
|
stdin, stdout, stderr = cAero.exec_command("k3s kubectl -n infra delete svc technitium-npm-vip-service --ignore-not-found=true")
|
|
print("Aerodrome delete svc:", stdout.read().decode('utf-8'))
|
|
cAero.close()
|
|
|
|
# 2. Spaceport: delete legacy resources in infrastructure
|
|
cSpace = paramiko.SSHClient()
|
|
cSpace.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
cSpace.connect("140.44.4.41", username="root", key_filename=key_path, timeout=5)
|
|
cmd = """
|
|
k3s kubectl -n infrastructure delete deploy pihole technitium-dns --ignore-not-found=true --grace-period=0 --force
|
|
k3s kubectl -n infrastructure delete svc pihole-dns-tcp pihole-dns-udp pihole-web technitium-service --ignore-not-found=true
|
|
k3s kubectl -n infrastructure delete pvc pihole technitium-longhorn-pvc --ignore-not-found=true
|
|
"""
|
|
stdin, stdout, stderr = cSpace.exec_command(cmd)
|
|
print("Spaceport delete results:")
|
|
print(stdout.read().decode('utf-8'))
|
|
cSpace.close()
|
|
|