Documentation
¶
Index ¶
- Variables
- func ApplyNowModuleRelease(dynamicClient dynamic.Interface, releaseName string) error
- func ApproveModuleRelease(dynamicClient dynamic.Interface, releaseName string) error
- func CanBeAppliedNow(r ModuleReleaseInfo) bool
- func CanBeApproved(r ModuleReleaseInfo) bool
- func CompleteForApplyNow(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
- func CompleteForApprove(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
- func FindVersions(dynamicClient dynamic.Interface, moduleName string, match ReleaseMatchFunc) ([]string, error)
- func GetDynamicClient(cmd *cobra.Command) (dynamic.Interface, error)
- func ListModuleNames(dynamicClient dynamic.Interface) ([]string, error)
- func NormalizeVersion(version string) string
- func OperateModule(dynamicClient dynamic.Interface, name string, moduleState ModuleState) error
- func OptionsModule(config *rest.Config, kubeCl kubernetes.Interface, pathFromOption string) error
- func PrintNearestVersionSuggestions(releases []ModuleReleaseInfo, targetVersion string)
- func PrintNoReleasesHelp(dynamicClient dynamic.Interface, moduleName string)
- func PrintPendingReleases(releases []ModuleReleaseInfo)
- func PrintSimilarModules(dynamicClient dynamic.Interface, moduleName string)
- func ReleaseNotFoundError(moduleName, version string) error
- func SortReleasesByVersion(releases []ModuleReleaseInfo)
- func SuggestSuitableReleasesOnNotFound(dynamicClient dynamic.Interface, moduleName, version string, ...) error
- type ModuleReleaseInfo
- func FindReleases(dynamicClient dynamic.Interface, moduleName string, match ReleaseMatchFunc) ([]ModuleReleaseInfo, error)
- func GetModuleRelease(dynamicClient dynamic.Interface, moduleName, version string) (*ModuleReleaseInfo, error)
- func ListModuleReleases(dynamicClient dynamic.Interface, moduleName string) ([]ModuleReleaseInfo, error)
- type ModuleState
- type NearestVersions
- type ReleaseMatchFunc
Constants ¶
This section is empty.
Variables ¶
var ( MsgOK = color.New(color.FgGreen).Sprint("[OK]") MsgWarn = color.New(color.FgYellow).Sprint("[WARN]") MsgError = color.New(color.FgRed).Sprint("[ERROR]") )
Output message prefixes with colors for better status readability.
Functions ¶
func ApplyNowModuleRelease ¶ added in v0.25.0
ApplyNowModuleRelease adds the apply-now annotation to a module release.
func ApproveModuleRelease ¶ added in v0.25.0
ApproveModuleRelease adds the approved annotation to a module release.
func CanBeAppliedNow ¶ added in v0.25.0
func CanBeAppliedNow(r ModuleReleaseInfo) bool
CanBeAppliedNow returns true for pending releases without apply-now annotation. Used by the apply-now command to filter releases available for immediate deployment.
func CanBeApproved ¶ added in v0.25.0
func CanBeApproved(r ModuleReleaseInfo) bool
CanBeApproved returns true for pending releases that are not yet approved. Used by the approve command to filter releases available for approval.
func CompleteForApplyNow ¶ added in v0.25.0
func CompleteForApplyNow(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteForApplyNow provides shell completion for the apply-now command. It suggests pending releases that don't have the apply-now annotation.
func CompleteForApprove ¶ added in v0.25.0
func CompleteForApprove(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
CompleteForApprove provides shell completion for the approve command. It suggests pending releases that are not yet approved.
func FindVersions ¶ added in v0.25.0
func FindVersions(dynamicClient dynamic.Interface, moduleName string, match ReleaseMatchFunc) ([]string, error)
FindVersions returns a sorted list of versions for releases matching the predicate. All versions are normalized to have a "v" prefix for consistent completion.
func GetDynamicClient ¶ added in v0.25.0
GetDynamicClient creates a dynamic Kubernetes client from cobra command flags. It reads "kubeconfig" and "context" flags from the command. Dynamic client is required to work with Custom Resources like ModuleRelease and ModuleConfig, which don't have typed clients in client-go.
func ListModuleNames ¶ added in v0.25.0
ListModuleNames returns a sorted list of unique module names from all releases.
func NormalizeVersion ¶ added in v0.25.0
NormalizeVersion ensures the version has a 'v' prefix.
func OperateModule ¶
func OperateModule(dynamicClient dynamic.Interface, name string, moduleState ModuleState) error
func OptionsModule ¶
func PrintNearestVersionSuggestions ¶ added in v0.25.0
func PrintNearestVersionSuggestions(releases []ModuleReleaseInfo, targetVersion string)
PrintNearestVersionSuggestions prints suggestions for nearest versions.
func PrintNoReleasesHelp ¶ added in v0.25.0
PrintNoReleasesHelp prints help when no pending releases are found.
func PrintPendingReleases ¶ added in v0.25.0
func PrintPendingReleases(releases []ModuleReleaseInfo)
PrintPendingReleases prints a list of available pending releases.
func PrintSimilarModules ¶ added in v0.25.0
PrintSimilarModules prints modules with similar names to help with typos.
func ReleaseNotFoundError ¶ added in v0.25.0
ReleaseNotFoundError returns a formatted error for a missing release.
func SortReleasesByVersion ¶ added in v0.25.0
func SortReleasesByVersion(releases []ModuleReleaseInfo)
SortReleasesByVersion sorts releases by semantic version in ascending order. Falls back to lexicographic comparison if version parsing fails.
func SuggestSuitableReleasesOnNotFound ¶ added in v0.25.0
func SuggestSuitableReleasesOnNotFound(dynamicClient dynamic.Interface, moduleName, version string, match ReleaseMatchFunc) error
SuggestSuitableReleasesOnNotFound prints helpful suggestions when a release is not found. It can suggest releases that are available for the given match predicate.
For example, all the releases that are in Pending phase and not yet approved. You can select any rule with the ReleaseMatchFunc predicate.
Types ¶
type ModuleReleaseInfo ¶ added in v0.25.0
type ModuleReleaseInfo struct {
Name string
ModuleName string
Version string
Phase string
Message string
IsApproved bool
IsApplyNow bool
}
ModuleReleaseInfo contains information about a module release. This is a simplified DTO for use in CLI commands.
func FindReleases ¶ added in v0.25.0
func FindReleases(dynamicClient dynamic.Interface, moduleName string, match ReleaseMatchFunc) ([]ModuleReleaseInfo, error)
FindReleases returns releases matching the given predicate, sorted by version. It's simply a filtered version of ListModuleReleases (convenience function).
func GetModuleRelease ¶ added in v0.25.0
func GetModuleRelease(dynamicClient dynamic.Interface, moduleName, version string) (*ModuleReleaseInfo, error)
GetModuleRelease returns a specific module release by module name and version.
func ListModuleReleases ¶ added in v0.25.0
func ListModuleReleases(dynamicClient dynamic.Interface, moduleName string) ([]ModuleReleaseInfo, error)
ListModuleReleases returns all module releases for a given module name. If moduleName is empty, returns all releases.
type ModuleState ¶
type ModuleState string
const ( ModuleEnabled ModuleState = "enabled" ModuleDisabled ModuleState = "disabled" )
type NearestVersions ¶ added in v0.25.0
type NearestVersions struct {
Lower *ModuleReleaseInfo // closest version below target, nil if none exists
Upper *ModuleReleaseInfo // closest version above target, nil if none exists
}
NearestVersions contains the closest versions below and above a target version.
func FindNearestVersions ¶ added in v0.25.0
func FindNearestVersions(releases []ModuleReleaseInfo, targetVersion string) NearestVersions
FindNearestVersions finds the closest versions below and above the target version.
type ReleaseMatchFunc ¶ added in v0.25.0
type ReleaseMatchFunc func(r ModuleReleaseInfo) bool
ReleaseMatchFunc is a predicate function for filtering releases. Returns true if the release should be included in the result.