Cleanup: Centralize Plugin Names in Plugin Interfaces #4309
Labels
help wanted
Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
kind/cleanup
Categorizes issue or PR as related to cleaning up code, process, or technical debt.
What do you want to happen?
Description: Currently, in various parts of the code, we use hardcoded constants to represent plugin names or keys, such as grafanaPluginKey and deployImagePluginKey in pkg/cli/alpha/internal/generate.go. This approach leads to redundant declarations of plugin names across different locations. For example, in the alpha generate command:
kubebuilder/pkg/cli/alpha/internal/generate.go
Lines 43 to 47 in a9ee390
Proposal
To improve maintainability and readability, we should:
Plugin{}.Name()
or equivalent methods wherever possible.Name()
) in their interface for retrieving their identifiers or names.This will help ensure consistency and make it easier to update plugin keys in the future.
Examples
Name()
method that returns the plugin name:Golang Plugin Name Method
By leveraging similar methods across plugins, we can avoid the need for hardcoded keys like
grafanaPluginKey
ordeployImagePluginKey
.Extra Labels
No response
The text was updated successfully, but these errors were encountered: