forked from vladimirvivien/ktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetrics-ctrl.go
49 lines (43 loc) · 1.36 KB
/
metrics-ctrl.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
package main
func main() {
//// initalize new manager
//mgr, err := cr.NewManager(cr.GetConfigOrDie(), cr.Options{})
//if err != nil {
// log.Fatal("failed to start controller runtime manager:", err)
//}
//
//err = metricsV1beta1.AddToScheme(mgr.GetScheme())
//if err != nil {
// log.Fatal("failed to add scheme:", err)
//}
//
//if err := cr.NewControllerManagedBy(mgr).
// For( &metricsV1beta1.NodeMetrics{}).
// Complete(&recon{mgr.GetClient()}); err != nil {
// log.Fatalf("failed to setup controller: %s", err)
//}
// add watcher for type and use a default enqueing handler
//
//if err := ctrl.Watch(&source.Kind{Type: &metricsV1beta1.NodeMetrics{}}, &handler.EnqueueRequestForObject{}); err != nil {
// log.Fatalf("failed to watch Pod: %s", err)
//}
// <<<<< End Use Controller Directly >>>>>
// Start manager to start internal controller
//if err := mgr.Start(signals.SetupSignalHandler()); err != nil {
// log.Fatal("unable to run manager:", err)
//}
}
//type recon struct{
// client.Client
//}
//
//func (r recon) Reconcile(req reconcile.Request) (reconcile.Result, error) {
// ctx := context.TODO()
//
// var metrics metricsV1beta1.PodMetrics
// if err := r.Get(ctx, req.NamespacedName, &metrics); err != nil {
// return reconcile.Result{Requeue: true}, nil
// }
// fmt.Printf("Got metrics %v\n", metrics)
// return cr.Result{Requeue: false}, nil
//}