-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
64 lines (45 loc) · 1.03 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
// Copyright 2022 Ilias Yacoubi ([email protected])
// Goal of this application is to learn and get familiar with the client-go package.
import (
"flag"
"fmt"
"log"
)
var (
ing bool
pv bool
)
func init() {
flag.BoolVar(&ing, "ing", false, "check dead ingresses.")
flag.BoolVar(&pv, "pv", false, "check persistent volumes.")
}
func main() {
flag.Parse()
var ans string
clientset, err := getCluster()
if ing {
ingItems, _ := getIngress(*clientset)
hs, _, wl, hl, in, ins := inspectIngress(ingItems)
i := 0
for _, host := range hs {
url := "http://" + host
if !statusChecker(url) && !wl[i] && !hl[i] {
fmt.Printf("🔴 %s \n", host)
fmt.Printf("Delete ingress %s in %s y/n: ", in[i], ins[i])
fmt.Scanln(&ans)
if ans == "Y" || ans == "y" {
deleteIngress(*clientset, in[i], ins[i])
}
}
i++
}
fmt.Printf("\n🔎💻 %d URL's \n", len(hs))
}
if pv {
err = listStorageObjects(*&clientset)
if err != nil {
log.Fatalf("Could not list storage objects: %v", err)
}
}
}