-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
The changes in ksctl/ksctl#568 (feat: Modularisation the core package for multiple clients) will require several updates in the ksctl/cli repository to ensure compatibility and leverage the new caching mechanism.
Refer:
Here's a summary of the expected changes:
1. Dependency Management
- Update
go.modinksctl/clito the new version/commit ofksctl/ksctlthat includes these changes. - Run
go mod tidyto sync dependencies.
2. Cache Integration
- Import New Package: Add
github.com/ksctl/ksctl/v2/pkg/cacheto imports. - Initialize Cache:
- Create an instance of
cache.InMemCache(or use thecache.Cacheinterface) in the CLI's main initialization sequence. - Example:
import ( "context" "github.com/ksctl/ksctl/v2/pkg/cache" ) // ... cliCache := cache.NewInMemCache(context.Background()) // Ensure cliCache.Close() is called appropriately (e.g., defer in main)
- Create an instance of
- Pass Cache Instance: Propagate the
cliCacheinstance to anyksctl/ksctlcomponents or functions that now require it (e.g., pollers, controllers, handlers).
3. API and Function Call Updates
- Review and update calls from
ksctl/clitoksctl/ksctlfunctions that have modified signatures. - Key areas:
- Poller Initialization: Functions like
poller.InitSharedGithubReleaseFakePollernow require acache.Cacheargument.- Example - Old:
poller.InitSharedGithubReleaseFakePoller(myPollerFunc) - Example - New:
poller.InitSharedGithubReleaseFakePoller(cliCache, myPollerFunc)
- Example - Old:
- Handlers/Controllers: Components like
AddonController(frompkg/handler/addons/addons.go) might now expect cache instances or configurations including cache (e.g., viaKsctlWorkerConfiguration).
- Poller Initialization: Functions like
4. Configuration (If Applicable)
- Check if
ksctl/cliuses configuration objects (e.g.,KsctlWorkerConfiguration) fromksctl/ksctlthat have been updated to include cache settings. Ensure these are correctly populated.
5. Testing
- Update tests in
ksctl/clito provide mock or real cache instances if the components under test now depend on the caching mechanism. Follow the pattern seen inksctl/ksctlPR #568's test updates.
This list should serve as a good starting point for the necessary refactoring in ksctl/cli. It's recommended to create a dedicated issue or PR in the ksctl/cli repository to track these changes.
Metadata
Metadata
Assignees
Labels
No labels