Move batch reads to respective classes#2154
Conversation
|
@ryanjbaxter this is minor refactor: moving batch reads by namespace in the right place. This was totally me getting it wrong initially. |
There was a problem hiding this comment.
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
strippedConfigMapsandstrippedSecretsmethods 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; | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I think copilot here is confused... "cause a compilation error", the build passes, so... :)
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
And AI is FAR from perfect ;)
There was a problem hiding this comment.
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; | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
same comment as above
No description provided.