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
748ea110
Commit
748ea110
authored
May 24, 2017
by
Jonathan MacMillan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Federation] Uniquify the ClusterRole and ClusterRoleBinding names created by .
parent
6f7eac63
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
+7
-7
join.go
federation/pkg/kubefed/join.go
+1
-1
join_test.go
federation/pkg/kubefed/join_test.go
+2
-2
unjoin_test.go
federation/pkg/kubefed/unjoin_test.go
+2
-2
util.go
federation/pkg/kubefed/util/util.go
+2
-2
No files found.
federation/pkg/kubefed/join.go
View file @
748ea110
...
...
@@ -593,7 +593,7 @@ func createServiceAccount(clusterClientset internalclientset.Interface, namespac
// service account identified by saName to access all resources in all namespaces
// in the cluster associated with clusterClientset.
func
createClusterRoleBinding
(
clusterClientset
internalclientset
.
Interface
,
saName
,
namespace
,
federationName
,
joiningClusterName
string
,
dryRun
bool
)
(
*
rbac
.
ClusterRoleBinding
,
error
)
{
roleName
:=
util
.
ClusterRoleName
(
saName
)
roleName
:=
util
.
ClusterRoleName
(
federationName
,
saName
)
role
:=
&
rbac
.
ClusterRole
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
roleName
,
...
...
federation/pkg/kubefed/join_test.go
View file @
748ea110
...
...
@@ -475,7 +475,7 @@ func fakeJoinTargetClusterFactory(clusterName, clusterCtx, dnsProvider, tmpDirPa
},
}
roleName
:=
util
.
ClusterRoleName
(
saName
)
roleName
:=
util
.
ClusterRoleName
(
testFederationName
,
saName
)
clusterRole
:=
rbacv1beta1
.
ClusterRole
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
roleName
,
...
...
@@ -595,7 +595,7 @@ func fakeCluster(clusterName, secretName, server string, isRBACAPIAvailable bool
saName
:=
serviceAccountName
(
clusterName
)
annotations
:=
map
[
string
]
string
{
kubectl
.
ServiceAccountNameAnnotation
:
saName
,
kubectl
.
ClusterRoleNameAnnotation
:
util
.
ClusterRoleName
(
saName
),
kubectl
.
ClusterRoleNameAnnotation
:
util
.
ClusterRoleName
(
testFederationName
,
saName
),
}
cluster
.
ObjectMeta
.
SetAnnotations
(
annotations
)
}
...
...
federation/pkg/kubefed/unjoin_test.go
View file @
748ea110
...
...
@@ -275,7 +275,7 @@ func fakeUnjoinHostFactory(clusterName string) cmdutil.Factory {
return
&
http
.
Response
{
StatusCode
:
http
.
StatusOK
,
Header
:
kubefedtesting
.
DefaultHeader
(),
Body
:
kubefedtesting
.
ObjBody
(
codec
,
&
status
)},
nil
case
strings
.
HasPrefix
(
p
,
clusterRoleBindingPrefix
)
&&
m
==
http
.
MethodDelete
:
got
:=
strings
.
TrimPrefix
(
p
,
clusterRoleBindingPrefix
)
want
:=
util
.
ClusterRoleName
(
serviceAccountName
(
clusterName
))
want
:=
util
.
ClusterRoleName
(
testFederationName
,
serviceAccountName
(
clusterName
))
if
got
!=
want
{
return
nil
,
errors
.
NewNotFound
(
api
.
Resource
(
"clusterrolebindings"
),
got
)
}
...
...
@@ -286,7 +286,7 @@ func fakeUnjoinHostFactory(clusterName string) cmdutil.Factory {
return
&
http
.
Response
{
StatusCode
:
http
.
StatusOK
,
Header
:
kubefedtesting
.
DefaultHeader
(),
Body
:
kubefedtesting
.
ObjBody
(
codec
,
&
status
)},
nil
case
strings
.
HasPrefix
(
p
,
clusterRolePrefix
)
&&
m
==
http
.
MethodDelete
:
got
:=
strings
.
TrimPrefix
(
p
,
clusterRolePrefix
)
want
:=
util
.
ClusterRoleName
(
serviceAccountName
(
clusterName
))
want
:=
util
.
ClusterRoleName
(
testFederationName
,
serviceAccountName
(
clusterName
))
if
got
!=
want
{
return
nil
,
errors
.
NewNotFound
(
api
.
Resource
(
"clusterroles"
),
got
)
}
...
...
federation/pkg/kubefed/util/util.go
View file @
748ea110
...
...
@@ -302,6 +302,6 @@ func ClusterServiceAccountName(joiningClusterName, hostContext string) string {
// ClusterRoleName returns the name of a ClusterRole and its associated
// ClusterRoleBinding that are used to allow the service account to
// access necessary resources on the cluster.
func
ClusterRoleName
(
serviceAccountName
string
)
string
{
return
fmt
.
Sprintf
(
"federation-controller-manager:%s
"
,
serviceAccountName
)
func
ClusterRoleName
(
federationName
,
serviceAccountName
string
)
string
{
return
fmt
.
Sprintf
(
"federation-controller-manager:%s
-%s"
,
federationName
,
serviceAccountName
)
}
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