forked from martin-helmich/kubernetes-crd-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
50 lines (36 loc) · 1.04 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
package main
import (
"flag"
"github.com/astaxie/beego"
"github.com/martin-helmich/kubernetes-crd-example/controllers"
)
var namespace = "default"
var kubeconfig string
func init() {
flag.StringVar(&kubeconfig, "kubeconfig", "", "path to Kubernetes config file")
flag.Parse()
}
func main() {
beego.BConfig.CopyRequestBody = true
beego.Router("/updata", new(controllers.UpdataController), "get,post:Update")
beego.Run(":80")
/*v1alpha1.AddToScheme(scheme.Scheme)
kubeConfig, err := utils.KubeConfig()
clientSet, err := clientV1alpha1.NewForConfig(kubeConfig)
if err != nil {
panic(err)
}
projects, err := clientSet.Projects("default").List(metav1.ListOptions{})
devices, err := clientSet.Devices("default").List(metav1.ListOptions{})
if err != nil {
panic(err)
}
fmt.Printf("devices found: %+v\n", devices)
fmt.Printf("projects found: %+v\n", projects)
store := WatchResources(clientSet)
for {
projectsFromStore := store.List()
fmt.Printf("project in store: %d\n", len(projectsFromStore))
time.Sleep(2 * time.Second)
}*/
}