47 Commits

Author SHA1 Message Date
Jefftree
8ddf4401e5 Gate apidiscovery/v2beta1 serving with a feature gate
Kubernetes-commit: 95d3d4a22d705ef6bf2d494c065743d356914e8d
2025-03-13 17:58:06 +00:00
novahe
5c7f206b25 Fix test cases that may potentially cause a panic.
Kubernetes-commit: 9e53371ddaaeab4083fde45e43c803071238e686
2025-03-11 17:41:37 +08:00
xin.li
d8b34c3ab2 fix wrong assertion on tests
Signed-off-by: xin.li <xin.li@daocloud.io>

Kubernetes-commit: bc4ae15d77beab23f321bf6547f82c04ba27c3fa
2025-02-22 12:39:01 +08:00
Matthieu MOREL
9d7f486102 fix: enable expected-actual rule from testifylint in module k8s.io/client-go
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Kubernetes-commit: 8286a69034d58e1ceafd6a6e5590bfcebd920b5b
2024-09-27 07:48:55 +02:00
Matthieu MOREL
290f054d9b fix: enable compares rule from testifylint in module
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Kubernetes-commit: 407d74fb6a563951045287338a6c64a79fcad8ec
2024-09-21 21:23:07 +02:00
Matthieu MOREL
acc5917341 fix: enable empty and len rules from testifylint on pkg package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>

Kubernetes-commit: f014b754fb5925dfbca6e27a44d0c3968b157e14
2024-06-28 21:20:13 +02:00
Jefftree
4bf7f9496e Use v2 types with agg discovery
Kubernetes-commit: 462dd326c2e98d937a96d49002883000efe4b2d6
2024-01-19 16:13:47 -05:00
Jefftree
2bd3f49236 Update gnostic references
Kubernetes-commit: 2111e79f56acdfa6a8dab56780c52e3abc608758
2023-06-01 18:25:39 +00:00
Sean Sullivan
6b8e57ec24 Plumb stale GroupVersions through aggregated discovery
Kubernetes-commit: fed7bb7c51e9f85db122ad6d111cb8326dce9f8a
2023-02-28 19:44:34 +00:00
Sean Sullivan
0bc91705fa Tolerate empty discovery response in memcache client
Kubernetes-commit: a49f13258548c71194e3001ebf5fa219b88155d0
2023-02-22 23:59:37 +00:00
Sean Sullivan
3ac73ea2c8 Adds bool to force non-aggregated discovery
Kubernetes-commit: a84d877310ba5cf9237c8e8e3218229c202d3a1e
2022-11-09 12:30:05 -08:00
Sean Sullivan
25d5761bfa Aggregated discovery client
Kubernetes-commit: b8fe2c7b8061e6ab0b093a49351bac256606da4a
2022-11-03 11:09:58 -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
inosato
27de641f75 Remove ioutil from client-go
Signed-off-by: inosato <si17_21@yahoo.co.jp>

Kubernetes-commit: 88dfa51b6003c90e8f0a0508939a1d79950a40df
2022-07-30 20:54:41 +09:00
Nic Cope
761f55c9e0 Use SHA256 sums to verify discovery cache integrity
This is a little more computationally expensive but reduces the
likelihood of a potentially malicious cache collision.

Signed-off-by: Nic Cope <nicc@rk0n.org>

Kubernetes-commit: c5957c284e1d23bdadc98fbbe2bb481fc1f345d4
2022-07-26 23:51:01 -07:00
Nic Cope
735524f850 Use sha256 to sanitize discovery HTTP cache keys
This helps avoid (potentially malicious) collisions when reading and
writing cache data.

Signed-off-by: Nic Cope <nicc@rk0n.org>

Kubernetes-commit: 288a17fd337c65cb5aea44e44ecb74e9cb8088f5
2022-07-14 14:11:33 -07:00
Nic Cope
1ea239faa5 Use checksums instead of fsyncs to manage discovery cache corruption
Part of the API discovery cache uses an HTTP RoundTripper that
transparently caches responses to disk. The upstream implementation of
the disk cache is hard coded to call Sync() on every file it writes.
This has noticably poor performance on modern Macs, which ask their disk
controllers to flush all the way to persistant storage because Go uses
the `F_FULLFSYNC` fnctl. Apple recommends minimizing this behaviour in
order to avoid degrading performance and increasing disk wear.

The content of the discovery cache is not critical; it is indeed just a
cache and can be recreated by hitting the API servers' discovery
endpoints. This commit replaces upstream httpcache's diskcache
implementation with a similar implementation that can use CRC-32
checksums to detect corrupted cache entries at read-time. When such an
entry is detected (e.g. because it was only partially flushed to
permanent storage before the host lost power) the cache will report a
miss. This causes httpcache to fall back to its underlying HTTP
transport (i.e. the real API server) and re-cache the resulting value.

Apart from adding CRC-32 checksums and avoiding calling fsync this
implementation differs from upstream httpcache's diskcache package in
that it uses FNV-32a hashes rather than MD5 hashes of cache keys in
order to generate filenames.

Signed-off-by: Nic Cope <nicc@rk0n.org>

Kubernetes-commit: 7a2c6a432f9e8db8b84abe5607843429f8bff417
2022-06-28 19:15:49 -07:00
Nic Cope
76fccca0ea Add a benchmark for the discovery cache RoundTripper
This benchmark is intended to demonstrate a performance improvement
gained by removing fsyncs. Refer to the below issue for more detail.

https://github.com/kubernetes/kubernetes/issues/110753

Signed-off-by: Nic Cope <nicc@rk0n.org>

Kubernetes-commit: eace46906512b99c23ad9635edc2ea055363a602
2022-06-28 19:40:58 -07:00
HaoJie Liu
2f582c2a40 Fix:import the same package multiple times
Signed-off-by: HaoJie Liu <liuhaojie@beyondcent.com>

Kubernetes-commit: 4f0a0ec81c649727cfc62cf8c0a2ad7eabf12516
2022-07-12 17:41:37 +08: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
Arda Güçlü
7e062f8fa4 Remove deprecated discovery/ServerResources function
ServerResources function was deprecated and instead ServerGroupsAndResources
function is suggested.

This PR removes ServerResources function and move every place to use ServerGroupsAndResources.

Kubernetes-commit: ef39a8914291ba200bd5486c88a7575ffd4b7d1d
2021-12-22 11:14:09 +03:00
Jefftree
186c332c7b googleapis/gnostic -> google/gnostic
Kubernetes-commit: 8a1d5947ad34ba275192341baa4e5fef8e6c7f24
2022-03-15 20:36:21 -07:00
Patrick Hunziker
0588bc827b Fix staticcheck failure for vendor/k8s.io/client-go/discovery/cached/memory
Kubernetes-commit: b08e36eeb9c18991fab5a98d456eae76f4f570b5
2020-09-27 18:31:46 +02:00
Jordan Liggitt
e3251a06c1 [go1.15] Use errors.As to unwrap net errors
Kubernetes-commit: c61c60eb1f59c92b0628484b55c640e585555aab
2020-08-07 15:22:54 -04:00
Maciej Szulik
65806b89ce Setup cache dirs properly based on --cache-dir value
Kubernetes-commit: 6c6cd2deeb03040d458b00824fd6c1a900a81b51
2020-07-08 15:43:25 +02:00
Davanum Srinivas
75fea27a27 switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 442a69c3bdf6fe8e525b05887e57d89db1e2f3a5
2020-04-17 15:25:06 -04:00
Jordan Liggitt
d847b4c964 github.com/googleapis/gnostic v0.4.1
Kubernetes-commit: 93c7b24562d80959f45c308e7412456a410b9b25
2020-03-31 17:18:56 -04:00
Joe Betz
6720cad255 Refresh discovery server resources for memCacheClient in parallel
Kubernetes-commit: 190a72392ae712fbbee979e95a6017ccb578877d
2020-02-20 13:40:23 -08:00
Yucheng Wu
790a4f6363 fix CVE-2019-11244: kubectl --http-cache=<world-accessible dir> creates world-writeable cached schema files
Kubernetes-commit: f228ae3364729caed59087e23c42868454bc3ff4
2019-05-14 14:49:38 +08:00
Chao Xu
65ff1483c9 Add glue for legacy interface for backward compatibility.
Kubernetes-commit: 63820236263cfefb3e9c9e6bf259b5448b724408
2019-02-12 19:16:01 -08:00
Chao Xu
9e44a08cb1 Moved memory-cached and disk-cached discovery to their own packages
Kubernetes-commit: 6666049898f93932655fef24f807bc4d6e439fc6
2018-12-19 13:32:56 -08:00
Dr. Stefan Schimanski
2cc261d78b client-go: extend discovery intf with ServerGroupsAndResources
Kubernetes-commit: 618050e35dd617032e81dfe61084a676d3e10757
2019-02-05 11:35:36 +01:00
Maciej Borsz
5865254254 Refactor memCacheClient to retry requests.
Kubernetes-commit: c94bee0b8b88851e5f5fd6538b99adff8b3a13f0
2018-11-13 13:10:31 +01:00
Jay Lim
c1a902d20d Fix linting issues in staging/src/k8s.io/client-go/discovery/*
Signed-off-by: Jay Lim <jay@imjching.com>

Kubernetes-commit: 7a317e6262ac42dc20abd1596d505abda81b1ee3
2018-10-22 18:29:30 -04:00
Jordan Liggitt
212413e762 Collapse memcached discovery client onto parallelized discovery method
Kubernetes-commit: af7d3b21f85d12e3296d8b237c7181d515ee530c
2018-05-09 18:00:12 -04:00
Jordan Liggitt
46ab86af26 Make ServerPreferred[Namespaced]Resources logic and caches consistent
Kubernetes-commit: 74b7cec0c6b1355615097be4068500761a9893fd
2018-05-03 23:34:09 -04:00
Kubernetes Publisher
fff8c3d73e sync: initially remove files BUILD */BUILD BUILD.bazel */BUILD.bazel 2018-03-15 09:19:38 +00:00
Jeff Grafton
fca8bb2928 Autogenerated: hack/update-bazel.sh
Kubernetes-commit: ef56a8d6bb3800ab7803713eafc4191e8202ad6e
2018-02-16 13:43:01 -08:00
Jeff Grafton
fe985a55a2 Autogenerate BUILD files
Kubernetes-commit: efee0704c60a2ee3049268a41535aaee7f661f6c
2017-12-23 13:06:26 -08:00
Jeff Grafton
c92755ea3b update BUILD files
Kubernetes-commit: aee5f457dbfd70c2d15c33e392dce6a3ca710116
2017-10-12 13:52:10 -07:00
Antoine Pelisse
5e3eb38791 kubectl: Remove swagger 1.2 entirely.
Kubernetes-commit: d1ce36371e637f159256f1f43e3590926ff906d5
2017-09-28 15:58:53 -07:00
Jeff Grafton
5da217e5c4 Use buildozer to delete licenses() rules except under third_party/
Kubernetes-commit: a7f49c906df816123e7d4ccbd4cebab411519465
2017-08-29 12:51:55 +00:00
Jeff Grafton
fa2ceb7462 Use buildozer to remove deprecated automanaged tags
Kubernetes-commit: 33276f06be5e872bf53ca62a095fcf0a6b6c11a8
2017-08-29 12:51:55 +00:00
Jeff Grafton
f921a73942 Run hack/update-bazel.sh to generate BUILD files
Kubernetes-commit: 3579017b865ddbc5449d6bba87346f086e4b93ff
2017-08-29 12:50:17 +00:00
Dan Mace
9ffde92a64 Refactor cached discovery client
Kubernetes-commit: 2639b75d84cbfb513f90f65de1efb46c50a2fbb6
2017-07-05 23:51:41 +00:00