chore: convert k8s-helper to singleton pattern - #2193
Conversation
Refactors the k8s-helper package from factory pattern (`New()`) to singleton pattern (`GetInstance()`) to ensure consistent initialization across the codebase. Changes: - Rename `New()` → `GetInstance()` - Rename `GetClientset()` → `GetClientSet()` (capitalization fix) - Rename `initializeForTesting()` → `InitializeForTesting()` (export) - Add `GetDiscoveryClient()` method for discovery API access - Add initialization checks with panic guards - Add `k8shelper.InitializeForTesting()` to all test packages - Update documentation in `.claude/rules/testing.md` The singleton pattern prevents multiple k8s client instances and ensures proper test initialization order across all packages. Assisted-by: Claude Sonnet 4.6
|
New operator image available: quay.io/eclipse/che-operator:pr-2193-arm64 |
|
New operator image available: quay.io/eclipse/che-operator:pr-2193-amd64 |
|
Hi! I'm che-ai-assistant — I help with your pull requests. I check for new comments every 10m0s, so there may be a short delay before I respond. Available commands:
|
|
This PR contains changes to files in directories that are typically not intended to be committed:
Please verify these changes are intentional. |
Signed-off-by: Anatolii Bazko <[email protected]>
|
New operator image available: quay.io/eclipse/che-operator:pr-2193-arm64 |
|
New operator image available: quay.io/eclipse/che-operator:pr-2193-amd64 |
Signed-off-by: Anatolii Bazko <[email protected]>
|
New operator image available: quay.io/eclipse/che-operator:pr-2193-arm64 |
|
New operator image available: quay.io/eclipse/che-operator:pr-2193-amd64 |
Signed-off-by: Anatolii Bazko <[email protected]>
|
New operator image available: quay.io/eclipse/che-operator:pr-2193-arm64 |
|
New operator image available: quay.io/eclipse/che-operator:pr-2193-amd64 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: rohanKanojia, tolusha The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@tolusha: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Refactors the k8s-helper package from factory pattern (
New()) to singleton pattern (GetInstance()) to ensure consistent initialization across the codebase.Changes:
New()→GetInstance()GetClientset()→GetClientSet()(capitalization fix)initializeForTesting()→InitializeForTesting()(export)GetDiscoveryClient()method for discovery API accessk8shelper.InitializeForTesting()to all test packages.claude/rules/testing.mdThe singleton pattern prevents multiple k8s client instances and ensures proper test initialization order across all packages.
Assisted-by: Claude Sonnet 4.6
What does this PR do?
Screenshot/screencast of this PR
What issues does this PR fix or reference?
How to test this PR?
OpenShift
on Minikube
Common Test Scenarios
PR Checklist
As the author of this Pull Request I made sure that:
Reviewers
Reviewers, please comment how you tested the PR when approving it.