-
Notifications
You must be signed in to change notification settings - Fork 11
feat: service manager factory #172
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
Conversation
This func does not need to be exported. The Run func is better placed at the top of the file.
This struct is used by external packages.
Introduce a factory function to initialize the Kubernetes and Helm clients required by service.Manager. This enables dependency injection of client initialization into commands, improving testability and flexibility. With this approach, clients can be created before constructing the service manager and reused for other command-level operations (like checking Helm chart versions for backward compatibility) without redundant initialization.
Introduce a factory function to initialize the Kubernetes and Helm clients required by service.Manager. This enables dependency injection of client initialization into commands, improving testability and flexibility. With this approach, clients can be created before constructing the service manager and reused for other command-level operations (like checking Helm chart versions for backward compatibility) without redundant initialization.
internal/cmd/local/install.go
Outdated
} | ||
|
||
func (i *InstallCmd) installOpts(ctx context.Context, user string) (*service.InstallOpts, error) { | ||
ctx, span := trace.NewSpan(ctx, "InstallCmd.InstallOpts") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx, span := trace.NewSpan(ctx, "InstallCmd.InstallOpts") | |
ctx, span := trace.NewSpan(ctx, "InstallCmd.installOpts") |
|
||
// SvcMgrClientFactory creates and returns the Kubernetes and Helm clients | ||
// needed by the service manager. | ||
type SvcMgrClientFactory func(kubeConfig, kubeContext string) (k8s.Client, goHelm.Client, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a very java name
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
This PR refactors the
install
command to declare the Kubernetes and Helm clients at the command level. This enables dependency injection into lower-level function calls within the command. A necessary step toward supporting version-specific Helm values since it allows us to query Helm charts and related metadata when generating Helm values. This will obviously assist in maintaining backward compatibility, etc.Apologies for a few sneaky tidy-up commits at the start. I had planned to raise a separate "clean-up" PR, but I think combining them all here provides better context.
There are also a number of sneaky lint changes that snuck in.