feat: add various infrastructure check and automation scripts
This commit is contained in:
31
scripts/check_crd_salvage.py
Normal file
31
scripts/check_crd_salvage.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import paramiko
|
||||
|
||||
SSH_KEY = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet"
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect("140.44.4.90", username="rancher", key_filename=SSH_KEY, timeout=10)
|
||||
|
||||
def k8s(cmd):
|
||||
full_cmd = f"echo Katzir476! | sudo -S sh -c 'export KUBECONFIG=/etc/rancher/rke2/rke2.yaml; PATH=$PATH:/var/lib/rancher/rke2/bin; {cmd}'"
|
||||
_, o, e = c.exec_command(full_cmd)
|
||||
return o.read().decode().strip(), e.read().decode().strip()
|
||||
|
||||
print("Replica spec fields:")
|
||||
out, _ = k8s("kubectl explain replica.longhorn.io.spec")
|
||||
print(out)
|
||||
|
||||
print("\nVolume spec fields:")
|
||||
out, _ = k8s("kubectl explain volume.longhorn.io.spec")
|
||||
print(out)
|
||||
|
||||
print("\nEngine spec fields:")
|
||||
out, _ = k8s("kubectl explain engine.longhorn.io.spec")
|
||||
print(out)
|
||||
|
||||
# Check engine CR directly
|
||||
out, _ = k8s("kubectl get engines.longhorn.io -n longhorn-system pvc-4da99c48-f52e-4adf-9b4c-16e8878eb495-e-0 -o yaml")
|
||||
print("\nEngine YAML for pvc-4da99c48:")
|
||||
print(out)
|
||||
|
||||
c.close()
|
||||
|
||||
Reference in New Issue
Block a user