Commit Graph

208 Commits

Author SHA1 Message Date
Joe Betz 6f648c15a2 Add retry around create
Kubernetes-commit: a05db0dd22a68a9c443a9f01cc1b8f6397fd6a9f
2024-01-19 16:10:30 -05:00
HirazawaUi f834404133 fix test store delete collection function failed
Kubernetes-commit: b12db6d9b55e02b232b716683a2d516e1788a9ce
2023-11-08 00:07:45 +08:00
Lukasz Szaszkiewicz f75c503352 storage/factory: extend the Create method by newList and resourcePrefix params
Kubernetes-commit: ccabc01093a1344ebb27c32c946e9da3b8e91fd2
2023-07-28 09:53:01 +02:00
Wojciech Tyczyński bf71493219 Simplify DeleteCollection
Kubernetes-commit: e08bd3bc263615f3a26bd17c66a3222e4b6ff7ec
2023-07-03 16:56:53 +02:00
Wojciech Tyczyński 6ab923fd4b Paginate within DeleteCollection call.
Kubernetes-commit: 732775ee7d1270b6056c371c4298a6b3380bec02
2023-02-09 20:59:18 +01:00
Antoine Pelisse d2d2fc8828 dryrun: Don't reuse current object for conversion
dry-run and non-dry-run are currently a little different since dry-run
was using the destination object to get the current status. That causes
a weird duplication bug with the HorizontalPodAutoscaler conversion
code. Addresses the bug by using an empty object for the current state
and keep the destination for its actual "out" purpose.

Kubernetes-commit: 20866b3f85ac50a094a4400469ebcac381cbc7e9
2023-06-02 13:37:34 -07:00
Daniel Smith 6abce7684c lavalamp is taking a long break
Kubernetes-commit: 1ffe3f467e8b8033312b7c68943d58125fd27663
2023-05-11 16:43:38 +00:00
Alexander Zielenski 29e89f54e2 move check for noop managed field timestamp updates
this check needs to go after any mutations. After the mutating admission chain, rest.BeforeUpdate (which is responsible for reverting updates to immutable timestamp fields, among other things.) is called in the store.Update function. Without moving this check, it will be possible for an object to be written to etcd with only a change to its managed fields timestamp.

Kubernetes-commit: 2b01f63b115e19e8ac9f8ee8e00dde65c5f40290
2023-03-22 11:18:50 -07:00
Damien Grisonnet 77fa29c10e pkg/registry: rename pod logs metrics
The pod_logs subsystem was inadvertently made redundant in the following
kube-apiserver metrics:
- kube_apiserver_pod_logs_pods_logs_backend_tls_failure_total
- kube_apiserver_pod_logs_pods_logs_insecure_backend_total

To safely rename them, it is required to deprecate them in 1.27 whilst
introducing the new metrics replacing them.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>

Kubernetes-commit: 1efa1a65ee26c68de3f972f4e079338889a3e5e9
2022-12-14 23:40:21 +01:00
Lukasz Szaszkiewicz 175c211688 Add SendInitialEvents to storage ListOptions
Kubernetes-commit: e1537fc41b9eecb0e5026bfc72b27e4a07d771ba
2023-01-30 14:54:59 +01:00
Jordan Liggitt 8d0e8f8cb8 Partition watchers by namespace/name scope
Kubernetes-commit: 1c2fa0c7f791cbe28ee54d957d6f8a1120d91018
2023-02-05 18:46:19 -05:00
Wojciech Tyczyński 27cf1d8797 Minor refactor of DeleteCollection
Kubernetes-commit: e1aa521c141e14e53278b463233c0839238f642f
2023-02-09 21:14:17 +01:00
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