mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-19 09:38:39 +00:00
Merge pull request #54156 from deads2k/admission-06-restclient
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. update admission webhook to accept client config Fixes https://github.com/kubernetes/kubernetes/issues/53827 This plumbs a complete client through the plugin initializer for admission webhooks. It achieves parity with our existing webhooks and provides flexibility if people want to do something special or different. Easy things are easy, hard things are possible. This does not change behavior for kube-apiserver. @kubernetes/sig-auth-api-reviews @kubernetes/sig-api-machinery-bugs Kubernetes-commit: f07b359e5bd5af8947b32309865dada7043d59e3
This commit is contained in:
commit
f80b026612
150
Godeps/Godeps.json
generated
150
Godeps/Godeps.json
generated
@ -372,303 +372,303 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/admissionregistration/v1alpha1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/apps/v1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/apps/v1beta1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/apps/v1beta2",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/authentication/v1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/authentication/v1beta1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/authorization/v1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/authorization/v1beta1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/autoscaling/v1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/autoscaling/v2beta1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/batch/v1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/batch/v1beta1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/batch/v2alpha1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/certificates/v1beta1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/core/v1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/extensions/v1beta1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/imagepolicy/v1alpha1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/networking/v1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/policy/v1beta1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/rbac/v1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/rbac/v1alpha1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/rbac/v1beta1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/scheduling/v1alpha1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/settings/v1alpha1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/storage/v1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api/storage/v1beta1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/conversion/unstructured",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/fields",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/labels",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/selection",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/types",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/cache",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/clock",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/version",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/pkg/watch",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
|
||||
"Rev": "4d1e9a7d2810c3a1e1683220b377263bf5462210"
|
||||
"Rev": "430fff74d5db6f361a1e309121cbfe58e4543d17"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/kube-openapi/pkg/common",
|
||||
|
@ -420,5 +420,45 @@ func AnonymousClientConfig(config *Config) *Config {
|
||||
QPS: config.QPS,
|
||||
Burst: config.Burst,
|
||||
Timeout: config.Timeout,
|
||||
Dial: config.Dial,
|
||||
}
|
||||
}
|
||||
|
||||
// CopyConfig returns a copy of the given config
|
||||
func CopyConfig(config *Config) *Config {
|
||||
return &Config{
|
||||
Host: config.Host,
|
||||
APIPath: config.APIPath,
|
||||
Prefix: config.Prefix,
|
||||
ContentConfig: config.ContentConfig,
|
||||
Username: config.Username,
|
||||
Password: config.Password,
|
||||
BearerToken: config.BearerToken,
|
||||
CacheDir: config.CacheDir,
|
||||
Impersonate: ImpersonationConfig{
|
||||
Groups: config.Impersonate.Groups,
|
||||
Extra: config.Impersonate.Extra,
|
||||
UserName: config.Impersonate.UserName,
|
||||
},
|
||||
AuthProvider: config.AuthProvider,
|
||||
AuthConfigPersister: config.AuthConfigPersister,
|
||||
TLSClientConfig: TLSClientConfig{
|
||||
Insecure: config.TLSClientConfig.Insecure,
|
||||
ServerName: config.TLSClientConfig.ServerName,
|
||||
CertFile: config.TLSClientConfig.CertFile,
|
||||
KeyFile: config.TLSClientConfig.KeyFile,
|
||||
CAFile: config.TLSClientConfig.CAFile,
|
||||
CertData: config.TLSClientConfig.CertData,
|
||||
KeyData: config.TLSClientConfig.KeyData,
|
||||
CAData: config.TLSClientConfig.CAData,
|
||||
},
|
||||
UserAgent: config.UserAgent,
|
||||
Transport: config.Transport,
|
||||
WrapTransport: config.WrapTransport,
|
||||
QPS: config.QPS,
|
||||
Burst: config.Burst,
|
||||
RateLimiter: config.RateLimiter,
|
||||
Timeout: config.Timeout,
|
||||
Dial: config.Dial,
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ import (
|
||||
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
||||
"k8s.io/client-go/util/flowcontrol"
|
||||
|
||||
"errors"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@ -206,6 +208,19 @@ func (n *fakeNegotiatedSerializer) DecoderToVersion(serializer runtime.Decoder,
|
||||
return &fakeCodec{}
|
||||
}
|
||||
|
||||
var fakeDialFunc = func(network, addr string) (net.Conn, error) {
|
||||
return nil, fakeDialerError
|
||||
}
|
||||
var fakeDialerError = errors.New("fakedialer")
|
||||
|
||||
type fakeAuthProviderConfigPersister struct{}
|
||||
|
||||
func (fakeAuthProviderConfigPersister) Persist(map[string]string) error {
|
||||
return fakeAuthProviderConfigPersisterError
|
||||
}
|
||||
|
||||
var fakeAuthProviderConfigPersisterError = errors.New("fakeAuthProviderConfigPersisterError")
|
||||
|
||||
func TestAnonymousConfig(t *testing.T) {
|
||||
f := fuzz.New().NilChance(0.0).NumElements(1, 1)
|
||||
f.Funcs(
|
||||
@ -268,9 +283,94 @@ func TestAnonymousConfig(t *testing.T) {
|
||||
actual.WrapTransport = nil
|
||||
expected.WrapTransport = nil
|
||||
}
|
||||
if actual.Dial != nil {
|
||||
_, actualError := actual.Dial("", "")
|
||||
_, expectedError := actual.Dial("", "")
|
||||
if !reflect.DeepEqual(expectedError, actualError) {
|
||||
t.Fatalf("CopyConfig dropped the Dial field")
|
||||
}
|
||||
} else {
|
||||
actual.Dial = nil
|
||||
expected.Dial = nil
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(*actual, expected) {
|
||||
t.Fatalf("AnonymousClientConfig dropped unexpected fields, identify whether they are security related or not: %s", diff.ObjectGoPrintDiff(expected, actual))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyConfig(t *testing.T) {
|
||||
f := fuzz.New().NilChance(0.0).NumElements(1, 1)
|
||||
f.Funcs(
|
||||
func(r *runtime.Codec, f fuzz.Continue) {
|
||||
codec := &fakeCodec{}
|
||||
f.Fuzz(codec)
|
||||
*r = codec
|
||||
},
|
||||
func(r *http.RoundTripper, f fuzz.Continue) {
|
||||
roundTripper := &fakeRoundTripper{}
|
||||
f.Fuzz(roundTripper)
|
||||
*r = roundTripper
|
||||
},
|
||||
func(fn *func(http.RoundTripper) http.RoundTripper, f fuzz.Continue) {
|
||||
*fn = fakeWrapperFunc
|
||||
},
|
||||
func(r *runtime.NegotiatedSerializer, f fuzz.Continue) {
|
||||
serializer := &fakeNegotiatedSerializer{}
|
||||
f.Fuzz(serializer)
|
||||
*r = serializer
|
||||
},
|
||||
func(r *flowcontrol.RateLimiter, f fuzz.Continue) {
|
||||
limiter := &fakeLimiter{}
|
||||
f.Fuzz(limiter)
|
||||
*r = limiter
|
||||
},
|
||||
func(r *AuthProviderConfigPersister, f fuzz.Continue) {
|
||||
*r = fakeAuthProviderConfigPersister{}
|
||||
},
|
||||
func(r *func(network, addr string) (net.Conn, error), f fuzz.Continue) {
|
||||
*r = fakeDialFunc
|
||||
},
|
||||
)
|
||||
for i := 0; i < 20; i++ {
|
||||
original := &Config{}
|
||||
f.Fuzz(original)
|
||||
actual := CopyConfig(original)
|
||||
expected := *original
|
||||
|
||||
// this is the list of known risky fields, add to this list if a new field
|
||||
// is added to Config, update CopyConfig to preserve the field otherwise.
|
||||
|
||||
// The DeepEqual cannot handle the func comparison, so we just verify if the
|
||||
// function return the expected object.
|
||||
if actual.WrapTransport == nil || !reflect.DeepEqual(expected.WrapTransport(nil), &fakeRoundTripper{}) {
|
||||
t.Fatalf("CopyConfig dropped the WrapTransport field")
|
||||
} else {
|
||||
actual.WrapTransport = nil
|
||||
expected.WrapTransport = nil
|
||||
}
|
||||
if actual.Dial != nil {
|
||||
_, actualError := actual.Dial("", "")
|
||||
_, expectedError := actual.Dial("", "")
|
||||
if !reflect.DeepEqual(expectedError, actualError) {
|
||||
t.Fatalf("CopyConfig dropped the Dial field")
|
||||
}
|
||||
}
|
||||
actual.Dial = nil
|
||||
expected.Dial = nil
|
||||
if actual.AuthConfigPersister != nil {
|
||||
actualError := actual.AuthConfigPersister.Persist(nil)
|
||||
expectedError := actual.AuthConfigPersister.Persist(nil)
|
||||
if !reflect.DeepEqual(expectedError, actualError) {
|
||||
t.Fatalf("CopyConfig dropped the Dial field")
|
||||
}
|
||||
}
|
||||
actual.AuthConfigPersister = nil
|
||||
expected.AuthConfigPersister = nil
|
||||
|
||||
if !reflect.DeepEqual(*actual, expected) {
|
||||
t.Fatalf("CopyConfig dropped unexpected fields, identify whether they are security related or not: %s", diff.ObjectReflectDiff(expected, *actual))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user