Commit Graph

196 Commits

Author SHA1 Message Date
Arda Güçlü d20862a68e Add singular name for the rest of types
Kubernetes-commit: 578ddde80e72a300fdb3798d68e550d2b4a61203
2022-11-03 10:18:45 +03:00
Antonio Ojea 852f0a02d4 Initialize Name (GenerateName) earlier in the Create process
Kubernetes-commit: af9d36f9310bc3c21791bf17470a667b690573b0
2022-08-26 13:20:43 +02:00
Antonio Ojea 89fb3670f4 test rest error generate name conflict
Kubernetes-commit: 20d190ec2ae90bc521e7342821a3a4301fe573af
2022-08-26 13:20:06 +02:00
Andy Goldstein ecf3a57374 watch cache: log GroupResource, not objectType
All CustomResources are treated as *unstructured.Unstructured, leading
the watch cache to log anything related to CRs as Unstructured. This
change uses the schema.GroupResource instead of object type for all type
related log messages in the watch cache, resulting in distinct output
for each CR type.

Signed-off-by: Andy Goldstein <andy.goldstein@redhat.com>

Kubernetes-commit: 397533a4c2df9639ff4422c907d06fae195a1835
2022-08-11 15:45:04 -04:00
cndoit18 902be89708 style: remove redundant judgment
Signed-off-by: cndoit18 <cndoit18@outlook.com>

Kubernetes-commit: ec43037d0f57fdfc2fdc4960fdb8a7e31ac79fae
2022-07-29 18:25:05 +08:00
Davanum Srinivas 7e94033a61 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>

Kubernetes-commit: a9593d634c6a053848413e600dadbf974627515f
2022-07-19 20:54:13 -04:00
Tim Hockin 970b3ee9bb Initialize UID earlier in the Create process
Before:
  Create()
      BeginCreate()
      BeforeCreate()
          init UID <---------------------
          strategy code

After:
  Create()
      init UID <-------------------------
      BeginCreate()
      BeforeCreate()
          strategy code

This also wipes UID early (suggested by David) and asserts it is set in
BeforeCreate().

Kubernetes-commit: 5615de51f9e768dd01d7fe49a48e8db756bd8ac8
2022-06-17 15:32:25 -07:00
Steve Kuznetsov 80256820ce storage: move the APIObjectVersioner definition to storage
The means by which we extract and parse the version of an API object is
not specific to etcd3. In order to allow for a generic suite of tests
against any storage.Interface imlpementation, we need this logic to live
outside of the etcd3 package, or import cycles will exist.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Kubernetes-commit: 3939f3003e9605c06f65e64d1fc6f94b294f9d97
2022-05-11 07:44:21 -07:00
Wojciech Tyczyński d0a6d0fb72 Cleanup no-longer used storage cleanup method
Kubernetes-commit: 2dd44d6226efc6b72ae56b5fb81b5b2921cf3e16
2022-05-11 19:02:51 +02:00
Sanskar Jaiswal d1bd5277fb Update comment and declaration of `storage.GuaranteedUpdate` to be clearer.
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>

Kubernetes-commit: f8df26ae803103f82edbf1efe17b1b169801b256
2022-04-16 17:19:06 +05:30
Wojciech Tyczyński fbdcc3ee50 Cleanup rest storage resources on shutdown
Kubernetes-commit: 0527a0dd453c4b76259389ec8e8e6888c5e2a5ab
2022-04-05 11:00:06 +02:00
Jordan Liggitt 268935d657 Revert "remove unwanted values returned from dry-run"
This reverts commit 60c1d58d02c7374645c00281dda3fd656264e1c5.

Kubernetes-commit: adb76219198235bb069bb67e924455dceaaba7c4
2022-04-06 12:34:42 -04:00
Patrick Ohly ba3b8e9322 enhance and fix log calls
Some of these changes are cosmetic (repeatedly calling klog.V instead of
reusing the result), others address real issues:

- Logging a message only above a certain verbosity threshold without
  recording that verbosity level (if klog.V().Enabled() { klog.Info... }):
  this matters when using a logging backend which records the verbosity
  level.

- Passing a format string with parameters to a logging function that
  doesn't do string formatting.

All of these locations where found by the enhanced logcheck tool from
https://github.com/kubernetes/klog/pull/297.

In some cases it reports false positives, but those can be suppressed with
source code comments.

Kubernetes-commit: edffc700a43e610f641907290a5152ca593bad79
2022-02-16 12:17:47 +01:00
Wojciech Tyczyński b028a2ea8d Unify merge GetToList and List storage methods to single GetList
Kubernetes-commit: f3d56369f71f5106eeec8300e77bd69b172733da
2022-02-10 10:15:29 +01:00
Wojciech Tyczyński 9f8f72fea9 Change storage.Interface to utilize recurisve parameter
Kubernetes-commit: 3016b3d8f868a3041c7cb86695de09d7ab27cf3b
2022-02-10 09:58:31 +01:00
Wojciech Tyczyński 24beadcd3f DeleteCollection respects context cancellation
Kubernetes-commit: 90a77bc482cd72d27977f007e205a514ff408ff1
2022-02-04 15:51:23 +01:00
Joe Julian 7cac225c86 remove unwanted values returned from dry-run
Remove the uid and the resourceVersion from dry-run results per kep 576

https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/576-dry-run/README.md#generated-values

Kubernetes-commit: 60c1d58d02c7374645c00281dda3fd656264e1c5
2021-12-16 12:44:02 -08:00
Davanum Srinivas c56bc7b872 OWNERS cleanup - Jan 2021 Week 1
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 9682b7248fb69733c2a0ee53618856e87b067f16
2022-01-03 10:59:47 -05:00
Patrick Ohly ec795ae204 avoid klog Info calls without verbosity
In the following code pattern, the log message will get logged with v=0 in JSON
output although conceptually it has a higher verbosity:

   if klog.V(5).Enabled() {
       klog.Info("hello world")
   }

Having the actual verbosity in the JSON output is relevant, for example for
filtering out only the important info messages. The solution is to use
klog.V(5).Info or something similar.

Whether the outer if is necessary at all depends on how complex the parameters
are. The return value of klog.V can be captured in a variable and be used
multiple times to avoid the overhead for that function call and to avoid
repeating the verbosity level.

Kubernetes-commit: 9eaa2dc554e0c3d4485d4c916dfdbc2f517db2e0
2021-12-11 12:10:21 +01:00
Wojciech Tyczyński b4935b065f Slightly improve reliability of storage List tests.
Kubernetes-commit: 8ca6c5922b9a0bafa8c83617d6930b981430334e
2021-12-10 12:05:32 +01:00
Davanum Srinivas b840d63feb Cleanup OWNERS files (No Activity in the last year)
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 497e9c1971c9e7d0193bc6d11503ec4ad527f1d5
2021-12-10 15:18:50 -05:00
Davanum Srinivas 56a3a30ae1 Check in OWNERS modified by update-yamlfmt.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 9405e9b55ebcd461f161859a698b949ea3bde31d
2021-12-09 21:31:26 -05:00
Wojciech Tyczyński 71bfcaaea1 Simplify storage.Interface by merging Watch and WatchList functions.
Kubernetes-commit: 53653e9b0a7145c3b6e133c5639194ff79b3719d
2021-11-18 12:40:26 +01:00
Kevin Delgado 59227ac996 Server Side Field Validation
Implements server side field validation behind the
`ServerSideFieldValidation` feature gate. With the
feature enabled, any create/update/patch request
with the `fieldValidation` query param set to
"Strict" will error if the object in the request
body have unknown fields. A value of "Warn"
(also the default when the feautre is enabled)
will succeed the request with a warning.

When the feature is disabled (or the query param
has a value of "Ignore"), the request will succeed
as it previously had with no indications of any
unknown or duplicate fields.

Kubernetes-commit: e50e2bbc889eb274ad1463a54188a2805767bfde
2021-08-18 02:25:36 +00:00
Antonio Ojea 4662dacdd3 migrate nolint coments to golangci-lint
Kubernetes-commit: d126b1483840b5ea7c0891d3e7a693bd50fae7f8
2021-11-16 16:57:58 +01:00
Raffaele Di Fazio bd72ab7a82 improve wording for panic message
Kubernetes-commit: 8e9d28eede7a8c81d7a9111cba642246353e0d14
2021-11-05 18:43:12 +01:00
Wojciech Tyczyński 0f1abbd5e4 Fix delete collection error channel size
Kubernetes-commit: f609a8e0b525ee22b3ea1a850a3b0504627525ea
2021-10-25 08:07:21 +02:00
scott 5d7782c370 fix goroutine leak in the DeleteCollection
Kubernetes-commit: 53df1caeef608dd82d6c0d2433646f538dcd2b5a
2021-10-11 20:21:27 +08:00
Vince Prignano 2b1166c385 Object creation with generateName should return a proper error
Signed-off-by: Vince Prignano <vincepri@vmware.com>

Kubernetes-commit: 8a9d61278f6c2177309f58bf2655f2269e8f6afd
2021-08-31 18:04:59 -07:00
Mike Spreitzer b225af44fe Introduce storagebackend.ConfigForResource
This is a Config specialized for a GroupResource.
It will support generating new resource-specific metrics.

Kubernetes-commit: 85bcd243aa3c8769a5904a1aea44ce704f5e7174
2021-08-29 01:06:12 -04:00
Tim Hockin cf0112f87e REST: Document mutable inputs on Create()
If one doesn't DeepCopy() on the way into Create, we can end up writing
into the original object.  This is by design, and should not be a
problem EXCEPT for tests.  If a test compares the input to this function
with the result, but the input was mutated in-situ, it may hide errors,
resulting in tests that pass, but shouldn't.

Kubernetes-commit: 6dfae64d9bebb2c40680bbd6e8270f69839ab013
2021-08-13 11:54:00 -07:00
Jordan Liggitt 29227fd4ee Avoid spurious calls to update/delete validation
Kubernetes-commit: 561ce035b5b7d577ddb5bb30657bc1f8b399e109
2021-08-05 17:21:40 -04:00
Abu Kashem feb4eefe1c apiserver: add callback to get notified of object count
Kubernetes-commit: 2c60feffbee690af4632d068158e640abe10f678
2021-07-14 16:44:34 -04:00
David Eads 526d12c09b prevent mutation of deletion options during delete collection
Kubernetes-commit: 649b87aaf85dbb6e8190bf7d16c5dc903b5ecedc
2021-03-10 15:41:03 -05:00
lala123912 5c11e2a763 staging/src/k8s.io/apiserver/pkg/registry:migrate logs to structured logs
Kubernetes-commit: 8e7b5ff480b04342f78b6d321814f05e31abc4bb
2021-01-22 10:25:47 +08:00
Jordan Liggitt 862269412a Eliminate parallel and unnecessary embedded etcd instances
Kubernetes-commit: 068e4c55a8aef3c9f3b7eb4565fc3babfab186b5
2021-06-04 00:41:09 -04:00
Jordan Liggitt 584c18160b Fix closing of decorated watcher channel on timeout
Kubernetes-commit: bd2d63dd57e6011bfa3218e59e27fddaa295426b
2021-06-02 14:05:52 -04:00
Jordan Liggitt 8dd82c2391 Add WarningsOnCreate,WarningsOnUpdate
Kubernetes-commit: 8c8a4cf3e4a18e97359ce750530a4fa27bbd3b88
2021-04-30 21:46:54 -04:00
Kevin Delgado 86db6c67fb Server-Side Apply: Status Wiping/Reset Fields
Adds and implements ResetFieldsProvder interface in order to ensure that
the fieldmanager no longer owns fields that get reset before the object
is persisted.

Co-authored-by: Kevin Wiesmueller <kwiesmul@redhat.com>
Co-authored-by: Kevin Delgado <kevindelgado@google.com>

Kubernetes-commit: a1fac8cbd9289d95db4831a83239292ed56ce59d
2021-03-09 23:54:55 +00:00
chymy 2b123cdcbb Fix staticcheck failures for vendor/k8s.io/apiserver/pkg/registry/generic
Signed-off-by: chymy <chang.min1@zte.com.cn>

Kubernetes-commit: 3bab70b06a9f84b4aeb6dd39ba56f813b4febe44
2021-02-27 03:25:24 -05:00
Nikhita Raghunath d22b238769 *: remove nikhiljindal from OWNERS
Kubernetes-commit: 6cef3a4e33c10c27bb301a1070ea3ff4cdad0c39
2021-02-16 10:50:50 +05:30
Nikhita Raghunath cce93bd25d *: move gmarek to emeritus_approvers
Kubernetes-commit: b11516d69f2131327931a2cf7452d5e891d7e520
2021-02-16 10:31:19 +05:30
David Eads 67507290ad finish removal of exportoptions
Kubernetes-commit: 37cc89ed8d5194f288bc9f9633e6142647631a07
2021-01-22 09:21:56 -05:00
David Eads 2ea61962bd add metrics for insecure backend proxy
Kubernetes-commit: 782a7a54269cba12bd16f90347127c9efd41fa36
2021-01-07 11:25:43 -05:00
Tim Hockin 12c81a534a Use typedefs for Begin* functions
David asked for this for readability, even if not all other hooks do it.

Kubernetes-commit: 37b34f5b53edec78ca33929443bb4ba9a9534ed1
2020-12-15 21:49:16 -08:00
Tim Hockin e0a1a6eb3d Change AfterCreate/Update to take Options
Also adds typedefs for these function signatures for code clarity.

Kubernetes-commit: 25da6a06609265dcd3f637629705686b308b26d0
2020-12-15 21:40:44 -08:00
Tim Hockin f25a4e6d0f Change AfterDelete to take DeleteOptions
All of the After* hooks are called, whether the operation is dry-run or
not.  Create and Upate both have BeginCreate() hooks which know about
dry-run but delete doesn't, and can't (because of graceful deletion and
finalizers, the Delete() method may return and the object is actually
deleted later).

This adds an argument to AfterDelete(), and the others will follow.

This commit also adds tests for AfterDelete being called in the right
places.

Kubernetes-commit: 9402f48e050c25514a95da2e5e1feb6754ad0e0d
2020-12-15 21:24:57 -08:00
Tim Hockin c1a9dd5c5f Remove ObjectFunc
Kubernetes-commit: bb79475a860e908c6d3bbaf25da802c158c356b7
2020-12-15 13:05:13 -08:00
Tim Hockin f723593774 Make REST Decorator funcs not return error
Kubernetes-commit: 625713008d8897670092a125f26d368e96b7268f
2020-11-10 15:07:05 -08:00
Tim Hockin 04148006d1 Make REST After* funcs not return error
Kubernetes-commit: 64491be328128606daa8f91768586257dc393bd0
2020-11-10 14:50:42 -08:00