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
09b5d727
Unverified
Commit
09b5d727
authored
Jan 30, 2017
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
install authentication.k8s.io/v1, add tests
parent
529ce5d3
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
101 additions
and
5 deletions
+101
-5
auth.go
cmd/kubelet/app/auth.go
+1
-1
cmd.go
cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go
+1
-0
.linted_packages
hack/.linted_packages
+1
-0
init.sh
hack/lib/init.sh
+1
-0
test-cmd-util.sh
hack/make-rules/test-cmd-util.sh
+2
-1
install.go
pkg/apis/authentication/install/install.go
+3
-1
fake_tokenreview_expansion.go
...yped/authentication/v1/fake/fake_tokenreview_expansion.go
+27
-0
generated_expansion.go
.../clientset/typed/authentication/v1/generated_expansion.go
+0
-2
tokenreview_expansion.go
...lientset/typed/authentication/v1/tokenreview_expansion.go
+35
-0
garbagecollector.go
pkg/controller/garbagecollector/garbagecollector.go
+1
-0
master.go
pkg/master/master.go
+2
-0
storage_authentication.go
pkg/registry/authentication/rest/storage_authentication.go
+19
-0
tokenreview-v1.json
test/fixtures/pkg/kubectl/cmd/create/tokenreview-v1.json
+8
-0
tokenreview-v1beta1.json
.../fixtures/pkg/kubectl/cmd/create/tokenreview-v1beta1.json
+0
-0
No files found.
cmd/kubelet/app/auth.go
View file @
09b5d727
...
@@ -41,7 +41,7 @@ func buildAuth(nodeName types.NodeName, client clientset.Interface, config compo
...
@@ -41,7 +41,7 @@ func buildAuth(nodeName types.NodeName, client clientset.Interface, config compo
sarClient
authorizationclient
.
SubjectAccessReviewInterface
sarClient
authorizationclient
.
SubjectAccessReviewInterface
)
)
if
client
!=
nil
&&
!
reflect
.
ValueOf
(
client
)
.
IsNil
()
{
if
client
!=
nil
&&
!
reflect
.
ValueOf
(
client
)
.
IsNil
()
{
tokenClient
=
client
.
Authentication
()
.
TokenReviews
()
tokenClient
=
client
.
Authentication
V1beta1
()
.
TokenReviews
()
sarClient
=
client
.
AuthorizationV1beta1
()
.
SubjectAccessReviews
()
sarClient
=
client
.
AuthorizationV1beta1
()
.
SubjectAccessReviews
()
}
}
...
...
cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go
View file @
09b5d727
...
@@ -77,6 +77,7 @@ func New() *Generator {
...
@@ -77,6 +77,7 @@ func New() *Generator {
`k8s.io/kubernetes/pkg/apis/batch/v1`
,
`k8s.io/kubernetes/pkg/apis/batch/v1`
,
`k8s.io/kubernetes/pkg/apis/batch/v2alpha1`
,
`k8s.io/kubernetes/pkg/apis/batch/v2alpha1`
,
`k8s.io/kubernetes/pkg/apis/apps/v1beta1`
,
`k8s.io/kubernetes/pkg/apis/apps/v1beta1`
,
`k8s.io/kubernetes/pkg/apis/authentication/v1`
,
`k8s.io/kubernetes/pkg/apis/authentication/v1beta1`
,
`k8s.io/kubernetes/pkg/apis/authentication/v1beta1`
,
`k8s.io/kubernetes/pkg/apis/rbac/v1alpha1`
,
`k8s.io/kubernetes/pkg/apis/rbac/v1alpha1`
,
`k8s.io/kubernetes/pkg/apis/rbac/v1beta1`
,
`k8s.io/kubernetes/pkg/apis/rbac/v1beta1`
,
...
...
hack/.linted_packages
View file @
09b5d727
...
@@ -120,6 +120,7 @@ pkg/client/informers/informers_generated/storage/v1beta1
...
@@ -120,6 +120,7 @@ pkg/client/informers/informers_generated/storage/v1beta1
pkg/client/listers/apps/internalversion
pkg/client/listers/apps/internalversion
pkg/client/listers/apps/v1beta1
pkg/client/listers/apps/v1beta1
pkg/client/listers/authentication/internalversion
pkg/client/listers/authentication/internalversion
pkg/client/listers/authentication/v1
pkg/client/listers/authentication/v1beta1
pkg/client/listers/authentication/v1beta1
pkg/client/listers/authorization/internalversion
pkg/client/listers/authorization/internalversion
pkg/client/listers/authorization/v1
pkg/client/listers/authorization/v1
...
...
hack/lib/init.sh
View file @
09b5d727
...
@@ -54,6 +54,7 @@ KUBE_OUTPUT_HOSTBIN="${KUBE_OUTPUT_BINPATH}/$(kube::util::host_platform)"
...
@@ -54,6 +54,7 @@ KUBE_OUTPUT_HOSTBIN="${KUBE_OUTPUT_BINPATH}/$(kube::util::host_platform)"
KUBE_AVAILABLE_GROUP_VERSIONS
=
"
${
KUBE_AVAILABLE_GROUP_VERSIONS
:-
\
KUBE_AVAILABLE_GROUP_VERSIONS
=
"
${
KUBE_AVAILABLE_GROUP_VERSIONS
:-
\
v1 \
v1 \
apps/v1beta1 \
apps/v1beta1 \
authentication.k8s.io/v1 \
authentication.k8s.io/v1beta1 \
authentication.k8s.io/v1beta1 \
authorization.k8s.io/v1 \
authorization.k8s.io/v1 \
authorization.k8s.io/v1beta1 \
authorization.k8s.io/v1beta1 \
...
...
hack/make-rules/test-cmd-util.sh
View file @
09b5d727
...
@@ -3240,7 +3240,8 @@ __EOF__
...
@@ -3240,7 +3240,8 @@ __EOF__
# check webhook token authentication endpoint, kubectl doesn't actually display the returned object so this isn't super useful
# check webhook token authentication endpoint, kubectl doesn't actually display the returned object so this isn't super useful
# but it proves that works
# but it proves that works
kubectl create
-f
test
/fixtures/pkg/kubectl/cmd/create/tokenreview.json
--validate
=
false
kubectl create
-f
test
/fixtures/pkg/kubectl/cmd/create/tokenreview-v1beta1.json
--validate
=
false
kubectl create
-f
test
/fixtures/pkg/kubectl/cmd/create/tokenreview-v1.json
--validate
=
false
fi
fi
...
...
pkg/apis/authentication/install/install.go
View file @
09b5d727
...
@@ -25,6 +25,7 @@ import (
...
@@ -25,6 +25,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/authentication"
"k8s.io/kubernetes/pkg/apis/authentication"
"k8s.io/kubernetes/pkg/apis/authentication/v1"
"k8s.io/kubernetes/pkg/apis/authentication/v1beta1"
"k8s.io/kubernetes/pkg/apis/authentication/v1beta1"
)
)
...
@@ -37,13 +38,14 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
...
@@ -37,13 +38,14 @@ func Install(groupFactoryRegistry announced.APIGroupFactoryRegistry, registry *r
if
err
:=
announced
.
NewGroupMetaFactory
(
if
err
:=
announced
.
NewGroupMetaFactory
(
&
announced
.
GroupMetaFactoryArgs
{
&
announced
.
GroupMetaFactoryArgs
{
GroupName
:
authentication
.
GroupName
,
GroupName
:
authentication
.
GroupName
,
VersionPreferenceOrder
:
[]
string
{
v1beta1
.
SchemeGroupVersion
.
Version
},
VersionPreferenceOrder
:
[]
string
{
v1
.
SchemeGroupVersion
.
Version
,
v1
beta1
.
SchemeGroupVersion
.
Version
},
ImportPrefix
:
"k8s.io/kubernetes/pkg/apis/authentication"
,
ImportPrefix
:
"k8s.io/kubernetes/pkg/apis/authentication"
,
RootScopedKinds
:
sets
.
NewString
(
"TokenReview"
),
RootScopedKinds
:
sets
.
NewString
(
"TokenReview"
),
AddInternalObjectsToScheme
:
authentication
.
AddToScheme
,
AddInternalObjectsToScheme
:
authentication
.
AddToScheme
,
},
},
announced
.
VersionToSchemeFunc
{
announced
.
VersionToSchemeFunc
{
v1beta1
.
SchemeGroupVersion
.
Version
:
v1beta1
.
AddToScheme
,
v1beta1
.
SchemeGroupVersion
.
Version
:
v1beta1
.
AddToScheme
,
v1
.
SchemeGroupVersion
.
Version
:
v1
.
AddToScheme
,
},
},
)
.
Announce
(
groupFactoryRegistry
)
.
RegisterAndEnable
(
registry
,
scheme
);
err
!=
nil
{
)
.
Announce
(
groupFactoryRegistry
)
.
RegisterAndEnable
(
registry
,
scheme
);
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
...
pkg/client/clientset_generated/clientset/typed/authentication/v1/fake/fake_tokenreview_expansion.go
0 → 100644
View file @
09b5d727
/*
Copyright 2017 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
(
core
"k8s.io/client-go/testing"
authenticationapi
"k8s.io/kubernetes/pkg/apis/authentication/v1"
)
func
(
c
*
FakeTokenReviews
)
Create
(
tokenReview
*
authenticationapi
.
TokenReview
)
(
result
*
authenticationapi
.
TokenReview
,
err
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewRootCreateAction
(
authenticationapi
.
SchemeGroupVersion
.
WithResource
(
"tokenreviews"
),
tokenReview
),
&
authenticationapi
.
TokenReview
{})
return
obj
.
(
*
authenticationapi
.
TokenReview
),
err
}
pkg/client/clientset_generated/clientset/typed/authentication/v1/generated_expansion.go
View file @
09b5d727
...
@@ -15,5 +15,3 @@ limitations under the License.
...
@@ -15,5 +15,3 @@ limitations under the License.
*/
*/
package
v1
package
v1
type
TokenReviewExpansion
interface
{}
pkg/client/clientset_generated/clientset/typed/authentication/v1/tokenreview_expansion.go
0 → 100644
View file @
09b5d727
/*
Copyright 2017 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
(
authenticationapi
"k8s.io/kubernetes/pkg/apis/authentication/v1"
)
type
TokenReviewExpansion
interface
{
Create
(
tokenReview
*
authenticationapi
.
TokenReview
)
(
result
*
authenticationapi
.
TokenReview
,
err
error
)
}
func
(
c
*
tokenReviews
)
Create
(
tokenReview
*
authenticationapi
.
TokenReview
)
(
result
*
authenticationapi
.
TokenReview
,
err
error
)
{
result
=
&
authenticationapi
.
TokenReview
{}
err
=
c
.
client
.
Post
()
.
Resource
(
"tokenreviews"
)
.
Body
(
tokenReview
)
.
Do
()
.
Into
(
result
)
return
}
pkg/controller/garbagecollector/garbagecollector.go
View file @
09b5d727
...
@@ -533,6 +533,7 @@ var ignoredResources = map[schema.GroupVersionResource]struct{}{
...
@@ -533,6 +533,7 @@ var ignoredResources = map[schema.GroupVersionResource]struct{}{
schema
.
GroupVersionResource
{
Group
:
""
,
Version
:
"v1"
,
Resource
:
"componentstatuses"
}
:
{},
schema
.
GroupVersionResource
{
Group
:
""
,
Version
:
"v1"
,
Resource
:
"componentstatuses"
}
:
{},
schema
.
GroupVersionResource
{
Group
:
""
,
Version
:
"v1"
,
Resource
:
"events"
}
:
{},
schema
.
GroupVersionResource
{
Group
:
""
,
Version
:
"v1"
,
Resource
:
"events"
}
:
{},
schema
.
GroupVersionResource
{
Group
:
"authentication.k8s.io"
,
Version
:
"v1beta1"
,
Resource
:
"tokenreviews"
}
:
{},
schema
.
GroupVersionResource
{
Group
:
"authentication.k8s.io"
,
Version
:
"v1beta1"
,
Resource
:
"tokenreviews"
}
:
{},
schema
.
GroupVersionResource
{
Group
:
"authentication.k8s.io"
,
Version
:
"v1"
,
Resource
:
"tokenreviews"
}
:
{},
schema
.
GroupVersionResource
{
Group
:
"authorization.k8s.io"
,
Version
:
"v1beta1"
,
Resource
:
"subjectaccessreviews"
}
:
{},
schema
.
GroupVersionResource
{
Group
:
"authorization.k8s.io"
,
Version
:
"v1beta1"
,
Resource
:
"subjectaccessreviews"
}
:
{},
schema
.
GroupVersionResource
{
Group
:
"authorization.k8s.io"
,
Version
:
"v1beta1"
,
Resource
:
"selfsubjectaccessreviews"
}
:
{},
schema
.
GroupVersionResource
{
Group
:
"authorization.k8s.io"
,
Version
:
"v1beta1"
,
Resource
:
"selfsubjectaccessreviews"
}
:
{},
schema
.
GroupVersionResource
{
Group
:
"authorization.k8s.io"
,
Version
:
"v1beta1"
,
Resource
:
"localsubjectaccessreviews"
}
:
{},
schema
.
GroupVersionResource
{
Group
:
"authorization.k8s.io"
,
Version
:
"v1beta1"
,
Resource
:
"localsubjectaccessreviews"
}
:
{},
...
...
pkg/master/master.go
View file @
09b5d727
...
@@ -35,6 +35,7 @@ import (
...
@@ -35,6 +35,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
apiv1
"k8s.io/kubernetes/pkg/api/v1"
apiv1
"k8s.io/kubernetes/pkg/api/v1"
appsapi
"k8s.io/kubernetes/pkg/apis/apps/v1beta1"
appsapi
"k8s.io/kubernetes/pkg/apis/apps/v1beta1"
authenticationv1
"k8s.io/kubernetes/pkg/apis/authentication/v1"
authenticationv1beta1
"k8s.io/kubernetes/pkg/apis/authentication/v1beta1"
authenticationv1beta1
"k8s.io/kubernetes/pkg/apis/authentication/v1beta1"
authorizationapiv1
"k8s.io/kubernetes/pkg/apis/authorization/v1"
authorizationapiv1
"k8s.io/kubernetes/pkg/apis/authorization/v1"
authorizationapiv1beta1
"k8s.io/kubernetes/pkg/apis/authorization/v1beta1"
authorizationapiv1beta1
"k8s.io/kubernetes/pkg/apis/authorization/v1beta1"
...
@@ -392,6 +393,7 @@ func DefaultAPIResourceConfigSource() *genericapiserver.ResourceConfig {
...
@@ -392,6 +393,7 @@ func DefaultAPIResourceConfigSource() *genericapiserver.ResourceConfig {
apiv1
.
SchemeGroupVersion
,
apiv1
.
SchemeGroupVersion
,
extensionsapiv1beta1
.
SchemeGroupVersion
,
extensionsapiv1beta1
.
SchemeGroupVersion
,
batchapiv1
.
SchemeGroupVersion
,
batchapiv1
.
SchemeGroupVersion
,
authenticationv1
.
SchemeGroupVersion
,
authenticationv1beta1
.
SchemeGroupVersion
,
authenticationv1beta1
.
SchemeGroupVersion
,
autoscalingapiv1
.
SchemeGroupVersion
,
autoscalingapiv1
.
SchemeGroupVersion
,
appsapi
.
SchemeGroupVersion
,
appsapi
.
SchemeGroupVersion
,
...
...
pkg/registry/authentication/rest/storage_authentication.go
View file @
09b5d727
...
@@ -23,6 +23,7 @@ import (
...
@@ -23,6 +23,7 @@ import (
genericapiserver
"k8s.io/apiserver/pkg/server"
genericapiserver
"k8s.io/apiserver/pkg/server"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/authentication"
"k8s.io/kubernetes/pkg/apis/authentication"
authenticationv1
"k8s.io/kubernetes/pkg/apis/authentication/v1"
authenticationv1beta1
"k8s.io/kubernetes/pkg/apis/authentication/v1beta1"
authenticationv1beta1
"k8s.io/kubernetes/pkg/apis/authentication/v1beta1"
"k8s.io/kubernetes/pkg/registry/authentication/tokenreview"
"k8s.io/kubernetes/pkg/registry/authentication/tokenreview"
)
)
...
@@ -43,6 +44,10 @@ func (p RESTStorageProvider) NewRESTStorage(apiResourceConfigSource genericapise
...
@@ -43,6 +44,10 @@ func (p RESTStorageProvider) NewRESTStorage(apiResourceConfigSource genericapise
apiGroupInfo
.
VersionedResourcesStorageMap
[
authenticationv1beta1
.
SchemeGroupVersion
.
Version
]
=
p
.
v1beta1Storage
(
apiResourceConfigSource
,
restOptionsGetter
)
apiGroupInfo
.
VersionedResourcesStorageMap
[
authenticationv1beta1
.
SchemeGroupVersion
.
Version
]
=
p
.
v1beta1Storage
(
apiResourceConfigSource
,
restOptionsGetter
)
apiGroupInfo
.
GroupMeta
.
GroupVersion
=
authenticationv1beta1
.
SchemeGroupVersion
apiGroupInfo
.
GroupMeta
.
GroupVersion
=
authenticationv1beta1
.
SchemeGroupVersion
}
}
if
apiResourceConfigSource
.
AnyResourcesForVersionEnabled
(
authenticationv1
.
SchemeGroupVersion
)
{
apiGroupInfo
.
VersionedResourcesStorageMap
[
authenticationv1
.
SchemeGroupVersion
.
Version
]
=
p
.
v1Storage
(
apiResourceConfigSource
,
restOptionsGetter
)
apiGroupInfo
.
GroupMeta
.
GroupVersion
=
authenticationv1
.
SchemeGroupVersion
}
return
apiGroupInfo
,
true
return
apiGroupInfo
,
true
}
}
...
@@ -61,6 +66,20 @@ func (p RESTStorageProvider) v1beta1Storage(apiResourceConfigSource genericapise
...
@@ -61,6 +66,20 @@ func (p RESTStorageProvider) v1beta1Storage(apiResourceConfigSource genericapise
return
storage
return
storage
}
}
func
(
p
RESTStorageProvider
)
v1Storage
(
apiResourceConfigSource
genericapiserver
.
APIResourceConfigSource
,
restOptionsGetter
generic
.
RESTOptionsGetter
)
map
[
string
]
rest
.
Storage
{
version
:=
authenticationv1
.
SchemeGroupVersion
storage
:=
map
[
string
]
rest
.
Storage
{}
if
apiResourceConfigSource
.
AnyResourcesForVersionEnabled
(
authenticationv1
.
SchemeGroupVersion
)
{
if
apiResourceConfigSource
.
ResourceEnabled
(
version
.
WithResource
(
"tokenreviews"
))
{
tokenReviewStorage
:=
tokenreview
.
NewREST
(
p
.
Authenticator
)
storage
[
"tokenreviews"
]
=
tokenReviewStorage
}
}
return
storage
}
func
(
p
RESTStorageProvider
)
GroupName
()
string
{
func
(
p
RESTStorageProvider
)
GroupName
()
string
{
return
authentication
.
GroupName
return
authentication
.
GroupName
}
}
test/fixtures/pkg/kubectl/cmd/create/tokenreview-v1.json
0 → 100644
View file @
09b5d727
{
"apiVersion"
:
"authentication.k8s.io/v1"
,
"kind"
:
"TokenReview"
,
"spec"
:
{
"token"
:
"test-token"
}
}
\ No newline at end of file
test/fixtures/pkg/kubectl/cmd/create/tokenreview.json
→
test/fixtures/pkg/kubectl/cmd/create/tokenreview
-v1beta1
.json
View file @
09b5d727
File moved
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