feat: add infrastructure automation scripts and master improvement plan
This commit is contained in:
34
scripts/inspect_storageclasses_pvcs.py
Normal file
34
scripts/inspect_storageclasses_pvcs.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import os
|
||||
import sys
|
||||
import paramiko
|
||||
|
||||
sys.stdout.reconfigure(encoding="utf-8")
|
||||
pkey = paramiko.Ed25519Key.from_private_key_file(os.path.expanduser('~/.ssh/id_ed25519_snarfnet'))
|
||||
|
||||
clusters = [
|
||||
("aerodrome (140.44.4.11)", "140.44.4.11"),
|
||||
("spaceport (140.44.4.41)", "140.44.4.41"),
|
||||
]
|
||||
|
||||
for name, ip in clusters:
|
||||
print(f"\n==================================================")
|
||||
print(f"STORAGE AUDIT ON {name}")
|
||||
print(f"==================================================")
|
||||
client = paramiko.SSHClient()
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
try:
|
||||
client.connect(ip, username="root", pkey=pkey, timeout=10)
|
||||
cmd = """
|
||||
echo "=== StorageClasses ==="
|
||||
kubectl get sc
|
||||
echo "=== Terminating / Stuck PVCs ==="
|
||||
kubectl get pvc -A | grep -iE 'terminating|failed|pending' || echo " None found"
|
||||
echo "=== Default Namespace PVCs ==="
|
||||
kubectl get pvc -n default || echo " None"
|
||||
"""
|
||||
stdin, stdout, stderr = client.exec_command(cmd)
|
||||
print(stdout.read().decode('utf-8', errors='replace'))
|
||||
client.close()
|
||||
except Exception as e:
|
||||
print(f"Error on {name}: {e}")
|
||||
|
||||
Reference in New Issue
Block a user