200 Commits
Author SHA1 Message Date
Yongrui Lin 0a9681e464 validation-gen: add a worked extensions example 2026-09-16 17:10:05 +00:00
Joe Betz e1654c0a87 validation-gen: add a worked custom-prefix example
Add examples/custom-prefix: a complete generator for a hypothetical project
whose tags use "+xyz:", with a tag of its own (+xyz:startsWith) backed by a
validation function outside apimachinery. Its layout mirrors what a
third-party module would contain, so it doubles as the template to copy and
as a regression test that the standard tags work under another prefix.

The output_tests packages follow the same pattern as validation-gen's own:
doc.go declares tagged types, go:generate runs the generator, and doc_test.go
asserts the resulting field.ErrorList through the testscheme.

hack/update-codegen.sh regenerates the example, since the repo-wide tag
search does not find "+xyz:" packages and the cleanup pass would otherwise
delete its output without restoring it.
2026-09-04 17:46:28 -04:00
Tim Hockin 84001df0a3 validation-gen: make file-tag more expressive
What used to be:
    `// +k8s:validation-gen=TypeMeta`
...is now:
    `// +k8s:validation-gen=TypesWithField=TypeMeta`
...which leaves room for other criteria
2026-07-08 09:58:06 -07:00
Lalit Chauhan 803aafa11f Wire DV for metav1.Condition 2026-05-29 02:52:30 +00:00
Yongrui Lin b622d5d2a2 hack: glob-remove all validation-gen outputs in update-codegen.sh
The cleanup step removed only zz_generated.validations.go and left the
per-Kind coverage test fixtures (zz_generated.<version>_test.go,
zz_generated.main_test.go) on disk, so renamed or removed Kinds would
leak stale files. Move every validation-gen output under a shared
zz_generated.validations. prefix and remove them via a single glob.
2026-05-12 20:31:20 +00:00
Joe Betz ec3a06051f Turn on strict linting of package level API definition generator tags 2026-05-12 12:49:01 -04:00
Yongrui Lin daae4100a6 hack: enable coverage fixture generation in update-codegen.sh
Pass -test-output-root and -test-allowlist to validation-gen so the
per-Kind coverage fixtures regenerate alongside the validators. Add the
allowlist YAML at test/declarative_validation/coverage-allowlist.yaml.
2026-05-09 19:11:01 +00:00
Brian Sonnenberg 044f65ca5c [KEP-4188] New Kubelet gRPC API with endpoint returning local Pod information 2026-03-18 23:07:36 +00:00
Jefftree d6b91820b7 deepcopy-gen: remove dead --bounding-dirs flag
The --bounding-dirs flag and BoundingDirs field in deepcopy-gen are dead
code. The field is stored on the genDeepCopy struct but never read by
any method.

The flag was introduced in gengo commit 14ae879 (2016) to control which
types deepcopy would generate for and which nested types it could assume
had generated deepcopy functions. Over time, as deepcopy-gen was
rewritten (gengo v2, moved to code-generator), the copyableAndInBounds /
isRootedUnder usage was dropped. The field and flag survived but
g.boundingDirs is never referenced in the current code.

hack/update-codegen.sh still passed --bounding-dirs but it had no
effect.
2026-03-02 14:53:52 -05:00
Maciej Szulik afaa8c19fe Update update-codegen.sh with sample-controller exception for openapi
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2026-01-29 16:06:16 +01:00
yongruilin d764e81a66 Revert "Implement validation-gen lint for CI"
This reverts commit 252d584cb7.

Lint logic is implemented through golanci-lint&kube-api-linter
2025-10-22 18:02:06 +00:00
Benjamin Elder 7ed65b466d remove defunct comments about updating copy_output 2025-10-13 09:47:24 -07:00
Jordan Liggitt 6d8adfe402 Isolate generated ProtoMessage() methods in build-tagged files 2025-10-08 14:28:40 -04:00
Joe Betz cfbe326e3a Enable openapi model name accessor generator
Signed-off-by: Joe Betz <jpbetz@google.com>
2025-09-10 15:52:58 -04:00
Sascha Grunert ea02ce5b60 Update protobindings scripts to drop gogo paths
Cleanup the available scripts to remove unused code paths after all
gogo references have been migrated to native protobuf.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2025-09-01 09:35:20 +02:00
Sascha Grunert fd2d2fd66f Convert k8s.io/kubelet/pkg/apis/dra from gogo to protoc
Use standard protoc for the dra instead of gogo.

Part of kubernetes#96564

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2025-08-29 09:40:51 +02:00
John-Paul Sassine b7de71f9ce feat(kubelet): Add ResourceHealthStatus for DRA pods
This change introduces the ability for the Kubelet to monitor and report
the health of devices allocated via Dynamic Resource Allocation (DRA).
This addresses a key part of KEP-4680 by providing visibility into
device failures, which helps users and controllers diagnose pod failures.

The implementation includes:
- A new `v1alpha1.NodeHealth` gRPC service with a `WatchResources`
  stream that DRA plugins can optionally implement.
- A health information cache within the Kubelet's DRA manager to track
  the last known health of each device and handle plugin disconnections.
- An asynchronous update mechanism that triggers a pod sync when a
  device's health changes.
- A new `allocatedResourcesStatus` field in `v1.ContainerStatus` to
  expose the device health information to users via the Pod API.

Update vendor

KEP-4680: Fix lint, boilerplate, and codegen issues

Add another e2e test, add TODO for KEP4680 & update test infra helpers

Add Feature Gate e2e test

Fixing presubmits

Fix var names, feature gating, and nits

Fix DRA Health gRPC API according to review feedback
2025-07-24 23:23:18 +00:00
Sascha Grunert c889ee17a2 Convert kubelet plugin manager from gogo to protoc
Use standard protoc for the kubelet plugin manager instead of gogo.

Part of https://github.com/kubernetes/kubernetes/issues/96564

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2025-07-23 16:55:05 +02:00
Sascha Grunert 3026020b44 Convert k8s.io/kubelet/pkg/apis/deviceplugin from gogo to protoc
Use standard protoc for the device plugin API instead of gogo.

Part of kubernetes#96564

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2025-07-21 10:04:01 +02:00
Sascha Grunert 532d48fe6a Convert k8s.io/kubelet/pkg/apis/podresources from gogo to protoc
Use standard protoc for the pod resources instead of gogo.

Part of kubernetes#96564

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2025-07-17 14:56:44 +02:00
Sascha Grunert 8e6651520e Convert k8s.io/kms/apis from gogo to protoc
Use standard protoc for the kms APIs instead of gogo.

Part of kubernetes#96564

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2025-07-16 16:46:39 +02:00
Sascha Grunert 841886df76 Convert externaljwt from gogo to protoc
Use standard protoc for the `externaljwt` package instead of gogo.

Part of https://github.com/kubernetes/kubernetes/issues/96564

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2025-07-08 08:08:30 +02:00
Sascha Grunert b464bbeb8f Remove gogo-protobuf from CRI
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2025-07-04 08:55:57 +02:00
Benjamin Elder d5bf33e7d7 update-codegen.sh: automatically install protoc 2025-04-24 22:54:09 -07:00
Benjamin Elder 8a2f367ec3 automatically install goimports when running update-codegen 2025-04-24 22:54:09 -07:00
Tim Hockin 252d584cb7 Implement validation-gen lint for CI
Results in errors like:

```
$ ./hack/verify-api-lint.sh
+++ [0317 09:00:04] Generating validation code for 69 targets
F0317 09:00:05.637556 1049736 targets.go:363] lint failed:
  type k8s.io/api/core/v1.PodAffinityTerm:
    field LabelSelector: conflicting tags: {+k8s:optional, +k8s:required}: fields cannot be both optional and required
    field Namespaces: conflicting tags: {+default, +k8s:required}: fields with default values are always optional
!!! [0317 09:00:05] Call tree:
!!! [0317 09:00:05]  1: hack/update-codegen.sh:1132 codegen::validation(...)
```
2025-03-21 08:20:04 -07:00
Aaron Prindle cfcf7e93a3 chore(validation-gen): rename flag --extra-pkg -> --readonly-pkg in validation-gen 2025-03-11 19:17:48 +00:00
Joe Betz 6798e2d863 Add time to extra-pkgs for validation-gen 2025-03-08 14:21:49 -05:00
Joe Betz 9765fe4abb Add all extra_pkgs needed by main API types to validation-gen 2025-03-06 19:45:17 -05:00
Joe Betz 3210f46b5b Add validation-gen to codegen scripts
Add validation-gen to repository wide codegen scripts and introduce
`./hack/update-codegen.sh validation` as a quick way to run validation-gen.
2025-03-03 09:49:50 -05:00
Lionel JouinandJoe Betz e9c47f8601 Add codegen::register to hack/update-codegen.sh
Co-authored-by: Joe Betz <jpbetz@google.com>
Signed-off-by: Lionel Jouin <lionel.jouin@est.tech>
2025-02-23 19:51:12 +01:00
Harshal Neelkamal 6fdacf0411 Add plugin and key-cache for ExternalJWTSigner integration 2024-11-07 03:16:23 +00:00
Monis Khan c2ae465355 Use protobuf for core clients
Signed-off-by: Monis Khan <mok@microsoft.com>
2024-10-23 10:56:34 -04:00
Patrick Ohly 91d7882e86 DRA: new API for 1.31
This is a complete revamp of the original API. Some of the key
differences:
- refocused on structured parameters and allocating devices
- support for constraints across devices
- support for allocating "all" or a fixed amount
  of similar devices in a single request
- no class for ResourceClaims, instead individual
  device requests are associated with a mandatory
  DeviceClass

For the sake of simplicity, optional basic types (ints, strings) where the null
value is the default are represented as values in the API types. This makes Go
code simpler because it doesn't have to check for nil (consumers) and values
can be set directly (producers). The effect is that in protobuf, these fields
always get encoded because `opt` only has an effect for pointers.

The roundtrip test data for v1.29.0 and v1.30.0 changes because of the new
"request" field. This is considered acceptable because the entire `claims`
field in the pod spec is still alpha.

The implementation is complete enough to bring up the apiserver.
Adapting other components follows.
2024-07-22 18:09:34 +02:00
Patrick Ohly 39bbcedbca dra api: add structured parameters
NodeResourceSlice will be used by kubelet to publish resource information on
behalf of DRA drivers on the node. NodeName and DriverName in
NodeResourceSlice must be immutable. This simplifies tracking the different
objects because what they are for cannot change after creation.

The new field in ResourceClass tells scheduler and autoscaler that they are
expected to handle allocation.

ResourceClaimParameters and ResourceClassParameters are new types for telling
in-tree components how to handle claims.
2024-03-07 16:15:31 +01:00
Tim Hockin df7f5fca27 Don't embed plural exceptions in tools 2024-03-06 14:57:46 -08:00
Tim Hockin 00e09374b6 Make update-codegen avoid sub-workspaces 2024-02-29 22:10:39 -08:00
Tim Hockin 1a4450f6ff Get rid of code-generator/cmd/openapi-gen
It's an exact duplicate of k8s.io/kube-openapi/cmd/openapi-gen.
2024-02-29 22:07:37 -08:00
Tim Hockin 8288c06b2b Make hack scripts use go install and assume PATH
Now that they all call setup_env, we don't need find-binary (I think).
That was originally meant to hide the diff between docker and local
builds but all these tools do local builds anyway.
2024-02-29 22:07:32 -08:00
Tim Hockin b68340e5b6 Get rid of gengo InputDirs flag 2024-02-29 22:07:23 -08:00
Tim Hockin d0dd72b01e Move OutputFileBase flag to each tool 2024-02-29 22:07:16 -08:00
Tim Hockin 26a1a13b80 Rename output-package -> output-pkg
To parallel "output-dir".
2024-02-29 22:07:15 -08:00
Tim Hockin 6a375b8f4c Move the OutputBase flag to each tool
...and rename to --output-dir
2024-02-29 22:07:14 -08:00
Tim Hockin 0ff7dd1943 Rename gengo DefaultGen -> GolangGenerator 2024-02-29 22:07:12 -08:00
Tim Hockin 4320631265 codegen: Don't need to pass --logtostderr
All the tools already set it internally
2024-02-29 22:07:06 -08:00
Tim Hockin 19b37f046f Rename update-generated-* dockerized
Now they don't start with "update" and confuse dumb scripts which try to
run all the updates.
2024-02-29 22:07:04 -08:00
Tim Hockin 94b709c0e2 codegen: Use single-dash for '-v' 2024-02-29 22:07:04 -08:00
Tim Hockin 3c2940f2ae Kill off PRJ_SRC_PATH 2024-02-29 22:06:50 -08:00
Tim Hockin 530c4352fb Rename new::setup_env back to setup_env 2024-02-29 22:06:44 -08:00
Tim Hockin f772410082 Make code-gen subprojects work on gengo/v2 2024-02-29 22:06:38 -08:00