You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Rename addonFilterFunc to cmaFilterFunc for clarity
The filter function parameter is specifically used for ClusterManagementAddon
objects, so the new name cmaFilterFunc is more descriptive and accurate than
the generic addonFilterFunc.
Signed-off-by: Claude <[email protected]>
🤖 Generated with Claude Code
Co-Authored-By: Claude <[email protected]>
Signed-off-by: zhujian <[email protected]>
* Add ManagedClusterAddOn filter functionality to addon framework
This commit introduces a new filtering mechanism for ManagedClusterAddOn objects
to enable selective processing of addons based on custom criteria.
Key changes:
1. Created pkg/utils/addon.go with filter functions:
- ManagedClusterAddOnFilterFunc type for custom filtering
- AllowAllAddOns function that accepts all addons
- FilterTemplateBasedAddOns function that filters template-based addons
2. Updated all addon controllers to accept and use the filter function:
- addonconfig controller
- agentdeploy controller
- certificate controllers (CSR approve/sign)
- registration controller
3. Added comprehensive test coverage in pkg/utils/addon_test.go
4. Updated BaseAddonManager interface to include mcaFilterFunc parameter
This enables selective processing of addons, particularly useful for
filtering template-based addons vs regular addons based on their
status.configReferences.
🤖 Generated with Claude Code
Co-Authored-By: Claude <[email protected]>
Signed-off-by: zhujian <[email protected]>
* Fix error handling in registration controller
Improve error handling in addonRegistrationController.sync() by:
- Only returning errors when operations actually fail
- Adding proper error wrapping with descriptive messages
- Returning nil when operations succeed
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
Signed-off-by: zhujian <[email protected]>
* Improve templateBasedAddOn parameter documentation and implementation
- Rename parameter from templateAddOn to templateBasedAddOn for clarity
- Add comprehensive documentation explaining the parameter's purpose
- Update comments to explain why addon-config-controller bypasses filtering
- Remove mcaFilterFunc parameter from addon-config-controller
- Reference GitHub issue #1181 for additional context
- Fix typos and improve comment readability
This change helps prevent premature processing of template-based addons
before their configurations are ready, reducing unnecessary errors.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
Signed-off-by: zhujian <[email protected]>
* Refactor template-based addon handling to avoid breaking interface changes
- Move templateBasedAddOn parameter from interface to concrete implementation
- Add SetTemplateBasedAddOn() method to BaseAddonManager interface
- Add templateBasedAddOn field to BaseAddonManagerImpl struct
- Revert StartWithInformers interface to original signature
- Update all callers to use the original interface method
- Maintain backward compatibility while providing new functionality
This allows users to configure template-based addon handling through the
public API without breaking existing external implementations:
manager, _ := addonmanager.New(config)
manager.SetTemplateBasedAddOn(true) // Enable template filtering
manager.StartWithInformers(ctx, ...) // Uses configured setting
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
Signed-off-by: zhujian <[email protected]>
* Rename SetTemplateBasedAddOn to SetTemplateMode for better clarity
- Update method name from SetTemplateBasedAddOn to SetTemplateMode
- Change parameter name from templateBasedAddOn to enabled
- Keep existing comments and documentation unchanged
- Provides cleaner, more intuitive API naming
Usage becomes:
manager.SetTemplateMode(true) // Enable template mode
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
Signed-off-by: zhujian <[email protected]>
* Refactor to use constructor options pattern to avoid breaking interface changes
- Remove SetTemplateMode method from BaseAddonManager interface
- Add Option type and WithTemplateMode(bool) constructor option
- Update NewBaseAddonManagerImpl to accept ...Option parameters
- Add NewWithOptions function for public API with options
- Preserve existing New() function for backward compatibility
- Remove SetTemplateMode method from implementation
This maintains full backward compatibility while providing template mode
configuration through constructor options:
// Existing usage unchanged
manager, _ := addonmanager.New(config)
// New usage with template mode
manager, _ := addonmanager.NewWithOptions(config, addonmanager.WithTemplateMode(true))
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
Signed-off-by: zhujian <[email protected]>
* Implement public Option struct with OptionFunc pattern
- Add public Option struct with public TemplateBasedAddOn field
- Add OptionFunc type and WithTemplateMode function
- Add WithOption helper to bridge struct and functional patterns
- Remove NewWithOptions in favor of unified NewWithOptionFuncs
- Remove ApplyOptions method to keep cleaner API
- Fix tautological condition warning
This provides flexible configuration supporting both patterns:
// Functional pattern
manager, _ := addonmanager.NewWithOptionFuncs(config, addonmanager.WithTemplateMode(true))
// Struct pattern with helper
opt := &addonmanager.Option{TemplateBasedAddOn: true}
manager, _ := addonmanager.NewWithOptionFuncs(config, addonmanager.WithOption(opt))
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
Signed-off-by: zhujian <[email protected]>
---------
Signed-off-by: zhujian <[email protected]>
Co-authored-by: Claude <[email protected]>
0 commit comments