Commit Graph

24 Commits

Author SHA1 Message Date
Patrick Ohly
8101e94f49 restmapper + discovery: add context-aware APIs
The main purpose is to replace context.TODO with a context provided by the
caller. A secondary purpose is to enable contextual logging.

Modifying the existing interfaces and APIs would have a big impact on the
ecosystem. This is a no-go. Instead, the following approach was taken:

- All interfaces get duplicated in a *WithContext variant where the methods
  also have a *WithContext suffix and the ctx parameter. All methods are
  treated this way except for obvious local get methods (like RESTClient)
  because it cannot be ruled out entirely that some implementation may
  need a context.

- Implementations of these interfaces implement both method variants
  which is possible because the method names are different.
  The old methods are implemented as thin wrappers around the updated
  code which is now the body of the new methods or shared helpers.
  In some cases there is additional overhead (type checks, potentially
  additional allocations) when using the old methods.

- To*WithContext helpers bridge from the old to the new interfaces. They
  try a type cast first. Because the in-tree implementations implement
  both, they can be used directly. For other implementations wrappers
  are used.

- All old APIs and interfaces are marked as deprecated. There is no
  intent to ever remove them, but consumers should be made aware
  that there are now better alternatives. Implementations also
  get marked this way even if nothing ever calls them directly
  because it shows which code, at least theoretically, could get
  removed.

- Existing unit tests do not get updated to the new APIs. This gives
  us unit test coverage of the old and new API because the old
  APIs call the new ones.

- In-tree consumers will be updated in follow-up PRs. This is likely
  to be a longer process. Because of the deprecation comment,
  `hack/golangci-lint.sh -n` can be used to find code which needs
  to be updated.

Kubernetes-commit: 025b844bcabe0212c4dd56395ee18481602d7c65
2024-12-06 17:38:06 +01:00
Jordan Liggitt
25d4fa6ba8 Make Request#RequestURI honor configured context root
Kubernetes-commit: 5677f7ab0b1b1ab22a71d01e4a710bf0f5e633aa
2025-04-03 12:51:46 -04:00
Joe Betz
b5002f17ec Update OpenAPI and fix openAPI tests to handle unexported jsonreferences
Co-authored-by: Alexander Zielensk <alexzielenski@gmail.com>

Kubernetes-commit: 700e3b566428bca46d2d37514c8fd7af60c7ff34
2024-10-25 13:51:03 -04:00
Rita Zhang
f77b3993b9 deprecate EnforceMountableSecretsAnnotation in 1.32
Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>

Kubernetes-commit: e7cdc595551954d6b87a859296eb09fddd01f3c9
2024-10-28 08:01:33 -07:00
杨军10092085
1a951c2887 Updated incorrect description of persistentVolumeClaimRetentionPolicy
Kubernetes-commit: 56bbae4807989cd43eff17cf9fa93f7b54c087bd
2024-08-05 21:30:25 +08:00
Tim Hockin
7087b65a74 Cleanup: s/depreciated/deprecated/g
Kubernetes-commit: 9f4b82bf3b079fe868effbd2498b61464db6d459
2024-02-18 14:50:55 -08:00
Antonio Ojea
656ec39ea1 remove ClusterCIDR
KEP-2593 proposed to expand the existing node-ipam controller
to be configurable via a ClusterCIDR objects, however, there
were reasonable doubts on the SIG about the feature and after
several months of dicussions we decided to not move forward
with the KEP intree, hence, we are going to remove the existing
code, that is still in alpha.

https://groups.google.com/g/kubernetes-sig-network/c/nts1xEZ--gQ/m/2aTOUNFFAAAJ

Change-Id: Ieaf2007b0b23c296cde333247bfb672441fe6dfc

Kubernetes-commit: c2d473f0d438cedab2f1831d23457d24961e0f4e
2023-10-13 21:31:29 +00:00
Paco Xu
92c5c93353 remove GAed FG GRPCContainerProbe
Kubernetes-commit: 7e7b67f2ccd38380120b6da2ccb10ae74970a7a6
2023-08-30 10:29:37 +08:00
Christoph Mewes
0d1af04557 fix typo dervied => derived
Kubernetes-commit: 62275e3cc8c7de6f852bb04ba6cf521d36443580
2023-09-17 11:26:19 +02:00
Antoine Pelisse
f454763642 openapi: Create client -> TypeConverter function
Allows creating a typeconverter from a client (i.e. by taking the data
of the client and formatting it so that one can create a type
converter).

Kubernetes-commit: 45853e20ae5c33d144939495650bb5cc49e1134c
2023-03-28 14:15:43 -07:00
Arda Güçlü
fc96cec338 Use absolute path instead requestURI in openapiv3 discovery (#117495)
Currently, openapiv3 discovery uses requestURI to discover resources.
However, that does not work when the rest endpoint contains prefixes
(e.g. `http://localhost/test-endpoint/`).
Because requestURI overwrites prefixes also in rest endpoint
(e.g. `http://localhost/openapiv3/apis/apps/v1`).

Since `absPath` keeps the prefixes in the rest endpoint,
this PR changes to absPath instead requestURI.

Kubernetes-commit: d94c733ee2bfaedd9a1c45d58fbd56c99403c94d
2023-04-29 18:28:27 +03:00
Antoine Pelisse
12beb34ceb openapi: Make file client more easy to re-use
A few notes about the change:
1. I need to initialize the fileclient once, in an init function, so I
don't have access to `testing.T` yet.
2. I want to be able to configure the openapi files that I use
3. We already have a "cache" client that wraps another client, we don't
need to re-implement caching here, one can just do:
`cache.NewClient(openapitest.NewFileClient("some/path"))` to do a cached
client. Or initialize it in an init/global var.

Since there is still some value to use the embedded file, make an
alternative constructor while using fs.FS interface to be able to
manipulate both virtual and disk-based filesystems.

Kubernetes-commit: 29503fd8d45bc2c9438e92936bf4111162529b40
2023-03-28 13:40:28 -07:00
Tim Allclair
b8c2b4bd8c Fix broken API docs URLs
Kubernetes-commit: ea974280dc9948e31d426ee6366abff0957a5f82
2023-03-10 19:18:06 -08:00
Paco Xu
7bf37ef90f cleanup: sync testdata as CronJobTimeZone is GAed
Kubernetes-commit: 23a583dc3679111d5aaebf2a87db67e4d7c58739
2023-03-08 13:15:46 +08:00
Sean Sullivan
0a3ea4f4da Refactor to use openapi fake client
Kubernetes-commit: e352d94e45cdd7f92574ac02e37fc3ab78a34798
2023-02-14 18:00:08 -08:00
Sean Sullivan
1369f160e9 New openapi v3 testing file client
Kubernetes-commit: 195a55c84c1a0ba9dcc278cc1cccee320334d5e1
2023-02-15 11:37:08 -08:00
Jordan Liggitt
fb55d97d70 Revert "Refactor fake versions of openapi client into testing subdir"
This reverts commit 869da89eab37ce670759cea2c86325f36625e7fc.

Kubernetes-commit: f98944590058f936c7adb76ea2c974899a460fe2
2023-02-14 22:14:37 -05:00
Sean Sullivan
bb1833cfed Refactor fake versions of openapi client into testing subdir
Kubernetes-commit: 869da89eab37ce670759cea2c86325f36625e7fc
2023-02-01 18:39:18 -08:00
Antoine Pelisse
a4d38f89cb Add apelisse into some more OWNERS files
Kubernetes-commit: b5f2130f240b0a9ebd1d0edd400b899d0efb8b2b
2022-11-14 16:28:14 -08:00
Alexander Zielenski
624929cd3f address feedback
Kubernetes-commit: 32d834a88673614080bc37727f8cc94b9b85bc86
2022-10-17 10:51:27 -07:00
Alexander Zielenski
12cafe2b1b refactor to use Schema(contentType)
Kubernetes-commit: e6e6dd826d76a2b19515cd907062f1f74f9e52c2
2022-10-14 12:46:36 -07:00
Alexander Zielenski
8b6ceae557 add more options for fetching openapiv3 in clients
remove serialized types from client

update tests

Kubernetes-commit: fec79e75a50f334d8384a5377513fc78222ea36a
2022-10-12 11:43:46 -07:00
Alexander Zielenski
fa08fc21f5 adjust comments
Kubernetes-commit: e9fc6c28a202ded0228e8505f5e14f5ec2049a3d
2022-03-28 18:40:34 -07:00
Alexander Zielenski
018cf8ace6 add fetching into discovery client for OpenAPI v3
reflect latest struct changes

use correct discovery openapi test data layout

make the OpenAPIv3 interface less blue

field grouping

add copyrights

implement cached discovery client

add cached discovery tests

address review feedback

Kubernetes-commit: 075866b3e3ea029c243d82d8d6eb99e96d9c49d3
2022-03-22 10:40:56 -07:00