Skip to content

Move batch reads to respective classes#2154

Merged
ryanjbaxter merged 3 commits into
spring-cloud:mainfrom
wind57:move_batch_reads_to_respective_classes
Feb 22, 2026
Merged

Move batch reads to respective classes#2154
ryanjbaxter merged 3 commits into
spring-cloud:mainfrom
wind57:move_batch_reads_to_respective_classes

Conversation

@wind57

@wind57 wind57 commented Feb 21, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: wind57 <eugen.rabii@gmail.com>
@wind57 wind57 marked this pull request as ready for review February 22, 2026 07:51
@wind57

wind57 commented Feb 22, 2026

Copy link
Copy Markdown
Contributor Author

@ryanjbaxter this is minor refactor: moving batch reads by namespace in the right place. This was totally me getting it wrong initially.

Copilot AI left a comment

Copy link
Copy Markdown

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 reorganizes the location of batch read methods by moving label-based read operations from SingleRead classes to BatchRead classes. The refactoring better aligns the code organization with the logical separation between batch operations (which read by labels) and single operations (which read by name).

Changes:

  • Moved label-based strippedConfigMaps and strippedSecrets methods from SingleRead to BatchRead classes
  • Added necessary imports (Map, logging, model classes) to BatchRead classes to support the moved methods
  • Removed unused imports from SingleRead classes

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
Fabric8SourcesSingleRead.java Removed label-based read methods and unused Map import
Fabric8SourcesBatchRead.java Added label-based read methods with required imports and logging
KubernetesClientSourcesSingleRead.java Removed label-based read methods, labelSelector helper, and unused imports
KubernetesClientSourcesBatchRead.java Added label-based read methods, labelSelector helper, and required imports

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -19,7 +19,6 @@
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;

Copilot AI Feb 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of the Map import will cause a compilation error in Fabric8ConfigUtils.java. That file has static imports for Fabric8SourcesSingleRead.strippedConfigMaps and Fabric8SourcesSingleRead.strippedSecrets methods that take Map<String, String> labels parameters. These imports (lines 42-43 in Fabric8ConfigUtils.java) should be removed since the methods with label parameters are now only in Fabric8SourcesBatchRead.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think copilot here is confused... "cause a compilation error", the build passes, so... :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is confused because the method is overloaded. The same method name still exists in Fabric8SourcesSingleRead. I assume that one should stay?

static List<StrippedSourceContainer> strippedConfigMaps(KubernetesClient client, String namespace, LinkedHashSet<String> sourceNames)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And AI is FAR from perfect ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the confusion comes that there are 3 strippedSecrets methods:

  • Fabric8SourcesBatchRead::strippedSecrets ( KubernetesClient client, String namespace)
  • Fabric8SourcesBatchRead::strippedSecrets ( KubernetesClient client, String namespace, Map<String, String> labels )
  • Fabric8SourcesSingleRead::strippedSecrets

All imported in Fabric8ConfigUtils.

It's only copilot confused, javac has no issues with that at all. Honestly, neither do I :)

@@ -19,8 +19,6 @@
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;

Copilot AI Feb 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of the Map and stream.Collectors imports will cause a compilation error in KubernetesClientConfigUtils.java. That file has static imports for KubernetesClientSourcesSingleRead.strippedConfigMaps and KubernetesClientSourcesSingleRead.strippedSecrets methods that take Map<String, String> labels parameters. These imports (lines 43-44 in KubernetesClientConfigUtils.java) should be removed since the methods with label parameters are now only in KubernetesClientSourcesBatchRead.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above

@ryanjbaxter ryanjbaxter merged commit 10e4198 into spring-cloud:main Feb 22, 2026
30 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in 2025.1.2 Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants