@@ -15,15 +15,15 @@ import (
15
15
"k8s.io/client-go/util/homedir"
16
16
)
17
17
18
- func main ( ) {
18
+ func main () {
19
19
var kubeconfigFilepath * string
20
- if homeDir := homedir .HomeDir ( ); homeDir != "" {
21
- kubeconfigFilepath = flag .String ("kubeconfig" , filepath .Join (homeDir , ".kube" , "config" ), "(optional) absolute path to the kubeconfig file" )
20
+ if homeDir := homedir .HomeDir (); homeDir != "" {
21
+ kubeconfigFilepath = flag .String ("kubeconfig" , filepath .Join (homeDir , ".kube" , "config" ), "(optional) absolute path to the kubeconfig file" )
22
22
} else {
23
- kubeconfigFilepath = flag .String ("kubeconfig" , "" , "absolute path to the kubeconfig file" )
23
+ kubeconfigFilepath = flag .String ("kubeconfig" , "" , "absolute path to the kubeconfig file" )
24
24
}
25
25
26
- flag .Parse ( )
26
+ flag .Parse ()
27
27
28
28
kubeconfig , err := clientcmd .BuildConfigFromFlags ("" , * kubeconfigFilepath )
29
29
if err != nil {
@@ -33,27 +33,31 @@ func main( ) {
33
33
// In-cluster configuration allows applications running in a pod to automatically connect to the
34
34
// Kubernetes API using the service account (mounted on the pod) credentials and API server
35
35
// endpoint information injected by the cluster.
36
- if kubeconfig , err = rest .InClusterConfig ( ); err != nil {
37
- log .Fatalf ("Error building kubeconfig from in-cluster config : %v" , err )}
36
+ if kubeconfig , err = rest .InClusterConfig (); err != nil {
37
+ log .Fatalf ("Error building kubeconfig from in-cluster config : %v" , err )
38
+ }
38
39
}
39
40
40
- ctx := setupGracefullShutdownHandler ( )
41
+ ctx := setupGracefullShutdownHandler ()
41
42
42
43
kubeclient , err := kubernetes .NewForConfig (kubeconfig )
43
44
if err != nil {
44
- log .Errorf ("Error creating Kubernetes API server client : %v" , err )}
45
+ log .Errorf ("Error creating Kubernetes API server client : %v" , err )
46
+ }
45
47
46
48
clientset , err := clientset .NewForConfig (kubeconfig )
47
49
if err != nil {
48
- log .Errorf ("Error creating Kubernetes API server client (for Application resource type) : %v" , err )}
50
+ log .Errorf ("Error creating Kubernetes API server client (for Application resource type) : %v" , err )
51
+ }
49
52
50
- informerFactory := informers .NewSharedInformerFactory (clientset , 20 * time .Second )
51
- informer := informerFactory .Instagramclone ( ).V1alpha1 ( ).Applications ( )
53
+ informerFactory := informers .NewSharedInformerFactory (clientset , 20 * time .Second )
54
+ informer := informerFactory .Instagramclone ().V1alpha1 ().Applications ()
52
55
53
56
controller := controller .NewController (kubeclient , clientset , informer )
54
57
55
- informerFactory .Start (ctx .Done ( ))
58
+ informerFactory .Start (ctx .Done ())
56
59
57
60
if err := controller .Run (ctx ); err != nil {
58
- log .Errorf ("Error running controller : %v" , err )}
59
- }
61
+ log .Errorf ("Error running controller : %v" , err )
62
+ }
63
+ }
0 commit comments