Commit Graph

230 Commits

Author SHA1 Message Date
yongruilin
016e821718 run codegen 2026-01-06 20:18:06 +00:00
yongruilin
47fb373c31 run update-codegen.sh 2025-11-06 00:54:52 +00:00
tinatingyu
59e075e8d3 Promote PodCertificateRequests to v1beta1 2025-11-02 05:33:44 +00:00
Jordan Liggitt
39d37a1e92 Remove invalid SAN certificate construction 2025-10-13 10:27:22 -07:00
Aaron Prindle
dfd7b230b4 feat: make it so that all ShortCircuit validators are run for short circuiting check 2025-10-07 22:47:42 +00:00
yongruilin
7bab54a7c8 emit comment for uniqueness is disabled by k8s:customUnique 2025-09-25 17:37:17 +00:00
Tim Hockin
c4d8c9b544 Re-disable listmap uniqueness (for now) 2025-09-09 22:12:25 +00:00
Tim Hockin
6fb020b194 Temporary: Re-enable listmap uniqueness checks
Testing this exposed a bug -- we do this check for both the field AND
the type when the field is a typedef.  Now fixed to only emit a
uniqueness check at the site where listmap keys are defined.
2025-09-09 22:11:47 +00:00
Tim Hockin
b6fdbe4a6a Emit ratchet check for fields with a type func
This could go inside the type func but then we end up with a double
ratchet sometimes.

Co-Authored-By: Yongrui Lin <yongrlin@outlook.com>
2025-09-09 21:58:55 +00:00
Tim Hockin
3e2e2195ed Unions: replace [2]string with a type 2025-09-09 16:55:11 +00:00
yongruilin
8130cf82b5 run "hack/update-codegen.sh valid" 2025-09-09 16:54:46 +00:00
Tim Hockin
348d576c9f validation: Use JSON names in paths
This ensures that things that parse paths (e.g. to extract the leaf
part) get API-style names.
2025-09-09 16:15:17 +00:00
Kubernetes Prow Robot
cc674e7470 Merge pull request #128010 from ahmedtd/pod-certificates-types
Pod Certificates: Preliminary implementation of KEP-4317
2025-07-21 19:26:30 -07:00
Taahir Ahmed
6d4000f844 Pod Certificates: make update
Change-Id: Ib258c1f3bf238f41cfa1d6de8e8d0de5b8379a06
2025-07-21 21:49:57 +00:00
Taahir Ahmed
4624cb9bb9 Pod Certificates: Basic implementation
* Define feature gate
* Define and serve PodCertificateRequest
* Implement Kubelet projected volume source
* kube-controller-manager GCs PodCertificateRequests
* Add agnhost subcommand that implements a toy signer for testing

Change-Id: Id7ed030d449806410a4fa28aab0f2ce4e01d3b10
2025-07-21 21:49:57 +00:00
Aaron Prindle
69a8a169d5 add WithOrigin and MarkedByDeclarative, update hand-written to error at list instead of list item field, add additional tests for approved+denied case 2025-07-21 19:27:59 +00:00
Aaron Prindle
6a2d5a1e64 feat: add CSR status.conditions approved+denied declarative validation tags and associated declarative validation tags to v1 and v1beta1 types.go 2025-07-21 19:27:59 +00:00
ylink-lfs
830a088d1b chore: remove strPtr usage with ptr.To instead 2025-07-08 09:03:38 +08:00
Kubernetes Prow Robot
41477c9748 Merge pull request #132361 from yongruilin/master_vg_enable-csr
Enable Declarative Validation for CertificateSigningRequest
2025-07-07 17:05:25 -07:00
PatrickLaabs
1ae1964e88 chore: depr. pointer pkg replacement for pkg/apis 2025-07-07 16:19:01 +02:00
yongruilin
eecba765de Enable validation-gen on certificates/v1,v1alpha1&v1beta1
This enables generation but does not activate the strategy calling of
declarative.
2025-07-01 16:13:56 +00:00
Davanum Srinivas
03afe6471b Add a replacement for cmp.Diff using json+go-difflib
Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2025-06-16 17:10:42 -04:00
Stanislav Láznička
ccd2d4d62a generate code 2025-03-11 18:07:26 +01:00
Stanislav Láznička
f598b4860c copy ClusterTrustBundle API to v1beta1 2025-03-11 17:39:07 +01:00
Tim Hockin
e54719bb66 Use randfill, do API renames 2025-03-08 15:18:00 -08:00
Davanum Srinivas
4e05bc20db Linter to ensure go-cmp/cmp is used ONLY in tests
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2025-01-24 20:49:14 -05:00
Patrick Ohly
8a908e0c0b remove import doc comments
The "// import <path>" comment has been superseded by Go modules.
We don't have to remove them, but doing so has some advantages:

- They are used inconsistently, which is confusing.
- We can then also remove the (currently broken) hack/update-vanity-imports.sh.
- Last but not least, it would be a first step towards avoiding the k8s.io domain.

This commit was generated with
   sed -i -e 's;^package \(.*\) // import.*;package \1;' $(git grep -l '^package.*// import' | grep -v 'vendor/')

Everything was included, except for
   package labels // import k8s.io/kubernetes/pkg/util/labels
because that package is marked as "read-only".
2024-12-02 16:59:34 +01:00
Tim Hockin
c8eeb486f4 Call-site comments: the "" arg to TooLong is unused 2024-11-05 15:10:24 -08:00
Tim Hockin
8a7af90300 Clarify that value arg to field.TooLong is unused 2024-11-05 15:10:23 -08:00
Joe Betz
2595aa1309 generate 2024-09-03 14:26:26 -04:00
Taahir Ahmed
96e610ac18 ClusterTrustBundle: Enforce max size during validation 2023-11-03 11:40:49 -07:00
Taahir Ahmed
ecfdc8fda5 Define ClusterTrustBundlePEM projected volume
This commit defines the ClusterTrustBundlePEM projected volume types.
These types have been renamed from the KEP (PEMTrustAnchors) in order to
leave open the possibility of a similar projection drawing from a
yet-to-exist namespaced-scoped TrustBundle object, which came up during
KEP discussion.

* Add the projection field to internal and v1 APIs.
* Add validation to ensure that usages of the project must specify a
  name and path.
* Add TODO covering admission control to forbid mirror pods from using
  the projection.

Part of KEP-3257.
2023-11-03 11:40:48 -07:00
Tim Hockin
d55b67b349 Clean up brace whitespace in **/validation_test.go
This was making my eyes bleed as I read over code.

I used the following in vim.  I made them up on the fly, but they seemed
to pass manual inspection.

:g/},\n\s*{$/s//}, {/
:w
:g/{$\n\s*{$/s//{{/
:w
:g/^\(\s*\)},\n\1},$/s//}},/
:w
:g/^\(\s*\)},$\n\1}$/s//}}/
:w
2023-05-02 00:48:42 -07:00
Kubernetes Prow Robot
56e17d6d67 Merge pull request #115168 from HirazawaUi/delte-pkg-apis-other-unused-functions
remove unused not api functions in the pkg/apis directory
2023-04-24 14:23:01 -07:00
Tim Hockin
29c0b73d64 Replace uses of diff.ObjectDiff with cmp.Diff
ObjectDiff is already a shim over cmp.Diff, so no actual output or
behavior changes
2023-04-12 08:46:12 -07:00
Taahir Ahmed
2e4b637bf8 ClusterTrustBundles: make update 2023-03-15 20:10:59 -07:00
Taahir Ahmed
6a75e7c40c ClusterTrustBundles: Define types
This commit is the main API piece of KEP-3257 (ClusterTrustBundles).

This commit:

* Adds the certificates.k8s.io/v1alpha1 API group
* Adds the ClusterTrustBundle type.
* Registers the new type in kube-apiserver.
* Implements the type-specfic validation specified for
  ClusterTrustBundles:
  - spec.pemTrustAnchors must always be non-empty.
  - spec.signerName must be either empty or a valid signer name.
  - Changing spec.signerName is disallowed.
* Implements the "attest" admission check to restrict actions on
  ClusterTrustBundles that include a signer name.

Because it wasn't specified in the KEP, I chose to make attempts to
update the signer name be validation errors, rather than silently
ignored.

I have tested this out by launching these changes in kind and
manipulating ClusterTrustBundle objects in the resulting cluster using
kubectl.
2023-03-15 20:10:18 -07:00
HirazawaUi
c50c19d13a remove unused not api functions in the pkg/apis directory 2023-01-18 23:37:57 +08:00
Paco Xu
160f015ef4 kubelet: add key encipherment usage only if it is rsa key
remove allowOmittingUsageKeyEncipherment as it is always true

Signed-off-by: Paco Xu <paco.xu@daocloud.io>
2022-12-27 16:04:25 +08:00
Paco Xu
3ace3eb74b certificates default to tolerate no key encipherment 2022-12-26 23:15:21 +08:00
Jordan Liggitt
78cb3862f1 Fix indentation/spacing in comments to render correctly in godoc 2022-12-17 23:27:38 -05:00
Tim Hockin
6d4241fe5d Clarify a few validation messages 2022-09-19 16:14:37 -07:00
cndoit18
ec43037d0f style: remove redundant judgment
Signed-off-by: cndoit18 <cndoit18@outlook.com>
2022-08-25 12:07:36 +08:00
Kubernetes Prow Robot
cb41d5002c Merge pull request #111061 from pacoxu/key-encipherment-optional
modify the signing/approving controller to tolerate either set of usages for kubelet client and serving certificates
2022-08-02 18:55:51 -07:00
Paco Xu
e6176c28b7 modify the signing/approving controller to tolerate either set of usages for kubelet client and serving certificates
Signed-off-by: Paco Xu <paco.xu@daocloud.io>
2022-08-03 05:12:04 +08:00
Davanum Srinivas
a9593d634c Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
Ryan Richard
e29ac0f8be Promote CertificateSigningRequest's Spec.ExpirationSeconds field to GA
Remove the comment "As of v1.22, this field is beta and is controlled
via the CSRDuration feature gate" from the expirationSeconds field's
godoc.

Mark the "CSRDuration" feature gate as GA in 1.24, lock its value to
"true", and remove the various logic which handled when the gate was
"false".

Update conformance test to check that the CertificateSigningRequest's
Spec.ExpirationSeconds field is stored, but do not check if the field
is honored since this functionality is optional.
2022-03-18 14:41:43 -07:00
Davanum Srinivas
9405e9b55e Check in OWNERS modified by update-yamlfmt.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-12-09 21:31:26 -05:00
Stephen Augustus
481cf6fbe7 generated: Run hack/update-gofmt.sh
Signed-off-by: Stephen Augustus <foo@auggie.dev>
2021-08-24 15:47:49 -04:00
Kubernetes Prow Robot
f805f5588b Merge pull request #104416 from liggitt/go117-certificates
Update unit tests to handle go1.17 certificate parsing error messages
2021-08-17 17:04:07 -07:00