-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (34 loc) · 901 Bytes
/
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
package main
import (
"log"
"github.com/AlecAivazis/survey/v2/terminal"
"github.com/AnthonyEnr1quez/local-path-provisioner-volume-converter/internal/kube"
"github.com/AnthonyEnr1quez/local-path-provisioner-volume-converter/internal/prompt"
)
func main() {
log.Print("Use \"Ctrl+C\" to quit\n\n")
config, err := kube.GetKubeconfig()
if err != nil {
log.Fatalln(err.Error())
}
cw := kube.GetClientWrapper(config)
err = cw.CreateMigrationNamespaceAndServiceAccount()
if err != nil {
log.Fatalln(err.Error())
}
defer cw.CleanupMigrationObjects()
for {
resourceNamespace, resourceName, volume, patcher, err := prompt.Survey(cw)
if err != nil {
log.Println(err.Error())
if err == terminal.InterruptErr {
break
}
continue
}
err = kube.ConvertVolume(cw, resourceNamespace, resourceName, volume, patcher)
if err != nil {
log.Fatalln(err.Error())
}
}
}