Commit graph

196 commits

Author SHA1 Message Date
Patrick Ohly
6bfa727bee client-go testing: fix List+Watch support
5644850607 added support for List+Watch to a fake client-go instance.
However, that support was not quite working yet as seen when analyzing a test
flake:

- List returned early when there were no objects, without adding the
  ResourceVersion. The ResourceVersion should have been "0" instead.
- When encountering "" as ResourceVersion, Watch didn't deliver
  any objects. That was meant to preserve compatibility with clients
  which don't expect objects from a Watch, but the right semantic of
  "" is "Start at most recent", which includes delivering existing
  objects.

Tests which meddle with the List implementation via a reactor (like
clustertrustbundlepublisher) have to be aware that Watch now may
return objects when given an empty ResourceVersion.
2026-01-15 16:08:23 +01:00
Aditi Gupta
915866f0e4 apimachinery: Use informer.RunWithContext in various components 2025-12-02 15:02:04 -08:00
Kubernetes Prow Robot
a058cf788a
Merge pull request #134624 from yt2985/podcertificates-beta
Promote Pod Certificates feature to beta
2025-11-04 11:42:12 -08:00
tinatingyu
59e075e8d3 Promote PodCertificateRequests to v1beta1 2025-11-02 05:33:44 +00:00
Ondra Kupka
5f3f39edc1 controller/certificates: Improve goroutine mgmt
Make sure all threads are terminated when Run returns.
2025-10-29 19:00:30 +01:00
Aditi Gupta
7d14367f57 Change WaitForNamedCacheSync to WaitForNamedCacheSyncWithContext.
This is part of the ongoing effort to adopt contextual logging
and utilities throughout the codebase.

Contributes to  #126379

Signed-off-by: Aditi Gupta <aditigpta@google.com>
2025-09-05 18:49:31 +00:00
264nm
9c8e03a40b gofmt cleaner.go 2025-08-25 17:36:35 +10:00
264nm
8b760704fc fix(cleaner.go): exit early on check of CSR issue state 2025-08-22 12:37:55 +10:00
264nm
ebf3d814f4 Fix(cleaner.go): Add GC to handle Approved-Unissued CSRs 2025-08-20 10:55:07 +10: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
Kubernetes Prow Robot
fe13474f61
Merge pull request #106225 from shawnhanx/certificates_cleaner
cleaner.go should use time.Until instead of t.Sub(time.Now())
2025-07-14 23:44:24 -07: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
5b3b68a3a1
KCM: CTBPublisher: use generics to handle both alpha/beta APIs 2025-03-11 18:07:29 +01:00
Stanislav Láznička
e0f536bf1f
use the ClusterTrustBundles beta API 2025-03-11 18:07:24 +01:00
shawnhanx
ea644981df
Update pkg/controller/certificates/cleaner/cleaner.go
Co-authored-by: Tim Hockin <thockin@google.com>
2025-01-14 14:19:16 +08:00
shawnhanx
1e1e2dee90
Update pkg/controller/certificates/cleaner/cleaner.go
Co-authored-by: Tim Hockin <thockin@google.com>
2025-01-14 14:18:51 +08: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
Stanislav Láznička
a4b83e77d9
trustbundles: add a new kube-apiserver-serving signer 2024-11-07 18:07:06 +01:00
Joe Betz
2595aa1309 generate 2024-09-03 14:26:26 -04:00
Alvaro Aleman
6d0ac8c561 Use the generic/typed workqueue throughout
This change makes us use the generic workqueue throughout the project in
order to improve type safety and readability of the code.
2024-05-04 14:33:12 -04:00
shawnhanx
eda71f9e95 cleaner.go should use time.Until instead of t.Sub(time.Now()) 2024-04-09 15:12:57 +08:00
Kubernetes Prow Robot
28296ba59e
Merge pull request #113994 from mengjiao-liu/contextual-logging-controller-certificates
certificate controller: use contextual logging
2023-06-21 09:03:42 -07:00
Sheng Zhan
892ebf2d25
Ensure version "*" is passed instead of "" for all authz checks (#116937)
* ensure version * is passed instead of  for all authz checks

* unexport match function

* remove allversion constant
2023-04-25 09:06:18 -07:00
Tim Hockin
9627c50ef3
Replace uses of ObjectGoPrintDiff with cmp.Diff
ObjectGoPrintDiff is already a shim over cmp.Diff, so no actual output
or behavior changes
2023-04-12 08:46:16 -07:00
Mengjiao Liu
017bb93887 certificate controller: use contextual logging 2023-03-15 11:26:08 +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
Han Kang
2bbd445f50 remove rate limiter metric as it is not in use
Change-Id: I91157653e3860eeecc3f572aee88da6ffc65faed
2022-10-13 13:07:11 -07: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
Wojciech Tyczyński
d9d46d5326 Clean shutdown of certificates integration tests 2022-06-02 21:02:04 +02:00
Kubernetes Prow Robot
14e8db067e
Merge pull request #108191 from ravisantoshgudimetla/wire-cert-contexts
Wire cert contexts
2022-03-23 11:20:17 -07: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
Ravi Gudimetla
72a62f47f7 Wire context for cert controllers
All the controllers should use context for signalling termination of communication with API server. Once kcm cancels context all the cert controllers which are started via kcm should cancel the APIServer request in flight instead of hanging around.
2022-03-07 10:19:45 -05:00
sivchari
a5c5acf56e fix curent to current 2021-12-17 03:33:22 +09: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
Stanislav Laznicka
b67bd722a9
rootcacertpublisher: drop the namespace label from metrics to reduce its cardinality
The `root_ca_cert_publisher_sync_duration_seconds` metric tracks the sync
duration in the root CA cert publisher per code and namespace. In
clusters with a high namespace turnover (like CI clusters), this may
cause the kube-controller-manager to expose over 100k series to
Prometheus, which may cause degradation of that service.

Drop the `namespace` label to remove the metrics' cardinality, tracking
this metric by namespace does not justify the impact of keeping it.
2021-09-16 14:05:32 +02:00
wojtekt
e233feb99b Migrate to k8s.io/utils/clock in pkg/controller 2021-09-10 11:42:32 +02: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
Jordan Liggitt
236e72cf8a Make CSR cleaner tolerate objects with invalid status.certificate 2021-07-21 10:35:17 -04:00
Monis Khan
cd91e59f7c
csr: add expirationSeconds field to control cert lifetime
This change updates the CSR API to add a new, optional field called
expirationSeconds.  This field is a request to the signer for the
maximum duration the client wishes the cert to have.  The signer is
free to ignore this request based on its own internal policy.  The
signers built-in to KCM will honor this field if it is not set to a
value greater than --cluster-signing-duration.  The minimum allowed
value for this field is 600 seconds (ten minutes).

This change will help enforce safer durations for certificates in
the Kube ecosystem and will help related projects such as
cert-manager with their migration to the Kube CSR API.

Future enhancements may update the Kubelet to take advantage of this
field when it is configured in a way that can tolerate shorter
certificate lifespans with regular rotation.

Signed-off-by: Monis Khan <mok@vmware.com>
2021-07-01 23:38:15 -04:00
Monis Khan
7e891e5d6c
csr: correctly handle backdating of short lived certs
This change updates the backdating logic to only be applied to the
NotBefore date and not the NotAfter date when the certificate is
short lived. Thus when such a certificate is issued, it will not be
immediately expired.  Long lived certificates continue to have the
same lifetime as before.

Consolidated all certificate lifetime logic into the
PermissiveSigningPolicy.policy method.

Signed-off-by: Monis Khan <mok@vmware.com>
2021-06-23 15:36:11 -04:00
Kubernetes Prow Robot
df9ad4d7d2
Merge pull request #96094 from Hellcatlk/m
Some comments' typos
2021-04-16 11:54:22 -07:00
Kubernetes Prow Robot
d51f15ed0d
Merge pull request #100885 from enj/enj/i/auth_owners
Update sig-auth OWNERS
2021-04-12 22:18:49 -07:00
David Eads
443e4ea0df include description of what kube-root-ca.crt can be used to verify 2021-04-08 10:43:41 -04:00
Monis Khan
bca4993004
Update auth OWNERS files to only use aliases
Signed-off-by: Monis Khan <mok@vmware.com>
2021-04-07 10:46:03 -04:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
Shihang Zhang
bbce0468d4 add metrics for rootcacertpublisher controller 2021-02-16 21:56:41 -08:00
Shihang Zhang
2c378beb64 abort if namespace doesn't exist or terminating 2020-11-05 11:12:15 -08:00
Shihang Zhang
d40f0c43c4 separate RootCAConfigMap from BoundServiceAccountTokenVolume 2020-11-04 17:10:39 -08:00