feat: add cluster management and audit utility scripts
This commit is contained in:
29
scripts/finish_phase1_prune.py
Normal file
29
scripts/finish_phase1_prune.py
Normal file
@@ -0,0 +1,29 @@
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user