diff --git a/cmd/main.go b/cmd/main.go index 2878e51..348a1e8 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -28,7 +28,6 @@ import ( "git.lilpenguins.com/crichardson/locust-operator/internal/logging" "go.uber.org/zap" "k8s.io/apimachinery/pkg/runtime" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" _ "k8s.io/client-go/plugin/pkg/client/auth" ctrl "sigs.k8s.io/controller-runtime" @@ -43,18 +42,29 @@ import ( var ( scheme = runtime.NewScheme() // setupLog = ctrl.Log.WithName("setup") + setupLog = logging.CreateFileLogger("/tmp/log", zap.DebugLevel) ) func init() { - utilruntime.Must(clientgoscheme.AddToScheme(scheme)) + // setupLog := logging.CreateFileLogger("/tmp/log", zap.DebugLevel) + ctrl.SetLogger(setupLog) + err := clientgoscheme.AddToScheme(scheme) + if err != nil { - utilruntime.Must(locustiov1alpha1.AddToScheme(scheme)) + } + // err := utilruntime.Must(clientgoscheme.AddToScheme(scheme)) + + err = locustiov1alpha1.AddToScheme(scheme) + if err != nil { + + } + // utilruntime.Must(locustiov1alpha1.AddToScheme(scheme)) // +kubebuilder:scaffold:scheme } // nolint:gocyclo func main() { - var logFilePath string + // var logFilePath string var metricsAddr string var metricsCertPath, metricsCertName, metricsCertKey string var webhookCertPath, webhookCertName, webhookCertKey string @@ -80,7 +90,7 @@ func main() { flag.StringVar(&metricsCertKey, "metrics-cert-key", "tls.key", "The name of the metrics server key file.") flag.BoolVar(&enableHTTP2, "enable-http2", false, "If set, HTTP/2 will be enabled for the metrics and webhook servers") - flag.StringVar(&logFilePath, "log-file", "/tmp/log", "The log file to write logs to.") + // flag.StringVar(&logFilePath, "log-file", "/tmp/log", "The log file to write logs to.") /* opts := zap.Options{ Development: true, @@ -90,10 +100,10 @@ func main() { flag.Parse() // logger := logging.CreateFileLogger(logFilePath, zap.DebugLevel) - setupLog := logging.CreateFileLogger(logFilePath, zap.DebugLevel) + // setupLog := logging.CreateFileLogger(logFilePath, zap.DebugLevel) // ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts))) - ctrl.SetLogger(setupLog) + // ctrl.SetLogger(setupLog) // if the enable-http2 flag is false (the default), http/2 should be disabled // due to its vulnerabilities. More specifically, disabling http/2 will