Test and fix for the wrong "Kind" declared on KubernetesListHandler #2336
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR changes
KubernetesListHandler.getKind()
from returning"Service"
to returning"List"
. The latter is whatKubernetesList.getKind()
returns, and the former causes the resultingResourceHandler.Key
to be identical to what is computed forServiceHandler
, meaningHandlers.of(key)
can return the wrong handler.In practice the problem noted above can cause the Kubernetes client to fail when working with
kind: Service
YAML manifests, in some circumstances. This was observed under OSGi using theDefaultKubernetesClient
.Handlers.of(<Service,v1>)
returned theKubernetesListHandler
which subsequently threw the following exception:The problem is not usually observed because
KubernetesListHandler
is not registered as a service in POJO, but it is under OSGi, and of course becauseHandlers
keeps a map based on the key, whether the problem actually happens depends which of the two handlers was registered last.This PR also includes a test which asserts there are no conflicts among the stock handlers, which fails prior to the fix and passes subsequently.
Type of change
test, version modification, documentation, etc.)
Checklist