Skip to content

Commit cb91380

Browse files
author
marcel
committed
update
1 parent 2f3689c commit cb91380

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ metadata:
1515
annotations:
1616
version: "0.1"
1717
spec:
18+
serviceAccountName: waitfor
1819
selector:
1920
matchLabels:
2021
app: myapp
@@ -42,6 +43,32 @@ spec:
4243
- name: myapp
4344
image: ghcr.io/example/myapp:latest
4445
imagePullPolicy: Always
46+
---
47+
apiVersion: v1
48+
kind: ServiceAccount
49+
metadata:
50+
name: waitfor
51+
---
52+
apiVersion: rbac.authorization.k8s.io/v1
53+
kind: Role
54+
metadata:
55+
name: waitfor-pod-reader
56+
rules:
57+
- apiGroups: [""]
58+
resources: ["pods"]
59+
verbs: ["get", "list", "watch"]
60+
---
61+
apiVersion: rbac.authorization.k8s.io/v1
62+
kind: RoleBinding
63+
metadata:
64+
name: waitfor-pod-reader-binding
65+
subjects:
66+
- kind: ServiceAccount
67+
name: waitfor
68+
roleRef:
69+
kind: Role
70+
name: waitfor-pod-reader
71+
apiGroup: rbac.authorization.k8s.io
4572
```
4673
4774
Example output while waiting for vault pods to be ready:

cmd/job.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package cmd
66
import (
77
"context"
88
"fmt"
9+
"os"
910
"time"
1011

1112
"github.com/spf13/cobra"
@@ -72,7 +73,7 @@ func waitForJobsCompleted(clientset *kubernetes.Clientset, namespace, selector s
7273
}
7374
if allDone {
7475
fmt.Println("Info: All Jobs are Completed!")
75-
return
76+
os.Exit(0)
7677
}
7778
}
7879

cmd/pod.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package cmd
66
import (
77
"context"
88
"fmt"
9+
"os"
910
"time"
1011

1112
"github.com/spf13/cobra"
@@ -83,7 +84,7 @@ func waitForPodsReady(clientset *kubernetes.Clientset, namespace, selector strin
8384
if allReady {
8485
fmt.Printf("==============================================\n")
8586
fmt.Println("Info: All pods are ready!")
86-
return
87+
os.Exit(0)
8788
}
8889
}
8990

0 commit comments

Comments
 (0)