Merge pull request #58111 from mikedanese/id-registry

Automatic merge from submit-queue (batch tested with PRs 60158, 60156, 58111, 57583, 60055). 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>.

add support for /token subresource in serviceaccount registry

I'm planning on implementing the registry bits (this) in one PR and followup with an authenticator that supports new id tokens.

https://github.com/kubernetes/kubernetes/issues/58790

@kubernetes/sig-auth-pr-reviews

```release-note
NONE
```

Kubernetes-commit: 8b94ae8ca8d06bfc3c9b2f73daaca69840f86d2f
This commit is contained in:
Kubernetes Publisher 2018-02-21 22:10:31 -08:00
commit 37ccd13bb4
6 changed files with 158 additions and 84 deletions

164
Godeps/Godeps.json generated
View File

@ -248,331 +248,331 @@
},
{
"ImportPath": "k8s.io/api/admissionregistration/v1alpha1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/admissionregistration/v1beta1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/apps/v1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/apps/v1beta1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/apps/v1beta2",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/authentication/v1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/authentication/v1beta1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/authorization/v1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/authorization/v1beta1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/autoscaling/v1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/autoscaling/v2beta1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/batch/v1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/batch/v1beta1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/batch/v2alpha1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/certificates/v1beta1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/core/v1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/events/v1beta1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/extensions/v1beta1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/imagepolicy/v1alpha1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/networking/v1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/policy/v1beta1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/rbac/v1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/rbac/v1alpha1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/rbac/v1beta1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/scheduling/v1alpha1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/settings/v1alpha1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/storage/v1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/storage/v1alpha1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/api/storage/v1beta1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/equality",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/testing",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/fuzzer",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/testing/roundtrip",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/announced",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/httpstream/spdy",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/remotecommand",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "6462c8022c0af7f4718f111566bd037fe0fd4c3a"
"Rev": "c4b8804aa02d17a4a0ef92e7cb86260a6ba58de7"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",

View File

@ -32,9 +32,11 @@ go_library(
"service.go",
"service_expansion.go",
"serviceaccount.go",
"serviceaccount_expansion.go",
],
importpath = "k8s.io/client-go/kubernetes/typed/core/v1",
deps = [
"//vendor/k8s.io/api/authentication/v1:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/api/extensions/v1beta1:go_default_library",
"//vendor/k8s.io/api/policy/v1beta1:go_default_library",

View File

@ -31,9 +31,11 @@ go_library(
"fake_service.go",
"fake_service_expansion.go",
"fake_serviceaccount.go",
"fake_serviceaccount_expansion.go",
],
importpath = "k8s.io/client-go/kubernetes/typed/core/v1/fake",
deps = [
"//vendor/k8s.io/api/authentication/v1:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/api/extensions/v1beta1:go_default_library",
"//vendor/k8s.io/api/policy/v1beta1:go_default_library",

View File

@ -0,0 +1,31 @@
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
authenticationv1 "k8s.io/api/authentication/v1"
core "k8s.io/client-go/testing"
)
func (c *FakeServiceAccounts) CreateToken(name string, tr *authenticationv1.TokenRequest) (*authenticationv1.TokenRequest, error) {
obj, err := c.Fake.Invokes(core.NewCreateSubresourceAction(serviceaccountsResource, name, "token", c.ns, tr), &authenticationv1.TokenRequest{})
if obj == nil {
return nil, err
}
return obj.(*authenticationv1.TokenRequest), err
}

View File

@ -35,5 +35,3 @@ type ReplicationControllerExpansion interface{}
type ResourceQuotaExpansion interface{}
type SecretExpansion interface{}
type ServiceAccountExpansion interface{}

View File

@ -0,0 +1,41 @@
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1
import (
authenticationv1 "k8s.io/api/authentication/v1"
)
// The ServiceAccountExpansion interface allows manually adding extra methods
// to the ServiceAccountInterface.
type ServiceAccountExpansion interface {
CreateToken(name string, tr *authenticationv1.TokenRequest) (*authenticationv1.TokenRequest, error)
}
// CreateToken creates a new token for a serviceaccount.
func (c *serviceAccounts) CreateToken(name string, tr *authenticationv1.TokenRequest) (*authenticationv1.TokenRequest, error) {
result := &authenticationv1.TokenRequest{}
err := c.client.Post().
Namespace(c.ns).
Resource("serviceaccounts").
SubResource("token").
Name(name).
Body(tr).
Do().
Into(result)
return result, err
}