Commit Graph

113 Commits

Author SHA1 Message Date
Wojciech Tyczyński
80060a502c Implement Destroy() method for all registries 2022-04-19 15:59:13 +02:00
Kubernetes Prow Robot
9fbe66a486
Merge pull request #103516 from ykakarap/kubectl-subresources-apiserver
kubectl: apiserver changes to add --subresource support
2022-03-23 13:21:32 -07:00
Yuvaraj Kakaraparthi
801c39b478 kubectl: API changes to support --subresource in kubectl
Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
Co-authored-by: Nikhita Raghunath <nikitaraghunath@gmail.com>
Co-authored-by: Yuvaraj Kakaraparthi <kakaraparthy@vmware.com>
2022-03-23 11:19:58 +05:30
Madhav Jivrajani
f0ef426238 Update tests to have namespace set in req context
* This updates tests that make requests that call
  into admission.
* For apiextensions-apiserver, the namespace is set
  to metav1.NamespaceNone since the CRD created and
  worked with is a cluster scoped CRD.
* For most tests in register/storage, the namespace
  is set to NamespaceDefault or NamespaceNone based
  on if the resource is cluster scoped (namespaces)
  or namespace scoped (pvs).
* Endpoints tests now have a namespace specified in
  the expected object - NamespaceDefault or other
  based on the test.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
2022-02-17 00:13:34 -05:00
Mengjiao Liu
f3c37c2c82 Remove feature gate NamespaceDefaultLabelName 2021-12-07 16:51:17 +08:00
Hanna Lee
07a883d8e6 Remove //lint:ignore pragmas that aren't being used anymore 2021-11-17 08:56:54 +01:00
Hanna Lee
0f3836dcc5 Ignore deprecation warnings with //nolint:staticcheck 2021-11-17 08:55:57 +01:00
Jordan Liggitt
8c8a4cf3e4 Add WarningsOnCreate,WarningsOnUpdate 2021-05-18 10:42:36 -04:00
Kevin Delgado
a1fac8cbd9 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>
2021-03-10 01:02:18 +00:00
jay vyas
c94ce8c507
Add default namespace labels to all namespaces for selectors (#96968)
* namespace by name default labelling

Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
Co-authored-by: Abhishek Raut <rauta@vmware.com>

* Make some logic improvement into default namespace label

* Fix unit tests

* minor change to trigger the CI

* Correct some tests and validation behaviors

* Add Canonicalize normalization and improve validation

* Remove label validation that should be dealt by strategy

* Update defaults_test.go
add fuzzer
ns spec

* remove the finalizer thingy

* Fix integration test

* Add namespace canonicalize unit test

* Improve validation code and code comments

* move validation of labels to validateupdate

* spacex will save us all

* add comment to testget

* readablility of canonicalize

* Added namespace finalize and status update validation

* comment about ungenerated names

* correcting a missing line on storage_test

* Update the namespace validation unit test

* Add more missing unit test changes

* Let's just blast the value. Also documenting the workflow here

* Remove unnecessary validations

Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
Co-authored-by: Abhishek Raut <rauta@vmware.com>
Co-authored-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>
2021-03-08 20:46:59 -08:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
David Eads
37cc89ed8d finish removal of exportoptions 2021-01-22 13:47:31 -05:00
wojtekt
8b98305858 Remove variadic argument from storage interface 2020-11-02 16:08:23 +01:00
Mark Janssen
e3a0ca2731 Fix staticcheck failures for pkg/registry/...
Errors from staticcheck:
pkg/registry/autoscaling/horizontalpodautoscaler/storage/storage_test.go:207:7: this value of err is never used (SA4006)
pkg/registry/core/namespace/storage/storage.go:256:5: options.OrphanDependents is deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. +optional  (SA1019)
pkg/registry/core/namespace/storage/storage.go:257:11: options.OrphanDependents is deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. +optional  (SA1019)
pkg/registry/core/namespace/storage/storage.go:266:5: options.OrphanDependents is deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. +optional  (SA1019)
pkg/registry/core/namespace/storage/storage.go:267:11: options.OrphanDependents is deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. +optional  (SA1019)
pkg/registry/core/persistentvolumeclaim/storage/storage_test.go:165:2: this value of err is never used (SA4006)
pkg/registry/core/resourcequota/storage/storage_test.go:202:7: this value of err is never used (SA4006)
pkg/registry/core/service/ipallocator/allocator_test.go:338:2: this value of other is never used (SA4006)
pkg/registry/core/service/portallocator/allocator_test.go:199:2: this value of other is never used (SA4006)
pkg/registry/core/service/storage/rest_test.go:1843:2: this value of location is never used (SA4006)
pkg/registry/core/service/storage/rest_test.go:1849:2: this value of location is never used (SA4006)
pkg/registry/core/service/storage/rest_test.go:3174:20: use net.IP.Equal to compare net.IPs, not bytes.Equal (SA1021)
pkg/registry/core/service/storage/rest_test.go:3178:20: use net.IP.Equal to compare net.IPs, not bytes.Equal (SA1021)
pkg/registry/core/service/storage/rest_test.go:3185:20: use net.IP.Equal to compare net.IPs, not bytes.Equal (SA1021)
pkg/registry/core/service/storage/rest_test.go:3189:20: use net.IP.Equal to compare net.IPs, not bytes.Equal (SA1021)
2020-06-21 17:23:42 +02:00
Jordan Liggitt
bb90f0ff94 Install APIs directly for tests 2019-12-13 11:56:29 -05:00
Jordan Liggitt
36eb250cbb Switch TableGenerator/TableConvertor interfaces to metav1 2019-11-26 13:18:18 -05:00
Clayton Coleman
2ddeb94b56
storage: Deleting a namespace while spec.finalizers pending should not error
All objects with graceful deletion allow multiple DELETE calls in the pending
state. Namespace is the one outlier, and the error here predates graceful
deletion and finalizers. We should make this behavior consistent with other
calls and merely indicate success and return the state of the object, the
same as if there were pending metadata finalizers.

Clients that previously checked for a conflict error during delete to know
that the server is already deleting will now no longer receive an error
(as if the object were rapidly deleted). There is a small chance that some
clients have error checking for this state, but a much larger chance that
clients that want to trigger a delete of the namespace do not handle this
error case.

Discovered in an e2e test that used the framework namespace and triggered
deletion of that ns itself, and then the AfterEach step in e2e failed
because the namespace was already pending deletion.
2019-10-19 23:08:17 -04:00
Jordan Liggitt
61774cd717 Plumb context to admission Admit/Validate 2019-08-20 11:11:00 -04:00
Ted Yu
87b2a3129b Propagate error from NewREST 2019-08-12 13:55:35 -07:00
wojtekt
a756e20cb5 Update autogenerated files 2019-07-01 15:02:49 +02:00
wojtekt
7497260e54 Move etcd/testing to etcd3/testing 2019-07-01 15:02:49 +02:00
Chao Xu
7bb4a3bace Run deleteValidation at the storage layer so that it will be retried on
conflict.

Adding unit test verify that deleteValidation is retried.

adding e2e test verifying the webhook can intercept configmap and custom
resource deletion, and the existing object is sent via the
admissionreview.OldObject.

update the admission integration test to verify that the existing object
is passed to the deletion admission webhook as oldObject, in case of an
immediate deletion and in case of an update-on-delete.
2019-05-17 09:54:11 -07:00
yue9944882
34c4a6e057 Cherrypicking #66535
validate deletion admission object

backward compatibility: add validation for direct storage delete calls

apply nil validation to existing tests

revert behavior changes in deleteCollection call

fixes validation on wiring graceful deletion

remove nil validation check

continue admission check on not found error
2019-05-17 09:50:16 -07:00
Jordan Liggitt
fba885a0d2 Handle updates removing remaining finalizers on deleted objects 2019-05-15 17:17:39 -04:00
Kubernetes Prow Robot
b4cc2a5523
Merge pull request #76051 from zhouhaibing089/rm-orphan-by-default
namespace: remove gc finalizers based on delete options
2019-04-30 16:10:56 -07:00
zhouhaibing089
a458e9bb85 namespace: remove gc finalizers based on delete options
This makes the behavior being consistent with generic store, The
orphan finalizer should be removed if the delete options does not
specify propagarionPolicy as orphan.
2019-04-26 16:13:41 -07:00
Sean Sullivan
abfc5bbbf7 Rename TablePrinter interface to TableGenerator 2019-04-16 12:55:30 -07:00
ajatprabha
4ddc198c39
pin ResourceVersion precondition only when specified 2019-03-12 17:00:41 +05:30
ajatprabha
42f0a36f44
check for ResourceVersion conflict in separate if block 2019-03-12 17:00:39 +05:30
ajatprabha
8f48d76271
add ResourceVersion to DeleteOptions.Preconditions 2019-03-12 17:00:39 +05:30
Chao Xu
3b618af0d4 Expose storage version hash 2019-03-11 10:26:56 -07:00
Jordan Liggitt
17aa60686e Deprecate and remove use of alpha metadata.initializers field, remove IncludeUninitialized options 2019-01-23 16:34:43 -05:00
Antoine Pelisse
68937c4934 dry-run: Use dry-runnable structure 2018-08-03 14:30:50 -07:00
Jordan Liggitt
652e2dc025
generated 2018-07-13 11:41:09 -04:00
Jordan Liggitt
617078d220
Remove hand-written typed registries 2018-07-13 11:40:52 -04:00
Antoine Pelisse
03b1e14101 dry-run: Create new options for Update/Create and pass it along 2018-07-12 07:18:37 -07:00
jennybuckley
c60fe4fb76 Propagate forceAllowCreate as false to all subresources 2018-06-29 11:28:19 -07:00
jennybuckley
d10e08fc89 Allow override AllowCreateOnUpdate with new argument to Update 2018-06-28 14:24:51 -07:00
Jeff Grafton
23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
Kubernetes Submit Queue
484f62a568
Merge pull request #63333 from deads2k/api-14-snip
Automatic merge from submit-queue (batch tested with PRs 63421, 63432, 63333). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

update tests to be specific about the versions they are testing

When setting up tests, you want to rely on your own scheme.  This eliminates coupling to floating versions which gives unnecessary flexibility in most cases and prevents testing all the versions you need.

@liggitt  scrubs unnecessary deps.

```release-note
NONE
```
2018-05-04 10:52:10 -07:00
David Eads
94e3d94d67 update tests to be specific about the versions they are testing instead of floating 2018-05-01 13:18:41 -04:00
David Eads
8ae62517da remove rootscopedkinds from groupmeta 2018-05-01 13:08:23 -04:00
David Eads
a89291a5de stop duplicating preferred version order 2018-04-26 10:03:36 -04:00
Mike Danese
54fd2aaefd replace request.Context with context.Context 2018-04-24 08:59:00 -07:00
Clayton Coleman
1970f89e43
Namespace should support table printing 2018-02-22 11:37:40 -05:00
Jeff Grafton
ef56a8d6bb Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
Jeff Grafton
efee0704c6 Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
Dr. Stefan Schimanski
d4d53c0e2a apiserver: remove unneeded scheme from registry tester 2017-11-20 09:39:44 +01:00
Dr. Stefan Schimanski
0b100cb69b registry: move generic registry tester into k8s.io/apiserver 2017-11-16 09:03:42 +01:00
Dr. Stefan Schimanski
3410f536f4 registry: cut-off kube dependencies from registrytest 2017-11-16 08:57:58 +01:00