-
Notifications
You must be signed in to change notification settings - Fork 0
feat/improve-testability #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
ac4ea79
f27b782
19554ff
2ec28e0
9658aa4
cb24090
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,12 @@ var operatorCmd = &cobra.Command{ | |
| ctx, _, shutdown := platformeshcontext.StartContext(log, defaultCfg, defaultCfg.ShutdownTimeout) | ||
| defer shutdown() | ||
|
|
||
| restCfg, err := getKubeconfigFromPath(operatorCfg.KCP.Kubeconfig) | ||
| if err != nil { | ||
| log.Error().Err(err).Msg("unable to get KCP kubeconfig") | ||
| return err | ||
| } | ||
|
|
||
|
Comment on lines
+80
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 🧩 Analysis chainKubeconfig loader: confirm fallback/edge-cases. Ensure getKubeconfigFromPath handles empty/missing paths (fallback to in-cluster or KUBECONFIG), and respects auth plugins and exec providers. If not, add fallback to ctrl.GetConfig(). Run to verify presence and usage: 🏁 Script executed: #!/bin/bash
rg -nP --type=go -C2 '\bfunc\s+getKubeconfigFromPath\s*\('
rg -nP --type=go -C2 'getKubeconfigFromPath\s*\('Length of output: 1357 Support in-cluster and environment kubeconfigs when path is unset 🤖 Prompt for AI Agents |
||
| if defaultCfg.Sentry.Dsn != "" { | ||
| err := sentry.Start(ctx, | ||
| defaultCfg.Sentry.Dsn, defaultCfg.Environment, defaultCfg.Region, | ||
|
|
@@ -89,8 +95,6 @@ var operatorCmd = &cobra.Command{ | |
| defer platformeshcontext.Recover(log) | ||
| } | ||
|
|
||
| cfg := ctrl.GetConfigOrDie() | ||
|
|
||
| mgrOpts := ctrl.Options{ | ||
| Scheme: scheme, | ||
| Metrics: metricsserver.Options{ | ||
|
|
@@ -121,15 +125,15 @@ var operatorCmd = &cobra.Command{ | |
| return fmt.Errorf("scheme should not be nil") | ||
| } | ||
|
|
||
| provider, err := apiexport.New(cfg, apiexport.Options{ | ||
| provider, err := apiexport.New(restCfg, apiexport.Options{ | ||
| Scheme: mgrOpts.Scheme, | ||
| }) | ||
| if err != nil { | ||
| setupLog.Error(err, "unable to construct cluster provider") | ||
| return err | ||
| } | ||
|
|
||
| mgr, err := mcmanager.New(cfg, provider, mgrOpts) | ||
| mgr, err := mcmanager.New(restCfg, provider, mgrOpts) | ||
| if err != nil { | ||
| setupLog.Error(err, "Failed to create manager") | ||
| return err | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.