Merge pull request #28788 from deads2k/wire-authentication

Automatic merge from submit-queue

add tokenreviews endpoint to implement webhook

Wires up an API resource under `apis/authentication.k8s.io/v1beta1` to expose the webhook token authentication API as an API resource.  This allows one API server to use another for authentication and uses existing policy engines for the "authoritative" API server to controller access to the endpoint.

@cjcullen you wrote the initial type
This commit is contained in:
k8s-merge-robot
2016-07-20 22:23:45 -07:00
committed by GitHub
58 changed files with 5378 additions and 1584 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,143 +0,0 @@
// +build !ignore_autogenerated
/*
Copyright 2016 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.
*/
// This file was autogenerated by conversion-gen. Do not edit it manually!
package v1beta1
import (
api "k8s.io/kubernetes/pkg/api"
authentication_k8s_io "k8s.io/kubernetes/pkg/apis/authentication.k8s.io"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func init() {
if err := api.Scheme.AddGeneratedConversionFuncs(
Convert_v1beta1_TokenReview_To_authenticationk8sio_TokenReview,
Convert_authenticationk8sio_TokenReview_To_v1beta1_TokenReview,
Convert_v1beta1_TokenReviewSpec_To_authenticationk8sio_TokenReviewSpec,
Convert_authenticationk8sio_TokenReviewSpec_To_v1beta1_TokenReviewSpec,
Convert_v1beta1_TokenReviewStatus_To_authenticationk8sio_TokenReviewStatus,
Convert_authenticationk8sio_TokenReviewStatus_To_v1beta1_TokenReviewStatus,
Convert_v1beta1_UserInfo_To_authenticationk8sio_UserInfo,
Convert_authenticationk8sio_UserInfo_To_v1beta1_UserInfo,
); err != nil {
// if one of the conversion functions is malformed, detect it immediately.
panic(err)
}
}
func autoConvert_v1beta1_TokenReview_To_authenticationk8sio_TokenReview(in *TokenReview, out *authentication_k8s_io.TokenReview, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
if err := Convert_v1beta1_TokenReviewSpec_To_authenticationk8sio_TokenReviewSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_v1beta1_TokenReviewStatus_To_authenticationk8sio_TokenReviewStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
func Convert_v1beta1_TokenReview_To_authenticationk8sio_TokenReview(in *TokenReview, out *authentication_k8s_io.TokenReview, s conversion.Scope) error {
return autoConvert_v1beta1_TokenReview_To_authenticationk8sio_TokenReview(in, out, s)
}
func autoConvert_authenticationk8sio_TokenReview_To_v1beta1_TokenReview(in *authentication_k8s_io.TokenReview, out *TokenReview, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
if err := Convert_authenticationk8sio_TokenReviewSpec_To_v1beta1_TokenReviewSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_authenticationk8sio_TokenReviewStatus_To_v1beta1_TokenReviewStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
func Convert_authenticationk8sio_TokenReview_To_v1beta1_TokenReview(in *authentication_k8s_io.TokenReview, out *TokenReview, s conversion.Scope) error {
return autoConvert_authenticationk8sio_TokenReview_To_v1beta1_TokenReview(in, out, s)
}
func autoConvert_v1beta1_TokenReviewSpec_To_authenticationk8sio_TokenReviewSpec(in *TokenReviewSpec, out *authentication_k8s_io.TokenReviewSpec, s conversion.Scope) error {
out.Token = in.Token
return nil
}
func Convert_v1beta1_TokenReviewSpec_To_authenticationk8sio_TokenReviewSpec(in *TokenReviewSpec, out *authentication_k8s_io.TokenReviewSpec, s conversion.Scope) error {
return autoConvert_v1beta1_TokenReviewSpec_To_authenticationk8sio_TokenReviewSpec(in, out, s)
}
func autoConvert_authenticationk8sio_TokenReviewSpec_To_v1beta1_TokenReviewSpec(in *authentication_k8s_io.TokenReviewSpec, out *TokenReviewSpec, s conversion.Scope) error {
out.Token = in.Token
return nil
}
func Convert_authenticationk8sio_TokenReviewSpec_To_v1beta1_TokenReviewSpec(in *authentication_k8s_io.TokenReviewSpec, out *TokenReviewSpec, s conversion.Scope) error {
return autoConvert_authenticationk8sio_TokenReviewSpec_To_v1beta1_TokenReviewSpec(in, out, s)
}
func autoConvert_v1beta1_TokenReviewStatus_To_authenticationk8sio_TokenReviewStatus(in *TokenReviewStatus, out *authentication_k8s_io.TokenReviewStatus, s conversion.Scope) error {
out.Authenticated = in.Authenticated
if err := Convert_v1beta1_UserInfo_To_authenticationk8sio_UserInfo(&in.User, &out.User, s); err != nil {
return err
}
return nil
}
func Convert_v1beta1_TokenReviewStatus_To_authenticationk8sio_TokenReviewStatus(in *TokenReviewStatus, out *authentication_k8s_io.TokenReviewStatus, s conversion.Scope) error {
return autoConvert_v1beta1_TokenReviewStatus_To_authenticationk8sio_TokenReviewStatus(in, out, s)
}
func autoConvert_authenticationk8sio_TokenReviewStatus_To_v1beta1_TokenReviewStatus(in *authentication_k8s_io.TokenReviewStatus, out *TokenReviewStatus, s conversion.Scope) error {
out.Authenticated = in.Authenticated
if err := Convert_authenticationk8sio_UserInfo_To_v1beta1_UserInfo(&in.User, &out.User, s); err != nil {
return err
}
return nil
}
func Convert_authenticationk8sio_TokenReviewStatus_To_v1beta1_TokenReviewStatus(in *authentication_k8s_io.TokenReviewStatus, out *TokenReviewStatus, s conversion.Scope) error {
return autoConvert_authenticationk8sio_TokenReviewStatus_To_v1beta1_TokenReviewStatus(in, out, s)
}
func autoConvert_v1beta1_UserInfo_To_authenticationk8sio_UserInfo(in *UserInfo, out *authentication_k8s_io.UserInfo, s conversion.Scope) error {
out.Username = in.Username
out.UID = in.UID
out.Groups = in.Groups
out.Extra = in.Extra
return nil
}
func Convert_v1beta1_UserInfo_To_authenticationk8sio_UserInfo(in *UserInfo, out *authentication_k8s_io.UserInfo, s conversion.Scope) error {
return autoConvert_v1beta1_UserInfo_To_authenticationk8sio_UserInfo(in, out, s)
}
func autoConvert_authenticationk8sio_UserInfo_To_v1beta1_UserInfo(in *authentication_k8s_io.UserInfo, out *UserInfo, s conversion.Scope) error {
out.Username = in.Username
out.UID = in.UID
out.Groups = in.Groups
out.Extra = in.Extra
return nil
}
func Convert_authenticationk8sio_UserInfo_To_v1beta1_UserInfo(in *authentication_k8s_io.UserInfo, out *UserInfo, s conversion.Scope) error {
return autoConvert_authenticationk8sio_UserInfo_To_v1beta1_UserInfo(in, out, s)
}

View File

@@ -15,5 +15,5 @@ limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
package authentication // import "k8s.io/kubernetes/pkg/apis/authentication.k8s.io"
// +groupName=authentication.k8s.io
package authentication // import "k8s.io/kubernetes/pkg/apis/authentication"

View File

@@ -28,13 +28,13 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apimachinery"
"k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/apis/authentication.k8s.io"
"k8s.io/kubernetes/pkg/apis/authentication.k8s.io/v1beta1"
"k8s.io/kubernetes/pkg/apis/authentication"
"k8s.io/kubernetes/pkg/apis/authentication/v1beta1"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/sets"
)
const importPrefix = "k8s.io/kubernetes/pkg/apis/authentication.k8s.io"
const importPrefix = "k8s.io/kubernetes/pkg/apis/authentication"
var accessor = meta.NewAccessor()

View File

@@ -17,6 +17,7 @@ limitations under the License.
package authentication
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
@@ -43,8 +44,10 @@ func AddToScheme(scheme *runtime.Scheme) {
func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&api.ListOptions{},
&api.DeleteOptions{},
&api.ExportOptions{},
&TokenReview{},
)
}
func (obj *TokenReview) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }

File diff suppressed because it is too large Load Diff

View File

@@ -17,12 +17,20 @@ limitations under the License.
package authentication
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
)
// +genclient=true
// +nonNamespaced=true
// +noMethods=true
// TokenReview attempts to authenticate a token to a known user.
type TokenReview struct {
unversioned.TypeMeta
// ObjectMeta fulfills the meta.ObjectMetaAccessor interface so that the stock
// REST handler paths work
api.ObjectMeta
// Spec holds information about the request being evaluated
Spec TokenReviewSpec
@@ -38,11 +46,14 @@ type TokenReviewSpec struct {
}
// TokenReviewStatus is the result of the token authentication request.
// This type mirrors the authentication.Token interface
type TokenReviewStatus struct {
// Authenticated indicates that the token was associated with a known user.
Authenticated bool
// User is the UserInfo associated with the provided token.
User UserInfo
// Error indicates that the token couldn't be checked
Error string
}
// UserInfo holds the information about the user needed to implement the
@@ -57,5 +68,8 @@ type UserInfo struct {
// The names of groups this user is a part of.
Groups []string
// Any additional information provided by the authenticator.
Extra map[string][]string
Extra map[string]ExtraValue
}
// ExtraValue masks the value so protobuf can generate
type ExtraValue []string

View File

@@ -15,6 +15,6 @@ limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/authentication.k8s.io
package v1beta1 // import "k8s.io/kubernetes/pkg/apis/authentication.k8s.io/v1beta1"
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/authentication
// +groupName=authentication.k8s.io
package v1beta1 // import "k8s.io/kubernetes/pkg/apis/authentication/v1beta1"

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,90 @@
/*
Copyright 2016 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.
*/
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
syntax = 'proto2';
package k8s.io.kubernetes.pkg.apis.authentication.v1beta1;
import "k8s.io/kubernetes/pkg/api/resource/generated.proto";
import "k8s.io/kubernetes/pkg/api/unversioned/generated.proto";
import "k8s.io/kubernetes/pkg/api/v1/generated.proto";
import "k8s.io/kubernetes/pkg/runtime/generated.proto";
import "k8s.io/kubernetes/pkg/util/intstr/generated.proto";
// Package-wide variables from generator "generated".
option go_package = "v1beta1";
// ExtraValue masks the value so protobuf can generate
// +protobuf.nullable=true
// +protobuf.options.(gogoproto.goproto_stringer)=false
message ExtraValue {
// items, if empty, will result in an empty slice
repeated string items = 1;
}
// TokenReview attempts to authenticate a token to a known user.
// Note: TokenReview requests may be cached by the webhook token authenticator
// plugin in the kube-apiserver.
message TokenReview {
optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1;
// Spec holds information about the request being evaluated
optional TokenReviewSpec spec = 2;
// Status is filled in by the server and indicates whether the request can be authenticated.
optional TokenReviewStatus status = 3;
}
// TokenReviewSpec is a description of the token authentication request.
message TokenReviewSpec {
// Token is the opaque bearer token.
optional string token = 1;
}
// TokenReviewStatus is the result of the token authentication request.
message TokenReviewStatus {
// Authenticated indicates that the token was associated with a known user.
optional bool authenticated = 1;
// User is the UserInfo associated with the provided token.
optional UserInfo user = 2;
// Error indicates that the token couldn't be checked
optional string error = 3;
}
// UserInfo holds the information about the user needed to implement the
// user.Info interface.
message UserInfo {
// The name that uniquely identifies this user among all active users.
optional string username = 1;
// A unique value that identifies this user across time. If this user is
// deleted and another user by the same name is added, they will have
// different UIDs.
optional string uid = 2;
// The names of groups this user is a part of.
repeated string groups = 3;
// Any additional information provided by the authenticator.
map<string, ExtraValue> extra = 4;
}

View File

@@ -18,6 +18,7 @@ package v1beta1
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/runtime"
)
@@ -37,8 +38,10 @@ func AddToScheme(scheme *runtime.Scheme) {
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) {
scheme.AddKnownTypes(SchemeGroupVersion,
&v1.ListOptions{},
&v1.DeleteOptions{},
&v1.ExportOptions{},
&TokenReview{},
)
}
func (obj *TokenReview) GetObjectKind() unversioned.ObjectKind { return &obj.TypeMeta }

View File

@@ -26,8 +26,11 @@ import (
"fmt"
codec1978 "github.com/ugorji/go/codec"
pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned"
pkg2_v1 "k8s.io/kubernetes/pkg/api/v1"
pkg3_types "k8s.io/kubernetes/pkg/types"
"reflect"
"runtime"
time "time"
)
const (
@@ -61,7 +64,10 @@ func init() {
}
if false { // reference the types, but skip this branch at build/run time
var v0 pkg1_unversioned.TypeMeta
_ = v0
var v1 pkg2_v1.ObjectMeta
var v2 pkg3_types.UID
var v3 time.Time
_, _, _, _ = v0, v1, v2, v3
}
}
@@ -79,15 +85,16 @@ func (x *TokenReview) CodecEncodeSelf(e *codec1978.Encoder) {
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [4]bool
var yyq2 [5]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[1] = true
yyq2[2] = x.Kind != ""
yyq2[3] = x.APIVersion != ""
yyq2[0] = true
yyq2[2] = true
yyq2[3] = x.Kind != ""
yyq2[4] = x.APIVersion != ""
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(4)
r.EncodeArrayStart(5)
} else {
yynn2 = 1
for _, b := range yyq2 {
@@ -100,37 +107,54 @@ func (x *TokenReview) CodecEncodeSelf(e *codec1978.Encoder) {
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yy4 := &x.Spec
yy4.CodecEncodeSelf(e)
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("spec"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy6 := &x.Spec
yy6.CodecEncodeSelf(e)
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[1] {
yy9 := &x.Status
yy9.CodecEncodeSelf(e)
if yyq2[0] {
yy4 := &x.ObjectMeta
yy4.CodecEncodeSelf(e)
} else {
r.EncodeNil()
}
} else {
if yyq2[1] {
if yyq2[0] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("status"))
r.EncodeString(codecSelferC_UTF81234, string("metadata"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy11 := &x.Status
yy11.CodecEncodeSelf(e)
yy6 := &x.ObjectMeta
yy6.CodecEncodeSelf(e)
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yy9 := &x.Spec
yy9.CodecEncodeSelf(e)
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("spec"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy11 := &x.Spec
yy11.CodecEncodeSelf(e)
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[2] {
yym14 := z.EncBinary()
_ = yym14
yy14 := &x.Status
yy14.CodecEncodeSelf(e)
} else {
r.EncodeNil()
}
} else {
if yyq2[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("status"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy16 := &x.Status
yy16.CodecEncodeSelf(e)
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[3] {
yym19 := z.EncBinary()
_ = yym19
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
@@ -139,12 +163,12 @@ func (x *TokenReview) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[2] {
if yyq2[3] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("kind"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym15 := z.EncBinary()
_ = yym15
yym20 := z.EncBinary()
_ = yym20
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
@@ -153,9 +177,9 @@ func (x *TokenReview) CodecEncodeSelf(e *codec1978.Encoder) {
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[3] {
yym17 := z.EncBinary()
_ = yym17
if yyq2[4] {
yym22 := z.EncBinary()
_ = yym22
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
@@ -164,12 +188,12 @@ func (x *TokenReview) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[3] {
if yyq2[4] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym18 := z.EncBinary()
_ = yym18
yym23 := z.EncBinary()
_ = yym23
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
@@ -237,19 +261,26 @@ func (x *TokenReview) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
yys3 := string(yys3Slc)
z.DecSendContainerState(codecSelfer_containerMapValue1234)
switch yys3 {
case "metadata":
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_v1.ObjectMeta{}
} else {
yyv4 := &x.ObjectMeta
yyv4.CodecDecodeSelf(d)
}
case "spec":
if r.TryDecodeAsNil() {
x.Spec = TokenReviewSpec{}
} else {
yyv4 := &x.Spec
yyv4.CodecDecodeSelf(d)
yyv5 := &x.Spec
yyv5.CodecDecodeSelf(d)
}
case "status":
if r.TryDecodeAsNil() {
x.Status = TokenReviewStatus{}
} else {
yyv5 := &x.Status
yyv5.CodecDecodeSelf(d)
yyv6 := &x.Status
yyv6.CodecDecodeSelf(d)
}
case "kind":
if r.TryDecodeAsNil() {
@@ -274,16 +305,33 @@ func (x *TokenReview) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj8 int
var yyb8 bool
var yyhl8 bool = l >= 0
yyj8++
if yyhl8 {
yyb8 = yyj8 > l
var yyj9 int
var yyb9 bool
var yyhl9 bool = l >= 0
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb8 = r.CheckBreak()
yyb9 = r.CheckBreak()
}
if yyb8 {
if yyb9 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_v1.ObjectMeta{}
} else {
yyv10 := &x.ObjectMeta
yyv10.CodecDecodeSelf(d)
}
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb9 = r.CheckBreak()
}
if yyb9 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -291,16 +339,16 @@ func (x *TokenReview) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Spec = TokenReviewSpec{}
} else {
yyv9 := &x.Spec
yyv9.CodecDecodeSelf(d)
yyv11 := &x.Spec
yyv11.CodecDecodeSelf(d)
}
yyj8++
if yyhl8 {
yyb8 = yyj8 > l
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb8 = r.CheckBreak()
yyb9 = r.CheckBreak()
}
if yyb8 {
if yyb9 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -308,16 +356,16 @@ func (x *TokenReview) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() {
x.Status = TokenReviewStatus{}
} else {
yyv10 := &x.Status
yyv10.CodecDecodeSelf(d)
yyv12 := &x.Status
yyv12.CodecDecodeSelf(d)
}
yyj8++
if yyhl8 {
yyb8 = yyj8 > l
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb8 = r.CheckBreak()
yyb9 = r.CheckBreak()
}
if yyb8 {
if yyb9 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -327,13 +375,13 @@ func (x *TokenReview) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
} else {
x.Kind = string(r.DecodeString())
}
yyj8++
if yyhl8 {
yyb8 = yyj8 > l
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb8 = r.CheckBreak()
yyb9 = r.CheckBreak()
}
if yyb8 {
if yyb9 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -344,17 +392,17 @@ func (x *TokenReview) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
x.APIVersion = string(r.DecodeString())
}
for {
yyj8++
if yyhl8 {
yyb8 = yyj8 > l
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
} else {
yyb8 = r.CheckBreak()
yyb9 = r.CheckBreak()
}
if yyb8 {
if yyb9 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj8-1, "")
z.DecStructFieldNotFound(yyj9-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
@@ -542,14 +590,15 @@ func (x *TokenReviewStatus) CodecEncodeSelf(e *codec1978.Encoder) {
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [2]bool
var yyq2 [3]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[0] = x.Authenticated != false
yyq2[1] = true
yyq2[2] = x.Error != ""
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(2)
r.EncodeArrayStart(3)
} else {
yynn2 = 0
for _, b := range yyq2 {
@@ -602,6 +651,31 @@ func (x *TokenReviewStatus) CodecEncodeSelf(e *codec1978.Encoder) {
yy9.CodecEncodeSelf(e)
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[2] {
yym12 := z.EncBinary()
_ = yym12
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Error))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("error"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym13 := z.EncBinary()
_ = yym13
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Error))
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
@@ -676,6 +750,12 @@ func (x *TokenReviewStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder)
yyv5 := &x.User
yyv5.CodecDecodeSelf(d)
}
case "error":
if r.TryDecodeAsNil() {
x.Error = ""
} else {
x.Error = string(r.DecodeString())
}
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
@@ -687,16 +767,16 @@ func (x *TokenReviewStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj6 int
var yyb6 bool
var yyhl6 bool = l >= 0
yyj6++
if yyhl6 {
yyb6 = yyj6 > l
var yyj7 int
var yyb7 bool
var yyhl7 bool = l >= 0
yyj7++
if yyhl7 {
yyb7 = yyj7 > l
} else {
yyb6 = r.CheckBreak()
yyb7 = r.CheckBreak()
}
if yyb6 {
if yyb7 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -706,13 +786,13 @@ func (x *TokenReviewStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder
} else {
x.Authenticated = bool(r.DecodeBool())
}
yyj6++
if yyhl6 {
yyb6 = yyj6 > l
yyj7++
if yyhl7 {
yyb7 = yyj7 > l
} else {
yyb6 = r.CheckBreak()
yyb7 = r.CheckBreak()
}
if yyb6 {
if yyb7 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
@@ -720,21 +800,37 @@ func (x *TokenReviewStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder
if r.TryDecodeAsNil() {
x.User = UserInfo{}
} else {
yyv8 := &x.User
yyv8.CodecDecodeSelf(d)
yyv9 := &x.User
yyv9.CodecDecodeSelf(d)
}
yyj7++
if yyhl7 {
yyb7 = yyj7 > l
} else {
yyb7 = r.CheckBreak()
}
if yyb7 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Error = ""
} else {
x.Error = string(r.DecodeString())
}
for {
yyj6++
if yyhl6 {
yyb6 = yyj6 > l
yyj7++
if yyhl7 {
yyb7 = yyj7 > l
} else {
yyb6 = r.CheckBreak()
yyb7 = r.CheckBreak()
}
if yyb6 {
if yyb7 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj6-1, "")
z.DecStructFieldNotFound(yyj7-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
@@ -866,7 +962,7 @@ func (x *UserInfo) CodecEncodeSelf(e *codec1978.Encoder) {
_ = yym13
if false {
} else {
h.encMapstringSlicestring((map[string][]string)(x.Extra), e)
h.encMapstringExtraValue((map[string]ExtraValue)(x.Extra), e)
}
}
} else {
@@ -884,7 +980,7 @@ func (x *UserInfo) CodecEncodeSelf(e *codec1978.Encoder) {
_ = yym14
if false {
} else {
h.encMapstringSlicestring((map[string][]string)(x.Extra), e)
h.encMapstringExtraValue((map[string]ExtraValue)(x.Extra), e)
}
}
}
@@ -983,7 +1079,7 @@ func (x *UserInfo) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
_ = yym9
if false {
} else {
h.decMapstringSlicestring((*map[string][]string)(yyv8), d)
h.decMapstringExtraValue((*map[string]ExtraValue)(yyv8), d)
}
}
default:
@@ -1073,7 +1169,7 @@ func (x *UserInfo) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
_ = yym16
if false {
} else {
h.decMapstringSlicestring((*map[string][]string)(yyv15), d)
h.decMapstringExtraValue((*map[string]ExtraValue)(yyv15), d)
}
}
for {
@@ -1092,7 +1188,37 @@ func (x *UserInfo) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) encMapstringSlicestring(v map[string][]string, e *codec1978.Encoder) {
func (x ExtraValue) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
if x == nil {
r.EncodeNil()
} else {
yym1 := z.EncBinary()
_ = yym1
if false {
} else if z.HasExtensions() && z.EncExt(x) {
} else {
h.encExtraValue((ExtraValue)(x), e)
}
}
}
func (x *ExtraValue) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
yym1 := z.DecBinary()
_ = yym1
if false {
} else if z.HasExtensions() && z.DecExt(x) {
} else {
h.decExtraValue((*ExtraValue)(x), d)
}
}
func (x codecSelfer1234) encMapstringExtraValue(v map[string]ExtraValue, e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@@ -1109,18 +1235,13 @@ func (x codecSelfer1234) encMapstringSlicestring(v map[string][]string, e *codec
if yyv1 == nil {
r.EncodeNil()
} else {
yym3 := z.EncBinary()
_ = yym3
if false {
} else {
z.F.EncSliceStringV(yyv1, false, e)
}
yyv1.CodecEncodeSelf(e)
}
}
z.EncSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x codecSelfer1234) decMapstringSlicestring(v *map[string][]string, d *codec1978.Decoder) {
func (x codecSelfer1234) decMapstringExtraValue(v *map[string]ExtraValue, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@@ -1130,11 +1251,11 @@ func (x codecSelfer1234) decMapstringSlicestring(v *map[string][]string, d *code
yybh1 := z.DecBasicHandle()
if yyv1 == nil {
yyrl1, _ := z.DecInferLen(yyl1, yybh1.MaxInitLen, 40)
yyv1 = make(map[string][]string, yyrl1)
yyv1 = make(map[string]ExtraValue, yyrl1)
*v = yyv1
}
var yymk1 string
var yymv1 []string
var yymv1 ExtraValue
var yymg1 bool
if yybh1.MapValueReset {
yymg1 = true
@@ -1158,12 +1279,7 @@ func (x codecSelfer1234) decMapstringSlicestring(v *map[string][]string, d *code
yymv1 = nil
} else {
yyv3 := &yymv1
yym4 := z.DecBinary()
_ = yym4
if false {
} else {
z.F.DecSliceStringX(yyv3, false, d)
}
yyv3.CodecDecodeSelf(d)
}
if yyv1 != nil {
@@ -1188,13 +1304,8 @@ func (x codecSelfer1234) decMapstringSlicestring(v *map[string][]string, d *code
if r.TryDecodeAsNil() {
yymv1 = nil
} else {
yyv6 := &yymv1
yym7 := z.DecBinary()
_ = yym7
if false {
} else {
z.F.DecSliceStringX(yyv6, false, d)
}
yyv5 := &yymv1
yyv5.CodecDecodeSelf(d)
}
if yyv1 != nil {
@@ -1205,7 +1316,7 @@ func (x codecSelfer1234) decMapstringSlicestring(v *map[string][]string, d *code
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x codecSelfer1234) encSlicestring(v []string, e *codec1978.Encoder) {
func (x codecSelfer1234) encExtraValue(v ExtraValue, e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@@ -1222,7 +1333,7 @@ func (x codecSelfer1234) encSlicestring(v []string, e *codec1978.Encoder) {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) decSlicestring(v *[]string, d *codec1978.Decoder) {
func (x codecSelfer1234) decExtraValue(v *ExtraValue, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r

View File

@@ -17,47 +17,66 @@ limitations under the License.
package v1beta1
import (
"fmt"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
)
// +genclient=true
// +nonNamespaced=true
// +noMethods=true
// TokenReview attempts to authenticate a token to a known user.
// Note: TokenReview requests may be cached by the webhook token authenticator
// plugin in the kube-apiserver.
type TokenReview struct {
unversioned.TypeMeta `json:",inline"`
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec holds information about the request being evaluated
Spec TokenReviewSpec `json:"spec"`
Spec TokenReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
// Status is filled in by the server and indicates whether the request can be authenticated.
Status TokenReviewStatus `json:"status,omitempty"`
Status TokenReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// TokenReviewSpec is a description of the token authentication request.
type TokenReviewSpec struct {
// Token is the opaque bearer token.
Token string `json:"token,omitempty"`
Token string `json:"token,omitempty" protobuf:"bytes,1,opt,name=token"`
}
// TokenReviewStatus is the result of the token authentication request.
type TokenReviewStatus struct {
// Authenticated indicates that the token was associated with a known user.
Authenticated bool `json:"authenticated,omitempty"`
Authenticated bool `json:"authenticated,omitempty" protobuf:"varint,1,opt,name=authenticated"`
// User is the UserInfo associated with the provided token.
User UserInfo `json:"user,omitempty"`
User UserInfo `json:"user,omitempty" protobuf:"bytes,2,opt,name=user"`
// Error indicates that the token couldn't be checked
Error string `json:"error,omitempty" protobuf:"bytes,3,opt,name=error"`
}
// UserInfo holds the information about the user needed to implement the
// user.Info interface.
type UserInfo struct {
// The name that uniquely identifies this user among all active users.
Username string `json:"username,omitempty"`
Username string `json:"username,omitempty" protobuf:"bytes,1,opt,name=username"`
// A unique value that identifies this user across time. If this user is
// deleted and another user by the same name is added, they will have
// different UIDs.
UID string `json:"uid,omitempty"`
UID string `json:"uid,omitempty" protobuf:"bytes,2,opt,name=uid"`
// The names of groups this user is a part of.
Groups []string `json:"groups,omitempty"`
Groups []string `json:"groups,omitempty" protobuf:"bytes,3,rep,name=groups"`
// Any additional information provided by the authenticator.
Extra map[string][]string `json:"extra,omitempty"`
Extra map[string]ExtraValue `json:"extra,omitempty" protobuf:"bytes,4,rep,name=extra"`
}
// ExtraValue masks the value so protobuf can generate
// +protobuf.nullable=true
// +protobuf.options.(gogoproto.goproto_stringer)=false
type ExtraValue []string
func (t ExtraValue) String() string {
return fmt.Sprintf("%v", []string(t))
}

View File

@@ -0,0 +1,72 @@
/*
Copyright 2016 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 v1beta1
// This file contains a collection of methods that can be used from go-restful to
// generate Swagger API documentation for its models. Please read this PR for more
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
//
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
// they are on one line! For multiple line or blocks that you want to ignore use ---.
// Any context after a --- is ignored.
//
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
// AUTO-GENERATED FUNCTIONS START HERE
var map_TokenReview = map[string]string{
"": "TokenReview attempts to authenticate a token to a known user. Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver.",
"spec": "Spec holds information about the request being evaluated",
"status": "Status is filled in by the server and indicates whether the request can be authenticated.",
}
func (TokenReview) SwaggerDoc() map[string]string {
return map_TokenReview
}
var map_TokenReviewSpec = map[string]string{
"": "TokenReviewSpec is a description of the token authentication request.",
"token": "Token is the opaque bearer token.",
}
func (TokenReviewSpec) SwaggerDoc() map[string]string {
return map_TokenReviewSpec
}
var map_TokenReviewStatus = map[string]string{
"": "TokenReviewStatus is the result of the token authentication request.",
"authenticated": "Authenticated indicates that the token was associated with a known user.",
"user": "User is the UserInfo associated with the provided token.",
"error": "Error indicates that the token couldn't be checked",
}
func (TokenReviewStatus) SwaggerDoc() map[string]string {
return map_TokenReviewStatus
}
var map_UserInfo = map[string]string{
"": "UserInfo holds the information about the user needed to implement the user.Info interface.",
"username": "The name that uniquely identifies this user among all active users.",
"uid": "A unique value that identifies this user across time. If this user is deleted and another user by the same name is added, they will have different UIDs.",
"groups": "The names of groups this user is a part of.",
"extra": "Any additional information provided by the authenticator.",
}
func (UserInfo) SwaggerDoc() map[string]string {
return map_UserInfo
}
// AUTO-GENERATED FUNCTIONS END HERE

View File

@@ -0,0 +1,179 @@
// +build !ignore_autogenerated
/*
Copyright 2016 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.
*/
// This file was autogenerated by conversion-gen. Do not edit it manually!
package v1beta1
import (
api "k8s.io/kubernetes/pkg/api"
authentication "k8s.io/kubernetes/pkg/apis/authentication"
conversion "k8s.io/kubernetes/pkg/conversion"
)
func init() {
if err := api.Scheme.AddGeneratedConversionFuncs(
Convert_v1beta1_TokenReview_To_authentication_TokenReview,
Convert_authentication_TokenReview_To_v1beta1_TokenReview,
Convert_v1beta1_TokenReviewSpec_To_authentication_TokenReviewSpec,
Convert_authentication_TokenReviewSpec_To_v1beta1_TokenReviewSpec,
Convert_v1beta1_TokenReviewStatus_To_authentication_TokenReviewStatus,
Convert_authentication_TokenReviewStatus_To_v1beta1_TokenReviewStatus,
Convert_v1beta1_UserInfo_To_authentication_UserInfo,
Convert_authentication_UserInfo_To_v1beta1_UserInfo,
); err != nil {
// if one of the conversion functions is malformed, detect it immediately.
panic(err)
}
}
func autoConvert_v1beta1_TokenReview_To_authentication_TokenReview(in *TokenReview, out *authentication.TokenReview, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if err := Convert_v1beta1_TokenReviewSpec_To_authentication_TokenReviewSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_v1beta1_TokenReviewStatus_To_authentication_TokenReviewStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
func Convert_v1beta1_TokenReview_To_authentication_TokenReview(in *TokenReview, out *authentication.TokenReview, s conversion.Scope) error {
return autoConvert_v1beta1_TokenReview_To_authentication_TokenReview(in, out, s)
}
func autoConvert_authentication_TokenReview_To_v1beta1_TokenReview(in *authentication.TokenReview, out *TokenReview, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if err := Convert_authentication_TokenReviewSpec_To_v1beta1_TokenReviewSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_authentication_TokenReviewStatus_To_v1beta1_TokenReviewStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
func Convert_authentication_TokenReview_To_v1beta1_TokenReview(in *authentication.TokenReview, out *TokenReview, s conversion.Scope) error {
return autoConvert_authentication_TokenReview_To_v1beta1_TokenReview(in, out, s)
}
func autoConvert_v1beta1_TokenReviewSpec_To_authentication_TokenReviewSpec(in *TokenReviewSpec, out *authentication.TokenReviewSpec, s conversion.Scope) error {
out.Token = in.Token
return nil
}
func Convert_v1beta1_TokenReviewSpec_To_authentication_TokenReviewSpec(in *TokenReviewSpec, out *authentication.TokenReviewSpec, s conversion.Scope) error {
return autoConvert_v1beta1_TokenReviewSpec_To_authentication_TokenReviewSpec(in, out, s)
}
func autoConvert_authentication_TokenReviewSpec_To_v1beta1_TokenReviewSpec(in *authentication.TokenReviewSpec, out *TokenReviewSpec, s conversion.Scope) error {
out.Token = in.Token
return nil
}
func Convert_authentication_TokenReviewSpec_To_v1beta1_TokenReviewSpec(in *authentication.TokenReviewSpec, out *TokenReviewSpec, s conversion.Scope) error {
return autoConvert_authentication_TokenReviewSpec_To_v1beta1_TokenReviewSpec(in, out, s)
}
func autoConvert_v1beta1_TokenReviewStatus_To_authentication_TokenReviewStatus(in *TokenReviewStatus, out *authentication.TokenReviewStatus, s conversion.Scope) error {
out.Authenticated = in.Authenticated
if err := Convert_v1beta1_UserInfo_To_authentication_UserInfo(&in.User, &out.User, s); err != nil {
return err
}
out.Error = in.Error
return nil
}
func Convert_v1beta1_TokenReviewStatus_To_authentication_TokenReviewStatus(in *TokenReviewStatus, out *authentication.TokenReviewStatus, s conversion.Scope) error {
return autoConvert_v1beta1_TokenReviewStatus_To_authentication_TokenReviewStatus(in, out, s)
}
func autoConvert_authentication_TokenReviewStatus_To_v1beta1_TokenReviewStatus(in *authentication.TokenReviewStatus, out *TokenReviewStatus, s conversion.Scope) error {
out.Authenticated = in.Authenticated
if err := Convert_authentication_UserInfo_To_v1beta1_UserInfo(&in.User, &out.User, s); err != nil {
return err
}
out.Error = in.Error
return nil
}
func Convert_authentication_TokenReviewStatus_To_v1beta1_TokenReviewStatus(in *authentication.TokenReviewStatus, out *TokenReviewStatus, s conversion.Scope) error {
return autoConvert_authentication_TokenReviewStatus_To_v1beta1_TokenReviewStatus(in, out, s)
}
func autoConvert_v1beta1_UserInfo_To_authentication_UserInfo(in *UserInfo, out *authentication.UserInfo, s conversion.Scope) error {
out.Username = in.Username
out.UID = in.UID
out.Groups = in.Groups
if in.Extra != nil {
in, out := &in.Extra, &out.Extra
*out = make(map[string]authentication.ExtraValue, len(*in))
for key, val := range *in {
newVal := new(authentication.ExtraValue)
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&val, newVal, 0); err != nil {
return err
}
(*out)[key] = *newVal
}
} else {
out.Extra = nil
}
return nil
}
func Convert_v1beta1_UserInfo_To_authentication_UserInfo(in *UserInfo, out *authentication.UserInfo, s conversion.Scope) error {
return autoConvert_v1beta1_UserInfo_To_authentication_UserInfo(in, out, s)
}
func autoConvert_authentication_UserInfo_To_v1beta1_UserInfo(in *authentication.UserInfo, out *UserInfo, s conversion.Scope) error {
out.Username = in.Username
out.UID = in.UID
out.Groups = in.Groups
if in.Extra != nil {
in, out := &in.Extra, &out.Extra
*out = make(map[string]ExtraValue, len(*in))
for key, val := range *in {
newVal := new(ExtraValue)
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&val, newVal, 0); err != nil {
return err
}
(*out)[key] = *newVal
}
} else {
out.Extra = nil
}
return nil
}
func Convert_authentication_UserInfo_To_v1beta1_UserInfo(in *authentication.UserInfo, out *UserInfo, s conversion.Scope) error {
return autoConvert_authentication_UserInfo_To_v1beta1_UserInfo(in, out, s)
}

View File

@@ -22,6 +22,7 @@ package v1beta1
import (
api "k8s.io/kubernetes/pkg/api"
v1 "k8s.io/kubernetes/pkg/api/v1"
conversion "k8s.io/kubernetes/pkg/conversion"
reflect "reflect"
)
@@ -43,6 +44,9 @@ func DeepCopy_v1beta1_TokenReview(in interface{}, out interface{}, c *conversion
in := in.(*TokenReview)
out := out.(*TokenReview)
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.Spec = in.Spec
if err := DeepCopy_v1beta1_TokenReviewStatus(&in.Status, &out.Status, c); err != nil {
return err
@@ -68,6 +72,7 @@ func DeepCopy_v1beta1_TokenReviewStatus(in interface{}, out interface{}, c *conv
if err := DeepCopy_v1beta1_UserInfo(&in.User, &out.User, c); err != nil {
return err
}
out.Error = in.Error
return nil
}
}
@@ -87,12 +92,12 @@ func DeepCopy_v1beta1_UserInfo(in interface{}, out interface{}, c *conversion.Cl
}
if in.Extra != nil {
in, out := &in.Extra, &out.Extra
*out = make(map[string][]string)
*out = make(map[string]ExtraValue)
for key, val := range *in {
if newVal, err := c.DeepCopy(&val); err != nil {
return err
} else {
(*out)[key] = *newVal.(*[]string)
(*out)[key] = *newVal.(*ExtraValue)
}
}
} else {

View File

@@ -28,30 +28,33 @@ import (
func init() {
if err := api.Scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_authenticationk8sio_TokenReview, InType: reflect.TypeOf(func() *TokenReview { var x *TokenReview; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_authenticationk8sio_TokenReviewSpec, InType: reflect.TypeOf(func() *TokenReviewSpec { var x *TokenReviewSpec; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_authenticationk8sio_TokenReviewStatus, InType: reflect.TypeOf(func() *TokenReviewStatus { var x *TokenReviewStatus; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_authenticationk8sio_UserInfo, InType: reflect.TypeOf(func() *UserInfo { var x *UserInfo; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_authentication_TokenReview, InType: reflect.TypeOf(func() *TokenReview { var x *TokenReview; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_authentication_TokenReviewSpec, InType: reflect.TypeOf(func() *TokenReviewSpec { var x *TokenReviewSpec; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_authentication_TokenReviewStatus, InType: reflect.TypeOf(func() *TokenReviewStatus { var x *TokenReviewStatus; return x }())},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_authentication_UserInfo, InType: reflect.TypeOf(func() *UserInfo { var x *UserInfo; return x }())},
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
}
}
func DeepCopy_authenticationk8sio_TokenReview(in interface{}, out interface{}, c *conversion.Cloner) error {
func DeepCopy_authentication_TokenReview(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*TokenReview)
out := out.(*TokenReview)
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.Spec = in.Spec
if err := DeepCopy_authenticationk8sio_TokenReviewStatus(&in.Status, &out.Status, c); err != nil {
if err := DeepCopy_authentication_TokenReviewStatus(&in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
}
func DeepCopy_authenticationk8sio_TokenReviewSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
func DeepCopy_authentication_TokenReviewSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*TokenReviewSpec)
out := out.(*TokenReviewSpec)
@@ -60,19 +63,20 @@ func DeepCopy_authenticationk8sio_TokenReviewSpec(in interface{}, out interface{
}
}
func DeepCopy_authenticationk8sio_TokenReviewStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
func DeepCopy_authentication_TokenReviewStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*TokenReviewStatus)
out := out.(*TokenReviewStatus)
out.Authenticated = in.Authenticated
if err := DeepCopy_authenticationk8sio_UserInfo(&in.User, &out.User, c); err != nil {
if err := DeepCopy_authentication_UserInfo(&in.User, &out.User, c); err != nil {
return err
}
out.Error = in.Error
return nil
}
}
func DeepCopy_authenticationk8sio_UserInfo(in interface{}, out interface{}, c *conversion.Cloner) error {
func DeepCopy_authentication_UserInfo(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*UserInfo)
out := out.(*UserInfo)
@@ -87,12 +91,12 @@ func DeepCopy_authenticationk8sio_UserInfo(in interface{}, out interface{}, c *c
}
if in.Extra != nil {
in, out := &in.Extra, &out.Extra
*out = make(map[string][]string)
*out = make(map[string]ExtraValue)
for key, val := range *in {
if newVal, err := c.DeepCopy(&val); err != nil {
return err
} else {
(*out)[key] = *newVal.(*[]string)
(*out)[key] = *newVal.(*ExtraValue)
}
}
} else {