Skip to content

Commit 90a5c26

Browse files
committed
list mount points
1 parent ca79536 commit 90a5c26

4 files changed

Lines changed: 22 additions & 52 deletions

File tree

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,19 @@
9191
PUSHGATEWAY_URL=http://localhost:9091
9292
```
9393
94+
95+
* run
96+
```
97+
python -m src.main
98+
```
99+
94100
## Install locally with Docker
95-
* build image
101+
* build
96102
```
97103
docker build . --tag clustersnap:local
98104
```
99105
100-
* run image
106+
* run
101107
```
102108
docker run clustersnap:local
103109
```
@@ -113,7 +119,7 @@
113119
```
114120
* create pod
115121
```
116-
kubectl apply -f tests/pod.yaml -n NAMESPACE
122+
NAMESPACE=tenant-test0 envsubst < tests/resources.yaml | kubectl apply -f -
117123
```
118124
119125

src/helpers/pvc.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/main.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22

3-
from src.helpers.pvc import Kubernetes
3+
from src.helpers.kubernetes import Kubernetes
44

55

66
def main():
@@ -11,6 +11,18 @@ def main():
1111
for pvc in kubernetes.list_pvc():
1212
print(f"- {pvc['name']} [{pvc['status']}] - {pvc['capacity']}")
1313

14+
mounts = kubernetes.get_pvc_mount_points(pvc)
15+
if not mounts:
16+
print("PVC is not attached to an active pod.")
17+
else:
18+
for m in mounts:
19+
print(f"pods:")
20+
print(f"- name: {m['pod_name']}")
21+
print(f" containers:")
22+
print(f" - name: {m['container_name']}")
23+
print(f" mountpoints:")
24+
print(f" - name: {m['mount_path']}")
25+
print(f" readonly: {m['read_only']}")
1426

1527
if __name__ == "__main__":
1628
sys.exit(main())

tests/pod.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)