11package addon_operator
22
33import (
4- "context"
54 "fmt"
65
76 log "github.com/sirupsen/logrus"
@@ -17,7 +16,7 @@ import (
1716)
1817
1918// Bootstrap inits all dependencies for a full-fledged AddonOperator instance.
20- func Bootstrap (op * AddonOperator ) error {
19+ func (op * AddonOperator ) bootstrap ( ) error {
2120 runtimeConfig := config .NewConfig ()
2221 // Init logging subsystem.
2322 sh_app .SetupLogging (runtimeConfig )
@@ -40,8 +39,6 @@ func Bootstrap(op *AddonOperator) error {
4039
4140 log .Infof ("Addon-operator namespace: %s" , app .Namespace )
4241
43- op .WithContext (context .Background ())
44-
4542 // Debug server.
4643 debugServer , err := shell_operator .InitDefaultDebugServer ()
4744 if err != nil {
@@ -55,7 +52,7 @@ func Bootstrap(op *AddonOperator) error {
5552 return err
5653 }
5754
58- err = AssembleAddonOperator ( op , app .ModulesDir , globalHooksDir , tempDir , debugServer , runtimeConfig )
55+ err = op . Assemble ( app .ModulesDir , globalHooksDir , tempDir , debugServer , runtimeConfig )
5956 if err != nil {
6057 log .Errorf ("Fatal: %s" , err )
6158 return err
@@ -64,17 +61,17 @@ func Bootstrap(op *AddonOperator) error {
6461 return nil
6562}
6663
67- func AssembleAddonOperator (op * AddonOperator , modulesDir string , globalHooksDir string , tempDir string , debugServer * debug.Server , runtimeConfig * config.Config ) (err error ) {
68- RegisterDefaultRoutes (op )
64+ func (op * AddonOperator ) Assemble ( modulesDir string , globalHooksDir string , tempDir string , debugServer * debug.Server , runtimeConfig * config.Config ) (err error ) {
65+ op . RegisterDefaultRoutes ()
6966 RegisterAddonOperatorMetrics (op .MetricStorage )
7067 StartLiveTicksUpdater (op .MetricStorage )
7168 StartTasksQueueLengthUpdater (op .MetricStorage , op .TaskQueues )
7269
7370 // Register routes in debug server.
7471 shell_operator .RegisterDebugQueueRoutes (debugServer , op .ShellOperator )
7572 shell_operator .RegisterDebugConfigRoutes (debugServer , runtimeConfig )
76- RegisterDebugGlobalRoutes (debugServer , op )
77- RegisterDebugModuleRoutes (debugServer , op )
73+ op . RegisterDebugGlobalRoutes (debugServer )
74+ op . RegisterDebugModuleRoutes (debugServer )
7875
7976 // Helm client factory.
8077 op .Helm , err = helm .InitHelmClientFactory (op .KubeClient )
@@ -89,7 +86,7 @@ func AssembleAddonOperator(op *AddonOperator, modulesDir string, globalHooksDir
8986 return fmt .Errorf ("initialize Helm resources manager: %s" , err )
9087 }
9188
92- SetupModuleManager (op , modulesDir , globalHooksDir , tempDir , runtimeConfig )
89+ op . SetupModuleManager (modulesDir , globalHooksDir , tempDir , runtimeConfig )
9390
9491 err = op .InitModuleManager ()
9592 if err != nil {
@@ -99,7 +96,7 @@ func AssembleAddonOperator(op *AddonOperator, modulesDir string, globalHooksDir
9996 return nil
10097}
10198
102- func SetupModuleManager (op * AddonOperator , modulesDir string , globalHooksDir string , tempDir string , runtimeConfig * config.Config ) {
99+ func (op * AddonOperator ) SetupModuleManager ( modulesDir string , globalHooksDir string , tempDir string , runtimeConfig * config.Config ) {
103100 // Create manager to check values in ConfigMap.
104101 kcfg := kube_config_manager.Config {
105102 Namespace : app .Namespace ,
0 commit comments