fix: Make AbstractOperatorExtension use the kubernetesClient if the infrastructureKubernetesClient is not set by xstefank · Pull Request #3077 · operator-framework/java-operator-sdk
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a client initialization issue in AbstractOperatorExtension where providing only a kubernetesClient (without an infrastructureKubernetesClient) would unnecessarily create a new client instance instead of reusing the provided one. The fix ensures both client references use the same instance when only one is provided, improving resource efficiency and addressing the issue discussed in the linked GitHub discussion.
Key Changes
- Modified the
infrastructureKubernetesClientinitialization to fall back tokubernetesClientbefore creating a new instance - This prevents unnecessary client creation when
kubernetesClientis provided butinfrastructureKubernetesClientis not
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.