Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
48959be8
Commit
48959be8
authored
Feb 01, 2018
by
Mike Danese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add minimal types for service account TokenRequest API
parent
1105751c
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
182 additions
and
0 deletions
+182
-0
register.go
pkg/apis/authentication/register.go
+1
-0
types.go
pkg/apis/authentication/types.go
+55
-0
register.go
staging/src/k8s.io/api/authentication/v1/register.go
+1
-0
types.go
staging/src/k8s.io/api/authentication/v1/types.go
+61
-0
register.go
staging/src/k8s.io/api/authentication/v1beta1/register.go
+1
-0
types.go
staging/src/k8s.io/api/authentication/v1beta1/types.go
+61
-0
etcd_storage_path_test.go
test/integration/etcd/etcd_storage_path_test.go
+2
-0
No files found.
pkg/apis/authentication/register.go
View file @
48959be8
...
@@ -45,6 +45,7 @@ var (
...
@@ -45,6 +45,7 @@ var (
func
addKnownTypes
(
scheme
*
runtime
.
Scheme
)
error
{
func
addKnownTypes
(
scheme
*
runtime
.
Scheme
)
error
{
scheme
.
AddKnownTypes
(
SchemeGroupVersion
,
scheme
.
AddKnownTypes
(
SchemeGroupVersion
,
&
TokenReview
{},
&
TokenReview
{},
&
TokenRequest
{},
)
)
return
nil
return
nil
}
}
pkg/apis/authentication/types.go
View file @
48959be8
...
@@ -18,6 +18,7 @@ package authentication
...
@@ -18,6 +18,7 @@ package authentication
import
(
import
(
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
)
const
(
const
(
...
@@ -88,3 +89,57 @@ type UserInfo struct {
...
@@ -88,3 +89,57 @@ type UserInfo struct {
// ExtraValue masks the value so protobuf can generate
// ExtraValue masks the value so protobuf can generate
type
ExtraValue
[]
string
type
ExtraValue
[]
string
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// TokenRequest requests a token for a given service account.
type
TokenRequest
struct
{
metav1
.
TypeMeta
// ObjectMeta fulfills the metav1.ObjectMetaAccessor interface so that the stock
// REST handler paths work
metav1
.
ObjectMeta
Spec
TokenRequestSpec
Status
TokenRequestStatus
}
// TokenRequestSpec contains client provided parameters of a token request.
type
TokenRequestSpec
struct
{
// Audiences are the intendend audiences of the token. A recipient of a
// token must identitfy themself with an identifier in the list of
// audiences of the token, and otherwise should reject the token. A
// token issued for multiple audiences may be used to authenticate
// against any of the audiences listed but implies a high degree of
// trust between the target audiences.
Audiences
[]
string
// ExpirationSeconds is the requested duration of validity of the request. The
// token issuer may return a token with a different validity duration so a
// client needs to check the 'expiration' field in a response.
ExpirationSeconds
int64
// BoundObjectRef is a reference to an object that the token will be bound to.
// The token will only be valid for as long as the bound objet exists.
BoundObjectRef
*
BoundObjectReference
}
// TokenRequestStatus is the result of a token request.
type
TokenRequestStatus
struct
{
// Token is the opaque bearer token.
Token
string
// ExpirationTimestamp is the time of expiration of the returned token.
ExpirationTimestamp
metav1
.
Time
}
// BoundObjectReference is a reference to an object that a token is bound to.
type
BoundObjectReference
struct
{
// Kind of the referent. Valid kinds are 'Pod' and 'Secret'.
Kind
string
// API version of the referent.
APIVersion
string
// Name of the referent.
Name
string
// UID of the referent.
UID
types
.
UID
}
staging/src/k8s.io/api/authentication/v1/register.go
View file @
48959be8
...
@@ -45,6 +45,7 @@ var (
...
@@ -45,6 +45,7 @@ var (
func
addKnownTypes
(
scheme
*
runtime
.
Scheme
)
error
{
func
addKnownTypes
(
scheme
*
runtime
.
Scheme
)
error
{
scheme
.
AddKnownTypes
(
SchemeGroupVersion
,
scheme
.
AddKnownTypes
(
SchemeGroupVersion
,
&
TokenReview
{},
&
TokenReview
{},
&
TokenRequest
{},
)
)
metav1
.
AddToGroupVersion
(
scheme
,
SchemeGroupVersion
)
metav1
.
AddToGroupVersion
(
scheme
,
SchemeGroupVersion
)
return
nil
return
nil
...
...
staging/src/k8s.io/api/authentication/v1/types.go
View file @
48959be8
...
@@ -20,6 +20,7 @@ import (
...
@@ -20,6 +20,7 @@ import (
"fmt"
"fmt"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
)
const
(
const
(
...
@@ -105,3 +106,63 @@ type ExtraValue []string
...
@@ -105,3 +106,63 @@ type ExtraValue []string
func
(
t
ExtraValue
)
String
()
string
{
func
(
t
ExtraValue
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
[]
string
(
t
))
return
fmt
.
Sprintf
(
"%v"
,
[]
string
(
t
))
}
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// TokenRequest requests a token for a given service account.
type
TokenRequest
struct
{
metav1
.
TypeMeta
`json:",inline"`
// +optional
metav1
.
ObjectMeta
`json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Spec
TokenRequestSpec
`json:"spec" protobuf:"bytes,2,opt,name=spec"`
// +optional
Status
TokenRequestStatus
`json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// TokenRequestSpec contains client provided parameters of a token request.
type
TokenRequestSpec
struct
{
// Audiences are the intendend audiences of the token. A recipient of a
// token must identitfy themself with an identifier in the list of
// audiences of the token, and otherwise should reject the token. A
// token issued for multiple audiences may be used to authenticate
// against any of the audiences listed but implies a high degree of
// trust between the target audiences.
Audiences
[]
string
`json:"audiences" protobuf:"bytes,1,rep,name=audiences"`
// ExpirationSeconds is the requested duration of validity of the request. The
// token issuer may return a token with a different validity duration so a
// client needs to check the 'expiration' field in a response.
// +optional
ExpirationSeconds
*
int64
`json:"expirationSeconds" protobuf:"varint,4,opt,name=expirationSeconds"`
// BoundObjectRef is a reference to an object that the token will be bound to.
// The token will only be valid for as long as the bound objet exists.
// +optional
BoundObjectRef
*
BoundObjectReference
`json:"boundObjectRef" protobuf:"bytes,3,opt,name=boundObjectRef"`
}
// TokenRequestStatus is the result of a token request.
type
TokenRequestStatus
struct
{
// Token is the opaque bearer token.
Token
string
`json:"token" protobuf:"bytes,1,opt,name=token"`
// ExpirationTimestamp is the time of expiration of the returned token.
ExpirationTimestamp
metav1
.
Time
`json:"expirationTimestamp" protobuf:"bytes,2,opt,name=expirationTimestamp"`
}
// BoundObjectReference is a reference to an object that a token is bound to.
type
BoundObjectReference
struct
{
// Kind of the referent. Valid kinds are 'Pod' and 'Secret'.
// +optional
Kind
string
`json:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"`
// API version of the referent.
// +optional
APIVersion
string
`json:"apiVersion,omitempty" protobuf:"bytes,2,opt,name=aPIVersion"`
// Name of the referent.
// +optional
Name
string
`json:"name,omitempty" protobuf:"bytes,3,opt,name=name"`
// UID of the referent.
// +optional
UID
types
.
UID
`json:"uid,omitempty" protobuf:"bytes,4,opt,name=uID,casttype=k8s.io/apimachinery/pkg/types.UID"`
}
staging/src/k8s.io/api/authentication/v1beta1/register.go
View file @
48959be8
...
@@ -45,6 +45,7 @@ var (
...
@@ -45,6 +45,7 @@ var (
func
addKnownTypes
(
scheme
*
runtime
.
Scheme
)
error
{
func
addKnownTypes
(
scheme
*
runtime
.
Scheme
)
error
{
scheme
.
AddKnownTypes
(
SchemeGroupVersion
,
scheme
.
AddKnownTypes
(
SchemeGroupVersion
,
&
TokenReview
{},
&
TokenReview
{},
&
TokenRequest
{},
)
)
metav1
.
AddToGroupVersion
(
scheme
,
SchemeGroupVersion
)
metav1
.
AddToGroupVersion
(
scheme
,
SchemeGroupVersion
)
return
nil
return
nil
...
...
staging/src/k8s.io/api/authentication/v1beta1/types.go
View file @
48959be8
...
@@ -20,6 +20,7 @@ import (
...
@@ -20,6 +20,7 @@ import (
"fmt"
"fmt"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
)
// +genclient
// +genclient
...
@@ -90,3 +91,63 @@ type ExtraValue []string
...
@@ -90,3 +91,63 @@ type ExtraValue []string
func
(
t
ExtraValue
)
String
()
string
{
func
(
t
ExtraValue
)
String
()
string
{
return
fmt
.
Sprintf
(
"%v"
,
[]
string
(
t
))
return
fmt
.
Sprintf
(
"%v"
,
[]
string
(
t
))
}
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// TokenRequest requests a token for a given service account.
type
TokenRequest
struct
{
metav1
.
TypeMeta
`json:",inline"`
// +optional
metav1
.
ObjectMeta
`json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Spec
TokenRequestSpec
`json:"spec" protobuf:"bytes,2,opt,name=spec"`
// +optional
Status
TokenRequestStatus
`json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// TokenRequestSpec contains client provided parameters of a token request.
type
TokenRequestSpec
struct
{
// Audiences are the intendend audiences of the token. A recipient of a
// token must identitfy themself with an identifier in the list of
// audiences of the token, and otherwise should reject the token. A
// token issued for multiple audiences may be used to authenticate
// against any of the audiences listed but implies a high degree of
// trust between the target audiences.
Audiences
[]
string
`json:"audiences" protobuf:"bytes,1,rep,name=audiences"`
// ExpirationSeconds is the requested duration of validity of the request. The
// token issuer may return a token with a different validity duration so a
// client needs to check the 'expiration' field in a response.
// +optional
ExpirationSeconds
*
int64
`json:"expirationSeconds" protobuf:"varint,4,opt,name=expirationSeconds"`
// BoundObjectRef is a reference to an object that the token will be bound to.
// The token will only be valid for as long as the bound objet exists.
// +optional
BoundObjectRef
*
BoundObjectReference
`json:"boundObjectRef" protobuf:"bytes,3,opt,name=boundObjectRef"`
}
// TokenRequestStatus is the result of a token request.
type
TokenRequestStatus
struct
{
// Token is the opaque bearer token.
Token
string
`json:"token" protobuf:"bytes,1,opt,name=token"`
// ExpirationTimestmap is the time of expiration of the returned token.
ExpirationTimestamp
metav1
.
Time
`json:"expirationTimestamp" protobuf:"bytes,2,opt,name=expirationTimestamp"`
}
// BoundObjectReference is a reference to an object that a token is bound to.
type
BoundObjectReference
struct
{
// Kind of the referent. Valid kinds are 'Pod' and 'Secret'.
// +optional
Kind
string
`json:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"`
// API version of the referent.
// +optional
APIVersion
string
`json:"apiVersion,omitempty" protobuf:"bytes,2,opt,name=aPIVersion"`
// Name of the referent.
// +optional
Name
string
`json:"name,omitempty" protobuf:"bytes,3,opt,name=name"`
// UID of the referent.
// +optional
UID
types
.
UID
`json:"uid,omitempty" protobuf:"bytes,4,opt,name=uID,casttype=k8s.io/apimachinery/pkg/types.UID"`
}
test/integration/etcd/etcd_storage_path_test.go
View file @
48959be8
...
@@ -438,10 +438,12 @@ var ephemeralWhiteList = createEphemeralWhiteList(
...
@@ -438,10 +438,12 @@ var ephemeralWhiteList = createEphemeralWhiteList(
// k8s.io/kubernetes/pkg/apis/authentication/v1beta1
// k8s.io/kubernetes/pkg/apis/authentication/v1beta1
gvr
(
"authentication.k8s.io"
,
"v1beta1"
,
"tokenreviews"
),
// not stored in etcd
gvr
(
"authentication.k8s.io"
,
"v1beta1"
,
"tokenreviews"
),
// not stored in etcd
gvr
(
"authentication.k8s.io"
,
"v1beta1"
,
"tokenrequests"
),
// not stored in etcd
// --
// --
// k8s.io/kubernetes/pkg/apis/authentication/v1
// k8s.io/kubernetes/pkg/apis/authentication/v1
gvr
(
"authentication.k8s.io"
,
"v1"
,
"tokenreviews"
),
// not stored in etcd
gvr
(
"authentication.k8s.io"
,
"v1"
,
"tokenreviews"
),
// not stored in etcd
gvr
(
"authentication.k8s.io"
,
"v1"
,
"tokenrequests"
),
// not stored in etcd
// --
// --
// k8s.io/kubernetes/pkg/apis/authorization/v1beta1
// k8s.io/kubernetes/pkg/apis/authorization/v1beta1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment