Skip to content

8.0: API Group + v1.24 - #850

Merged
k8s-ci-robot merged 11 commits into
kubernetes-client:masterfrom
tg123:v1.24
May 7, 2022
Merged

k8s-ci-robot merged 11 commits into
kubernetes-client:masterfrom
tg123:v1.24

Conversation

@tg123

@tg123 tg123 commented May 7, 2022 •

Copy link
Copy Markdown
Member
  • update api model to v1.24
  • support api group

api group [breaking change to code]

why this change

before api group, apis with same operationid, for example getAPIResources, were suffixed with a number which does not make any sense.
this change is also aligning api style with other sdk, for example, java

new api exmaple

before

client.ListNamespacedPod("default");

after

client.CoreV1.ListNamespacedPod("default");

something should follow up
client.CoreV1 creates a new object each time which can be optimized and cached

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 7, 2022
@k8s-ci-robot
k8s-ci-robot requested a review from brendandburns May 7, 2022 16:04
@brendandburns

Copy link
Copy Markdown
Contributor

/lgtm
/approve

Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 7, 2022
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, tg123

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [brendandburns,tg123]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
k8s-ci-robot merged commit 85755cc into kubernetes-client:master May 7, 2022
@tg123
tg123 deleted the v1.24 branch May 8, 2022 05:19
kimpenhaus added a commit to dotnet/dotnet-operator-sdk that referenced this pull request Nov 28, 2026
## Summary

`KubernetesClient` sends every request through the custom objects API
(`CustomObjects.*`, also via `GenericClient`),
including core types, for which the group is empty. The generated
Kubernetes client rewrites the resulting
`/apis//v1/...` path to `/api/v1/...` (`url.Replace("apis//", "api/")`
in `Operations.cs.template`, since
kubernetes-client/csharp#850, KubernetesClient 8.0). Upstream's own
`GenericClient` relies on the same mechanism for
core types, so the paths on the wire are correct; building them
ourselves would mean replacing every
`CustomObjects` call with own request code.

This PR pins the method and path that are sent for core types with the
existing `StubApiServer`, so that a change of
that behaviour is noticed on the next dependency update:

| Method | Request |
| --- | --- |
| `GetAsync` | `GET /api/v1/namespaces/default/configmaps/my-config`,
`GET /api/v1/namespaces/my-namespace` |
| `ListAsync` | `GET /api/v1/namespaces/default/configmaps`, `GET
/api/v1/configmaps` |
| `WatchAsync` | `GET /api/v1/namespaces/default/configmaps?watch=true`,
`GET /api/v1/configmaps?watch=true` |
| `CreateAsync` | `POST /api/v1/namespaces/default/configmaps` |
| `UpdateAsync` | `PUT /api/v1/namespaces/default/configmaps/my-config`
|
| `PatchAsync` | `PATCH /api/v1/namespaces/default/configmaps/my-config`
|
| `DeleteAsync` | `DELETE
/api/v1/namespaces/default/configmaps/my-config` |
| `UpdateStatusAsync` | `PATCH
/api/v1/namespaces/default/pods/my-pod/status`, `PATCH
/api/v1/namespaces/my-namespace/status` |

`UpdateStatusAsync` for core types had no coverage at all; the other
methods were only covered indirectly by the
integration tests with `V1ConfigMap`.

No production code changes.

## Checks

- `/simplify`: the stub answers with the entity in the status tests; a
shared base class for the stubbed client
tests (now three copies) was left out, as it would touch files outside
this PR. Added Watch, all-namespaces List,
  cluster-scoped Get and Update after the altitude review.
- `/code-review` (medium): no bugs; added the HTTP method to every
assertion, parsed the watch query and added the
all-namespaces watch. Not added: cluster-scoped
Create/Update/Patch/Delete for `V1Namespace` and the patch body
  (covered in `KubernetesClient.Patch.Test.cs`).
- `/security-review`: test-only change, nothing to review.
- `dotnet build -c Release` without warnings, `dotnet format
--verify-no-changes`, unit tests of
  `KubeOps.KubernetesClient.Test` (156) pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants