@@ -13,6 +13,24 @@ type PodOptions struct {
13
13
cmd []string
14
14
}
15
15
16
+ var script = `
17
+ base_processes=$(ps aux | grep -E "ash|bash|sh" | grep -v grep | wc -l)
18
+ echo "Processes: $base_processes"
19
+ sleep 2
20
+
21
+ while :; do
22
+ shell_processes=$(ps aux | grep -E "ash|bash|sh" | grep -v grep | wc -l)
23
+ if [ "$shell_processes" -gt "$base_processes" ]; then
24
+ echo "Found an additional process"
25
+ while [ "$shell_processes" -gt "$base_processes" ]; do
26
+ sleep 2
27
+ shell_processes=$(ps aux | grep -E "ash|bash|sh" | grep -v grep | wc -l)
28
+ done
29
+ exit 0
30
+ fi
31
+ done
32
+ `
33
+
16
34
// Finds if a pod that attached to a PVC
17
35
func findPodByPVC (podList corev1.PodList , pvc corev1.PersistentVolumeClaim ) * corev1.Pod {
18
36
for _ , pod := range podList .Items {
@@ -33,24 +51,25 @@ func buildPvcbGetJob(options PodOptions) *batchv1.Job {
33
51
34
52
job := & batchv1.Job {
35
53
ObjectMeta : metav1.ObjectMeta {
36
- Name : "pvcb-edit- " + options .pvc .Name ,
54
+ Name : "browse-pvc " + options .pvc .Name ,
37
55
Namespace : options .namespace ,
38
56
},
39
57
Spec : batchv1.JobSpec {
40
58
TTLSecondsAfterFinished : TTLSecondsAfterFinished ,
41
59
Template : corev1.PodTemplateSpec {
42
60
ObjectMeta : metav1.ObjectMeta {
43
- Name : "pvcb-edit " ,
61
+ Name : "browse-pvc " ,
44
62
},
45
63
Spec : corev1.PodSpec {
46
64
RestartPolicy : "Never" ,
47
65
Containers : []corev1.Container {
48
66
{
49
- Name : "pvcb-edit " ,
67
+ Name : "browser " ,
50
68
Image : image ,
51
69
//Command: []string{"/bin/bash", "-c", "--"},
52
70
Command : options .cmd ,
53
- Args : []string {"/entrypoint.sh" },
71
+ //Args: []string{"/entrypoint.sh"},
72
+ Args : []string {script },
54
73
VolumeMounts : []corev1.VolumeMount {
55
74
{
56
75
Name : "target-pvc" ,
0 commit comments