Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing internal usage of registerCustomKind #4579

Merged
merged 1 commit into from Dec 7, 2022

Conversation

shawkins
Copy link
Contributor

@shawkins shawkins commented Nov 15, 2022

Description

This follows up on a next step of #3972 - remove the internal usage of registerCustomKind. The static nature of that registration was problematic both for us and for users as the behavior would seem inconsistent.

This change highlighted that several packages are missing from the KubernetesDeserializer - 8db8124 - that commit won't be needed against master if #4511 is committed first, but may be considered for back-porting.

The strategy here is to use some additional jackson logic to convey an element type with list parsing. list is the only built-in path where we may not have a type already associated with the processing - the other calls, such as a get, will pass the expected type directly; have handling to convert, such as with watch events; or can just use the generic.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@shawkins
Copy link
Contributor Author

This change highlighted that several packages are missing from the KubernetesDeserializer - 8db8124 - that commit won't be needed against master if #4511 is committed first, but may be considered for back-porting.

Separated to #4594

@@ -579,7 +585,8 @@ private <T> T handleResponse(HttpRequest.Builder requestBuilder, Class<T> type,
*
* @return Returns a de-serialized object as api server response of provided type.
*/
protected <T> CompletableFuture<T> handleResponse(HttpClient client, HttpRequest.Builder requestBuilder, Class<T> type,
protected <T> CompletableFuture<T> handleResponse(HttpClient client, HttpRequest.Builder requestBuilder,
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be easier to provide an overloaded method instead of duplicating the TypeReference inner-class instantiation in most of the calling methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't like how many overloaded methods there are already in OperationSupport, so it didn't seem worth it as it would just combine 2 calls.

Copy link
Member

Choose a reason for hiding this comment

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

sounds good

@manusa manusa added this to the 6.3.0 milestone Dec 7, 2022
@sonarcloud
Copy link

sonarcloud bot commented Dec 7, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

38.9% 38.9% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants