davsclaus opened a new pull request, #28399:
URL: https://github.com/apache/camel/pull/28399
_Claude Code on behalf of davsclaus_
This group adds the catalog body types (CAMEL-24961) for ten kubernetes
components: kubernetes-config-maps, -custom-resources, -deployments, -events,
-hpa, -job, -cronjob, -namespaces, -nodes and -pods. Each Endpoint class gets
its own `@BodyTypes` annotation; the JSON it generates and the catalog copy
come with it. No doc page changes. The other kubernetes and openshift
components follow in a separate PR with the same pattern.
**What the catalog says now**
The producers take their input from headers (the name, the namespace, the
labels, the spec), not from the body. The output is listed by the `operation`
option, with the values of `KubernetesOperations`; the operation can also come
from the CamelKubernetesOperation header.
| Component | Consumer | Producer output |
|---|---|---|
| config-maps, deployments, events, hpa, namespaces, nodes, pods | the
fabric8 resource that changed (`ConfigMap`, `Deployment`, `events.v1.Event`,
`HorizontalPodAutoscaler`, `Namespace`, `Node`, `Pod`), with the action in
CamelKubernetesEventAction | a List for the list operations; the resource or
null for get; the resource for create and update; a `Boolean` for delete |
| deployments | | `Integer` (the replicas of the status) for scaleDeployment
|
| events | | createEvent and updateEvent also take an `EventBuilder` from
the body |
| job, cronjob | | as above, but delete leaves the body unchanged |
| custom-resources | the resource as JSON text, with the action in
CamelKubernetesCRDEventAction | a `JsonArray` for list; a `JsonObject` for get;
a `GenericKubernetesResource` for create and update; unchanged for delete, with
the result in CamelKubernetesDeleteResult; the instance JSON is the
CamelKubernetesCRDInstance header |
**Checked at runtime.** A throwaway test, not part of the PR, used the
fabric8 mock server in CRUD mode.
- Every producer ran create, get, get of a missing name, update, list,
listByLabels, delete, and delete of a missing name.
- createConfigMap and createEvent were sent text, bytes, a stream, a file, a
Map and no body. The body is not read, except that createEvent takes an
`EventBuilder`.
- The config-maps, pods and custom-resources consumers were checked with
real watch events.
The other consumers share the code of pods and config-maps, and were not
run. A successful scaleDeployment was not run either: the mock leaves the
status empty.
**Choices**
- The default producer output is the union of the operations, as the
operation can come from a header.
- There is no javaType on the List and on get, because get can be null.
**Bugs found, not fixed here.** The JIRAs will follow.
- **custom-resources:**
- The producer checks the endpoint options crdName, crdGroup, crdScope,
crdVersion and crdPlural, but builds the context from the headers only. With
only the endpoint options, listCustomResources fails with "Neither kind nor
plural was set".
- getCustomResource of a missing name fails with
ResourceNotFoundException. The code means to return an empty JsonObject, but
`.require()` throws outside the 404 catch.
- A create or update that gets a 409 is swallowed: the body becomes an
empty `GenericKubernetesResource`, with only an INFO log.
- The consumer logs "namespace is not specified." when a namespace is set,
because the check is inverted.
- **deployments:** scaleDeployment fails with a NullPointerException when
the returned Deployment has no status yet.
PR #28380 changes the watch consumers of these components, but not their
bodies, nor the Endpoint classes and generated files of this PR.
**Local checks**
- camel-kubernetes builds, with no change to the generated files after the
build.
- The 10 catalog copies equal their module.
- camel-catalog, camel-yaml-dsl-validator and camel-jbang-core tests pass.
- The Endpoint and Component DSLs regenerate with no change.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]