Merge pull request #63084 from mikedanese/ctx
Automatic merge from submit-queue (batch tested with PRs 59220, 62927, 63084, 63090, 62284). 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>. replace request.Context with context.Context Followup on https://github.com/kubernetes/kubernetes/pull/62810 cc @liggitt @kubernetes/sig-api-machinery-pr-reviews ```release-note NONE ``` Kubernetes-commit: 9baf337cf3447d1758d4527489b3e9c2e47c1295
This commit is contained in:
commit
b945950cf5
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"ImportPath": "k8s.io/apiserver",
|
||||
"GoVersion": "go1.10",
|
||||
"GoVersion": "go1.9",
|
||||
"GodepVersion": "v80",
|
||||
"Packages": [
|
||||
"./..."
|
||||
|
@ -812,339 +812,339 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/admission/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/admissionregistration/v1alpha1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/admissionregistration/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/apps/v1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/apps/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/apps/v1beta2",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/authentication/v1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/authentication/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/authorization/v1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/authorization/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/autoscaling/v1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/autoscaling/v2beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/batch/v1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/batch/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/batch/v2alpha1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/certificates/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/core/v1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/events/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/extensions/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/networking/v1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/policy/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/rbac/v1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/rbac/v1alpha1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/rbac/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/scheduling/v1alpha1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/settings/v1alpha1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/storage/v1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/storage/v1alpha1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/storage/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "6ef9db38b7d4d02a221e7af3e7f508ff19706fc6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/testing",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/fuzzer",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/roundtrip",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/validation",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/validation/path",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/announced",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/validation",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/fields",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/labels",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/selection",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/types",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/cache",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/clock",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/rand",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/uuid",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/waitgroup",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/version",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/watch",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
"Rev": "8cd82ca9c2ecc1799da600b08af6c04a112490aa"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/discovery",
|
||||
|
@ -1154,6 +1154,10 @@
|
|||
"ImportPath": "k8s.io/client-go/discovery/fake",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/informers",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/informers/admissionregistration",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
|
@ -1314,6 +1318,10 @@
|
|||
"ImportPath": "k8s.io/client-go/kubernetes",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/kubernetes/fake",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/kubernetes/scheme",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
|
@ -1674,6 +1682,10 @@
|
|||
"ImportPath": "k8s.io/client-go/tools/cache",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/tools/clientcmd",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/tools/clientcmd/api",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
|
@ -1745,78 +1757,6 @@
|
|||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
|
||||
"Rev": "50ae88d24ede7b8bad68e23c805b5d3da5c8abaf"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/discovery",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/informers",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/kubernetes",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/kubernetes/fake",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/kubernetes/scheme",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/kubernetes/typed/authentication/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/kubernetes/typed/authorization/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/kubernetes/typed/core/v1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/listers/admissionregistration/v1beta1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/listers/core/v1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/rest",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/testing",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/tools/cache",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/tools/clientcmd",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/tools/clientcmd/api",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/tools/clientcmd/api/v1",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/util/cert",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/client-go/util/flowcontrol",
|
||||
"Rev": "d36be08adf48ae3991e23fb0d5f5963e916a9058"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package endpoints
|
|||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
@ -410,7 +411,7 @@ type SimpleRESTStorage struct {
|
|||
injectedFunction func(obj runtime.Object) (returnObj runtime.Object, err error)
|
||||
}
|
||||
|
||||
func (storage *SimpleRESTStorage) Export(ctx request.Context, name string, opts metav1.ExportOptions) (runtime.Object, error) {
|
||||
func (storage *SimpleRESTStorage) Export(ctx context.Context, name string, opts metav1.ExportOptions) (runtime.Object, error) {
|
||||
obj, err := storage.Get(ctx, name, &metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -425,11 +426,11 @@ func (storage *SimpleRESTStorage) Export(ctx request.Context, name string, opts
|
|||
return obj, storage.errors["export"]
|
||||
}
|
||||
|
||||
func (storage *SimpleRESTStorage) ConvertToTable(ctx request.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error) {
|
||||
func (storage *SimpleRESTStorage) ConvertToTable(ctx context.Context, obj runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error) {
|
||||
return rest.NewDefaultTableConvertor(schema.GroupResource{Resource: "simple"}).ConvertToTable(ctx, obj, tableOptions)
|
||||
}
|
||||
|
||||
func (storage *SimpleRESTStorage) List(ctx request.Context, options *metainternalversion.ListOptions) (runtime.Object, error) {
|
||||
func (storage *SimpleRESTStorage) List(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error) {
|
||||
storage.checkContext(ctx)
|
||||
result := &genericapitesting.SimpleList{
|
||||
ListMeta: metav1.ListMeta{
|
||||
|
@ -484,7 +485,7 @@ func (h *OutputConnect) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||
w.Write([]byte(h.response))
|
||||
}
|
||||
|
||||
func (storage *SimpleRESTStorage) Get(ctx request.Context, id string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
func (storage *SimpleRESTStorage) Get(ctx context.Context, id string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
storage.checkContext(ctx)
|
||||
if id == "binary" {
|
||||
return storage.stream, storage.errors["get"]
|
||||
|
@ -492,11 +493,11 @@ func (storage *SimpleRESTStorage) Get(ctx request.Context, id string, options *m
|
|||
return storage.item.DeepCopy(), storage.errors["get"]
|
||||
}
|
||||
|
||||
func (storage *SimpleRESTStorage) checkContext(ctx request.Context) {
|
||||
func (storage *SimpleRESTStorage) checkContext(ctx context.Context) {
|
||||
storage.actualNamespace, storage.namespacePresent = request.NamespaceFrom(ctx)
|
||||
}
|
||||
|
||||
func (storage *SimpleRESTStorage) Delete(ctx request.Context, id string, options *metav1.DeleteOptions) (runtime.Object, bool, error) {
|
||||
func (storage *SimpleRESTStorage) Delete(ctx context.Context, id string, options *metav1.DeleteOptions) (runtime.Object, bool, error) {
|
||||
storage.checkContext(ctx)
|
||||
storage.deleted = id
|
||||
storage.deleteOptions = options
|
||||
|
@ -519,7 +520,7 @@ func (storage *SimpleRESTStorage) NewList() runtime.Object {
|
|||
return &genericapitesting.SimpleList{}
|
||||
}
|
||||
|
||||
func (storage *SimpleRESTStorage) Create(ctx request.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, includeUninitialized bool) (runtime.Object, error) {
|
||||
func (storage *SimpleRESTStorage) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, includeUninitialized bool) (runtime.Object, error) {
|
||||
storage.checkContext(ctx)
|
||||
storage.created = obj.(*genericapitesting.Simple)
|
||||
if err := storage.errors["create"]; err != nil {
|
||||
|
@ -535,7 +536,7 @@ func (storage *SimpleRESTStorage) Create(ctx request.Context, obj runtime.Object
|
|||
return obj, err
|
||||
}
|
||||
|
||||
func (storage *SimpleRESTStorage) Update(ctx request.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc) (runtime.Object, bool, error) {
|
||||
func (storage *SimpleRESTStorage) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc) (runtime.Object, bool, error) {
|
||||
storage.checkContext(ctx)
|
||||
obj, err := objInfo.UpdatedObject(ctx, &storage.item)
|
||||
if err != nil {
|
||||
|
@ -555,7 +556,7 @@ func (storage *SimpleRESTStorage) Update(ctx request.Context, name string, objIn
|
|||
}
|
||||
|
||||
// Implement ResourceWatcher.
|
||||
func (storage *SimpleRESTStorage) Watch(ctx request.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
|
||||
func (storage *SimpleRESTStorage) Watch(ctx context.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
|
||||
storage.lock.Lock()
|
||||
defer storage.lock.Unlock()
|
||||
storage.checkContext(ctx)
|
||||
|
@ -604,7 +605,7 @@ func (s *ConnecterRESTStorage) New() runtime.Object {
|
|||
return &genericapitesting.Simple{}
|
||||
}
|
||||
|
||||
func (s *ConnecterRESTStorage) Connect(ctx request.Context, id string, options runtime.Object, responder rest.Responder) (http.Handler, error) {
|
||||
func (s *ConnecterRESTStorage) Connect(ctx context.Context, id string, options runtime.Object, responder rest.Responder) (http.Handler, error) {
|
||||
s.receivedConnectOptions = options
|
||||
s.receivedID = id
|
||||
s.receivedResponder = responder
|
||||
|
@ -629,7 +630,7 @@ type LegacyRESTStorage struct {
|
|||
*SimpleRESTStorage
|
||||
}
|
||||
|
||||
func (storage LegacyRESTStorage) Delete(ctx request.Context, id string) (runtime.Object, error) {
|
||||
func (storage LegacyRESTStorage) Delete(ctx context.Context, id string) (runtime.Object, error) {
|
||||
obj, _, err := storage.SimpleRESTStorage.Delete(ctx, id, nil)
|
||||
return obj, err
|
||||
}
|
||||
|
@ -655,7 +656,7 @@ type GetWithOptionsRESTStorage struct {
|
|||
takesPath string
|
||||
}
|
||||
|
||||
func (r *GetWithOptionsRESTStorage) Get(ctx request.Context, name string, options runtime.Object) (runtime.Object, error) {
|
||||
func (r *GetWithOptionsRESTStorage) Get(ctx context.Context, name string, options runtime.Object) (runtime.Object, error) {
|
||||
if _, ok := options.(*genericapitesting.SimpleGetOptions); !ok {
|
||||
return nil, fmt.Errorf("Unexpected options object: %#v", options)
|
||||
}
|
||||
|
@ -678,7 +679,7 @@ type GetWithOptionsRootRESTStorage struct {
|
|||
takesPath string
|
||||
}
|
||||
|
||||
func (r *GetWithOptionsRootRESTStorage) Get(ctx request.Context, name string, options runtime.Object) (runtime.Object, error) {
|
||||
func (r *GetWithOptionsRootRESTStorage) Get(ctx context.Context, name string, options runtime.Object) (runtime.Object, error) {
|
||||
if _, ok := options.(*genericapitesting.SimpleGetOptions); !ok {
|
||||
return nil, fmt.Errorf("Unexpected options object: %#v", options)
|
||||
}
|
||||
|
@ -700,7 +701,7 @@ type NamedCreaterRESTStorage struct {
|
|||
createdName string
|
||||
}
|
||||
|
||||
func (storage *NamedCreaterRESTStorage) Create(ctx request.Context, name string, obj runtime.Object, createValidation rest.ValidateObjectFunc, includeUninitialized bool) (runtime.Object, error) {
|
||||
func (storage *NamedCreaterRESTStorage) Create(ctx context.Context, name string, obj runtime.Object, createValidation rest.ValidateObjectFunc, includeUninitialized bool) (runtime.Object, error) {
|
||||
storage.checkContext(ctx)
|
||||
storage.created = obj.(*genericapitesting.Simple)
|
||||
storage.createdName = name
|
||||
|
@ -730,12 +731,12 @@ func (storage *SimpleTypedStorage) New() runtime.Object {
|
|||
return storage.baseType
|
||||
}
|
||||
|
||||
func (storage *SimpleTypedStorage) Get(ctx request.Context, id string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
func (storage *SimpleTypedStorage) Get(ctx context.Context, id string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
storage.checkContext(ctx)
|
||||
return storage.item.DeepCopyObject(), storage.errors["get"]
|
||||
}
|
||||
|
||||
func (storage *SimpleTypedStorage) checkContext(ctx request.Context) {
|
||||
func (storage *SimpleTypedStorage) checkContext(ctx context.Context) {
|
||||
storage.actualNamespace, storage.namespacePresent = request.NamespaceFrom(ctx)
|
||||
}
|
||||
|
||||
|
@ -3827,7 +3828,7 @@ func (storage *SimpleXGSubresourceRESTStorage) New() runtime.Object {
|
|||
return &genericapitesting.SimpleXGSubresource{}
|
||||
}
|
||||
|
||||
func (storage *SimpleXGSubresourceRESTStorage) Get(ctx request.Context, id string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
func (storage *SimpleXGSubresourceRESTStorage) Get(ctx context.Context, id string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
return storage.item.DeepCopyObject(), nil
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package filters
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
|
@ -76,7 +77,7 @@ func WithAuthorization(handler http.Handler, a authorizer.Authorizer, s runtime.
|
|||
})
|
||||
}
|
||||
|
||||
func GetAuthorizerAttributes(ctx request.Context) (authorizer.Attributes, error) {
|
||||
func GetAuthorizerAttributes(ctx context.Context) (authorizer.Attributes, error) {
|
||||
attribs := authorizer.AttributesRecord{}
|
||||
|
||||
user, ok := request.UserFrom(ctx)
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package filters
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
@ -308,7 +309,7 @@ func TestImpersonationFilter(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
var ctx request.Context
|
||||
var ctx context.Context
|
||||
var actualUser user.Info
|
||||
var lock sync.Mutex
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
@ -163,6 +164,6 @@ type namedCreaterAdapter struct {
|
|||
rest.Creater
|
||||
}
|
||||
|
||||
func (c *namedCreaterAdapter) Create(ctx request.Context, name string, obj runtime.Object, createValidatingAdmission rest.ValidateObjectFunc, includeUninitialized bool) (runtime.Object, error) {
|
||||
func (c *namedCreaterAdapter) Create(ctx context.Context, name string, obj runtime.Object, createValidatingAdmission rest.ValidateObjectFunc, includeUninitialized bool) (runtime.Object, error) {
|
||||
return c.Creater.Create(ctx, obj, createValidatingAdmission, includeUninitialized)
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
|
@ -40,7 +41,7 @@ import (
|
|||
|
||||
// getterFunc performs a get request with the given context and object name. The request
|
||||
// may be used to deserialize an options object to pass to the getter.
|
||||
type getterFunc func(ctx request.Context, name string, req *http.Request, trace *utiltrace.Trace) (runtime.Object, error)
|
||||
type getterFunc func(ctx context.Context, name string, req *http.Request, trace *utiltrace.Trace) (runtime.Object, error)
|
||||
|
||||
// getResourceHandler is an HTTP handler function for get requests. It delegates to the
|
||||
// passed-in getterFunc to perform the actual get.
|
||||
|
@ -80,7 +81,7 @@ func getResourceHandler(scope RequestScope, getter getterFunc) http.HandlerFunc
|
|||
// GetResource returns a function that handles retrieving a single resource from a rest.Storage object.
|
||||
func GetResource(r rest.Getter, e rest.Exporter, scope RequestScope) http.HandlerFunc {
|
||||
return getResourceHandler(scope,
|
||||
func(ctx request.Context, name string, req *http.Request, trace *utiltrace.Trace) (runtime.Object, error) {
|
||||
func(ctx context.Context, name string, req *http.Request, trace *utiltrace.Trace) (runtime.Object, error) {
|
||||
// check for export
|
||||
options := metav1.GetOptions{}
|
||||
if values := req.URL.Query(); len(values) > 0 {
|
||||
|
@ -110,7 +111,7 @@ func GetResource(r rest.Getter, e rest.Exporter, scope RequestScope) http.Handle
|
|||
// GetResourceWithOptions returns a function that handles retrieving a single resource from a rest.Storage object.
|
||||
func GetResourceWithOptions(r rest.GetterWithOptions, scope RequestScope, isSubresource bool) http.HandlerFunc {
|
||||
return getResourceHandler(scope,
|
||||
func(ctx request.Context, name string, req *http.Request, trace *utiltrace.Trace) (runtime.Object, error) {
|
||||
func(ctx context.Context, name string, req *http.Request, trace *utiltrace.Trace) (runtime.Object, error) {
|
||||
opts, subpath, subpathKey := r.NewGetOptions()
|
||||
trace.Step("About to process Get options")
|
||||
if err := getRequestOptions(req, scope, opts, subpath, subpathKey, isSubresource); err != nil {
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
@ -151,7 +152,7 @@ type mutateObjectUpdateFunc func(obj, old runtime.Object) error
|
|||
|
||||
// patchResource divides PatchResource for easier unit testing
|
||||
func patchResource(
|
||||
ctx request.Context,
|
||||
ctx context.Context,
|
||||
updateMutation mutateObjectUpdateFunc,
|
||||
createValidation rest.ValidateObjectFunc,
|
||||
updateValidation rest.ValidateObjectUpdateFunc,
|
||||
|
@ -184,7 +185,7 @@ func patchResource(
|
|||
|
||||
// applyPatch is called every time GuaranteedUpdate asks for the updated object,
|
||||
// and is given the currently persisted object as input.
|
||||
applyPatch := func(_ request.Context, _, currentObject runtime.Object) (runtime.Object, error) {
|
||||
applyPatch := func(_ context.Context, _, currentObject runtime.Object) (runtime.Object, error) {
|
||||
// Make sure we actually have a persisted currentObject
|
||||
trace.Step("About to apply patch")
|
||||
if hasUID, err := hasUID(currentObject); err != nil {
|
||||
|
@ -373,7 +374,7 @@ func patchResource(
|
|||
|
||||
// applyAdmission is called every time GuaranteedUpdate asks for the updated object,
|
||||
// and is given the currently persisted object and the patched object as input.
|
||||
applyAdmission := func(ctx request.Context, patchedObject runtime.Object, currentObject runtime.Object) (runtime.Object, error) {
|
||||
applyAdmission := func(ctx context.Context, patchedObject runtime.Object, currentObject runtime.Object) (runtime.Object, error) {
|
||||
trace.Step("About to check admission control")
|
||||
return patchedObject, updateMutation(patchedObject, currentObject)
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
|
@ -28,12 +29,11 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apiserver/pkg/endpoints/handlers/negotiation"
|
||||
"k8s.io/apiserver/pkg/endpoints/handlers/responsewriters"
|
||||
"k8s.io/apiserver/pkg/endpoints/request"
|
||||
)
|
||||
|
||||
// transformResponseObject takes an object loaded from storage and performs any necessary transformations.
|
||||
// Will write the complete response object.
|
||||
func transformResponseObject(ctx request.Context, scope RequestScope, req *http.Request, w http.ResponseWriter, statusCode int, result runtime.Object) {
|
||||
func transformResponseObject(ctx context.Context, scope RequestScope, req *http.Request, w http.ResponseWriter, statusCode int, result runtime.Object) {
|
||||
// TODO: fetch the media type much earlier in request processing and pass it into this method.
|
||||
mediaType, _, err := negotiation.NegotiateOutputMediaType(req, scope.Serializer, &scope)
|
||||
if err != nil {
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package responsewriters
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
@ -26,7 +27,6 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apiserver/pkg/authorization/authorizer"
|
||||
"k8s.io/apiserver/pkg/endpoints/request"
|
||||
)
|
||||
|
||||
// Avoid emitting errors that look like valid HTML. Quotes are okay.
|
||||
|
@ -41,7 +41,7 @@ func BadGatewayError(w http.ResponseWriter, req *http.Request) {
|
|||
}
|
||||
|
||||
// Forbidden renders a simple forbidden error
|
||||
func Forbidden(ctx request.Context, attributes authorizer.Attributes, w http.ResponseWriter, req *http.Request, reason string, s runtime.NegotiatedSerializer) {
|
||||
func Forbidden(ctx context.Context, attributes authorizer.Attributes, w http.ResponseWriter, req *http.Request, reason string, s runtime.NegotiatedSerializer) {
|
||||
msg := sanitizer.Replace(forbiddenMessage(attributes))
|
||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
|
@ -263,7 +264,7 @@ func checkName(obj runtime.Object, name, namespace string, namer ScopeNamer) err
|
|||
|
||||
// setListSelfLink sets the self link of a list to the base URL, then sets the self links
|
||||
// on all child objects returned. Returns the number of items in the list.
|
||||
func setListSelfLink(obj runtime.Object, ctx request.Context, req *http.Request, namer ScopeNamer) (int, error) {
|
||||
func setListSelfLink(obj runtime.Object, ctx context.Context, req *http.Request, namer ScopeNamer) (int, error) {
|
||||
if !meta.IsListType(obj) {
|
||||
return 0, nil
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
@ -171,7 +172,7 @@ func (p *testPatcher) New() runtime.Object {
|
|||
return &example.Pod{}
|
||||
}
|
||||
|
||||
func (p *testPatcher) Update(ctx request.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc) (runtime.Object, bool, error) {
|
||||
func (p *testPatcher) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc) (runtime.Object, bool, error) {
|
||||
currentPod := p.startingPod
|
||||
if p.numUpdates > 0 {
|
||||
currentPod = p.updatePod
|
||||
|
@ -200,7 +201,7 @@ func (p *testPatcher) Update(ctx request.Context, name string, objInfo rest.Upda
|
|||
return inPod, false, nil
|
||||
}
|
||||
|
||||
func (p *testPatcher) Get(ctx request.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
func (p *testPatcher) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
p.t.Fatal("Unexpected call to testPatcher.Get")
|
||||
return nil, errors.New("Unexpected call to testPatcher.Get")
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
@ -90,7 +91,7 @@ func UpdateResource(r rest.Updater, scope RequestScope, typer runtime.ObjectType
|
|||
staticAdmissionAttributes := admission.NewAttributesRecord(nil, nil, scope.Kind, namespace, name, scope.Resource, scope.Subresource, admission.Update, userInfo)
|
||||
var transformers []rest.TransformFunc
|
||||
if mutatingAdmission, ok := admit.(admission.MutationInterface); ok && mutatingAdmission.Handles(admission.Update) {
|
||||
transformers = append(transformers, func(ctx request.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))
|
||||
})
|
||||
}
|
||||
|
|
|
@ -18,8 +18,6 @@ package request
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
@ -27,28 +25,6 @@ import (
|
|||
"k8s.io/apiserver/pkg/authentication/user"
|
||||
)
|
||||
|
||||
// Context carries values across API boundaries.
|
||||
// This context matches the context.Context interface
|
||||
// (https://blog.golang.org/context), for the purposes
|
||||
// of passing the api.Context through to the storage tier.
|
||||
// TODO: Determine the extent that this abstraction+interface
|
||||
// is used by the api, and whether we can remove.
|
||||
type Context interface {
|
||||
// Value returns the value associated with key or nil if none.
|
||||
Value(key interface{}) interface{}
|
||||
|
||||
// Deadline returns the time when this Context will be canceled, if any.
|
||||
Deadline() (deadline time.Time, ok bool)
|
||||
|
||||
// Done returns a channel that is closed when this Context is canceled
|
||||
// or times out.
|
||||
Done() <-chan struct{}
|
||||
|
||||
// Err indicates why this context was canceled, after the Done channel
|
||||
// is closed.
|
||||
Err() error
|
||||
}
|
||||
|
||||
// The key type is unexported to prevent collisions
|
||||
type key int
|
||||
|
||||
|
@ -70,43 +46,39 @@ const (
|
|||
)
|
||||
|
||||
// NewContext instantiates a base context object for request flows.
|
||||
func NewContext() Context {
|
||||
func NewContext() context.Context {
|
||||
return context.TODO()
|
||||
}
|
||||
|
||||
// NewDefaultContext instantiates a base context object for request flows in the default namespace
|
||||
func NewDefaultContext() Context {
|
||||
func NewDefaultContext() context.Context {
|
||||
return WithNamespace(NewContext(), metav1.NamespaceDefault)
|
||||
}
|
||||
|
||||
// WithValue returns a copy of parent in which the value associated with key is val.
|
||||
func WithValue(parent Context, key interface{}, val interface{}) Context {
|
||||
internalCtx, ok := parent.(context.Context)
|
||||
if !ok {
|
||||
panic(errors.New("Invalid context type"))
|
||||
}
|
||||
return context.WithValue(internalCtx, key, val)
|
||||
func WithValue(parent context.Context, key interface{}, val interface{}) context.Context {
|
||||
return context.WithValue(parent, key, val)
|
||||
}
|
||||
|
||||
// WithNamespace returns a copy of parent in which the namespace value is set
|
||||
func WithNamespace(parent Context, namespace string) Context {
|
||||
func WithNamespace(parent context.Context, namespace string) context.Context {
|
||||
return WithValue(parent, namespaceKey, namespace)
|
||||
}
|
||||
|
||||
// NamespaceFrom returns the value of the namespace key on the ctx
|
||||
func NamespaceFrom(ctx Context) (string, bool) {
|
||||
func NamespaceFrom(ctx context.Context) (string, bool) {
|
||||
namespace, ok := ctx.Value(namespaceKey).(string)
|
||||
return namespace, ok
|
||||
}
|
||||
|
||||
// NamespaceValue returns the value of the namespace key on the ctx, or the empty string if none
|
||||
func NamespaceValue(ctx Context) string {
|
||||
func NamespaceValue(ctx context.Context) string {
|
||||
namespace, _ := NamespaceFrom(ctx)
|
||||
return namespace
|
||||
}
|
||||
|
||||
// WithNamespaceDefaultIfNone returns a context whose namespace is the default if and only if the parent context has no namespace value
|
||||
func WithNamespaceDefaultIfNone(parent Context) Context {
|
||||
func WithNamespaceDefaultIfNone(parent context.Context) context.Context {
|
||||
namespace, ok := NamespaceFrom(parent)
|
||||
if !ok || len(namespace) == 0 {
|
||||
return WithNamespace(parent, metav1.NamespaceDefault)
|
||||
|
@ -115,34 +87,34 @@ func WithNamespaceDefaultIfNone(parent Context) Context {
|
|||
}
|
||||
|
||||
// WithUser returns a copy of parent in which the user value is set
|
||||
func WithUser(parent Context, user user.Info) Context {
|
||||
func WithUser(parent context.Context, user user.Info) context.Context {
|
||||
return WithValue(parent, userKey, user)
|
||||
}
|
||||
|
||||
// UserFrom returns the value of the user key on the ctx
|
||||
func UserFrom(ctx Context) (user.Info, bool) {
|
||||
func UserFrom(ctx context.Context) (user.Info, bool) {
|
||||
user, ok := ctx.Value(userKey).(user.Info)
|
||||
return user, ok
|
||||
}
|
||||
|
||||
// WithUID returns a copy of parent in which the uid value is set
|
||||
func WithUID(parent Context, uid types.UID) Context {
|
||||
func WithUID(parent context.Context, uid types.UID) context.Context {
|
||||
return WithValue(parent, uidKey, uid)
|
||||
}
|
||||
|
||||
// UIDFrom returns the value of the uid key on the ctx
|
||||
func UIDFrom(ctx Context) (types.UID, bool) {
|
||||
func UIDFrom(ctx context.Context) (types.UID, bool) {
|
||||
uid, ok := ctx.Value(uidKey).(types.UID)
|
||||
return uid, ok
|
||||
}
|
||||
|
||||
// WithAuditEvent returns set audit event struct.
|
||||
func WithAuditEvent(parent Context, ev *audit.Event) Context {
|
||||
func WithAuditEvent(parent context.Context, ev *audit.Event) context.Context {
|
||||
return WithValue(parent, auditKey, ev)
|
||||
}
|
||||
|
||||
// AuditEventFrom returns the audit event struct on the ctx
|
||||
func AuditEventFrom(ctx Context) *audit.Event {
|
||||
func AuditEventFrom(ctx context.Context) *audit.Event {
|
||||
ev, _ := ctx.Value(auditKey).(*audit.Event)
|
||||
return ev
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package request
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
@ -232,12 +233,12 @@ type requestInfoKeyType int
|
|||
const requestInfoKey requestInfoKeyType = iota
|
||||
|
||||
// WithRequestInfo returns a copy of parent in which the request info value is set
|
||||
func WithRequestInfo(parent Context, info *RequestInfo) Context {
|
||||
func WithRequestInfo(parent context.Context, info *RequestInfo) context.Context {
|
||||
return WithValue(parent, requestInfoKey, info)
|
||||
}
|
||||
|
||||
// RequestInfoFrom returns the value of the RequestInfo key on the ctx
|
||||
func RequestInfoFrom(ctx Context) (*RequestInfo, bool) {
|
||||
func RequestInfoFrom(ctx context.Context) (*RequestInfo, bool) {
|
||||
info, ok := ctx.Value(requestInfoKey).(*RequestInfo)
|
||||
return info, ok
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package registry
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
@ -99,14 +100,14 @@ type Store struct {
|
|||
// entire collection (listing and watching).
|
||||
//
|
||||
// KeyRootFunc and KeyFunc must be supplied together or not at all.
|
||||
KeyRootFunc func(ctx genericapirequest.Context) string
|
||||
KeyRootFunc func(ctx context.Context) string
|
||||
|
||||
// KeyFunc returns the key for a specific object in the collection.
|
||||
// KeyFunc is called for Create/Update/Get/Delete. Note that 'namespace'
|
||||
// can be gotten from ctx.
|
||||
//
|
||||
// KeyFunc and KeyRootFunc must be supplied together or not at all.
|
||||
KeyFunc func(ctx genericapirequest.Context, name string) (string, error)
|
||||
KeyFunc func(ctx context.Context, name string) (string, error)
|
||||
|
||||
// ObjectNameFunc returns the name of an object or an error.
|
||||
ObjectNameFunc func(obj runtime.Object) (string, error)
|
||||
|
@ -190,7 +191,7 @@ const (
|
|||
|
||||
// NamespaceKeyRootFunc is the default function for constructing storage paths
|
||||
// to resource directories enforcing namespace rules.
|
||||
func NamespaceKeyRootFunc(ctx genericapirequest.Context, prefix string) string {
|
||||
func NamespaceKeyRootFunc(ctx context.Context, prefix string) string {
|
||||
key := prefix
|
||||
ns, ok := genericapirequest.NamespaceFrom(ctx)
|
||||
if ok && len(ns) > 0 {
|
||||
|
@ -202,7 +203,7 @@ func NamespaceKeyRootFunc(ctx genericapirequest.Context, prefix string) string {
|
|||
// NamespaceKeyFunc is the default function for constructing storage paths to
|
||||
// a resource relative to the given prefix enforcing namespace rules. If the
|
||||
// context does not contain a namespace, it errors.
|
||||
func NamespaceKeyFunc(ctx genericapirequest.Context, prefix string, name string) (string, error) {
|
||||
func NamespaceKeyFunc(ctx context.Context, prefix string, name string) (string, error) {
|
||||
key := NamespaceKeyRootFunc(ctx, prefix)
|
||||
ns, ok := genericapirequest.NamespaceFrom(ctx)
|
||||
if !ok || len(ns) == 0 {
|
||||
|
@ -220,7 +221,7 @@ func NamespaceKeyFunc(ctx genericapirequest.Context, prefix string, name string)
|
|||
|
||||
// NoNamespaceKeyFunc is the default function for constructing storage paths
|
||||
// to a resource relative to the given prefix without a namespace.
|
||||
func NoNamespaceKeyFunc(ctx genericapirequest.Context, prefix string, name string) (string, error) {
|
||||
func NoNamespaceKeyFunc(ctx context.Context, prefix string, name string) (string, error) {
|
||||
if len(name) == 0 {
|
||||
return "", kubeerr.NewBadRequest("Name parameter required.")
|
||||
}
|
||||
|
@ -263,7 +264,7 @@ func (e *Store) GetExportStrategy() rest.RESTExportStrategy {
|
|||
|
||||
// List returns a list of items matching labels and field according to the
|
||||
// store's PredicateFunc.
|
||||
func (e *Store) List(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (runtime.Object, error) {
|
||||
func (e *Store) List(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error) {
|
||||
label := labels.Everything()
|
||||
if options != nil && options.LabelSelector != nil {
|
||||
label = options.LabelSelector
|
||||
|
@ -286,7 +287,7 @@ func (e *Store) List(ctx genericapirequest.Context, options *metainternalversion
|
|||
|
||||
// ListPredicate returns a list of all the items matching the given
|
||||
// SelectionPredicate.
|
||||
func (e *Store) ListPredicate(ctx genericapirequest.Context, p storage.SelectionPredicate, options *metainternalversion.ListOptions) (runtime.Object, error) {
|
||||
func (e *Store) ListPredicate(ctx context.Context, p storage.SelectionPredicate, options *metainternalversion.ListOptions) (runtime.Object, error) {
|
||||
if options == nil {
|
||||
// By default we should serve the request from etcd.
|
||||
options = &metainternalversion.ListOptions{ResourceVersion: ""}
|
||||
|
@ -309,7 +310,7 @@ func (e *Store) ListPredicate(ctx genericapirequest.Context, p storage.Selection
|
|||
}
|
||||
|
||||
// Create inserts a new item according to the unique key from the object.
|
||||
func (e *Store) Create(ctx genericapirequest.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, includeUninitialized bool) (runtime.Object, error) {
|
||||
func (e *Store) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, includeUninitialized bool) (runtime.Object, error) {
|
||||
if err := rest.BeforeCreate(e.CreateStrategy, ctx, obj); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -372,7 +373,7 @@ func (e *Store) Create(ctx genericapirequest.Context, obj runtime.Object, create
|
|||
|
||||
// WaitForInitialized holds until the object is initialized, or returns an error if the default limit expires.
|
||||
// This method is exposed publicly for consumers of generic rest tooling.
|
||||
func (e *Store) WaitForInitialized(ctx genericapirequest.Context, obj runtime.Object) (runtime.Object, error) {
|
||||
func (e *Store) WaitForInitialized(ctx context.Context, obj runtime.Object) (runtime.Object, error) {
|
||||
// return early if we don't have initializers, or if they've completed already
|
||||
accessor, err := meta.Accessor(obj)
|
||||
if err != nil {
|
||||
|
@ -453,7 +454,7 @@ func (e *Store) WaitForInitialized(ctx genericapirequest.Context, obj runtime.Ob
|
|||
// shouldDeleteDuringUpdate checks if a Update is removing all the object's
|
||||
// finalizers. If so, it further checks if the object's
|
||||
// DeletionGracePeriodSeconds is 0.
|
||||
func (e *Store) shouldDeleteDuringUpdate(ctx genericapirequest.Context, key string, obj, existing runtime.Object) bool {
|
||||
func (e *Store) shouldDeleteDuringUpdate(ctx context.Context, key string, obj, existing runtime.Object) bool {
|
||||
newMeta, err := meta.Accessor(obj)
|
||||
if err != nil {
|
||||
utilruntime.HandleError(err)
|
||||
|
@ -469,7 +470,7 @@ func (e *Store) shouldDeleteDuringUpdate(ctx genericapirequest.Context, key stri
|
|||
|
||||
// shouldDeleteForFailedInitialization returns true if the provided object is initializing and has
|
||||
// a failure recorded.
|
||||
func (e *Store) shouldDeleteForFailedInitialization(ctx genericapirequest.Context, obj runtime.Object) bool {
|
||||
func (e *Store) shouldDeleteForFailedInitialization(ctx context.Context, obj runtime.Object) bool {
|
||||
m, err := meta.Accessor(obj)
|
||||
if err != nil {
|
||||
utilruntime.HandleError(err)
|
||||
|
@ -483,7 +484,7 @@ func (e *Store) shouldDeleteForFailedInitialization(ctx genericapirequest.Contex
|
|||
|
||||
// deleteWithoutFinalizers handles deleting an object ignoring its finalizer list.
|
||||
// Used for objects that are either been finalized or have never initialized.
|
||||
func (e *Store) deleteWithoutFinalizers(ctx genericapirequest.Context, name, key string, obj runtime.Object, preconditions *storage.Preconditions) (runtime.Object, bool, error) {
|
||||
func (e *Store) deleteWithoutFinalizers(ctx context.Context, name, key string, obj runtime.Object, preconditions *storage.Preconditions) (runtime.Object, bool, error) {
|
||||
out := e.NewFunc()
|
||||
glog.V(6).Infof("going to delete %s from registry, triggered by update", name)
|
||||
if err := e.Storage.Delete(ctx, key, out, preconditions); err != nil {
|
||||
|
@ -509,7 +510,7 @@ func (e *Store) deleteWithoutFinalizers(ctx genericapirequest.Context, name, key
|
|||
// Update performs an atomic update and set of the object. Returns the result of the update
|
||||
// or an error. If the registry allows create-on-update, the create flow will be executed.
|
||||
// A bool is returned along with the object and any errors, to indicate object creation.
|
||||
func (e *Store) Update(ctx genericapirequest.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc) (runtime.Object, bool, error) {
|
||||
func (e *Store) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, createValidation rest.ValidateObjectFunc, updateValidation rest.ValidateObjectUpdateFunc) (runtime.Object, bool, error) {
|
||||
key, err := e.KeyFunc(ctx, name)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
|
@ -662,7 +663,7 @@ func (e *Store) Update(ctx genericapirequest.Context, name string, objInfo rest.
|
|||
}
|
||||
|
||||
// Get retrieves the item from storage.
|
||||
func (e *Store) Get(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
func (e *Store) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
obj := e.NewFunc()
|
||||
key, err := e.KeyFunc(ctx, name)
|
||||
if err != nil {
|
||||
|
@ -681,7 +682,7 @@ func (e *Store) Get(ctx genericapirequest.Context, name string, options *metav1.
|
|||
|
||||
// qualifiedResourceFromContext attempts to retrieve a GroupResource from the context's request info.
|
||||
// If the context has no request info, DefaultQualifiedResource is used.
|
||||
func (e *Store) qualifiedResourceFromContext(ctx genericapirequest.Context) schema.GroupResource {
|
||||
func (e *Store) qualifiedResourceFromContext(ctx context.Context) schema.GroupResource {
|
||||
if info, ok := genericapirequest.RequestInfoFrom(ctx); ok {
|
||||
return schema.GroupResource{Group: info.APIGroup, Resource: info.Resource}
|
||||
}
|
||||
|
@ -700,7 +701,7 @@ var (
|
|||
// priority, there are three factors affect whether to add/remove the
|
||||
// FinalizerOrphanDependents: options, existing finalizers of the object,
|
||||
// and e.DeleteStrategy.DefaultGarbageCollectionPolicy.
|
||||
func shouldOrphanDependents(ctx genericapirequest.Context, e *Store, accessor metav1.Object, options *metav1.DeleteOptions) bool {
|
||||
func shouldOrphanDependents(ctx context.Context, e *Store, accessor metav1.Object, options *metav1.DeleteOptions) bool {
|
||||
// Get default GC policy from this REST object type
|
||||
gcStrategy, ok := e.DeleteStrategy.(rest.GarbageCollectionDeleteStrategy)
|
||||
var defaultGCPolicy rest.GarbageCollectionPolicy
|
||||
|
@ -750,7 +751,7 @@ func shouldOrphanDependents(ctx genericapirequest.Context, e *Store, accessor me
|
|||
// priority, there are three factors affect whether to add/remove the
|
||||
// FinalizerDeleteDependents: options, existing finalizers of the object, and
|
||||
// e.DeleteStrategy.DefaultGarbageCollectionPolicy.
|
||||
func shouldDeleteDependents(ctx genericapirequest.Context, e *Store, accessor metav1.Object, options *metav1.DeleteOptions) bool {
|
||||
func shouldDeleteDependents(ctx context.Context, e *Store, accessor metav1.Object, options *metav1.DeleteOptions) bool {
|
||||
// Get default GC policy from this REST object type
|
||||
if gcStrategy, ok := e.DeleteStrategy.(rest.GarbageCollectionDeleteStrategy); ok && gcStrategy.DefaultGarbageCollectionPolicy(ctx) == rest.Unsupported {
|
||||
// return false to indicate that we should NOT delete in foreground
|
||||
|
@ -793,7 +794,7 @@ func shouldDeleteDependents(ctx genericapirequest.Context, e *Store, accessor me
|
|||
// The finalizers returned are intended to be handled by the garbage collector.
|
||||
// If garbage collection is disabled for the store, this function returns false
|
||||
// to ensure finalizers aren't set which will never be cleared.
|
||||
func deletionFinalizersForGarbageCollection(ctx genericapirequest.Context, e *Store, accessor metav1.Object, options *metav1.DeleteOptions) (bool, []string) {
|
||||
func deletionFinalizersForGarbageCollection(ctx context.Context, e *Store, accessor metav1.Object, options *metav1.DeleteOptions) (bool, []string) {
|
||||
if !e.EnableGarbageCollection {
|
||||
return false, []string{}
|
||||
}
|
||||
|
@ -857,7 +858,7 @@ func markAsDeleting(obj runtime.Object) (err error) {
|
|||
// should be deleted immediately
|
||||
// 4. a new output object with the state that was updated
|
||||
// 5. a copy of the last existing state of the object
|
||||
func (e *Store) updateForGracefulDeletionAndFinalizers(ctx genericapirequest.Context, name, key string, options *metav1.DeleteOptions, preconditions storage.Preconditions, in runtime.Object) (err error, ignoreNotFound, deleteImmediately bool, out, lastExisting runtime.Object) {
|
||||
func (e *Store) updateForGracefulDeletionAndFinalizers(ctx context.Context, name, key string, options *metav1.DeleteOptions, preconditions storage.Preconditions, in runtime.Object) (err error, ignoreNotFound, deleteImmediately bool, out, lastExisting runtime.Object) {
|
||||
lastGraceful := int64(0)
|
||||
var pendingFinalizers bool
|
||||
out = e.NewFunc()
|
||||
|
@ -937,7 +938,7 @@ func (e *Store) updateForGracefulDeletionAndFinalizers(ctx genericapirequest.Con
|
|||
}
|
||||
|
||||
// Delete removes the item from storage.
|
||||
func (e *Store) Delete(ctx genericapirequest.Context, name string, options *metav1.DeleteOptions) (runtime.Object, bool, error) {
|
||||
func (e *Store) Delete(ctx context.Context, name string, options *metav1.DeleteOptions) (runtime.Object, bool, error) {
|
||||
key, err := e.KeyFunc(ctx, name)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
|
@ -1015,7 +1016,7 @@ func (e *Store) Delete(ctx genericapirequest.Context, name string, options *meta
|
|||
// are removing all objects of a given type) with the current API (it's technically
|
||||
// possibly with storage API, but watch is not delivered correctly then).
|
||||
// It will be possible to fix it with v3 etcd API.
|
||||
func (e *Store) DeleteCollection(ctx genericapirequest.Context, options *metav1.DeleteOptions, listOptions *metainternalversion.ListOptions) (runtime.Object, error) {
|
||||
func (e *Store) DeleteCollection(ctx context.Context, options *metav1.DeleteOptions, listOptions *metainternalversion.ListOptions) (runtime.Object, error) {
|
||||
if listOptions == nil {
|
||||
listOptions = &metainternalversion.ListOptions{}
|
||||
} else {
|
||||
|
@ -1092,7 +1093,7 @@ func (e *Store) DeleteCollection(ctx genericapirequest.Context, options *metav1.
|
|||
|
||||
// finalizeDelete runs the Store's AfterDelete hook if runHooks is set and
|
||||
// returns the decorated deleted object if appropriate.
|
||||
func (e *Store) finalizeDelete(ctx genericapirequest.Context, obj runtime.Object, runHooks bool) (runtime.Object, error) {
|
||||
func (e *Store) finalizeDelete(ctx context.Context, obj runtime.Object, runHooks bool) (runtime.Object, error) {
|
||||
if runHooks && e.AfterDelete != nil {
|
||||
if err := e.AfterDelete(obj); err != nil {
|
||||
return nil, err
|
||||
|
@ -1127,7 +1128,7 @@ func (e *Store) finalizeDelete(ctx genericapirequest.Context, obj runtime.Object
|
|||
// WatchPredicate. If possible, you should customize PredicateFunc to produce
|
||||
// a matcher that matches by key. SelectionPredicate does this for you
|
||||
// automatically.
|
||||
func (e *Store) Watch(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
|
||||
func (e *Store) Watch(ctx context.Context, options *metainternalversion.ListOptions) (watch.Interface, error) {
|
||||
label := labels.Everything()
|
||||
if options != nil && options.LabelSelector != nil {
|
||||
label = options.LabelSelector
|
||||
|
@ -1147,7 +1148,7 @@ func (e *Store) Watch(ctx genericapirequest.Context, options *metainternalversio
|
|||
}
|
||||
|
||||
// WatchPredicate starts a watch for the items that matches.
|
||||
func (e *Store) WatchPredicate(ctx genericapirequest.Context, p storage.SelectionPredicate, resourceVersion string) (watch.Interface, error) {
|
||||
func (e *Store) WatchPredicate(ctx context.Context, p storage.SelectionPredicate, resourceVersion string) (watch.Interface, error) {
|
||||
if name, ok := p.MatchesSingle(); ok {
|
||||
if key, err := e.KeyFunc(ctx, name); err == nil {
|
||||
w, err := e.Storage.Watch(ctx, key, resourceVersion, p)
|
||||
|
@ -1209,7 +1210,7 @@ func exportObjectMeta(accessor metav1.Object, exact bool) {
|
|||
}
|
||||
|
||||
// Export implements the rest.Exporter interface
|
||||
func (e *Store) Export(ctx genericapirequest.Context, name string, opts metav1.ExportOptions) (runtime.Object, error) {
|
||||
func (e *Store) Export(ctx context.Context, name string, opts metav1.ExportOptions) (runtime.Object, error) {
|
||||
obj, err := e.Get(ctx, name, &metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -1299,17 +1300,17 @@ func (e *Store) CompleteWithOptions(options *generic.StoreOptions) error {
|
|||
// Set the default behavior for storage key generation
|
||||
if e.KeyRootFunc == nil && e.KeyFunc == nil {
|
||||
if isNamespaced {
|
||||
e.KeyRootFunc = func(ctx genericapirequest.Context) string {
|
||||
e.KeyRootFunc = func(ctx context.Context) string {
|
||||
return NamespaceKeyRootFunc(ctx, prefix)
|
||||
}
|
||||
e.KeyFunc = func(ctx genericapirequest.Context, name string) (string, error) {
|
||||
e.KeyFunc = func(ctx context.Context, name string) (string, error) {
|
||||
return NamespaceKeyFunc(ctx, prefix, name)
|
||||
}
|
||||
} else {
|
||||
e.KeyRootFunc = func(ctx genericapirequest.Context) string {
|
||||
e.KeyRootFunc = func(ctx context.Context) string {
|
||||
return prefix
|
||||
}
|
||||
e.KeyFunc = func(ctx genericapirequest.Context, name string) (string, error) {
|
||||
e.KeyFunc = func(ctx context.Context, name string) (string, error) {
|
||||
return NoNamespaceKeyFunc(ctx, prefix, name)
|
||||
}
|
||||
}
|
||||
|
@ -1395,7 +1396,7 @@ func (e *Store) startObservingCount(period time.Duration) func() {
|
|||
return func() { close(stopCh) }
|
||||
}
|
||||
|
||||
func (e *Store) ConvertToTable(ctx genericapirequest.Context, object runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error) {
|
||||
func (e *Store) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error) {
|
||||
if e.TableConvertor != nil {
|
||||
return e.TableConvertor.ConvertToTable(ctx, object, tableOptions)
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package registry
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"path"
|
||||
"reflect"
|
||||
|
@ -72,7 +73,7 @@ type testGracefulStrategy struct {
|
|||
testRESTStrategy
|
||||
}
|
||||
|
||||
func (t testGracefulStrategy) CheckGracefulDelete(ctx genericapirequest.Context, obj runtime.Object, options *metav1.DeleteOptions) bool {
|
||||
func (t testGracefulStrategy) CheckGracefulDelete(ctx context.Context, obj runtime.Object, options *metav1.DeleteOptions) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -82,7 +83,7 @@ type testOrphanDeleteStrategy struct {
|
|||
*testRESTStrategy
|
||||
}
|
||||
|
||||
func (t *testOrphanDeleteStrategy) DefaultGarbageCollectionPolicy(ctx genericapirequest.Context) rest.GarbageCollectionPolicy {
|
||||
func (t *testOrphanDeleteStrategy) DefaultGarbageCollectionPolicy(ctx context.Context) rest.GarbageCollectionPolicy {
|
||||
return rest.OrphanDependents
|
||||
}
|
||||
|
||||
|
@ -98,7 +99,7 @@ func (t *testRESTStrategy) NamespaceScoped() bool { return t.namespaceS
|
|||
func (t *testRESTStrategy) AllowCreateOnUpdate() bool { return t.allowCreateOnUpdate }
|
||||
func (t *testRESTStrategy) AllowUnconditionalUpdate() bool { return t.allowUnconditionalUpdate }
|
||||
|
||||
func (t *testRESTStrategy) PrepareForCreate(ctx genericapirequest.Context, obj runtime.Object) {
|
||||
func (t *testRESTStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
|
||||
metaObj, err := meta.Accessor(obj)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
|
@ -111,11 +112,11 @@ func (t *testRESTStrategy) PrepareForCreate(ctx genericapirequest.Context, obj r
|
|||
metaObj.SetLabels(labels)
|
||||
}
|
||||
|
||||
func (t *testRESTStrategy) PrepareForUpdate(ctx genericapirequest.Context, obj, old runtime.Object) {}
|
||||
func (t *testRESTStrategy) Validate(ctx genericapirequest.Context, obj runtime.Object) field.ErrorList {
|
||||
func (t *testRESTStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {}
|
||||
func (t *testRESTStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {
|
||||
return nil
|
||||
}
|
||||
func (t *testRESTStrategy) ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList {
|
||||
func (t *testRESTStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
|
||||
return nil
|
||||
}
|
||||
func (t *testRESTStrategy) Canonicalize(obj runtime.Object) {}
|
||||
|
@ -172,7 +173,7 @@ func TestStoreList(t *testing.T) {
|
|||
in *example.PodList
|
||||
m storage.SelectionPredicate
|
||||
out runtime.Object
|
||||
context genericapirequest.Context
|
||||
context context.Context
|
||||
}{
|
||||
"notFound": {
|
||||
in: nil,
|
||||
|
@ -579,7 +580,7 @@ func TestStoreCreateInitializedFailed(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func updateAndVerify(t *testing.T, ctx genericapirequest.Context, registry *Store, pod *example.Pod) bool {
|
||||
func updateAndVerify(t *testing.T, ctx context.Context, registry *Store, pod *example.Pod) bool {
|
||||
obj, _, err := registry.Update(ctx, pod.Name, rest.DefaultUpdatedObjectInfo(pod), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
|
@ -733,7 +734,7 @@ func TestNoOpUpdates(t *testing.T) {
|
|||
|
||||
type testPodExport struct{}
|
||||
|
||||
func (t testPodExport) Export(ctx genericapirequest.Context, obj runtime.Object, exact bool) error {
|
||||
func (t testPodExport) Export(ctx context.Context, obj runtime.Object, exact bool) error {
|
||||
pod := obj.(*example.Pod)
|
||||
if pod.Labels == nil {
|
||||
pod.Labels = map[string]string{}
|
||||
|
@ -1774,7 +1775,7 @@ func TestStoreWatch(t *testing.T) {
|
|||
|
||||
table := map[string]struct {
|
||||
selectPred storage.SelectionPredicate
|
||||
context genericapirequest.Context
|
||||
context context.Context
|
||||
}{
|
||||
"single": {
|
||||
selectPred: matchPodName("foo"),
|
||||
|
@ -1865,10 +1866,10 @@ func newTestGenericStoreRegistry(t *testing.T, scheme *runtime.Scheme, hasCacheE
|
|||
CreateStrategy: strategy,
|
||||
UpdateStrategy: strategy,
|
||||
DeleteStrategy: strategy,
|
||||
KeyRootFunc: func(ctx genericapirequest.Context) string {
|
||||
KeyRootFunc: func(ctx context.Context) string {
|
||||
return podPrefix
|
||||
},
|
||||
KeyFunc: func(ctx genericapirequest.Context, id string) (string, error) {
|
||||
KeyFunc: func(ctx context.Context, id string) (string, error) {
|
||||
if _, ok := genericapirequest.NamespaceFrom(ctx); !ok {
|
||||
return "", fmt.Errorf("namespace is required")
|
||||
}
|
||||
|
@ -2011,7 +2012,7 @@ type fakeStrategy struct {
|
|||
names.NameGenerator
|
||||
}
|
||||
|
||||
func (fakeStrategy) DefaultGarbageCollectionPolicy(ctx genericapirequest.Context) rest.GarbageCollectionPolicy {
|
||||
func (fakeStrategy) DefaultGarbageCollectionPolicy(ctx context.Context) rest.GarbageCollectionPolicy {
|
||||
appsv1beta1 := schema.GroupVersion{Group: "apps", Version: "v1beta1"}
|
||||
appsv1beta2 := schema.GroupVersion{Group: "apps", Version: "v1beta2"}
|
||||
extensionsv1beta1 := schema.GroupVersion{Group: "extensions", Version: "v1beta1"}
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package tester
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
|
@ -26,7 +27,6 @@ import (
|
|||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
genericregistry "k8s.io/apiserver/pkg/registry/generic/registry"
|
||||
"k8s.io/apiserver/pkg/registry/rest/resttest"
|
||||
etcdstorage "k8s.io/apiserver/pkg/storage/etcd"
|
||||
|
@ -142,7 +142,7 @@ func (t *Tester) TestWatch(valid runtime.Object, labelsPass, labelsFail []labels
|
|||
|
||||
// Helper functions
|
||||
|
||||
func (t *Tester) getObject(ctx genericapirequest.Context, obj runtime.Object) (runtime.Object, error) {
|
||||
func (t *Tester) getObject(ctx context.Context, obj runtime.Object) (runtime.Object, error) {
|
||||
accessor, err := meta.Accessor(obj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -155,7 +155,7 @@ func (t *Tester) getObject(ctx genericapirequest.Context, obj runtime.Object) (r
|
|||
return result, nil
|
||||
}
|
||||
|
||||
func (t *Tester) createObject(ctx genericapirequest.Context, obj runtime.Object) error {
|
||||
func (t *Tester) createObject(ctx context.Context, obj runtime.Object) error {
|
||||
accessor, err := meta.Accessor(obj)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -17,6 +17,8 @@ limitations under the License.
|
|||
package rest
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
genericvalidation "k8s.io/apimachinery/pkg/api/validation"
|
||||
|
@ -26,7 +28,6 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
"k8s.io/apiserver/pkg/admission"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/apiserver/pkg/features"
|
||||
"k8s.io/apiserver/pkg/storage/names"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
|
@ -52,12 +53,12 @@ type RESTCreateStrategy interface {
|
|||
// status. Clear the status because status changes are internal. External
|
||||
// callers of an api (users) should not be setting an initial status on
|
||||
// newly created objects.
|
||||
PrepareForCreate(ctx genericapirequest.Context, obj runtime.Object)
|
||||
PrepareForCreate(ctx context.Context, obj runtime.Object)
|
||||
// Validate returns an ErrorList with validation errors or nil. Validate
|
||||
// is invoked after default fields in the object have been filled in
|
||||
// before the object is persisted. This method should not mutate the
|
||||
// object.
|
||||
Validate(ctx genericapirequest.Context, obj runtime.Object) field.ErrorList
|
||||
Validate(ctx context.Context, obj runtime.Object) field.ErrorList
|
||||
// Canonicalize allows an object to be mutated into a canonical form. This
|
||||
// ensures that code that operates on these objects can rely on the common
|
||||
// form for things like comparison. Canonicalize is invoked after
|
||||
|
@ -70,7 +71,7 @@ type RESTCreateStrategy interface {
|
|||
// BeforeCreate ensures that common operations for all resources are performed on creation. It only returns
|
||||
// errors that can be converted to api.Status. It invokes PrepareForCreate, then GenerateName, then Validate.
|
||||
// It returns nil if the object should be created.
|
||||
func BeforeCreate(strategy RESTCreateStrategy, ctx genericapirequest.Context, obj runtime.Object) error {
|
||||
func BeforeCreate(strategy RESTCreateStrategy, ctx context.Context, obj runtime.Object) error {
|
||||
objectMeta, kind, kerr := objectMetaAndKind(strategy, obj)
|
||||
if kerr != nil {
|
||||
return kerr
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package rest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
|
@ -25,7 +26,6 @@ import (
|
|||
"k8s.io/apimachinery/pkg/apis/meta/v1/validation"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
)
|
||||
|
||||
// RESTDeleteStrategy defines deletion behavior on an object that follows Kubernetes
|
||||
|
@ -48,7 +48,7 @@ const (
|
|||
// orphan dependents by default.
|
||||
type GarbageCollectionDeleteStrategy interface {
|
||||
// DefaultGarbageCollectionPolicy returns the default garbage collection behavior.
|
||||
DefaultGarbageCollectionPolicy(ctx genericapirequest.Context) GarbageCollectionPolicy
|
||||
DefaultGarbageCollectionPolicy(ctx context.Context) GarbageCollectionPolicy
|
||||
}
|
||||
|
||||
// RESTGracefulDeleteStrategy must be implemented by the registry that supports
|
||||
|
@ -56,7 +56,7 @@ type GarbageCollectionDeleteStrategy interface {
|
|||
type RESTGracefulDeleteStrategy interface {
|
||||
// CheckGracefulDelete should return true if the object can be gracefully deleted and set
|
||||
// any default values on the DeleteOptions.
|
||||
CheckGracefulDelete(ctx genericapirequest.Context, obj runtime.Object, options *metav1.DeleteOptions) bool
|
||||
CheckGracefulDelete(ctx context.Context, obj runtime.Object, options *metav1.DeleteOptions) bool
|
||||
}
|
||||
|
||||
// BeforeDelete tests whether the object can be gracefully deleted.
|
||||
|
@ -68,7 +68,7 @@ type RESTGracefulDeleteStrategy interface {
|
|||
// where we set deletionTimestamp is pkg/registry/generic/registry/store.go.
|
||||
// This function is responsible for setting deletionTimestamp during gracefulDeletion,
|
||||
// other one for cascading deletions.
|
||||
func BeforeDelete(strategy RESTDeleteStrategy, ctx genericapirequest.Context, obj runtime.Object, options *metav1.DeleteOptions) (graceful, gracefulPending bool, err error) {
|
||||
func BeforeDelete(strategy RESTDeleteStrategy, ctx context.Context, obj runtime.Object, options *metav1.DeleteOptions) (graceful, gracefulPending bool, err error) {
|
||||
objectMeta, gvk, kerr := objectMetaAndKind(strategy, obj)
|
||||
if kerr != nil {
|
||||
return false, false, kerr
|
||||
|
|
|
@ -17,8 +17,9 @@ limitations under the License.
|
|||
package rest
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
)
|
||||
|
||||
// RESTExportStrategy is the interface that defines how to export a Kubernetes
|
||||
|
@ -29,5 +30,5 @@ import (
|
|||
type RESTExportStrategy interface {
|
||||
// Export strips fields that can not be set by the user. If 'exact' is false
|
||||
// fields specific to the cluster are also stripped
|
||||
Export(ctx genericapirequest.Context, obj runtime.Object, exact bool) error
|
||||
Export(ctx context.Context, obj runtime.Object, exact bool) error
|
||||
}
|
||||
|
|
|
@ -17,13 +17,15 @@ limitations under the License.
|
|||
package rest
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/uuid"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
)
|
||||
|
||||
// FillObjectMetaSystemFields populates fields that are managed by the system on ObjectMeta.
|
||||
func FillObjectMetaSystemFields(ctx genericapirequest.Context, meta metav1.Object) {
|
||||
func FillObjectMetaSystemFields(ctx context.Context, meta metav1.Object) {
|
||||
meta.SetCreationTimestamp(metav1.Now())
|
||||
// allows admission controllers to assign a UID earlier in the request processing
|
||||
// to support tracking resources pending creation.
|
||||
|
@ -38,7 +40,7 @@ func FillObjectMetaSystemFields(ctx genericapirequest.Context, meta metav1.Objec
|
|||
// ValidNamespace returns false if the namespace on the context differs from
|
||||
// the resource. If the resource has no namespace, it is set to the value in
|
||||
// the context.
|
||||
func ValidNamespace(ctx genericapirequest.Context, resource metav1.Object) bool {
|
||||
func ValidNamespace(ctx context.Context, resource metav1.Object) bool {
|
||||
ns, ok := genericapirequest.NamespaceFrom(ctx)
|
||||
if len(resource.GetNamespace()) == 0 {
|
||||
resource.SetNamespace(ns)
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package rest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
@ -27,7 +28,6 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
)
|
||||
|
||||
//TODO:
|
||||
|
@ -91,7 +91,7 @@ type Lister interface {
|
|||
// This object must be a pointer type for use with Codec.DecodeInto([]byte, runtime.Object)
|
||||
NewList() runtime.Object
|
||||
// List selects resources in the storage which match to the selector. 'options' can be nil.
|
||||
List(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (runtime.Object, error)
|
||||
List(ctx context.Context, options *metainternalversion.ListOptions) (runtime.Object, error)
|
||||
}
|
||||
|
||||
// Exporter is an object that knows how to strip a RESTful resource for export. A store should implement this interface
|
||||
|
@ -101,7 +101,7 @@ type Exporter interface {
|
|||
// Export an object. Fields that are not user specified (e.g. Status, ObjectMeta.ResourceVersion) are stripped out
|
||||
// Returns the stripped object. If 'exact' is true, fields that are specific to the cluster (e.g. namespace) are
|
||||
// retained, otherwise they are stripped also.
|
||||
Export(ctx genericapirequest.Context, name string, opts metav1.ExportOptions) (runtime.Object, error)
|
||||
Export(ctx context.Context, name string, opts metav1.ExportOptions) (runtime.Object, error)
|
||||
}
|
||||
|
||||
// Getter is an object that can retrieve a named RESTful resource.
|
||||
|
@ -109,7 +109,7 @@ type Getter interface {
|
|||
// Get finds a resource in the storage by name and returns it.
|
||||
// Although it can return an arbitrary error value, IsNotFound(err) is true for the
|
||||
// returned error value err when the specified resource is not found.
|
||||
Get(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (runtime.Object, error)
|
||||
Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error)
|
||||
}
|
||||
|
||||
// GetterWithOptions is an object that retrieve a named RESTful resource and takes
|
||||
|
@ -122,7 +122,7 @@ type GetterWithOptions interface {
|
|||
// The options object passed to it is of the same type returned by the NewGetOptions
|
||||
// method.
|
||||
// TODO: Pass metav1.GetOptions.
|
||||
Get(ctx genericapirequest.Context, name string, options runtime.Object) (runtime.Object, error)
|
||||
Get(ctx context.Context, name string, options runtime.Object) (runtime.Object, error)
|
||||
|
||||
// NewGetOptions returns an empty options object that will be used to pass
|
||||
// options to the Get method. It may return a bool and a string, if true, the
|
||||
|
@ -134,7 +134,7 @@ type GetterWithOptions interface {
|
|||
}
|
||||
|
||||
type TableConvertor interface {
|
||||
ConvertToTable(ctx genericapirequest.Context, object runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error)
|
||||
ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error)
|
||||
}
|
||||
|
||||
// GracefulDeleter knows how to pass deletion options to allow delayed deletion of a
|
||||
|
@ -149,7 +149,7 @@ type GracefulDeleter interface {
|
|||
// information about deletion.
|
||||
// It also returns a boolean which is set to true if the resource was instantly
|
||||
// deleted or false if it will be deleted asynchronously.
|
||||
Delete(ctx genericapirequest.Context, name string, options *metav1.DeleteOptions) (runtime.Object, bool, error)
|
||||
Delete(ctx context.Context, name string, options *metav1.DeleteOptions) (runtime.Object, bool, error)
|
||||
}
|
||||
|
||||
// CollectionDeleter is an object that can delete a collection
|
||||
|
@ -160,7 +160,7 @@ type CollectionDeleter interface {
|
|||
// them or return an invalid request error.
|
||||
// DeleteCollection may not be atomic - i.e. it may delete some objects and still
|
||||
// return an error after it. On success, returns a list of deleted objects.
|
||||
DeleteCollection(ctx genericapirequest.Context, options *metav1.DeleteOptions, listOptions *metainternalversion.ListOptions) (runtime.Object, error)
|
||||
DeleteCollection(ctx context.Context, options *metav1.DeleteOptions, listOptions *metainternalversion.ListOptions) (runtime.Object, error)
|
||||
}
|
||||
|
||||
// Creater is an object that can create an instance of a RESTful object.
|
||||
|
@ -171,7 +171,7 @@ type Creater interface {
|
|||
|
||||
// Create creates a new version of a resource. If includeUninitialized is set, the object may be returned
|
||||
// without completing initialization.
|
||||
Create(ctx genericapirequest.Context, obj runtime.Object, createValidation ValidateObjectFunc, includeUninitialized bool) (runtime.Object, error)
|
||||
Create(ctx context.Context, obj runtime.Object, createValidation ValidateObjectFunc, includeUninitialized bool) (runtime.Object, error)
|
||||
}
|
||||
|
||||
// NamedCreater is an object that can create an instance of a RESTful object using a name parameter.
|
||||
|
@ -184,7 +184,7 @@ type NamedCreater interface {
|
|||
// This is needed for create operations on subresources which include the name of the parent
|
||||
// resource in the path. If includeUninitialized is set, the object may be returned without
|
||||
// completing initialization.
|
||||
Create(ctx genericapirequest.Context, name string, obj runtime.Object, createValidation ValidateObjectFunc, includeUninitialized bool) (runtime.Object, error)
|
||||
Create(ctx context.Context, name string, obj runtime.Object, createValidation ValidateObjectFunc, includeUninitialized bool) (runtime.Object, error)
|
||||
}
|
||||
|
||||
// UpdatedObjectInfo provides information about an updated object to an Updater.
|
||||
|
@ -197,7 +197,7 @@ type UpdatedObjectInfo interface {
|
|||
|
||||
// UpdatedObject returns the updated object, given a context and old object.
|
||||
// The only time an empty oldObj should be passed in is if a "create on update" is occurring (there is no oldObj).
|
||||
UpdatedObject(ctx genericapirequest.Context, oldObj runtime.Object) (newObj runtime.Object, err error)
|
||||
UpdatedObject(ctx context.Context, oldObj runtime.Object) (newObj runtime.Object, err error)
|
||||
}
|
||||
|
||||
// ValidateObjectFunc is a function to act on a given object. An error may be returned
|
||||
|
@ -229,14 +229,14 @@ type Updater interface {
|
|||
// Update finds a resource in the storage and updates it. Some implementations
|
||||
// may allow updates creates the object - they should set the created boolean
|
||||
// to true.
|
||||
Update(ctx genericapirequest.Context, name string, objInfo UpdatedObjectInfo, createValidation ValidateObjectFunc, updateValidation ValidateObjectUpdateFunc) (runtime.Object, bool, error)
|
||||
Update(ctx context.Context, name string, objInfo UpdatedObjectInfo, createValidation ValidateObjectFunc, updateValidation ValidateObjectUpdateFunc) (runtime.Object, bool, error)
|
||||
}
|
||||
|
||||
// CreaterUpdater is a storage object that must support both create and update.
|
||||
// Go prevents embedded interfaces that implement the same method.
|
||||
type CreaterUpdater interface {
|
||||
Creater
|
||||
Update(ctx genericapirequest.Context, name string, objInfo UpdatedObjectInfo, createValidation ValidateObjectFunc, updateValidation ValidateObjectUpdateFunc) (runtime.Object, bool, error)
|
||||
Update(ctx context.Context, name string, objInfo UpdatedObjectInfo, createValidation ValidateObjectFunc, updateValidation ValidateObjectUpdateFunc) (runtime.Object, bool, error)
|
||||
}
|
||||
|
||||
// CreaterUpdater must satisfy the Updater interface.
|
||||
|
@ -255,7 +255,7 @@ type Watcher interface {
|
|||
// are supported; an error should be returned if 'field' tries to select on a field that
|
||||
// isn't supported. 'resourceVersion' allows for continuing/starting a watch at a
|
||||
// particular version.
|
||||
Watch(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
|
||||
Watch(ctx context.Context, options *metainternalversion.ListOptions) (watch.Interface, error)
|
||||
}
|
||||
|
||||
// StandardStorage is an interface covering the common verbs. Provided for testing whether a
|
||||
|
@ -272,7 +272,7 @@ type StandardStorage interface {
|
|||
// Redirector know how to return a remote resource's location.
|
||||
type Redirector interface {
|
||||
// ResourceLocation should return the remote location of the given resource, and an optional transport to use to request it, or an error.
|
||||
ResourceLocation(ctx genericapirequest.Context, id string) (remoteLocation *url.URL, transport http.RoundTripper, err error)
|
||||
ResourceLocation(ctx context.Context, id string) (remoteLocation *url.URL, transport http.RoundTripper, err error)
|
||||
}
|
||||
|
||||
// Responder abstracts the normal response behavior for a REST method and is passed to callers that
|
||||
|
@ -292,7 +292,7 @@ type Connecter interface {
|
|||
// code and body, so the ServeHTTP method should exit after invoking the responder. The Handler will
|
||||
// be used for a single API request and then discarded. The Responder is guaranteed to write to the
|
||||
// same http.ResponseWriter passed to ServeHTTP.
|
||||
Connect(ctx genericapirequest.Context, id string, options runtime.Object, r Responder) (http.Handler, error)
|
||||
Connect(ctx context.Context, id string, options runtime.Object, r Responder) (http.Handler, error)
|
||||
|
||||
// NewConnectOptions returns an empty options object that will be used to pass
|
||||
// options to the Connect method. If nil, then a nil options object is passed to
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package resttest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
@ -99,7 +100,7 @@ func (t *Tester) TestNamespace() string {
|
|||
|
||||
// TestContext returns a namespaced context that will be used when making storage calls.
|
||||
// Namespace is determined by TestNamespace()
|
||||
func (t *Tester) TestContext() genericapirequest.Context {
|
||||
func (t *Tester) TestContext() context.Context {
|
||||
if t.clusterScope {
|
||||
return genericapirequest.NewContext()
|
||||
}
|
||||
|
@ -128,11 +129,11 @@ func (t *Tester) setObjectMeta(obj runtime.Object, name string) {
|
|||
|
||||
type AssignFunc func([]runtime.Object) []runtime.Object
|
||||
type EmitFunc func(runtime.Object, string) error
|
||||
type GetFunc func(genericapirequest.Context, runtime.Object) (runtime.Object, error)
|
||||
type GetFunc func(context.Context, runtime.Object) (runtime.Object, error)
|
||||
type InitWatchFunc func()
|
||||
type InjectErrFunc func(err error)
|
||||
type IsErrorFunc func(err error) bool
|
||||
type CreateFunc func(genericapirequest.Context, runtime.Object) error
|
||||
type CreateFunc func(context.Context, runtime.Object) error
|
||||
type SetRVFunc func(uint64)
|
||||
type UpdateFunc func(runtime.Object) runtime.Object
|
||||
|
||||
|
@ -219,7 +220,7 @@ func (t *Tester) TestWatch(
|
|||
// =============================================================================
|
||||
// Creation tests.
|
||||
|
||||
func (t *Tester) delete(ctx genericapirequest.Context, obj runtime.Object) error {
|
||||
func (t *Tester) delete(ctx context.Context, obj runtime.Object) error {
|
||||
objectMeta, err := meta.Accessor(obj)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -576,7 +577,7 @@ func (t *Tester) testUpdateRetrievesOldObject(obj runtime.Object, createFn Creat
|
|||
// Make sure a custom transform is called, and sees the expected updatedObject and oldObject
|
||||
// This tests the mechanism used to pass the old and new object to admission
|
||||
calledUpdatedObject := 0
|
||||
noopTransform := func(_ genericapirequest.Context, updatedObject runtime.Object, oldObject runtime.Object) (runtime.Object, error) {
|
||||
noopTransform := func(_ context.Context, updatedObject runtime.Object, oldObject runtime.Object) (runtime.Object, error) {
|
||||
if !reflect.DeepEqual(storedFoo, oldObject) {
|
||||
t.Errorf("Expected\n\t%#v\ngot\n\t%#v", storedFoo, oldObject)
|
||||
}
|
||||
|
@ -618,7 +619,7 @@ func (t *Tester) testUpdatePropagatesUpdatedObjectError(obj runtime.Object, crea
|
|||
|
||||
// Make sure our transform is called, and sees the expected updatedObject and oldObject
|
||||
propagateErr := fmt.Errorf("custom updated object error for %v", foo)
|
||||
noopTransform := func(_ genericapirequest.Context, updatedObject runtime.Object, oldObject runtime.Object) (runtime.Object, error) {
|
||||
noopTransform := func(_ context.Context, updatedObject runtime.Object, oldObject runtime.Object) (runtime.Object, error) {
|
||||
return nil, propagateErr
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package rest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
@ -26,7 +27,6 @@ import (
|
|||
metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
)
|
||||
|
||||
type defaultTableConvertor struct {
|
||||
|
@ -40,7 +40,7 @@ func NewDefaultTableConvertor(resource schema.GroupResource) TableConvertor {
|
|||
|
||||
var swaggerMetadataDescriptions = metav1.ObjectMeta{}.SwaggerDoc()
|
||||
|
||||
func (c defaultTableConvertor) ConvertToTable(ctx genericapirequest.Context, object runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error) {
|
||||
func (c defaultTableConvertor) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1beta1.Table, error) {
|
||||
var table metav1beta1.Table
|
||||
fn := func(obj runtime.Object) error {
|
||||
m, err := meta.Accessor(obj)
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package rest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
|
@ -27,7 +28,6 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
"k8s.io/apiserver/pkg/admission"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/apiserver/pkg/features"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
)
|
||||
|
@ -46,11 +46,11 @@ type RESTUpdateStrategy interface {
|
|||
// the object. For example: remove fields that are not to be persisted,
|
||||
// sort order-insensitive list fields, etc. This should not remove fields
|
||||
// whose presence would be considered a validation error.
|
||||
PrepareForUpdate(ctx genericapirequest.Context, obj, old runtime.Object)
|
||||
PrepareForUpdate(ctx context.Context, obj, old runtime.Object)
|
||||
// ValidateUpdate is invoked after default fields in the object have been
|
||||
// filled in before the object is persisted. This method should not mutate
|
||||
// the object.
|
||||
ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList
|
||||
ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList
|
||||
// Canonicalize allows an object to be mutated into a canonical form. This
|
||||
// ensures that code that operates on these objects can rely on the common
|
||||
// form for things like comparison. Canonicalize is invoked after
|
||||
|
@ -83,7 +83,7 @@ func validateCommonFields(obj, old runtime.Object, strategy RESTUpdateStrategy)
|
|||
// BeforeUpdate ensures that common operations for all resources are performed on update. It only returns
|
||||
// errors that can be converted to api.Status. It will invoke update validation with the provided existing
|
||||
// and updated objects.
|
||||
func BeforeUpdate(strategy RESTUpdateStrategy, ctx genericapirequest.Context, obj, old runtime.Object) error {
|
||||
func BeforeUpdate(strategy RESTUpdateStrategy, ctx context.Context, obj, old runtime.Object) error {
|
||||
objectMeta, kind, kerr := objectMetaAndKind(strategy, obj)
|
||||
if kerr != nil {
|
||||
return kerr
|
||||
|
@ -130,7 +130,7 @@ func BeforeUpdate(strategy RESTUpdateStrategy, ctx genericapirequest.Context, ob
|
|||
}
|
||||
|
||||
// TransformFunc is a function to transform and return newObj
|
||||
type TransformFunc func(ctx genericapirequest.Context, newObj runtime.Object, oldObj runtime.Object) (transformedNewObj runtime.Object, err error)
|
||||
type TransformFunc func(ctx context.Context, newObj runtime.Object, oldObj runtime.Object) (transformedNewObj runtime.Object, err error)
|
||||
|
||||
// defaultUpdatedObjectInfo implements UpdatedObjectInfo
|
||||
type defaultUpdatedObjectInfo struct {
|
||||
|
@ -167,7 +167,7 @@ func (i *defaultUpdatedObjectInfo) Preconditions() *metav1.Preconditions {
|
|||
|
||||
// UpdatedObject satisfies the UpdatedObjectInfo interface.
|
||||
// It returns a copy of the held obj, passed through any configured transformers.
|
||||
func (i *defaultUpdatedObjectInfo) UpdatedObject(ctx genericapirequest.Context, oldObj runtime.Object) (runtime.Object, error) {
|
||||
func (i *defaultUpdatedObjectInfo) UpdatedObject(ctx context.Context, oldObj runtime.Object) (runtime.Object, error) {
|
||||
var err error
|
||||
// Start with the configured object
|
||||
newObj := i.obj
|
||||
|
@ -214,7 +214,7 @@ func (i *wrappedUpdatedObjectInfo) Preconditions() *metav1.Preconditions {
|
|||
|
||||
// UpdatedObject satisfies the UpdatedObjectInfo interface.
|
||||
// It delegates to the wrapped objInfo and passes the result through any configured transformers.
|
||||
func (i *wrappedUpdatedObjectInfo) UpdatedObject(ctx genericapirequest.Context, oldObj runtime.Object) (runtime.Object, error) {
|
||||
func (i *wrappedUpdatedObjectInfo) UpdatedObject(ctx context.Context, oldObj runtime.Object) (runtime.Object, error) {
|
||||
newObj, err := i.objInfo.UpdatedObject(ctx, oldObj)
|
||||
if err != nil {
|
||||
return newObj, err
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
@ -47,7 +48,6 @@ import (
|
|||
"k8s.io/apiserver/pkg/authorization/authorizer"
|
||||
"k8s.io/apiserver/pkg/endpoints/discovery"
|
||||
genericapifilters "k8s.io/apiserver/pkg/endpoints/filters"
|
||||
apirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
genericfilters "k8s.io/apiserver/pkg/server/filters"
|
||||
"k8s.io/client-go/informers"
|
||||
|
@ -467,7 +467,7 @@ func (p *testGetterStorage) New() runtime.Object {
|
|||
}
|
||||
}
|
||||
|
||||
func (p *testGetterStorage) Get(ctx apirequest.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
func (p *testGetterStorage) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue