Merge pull request #65572 from yue9944882/fixes-admission-operation-mismatch-for-create-on-update

Automatic merge from submit-queue. 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>.

fixes operation for "create on update"

**What this PR does / why we need it**:

Set operation to `admission.Create` for create-on-update requests.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #65553

**Special notes for your reviewer**:

**Release note**:

```release-note
Checks CREATE admission for create-on-update requests instead of UPDATE admission
```

Kubernetes-commit: 8770d12494f58f19cd5298853b9749937140e970
This commit is contained in:
Kubernetes Publisher 2018-07-19 10:42:54 -07:00
commit 8a13127950
3 changed files with 120 additions and 162 deletions

254
Godeps/Godeps.json generated
View File

@ -1,6 +1,6 @@
{ {
"ImportPath": "k8s.io/apiserver", "ImportPath": "k8s.io/apiserver",
"GoVersion": "go1.10", "GoVersion": "go1.9",
"GodepVersion": "v80", "GodepVersion": "v80",
"Packages": [ "Packages": [
"./..." "./..."
@ -832,339 +832,339 @@
}, },
{ {
"ImportPath": "k8s.io/api/admission/v1beta1", "ImportPath": "k8s.io/api/admission/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/admissionregistration/v1alpha1", "ImportPath": "k8s.io/api/admissionregistration/v1alpha1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/admissionregistration/v1beta1", "ImportPath": "k8s.io/api/admissionregistration/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/apps/v1", "ImportPath": "k8s.io/api/apps/v1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/apps/v1beta1", "ImportPath": "k8s.io/api/apps/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/apps/v1beta2", "ImportPath": "k8s.io/api/apps/v1beta2",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/authentication/v1", "ImportPath": "k8s.io/api/authentication/v1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/authentication/v1beta1", "ImportPath": "k8s.io/api/authentication/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/authorization/v1", "ImportPath": "k8s.io/api/authorization/v1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/authorization/v1beta1", "ImportPath": "k8s.io/api/authorization/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/autoscaling/v1", "ImportPath": "k8s.io/api/autoscaling/v1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/autoscaling/v2beta1", "ImportPath": "k8s.io/api/autoscaling/v2beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/batch/v1", "ImportPath": "k8s.io/api/batch/v1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/batch/v1beta1", "ImportPath": "k8s.io/api/batch/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/batch/v2alpha1", "ImportPath": "k8s.io/api/batch/v2alpha1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/certificates/v1beta1", "ImportPath": "k8s.io/api/certificates/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/coordination/v1beta1", "ImportPath": "k8s.io/api/coordination/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/core/v1", "ImportPath": "k8s.io/api/core/v1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/events/v1beta1", "ImportPath": "k8s.io/api/events/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/extensions/v1beta1", "ImportPath": "k8s.io/api/extensions/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/networking/v1", "ImportPath": "k8s.io/api/networking/v1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/policy/v1beta1", "ImportPath": "k8s.io/api/policy/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/rbac/v1", "ImportPath": "k8s.io/api/rbac/v1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/rbac/v1alpha1", "ImportPath": "k8s.io/api/rbac/v1alpha1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/rbac/v1beta1", "ImportPath": "k8s.io/api/rbac/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/scheduling/v1alpha1", "ImportPath": "k8s.io/api/scheduling/v1alpha1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/scheduling/v1beta1", "ImportPath": "k8s.io/api/scheduling/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/settings/v1alpha1", "ImportPath": "k8s.io/api/settings/v1alpha1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/storage/v1", "ImportPath": "k8s.io/api/storage/v1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/storage/v1alpha1", "ImportPath": "k8s.io/api/storage/v1alpha1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/api/storage/v1beta1", "ImportPath": "k8s.io/api/storage/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "183f3326a9353bd6d41430fc80f96259331d029c"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/equality", "ImportPath": "k8s.io/apimachinery/pkg/api/equality",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/errors", "ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/meta", "ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/resource", "ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/testing", "ImportPath": "k8s.io/apimachinery/pkg/api/testing",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/api/testing/fuzzer",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/roundtrip", "ImportPath": "k8s.io/apimachinery/pkg/api/testing/roundtrip",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/validation", "ImportPath": "k8s.io/apimachinery/pkg/api/validation",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/validation/path", "ImportPath": "k8s.io/apimachinery/pkg/api/validation/path",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/validation", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/validation",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion", "ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams", "ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/fields", "ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/labels", "ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime", "ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema", "ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/selection", "ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/types", "ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/cache", "ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/clock", "ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/diff", "ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/errors", "ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/framer", "ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr", "ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/json", "ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch", "ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/naming", "ImportPath": "k8s.io/apimachinery/pkg/util/naming",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/net", "ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/rand", "ImportPath": "k8s.io/apimachinery/pkg/util/rand",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime", "ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/sets", "ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch", "ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/uuid", "ImportPath": "k8s.io/apimachinery/pkg/util/uuid",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation", "ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field", "ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/wait", "ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/waitgroup", "ImportPath": "k8s.io/apimachinery/pkg/util/waitgroup",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml", "ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/version", "ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/watch", "ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "594fc14b6f143d963ea2c8132e09e73fe244b6c9"
}, },
{ {
"ImportPath": "k8s.io/client-go/discovery", "ImportPath": "k8s.io/client-go/discovery",
@ -1174,6 +1174,10 @@
"ImportPath": "k8s.io/client-go/discovery/fake", "ImportPath": "k8s.io/client-go/discovery/fake",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
}, },
{
"ImportPath": "k8s.io/client-go/informers",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{ {
"ImportPath": "k8s.io/client-go/informers/admissionregistration", "ImportPath": "k8s.io/client-go/informers/admissionregistration",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
@ -1346,6 +1350,10 @@
"ImportPath": "k8s.io/client-go/kubernetes", "ImportPath": "k8s.io/client-go/kubernetes",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
}, },
{
"ImportPath": "k8s.io/client-go/kubernetes/fake",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{ {
"ImportPath": "k8s.io/client-go/kubernetes/scheme", "ImportPath": "k8s.io/client-go/kubernetes/scheme",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
@ -1734,6 +1742,10 @@
"ImportPath": "k8s.io/client-go/tools/cache", "ImportPath": "k8s.io/client-go/tools/cache",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
}, },
{
"ImportPath": "k8s.io/client-go/tools/clientcmd",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{ {
"ImportPath": "k8s.io/client-go/tools/clientcmd/api", "ImportPath": "k8s.io/client-go/tools/clientcmd/api",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5" "Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
@ -1809,78 +1821,6 @@
{ {
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto", "ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
"Rev": "0cf8f7e6ed1d2e3d47d02e3b6e559369af24d803" "Rev": "0cf8f7e6ed1d2e3d47d02e3b6e559369af24d803"
},
{
"ImportPath": "k8s.io/client-go/discovery",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/informers",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/kubernetes",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/fake",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/scheme",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/authentication/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/authorization/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/core/v1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/listers/admissionregistration/v1beta1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/listers/core/v1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/rest",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/testing",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/tools/cache",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd/api",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd/api/v1",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/util/cert",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
},
{
"ImportPath": "k8s.io/client-go/util/flowcontrol",
"Rev": "d6a5799477e64ff9e476894020e68cfe794bbeb5"
} }
] ]
} }

View File

@ -127,6 +127,7 @@ func PatchResource(r rest.Patcher, scope RequestScope, admit admission.Interface
userInfo, userInfo,
) )
admissionCheck := func(updatedObject runtime.Object, currentObject runtime.Object) error { admissionCheck := func(updatedObject runtime.Object, currentObject runtime.Object) error {
// if we allow create-on-patch, we have this TODO: call the mutating admission chain with the CREATE verb instead of UPDATE
if mutatingAdmission, ok := admit.(admission.MutationInterface); ok && admit.Handles(admission.Update) { if mutatingAdmission, ok := admit.(admission.MutationInterface); ok && admit.Handles(admission.Update) {
return mutatingAdmission.Admit(admission.NewAttributesRecord( return mutatingAdmission.Admit(admission.NewAttributesRecord(
updatedObject, updatedObject,

View File

@ -105,12 +105,24 @@ func UpdateResource(r rest.Updater, scope RequestScope, admit admission.Interfac
} }
userInfo, _ := request.UserFrom(ctx) userInfo, _ := request.UserFrom(ctx)
staticAdmissionAttributes := admission.NewAttributesRecord(nil, nil, scope.Kind, namespace, name, scope.Resource, scope.Subresource, admission.Update, userInfo)
var transformers []rest.TransformFunc var transformers []rest.TransformFunc
if mutatingAdmission, ok := admit.(admission.MutationInterface); ok && mutatingAdmission.Handles(admission.Update) { if mutatingAdmission, ok := admit.(admission.MutationInterface); ok {
transformers = append(transformers, func(ctx context.Context, newObj, oldObj runtime.Object) (runtime.Object, error) { transformers = append(transformers, func(ctx context.Context, newObj, oldObj runtime.Object) (runtime.Object, error) {
return newObj, mutatingAdmission.Admit(admission.NewAttributesRecord(newObj, oldObj, scope.Kind, namespace, name, scope.Resource, scope.Subresource, admission.Update, userInfo)) isNotZeroObject, err := hasUID(oldObj)
if err != nil {
return nil, fmt.Errorf("unexpected error when extracting UID from oldObj: %v", err.Error())
} else if !isNotZeroObject {
if mutatingAdmission.Handles(admission.Create) {
return newObj, mutatingAdmission.Admit(admission.NewAttributesRecord(newObj, nil, scope.Kind, namespace, name, scope.Resource, scope.Subresource, admission.Create, userInfo))
}
} else {
if mutatingAdmission.Handles(admission.Update) {
return newObj, mutatingAdmission.Admit(admission.NewAttributesRecord(newObj, oldObj, scope.Kind, namespace, name, scope.Resource, scope.Subresource, admission.Update, userInfo))
}
}
return newObj, nil
}) })
} }
createAuthorizerAttributes := authorizer.AttributesRecord{ createAuthorizerAttributes := authorizer.AttributesRecord{
@ -133,8 +145,13 @@ func UpdateResource(r rest.Updater, scope RequestScope, admit admission.Interfac
ctx, ctx,
name, name,
rest.DefaultUpdatedObjectInfo(obj, transformers...), rest.DefaultUpdatedObjectInfo(obj, transformers...),
withAuthorization(rest.AdmissionToValidateObjectFunc(admit, staticAdmissionAttributes), scope.Authorizer, createAuthorizerAttributes), withAuthorization(rest.AdmissionToValidateObjectFunc(
rest.AdmissionToValidateObjectUpdateFunc(admit, staticAdmissionAttributes), admit,
admission.NewAttributesRecord(nil, nil, scope.Kind, namespace, name, scope.Resource, scope.Subresource, admission.Create, userInfo)),
scope.Authorizer, createAuthorizerAttributes),
rest.AdmissionToValidateObjectUpdateFunc(
admit,
admission.NewAttributesRecord(nil, nil, scope.Kind, namespace, name, scope.Resource, scope.Subresource, admission.Update, userInfo)),
false, false,
options, options,
) )