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
21dbeb53
Commit
21dbeb53
authored
Nov 13, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16714 from liggitt/tolerate_exists_errors
Auto commit by PR queue bot
parents
3550df30
974af49e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
serviceaccounts_controller.go
pkg/controller/serviceaccount/serviceaccounts_controller.go
+5
-3
No files found.
pkg/controller/serviceaccount/serviceaccounts_controller.go
View file @
21dbeb53
...
...
@@ -22,6 +22,7 @@ import (
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
apierrs
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/client/cache"
client
"k8s.io/kubernetes/pkg/client/unversioned"
...
...
@@ -206,17 +207,18 @@ func (e *ServiceAccountsController) createServiceAccountIfNeeded(name, namespace
e
.
createServiceAccount
(
name
,
namespace
)
}
// create
DefaultServiceAccount creates a default ServiceAccount in the specifie
d namespace
// create
ServiceAccount creates a ServiceAccount with the specified name an
d namespace
func
(
e
*
ServiceAccountsController
)
createServiceAccount
(
name
,
namespace
string
)
{
serviceAccount
:=
&
api
.
ServiceAccount
{}
serviceAccount
.
Name
=
name
serviceAccount
.
Namespace
=
namespace
if
_
,
err
:=
e
.
client
.
ServiceAccounts
(
namespace
)
.
Create
(
serviceAccount
);
err
!=
nil
{
_
,
err
:=
e
.
client
.
ServiceAccounts
(
namespace
)
.
Create
(
serviceAccount
)
if
err
!=
nil
&&
!
apierrs
.
IsAlreadyExists
(
err
)
{
glog
.
Error
(
err
)
}
}
// get
Default
ServiceAccount returns the ServiceAccount with the given name for the given namespace
// getServiceAccount returns the ServiceAccount with the given name for the given namespace
func
(
e
*
ServiceAccountsController
)
getServiceAccount
(
name
,
namespace
string
)
(
*
api
.
ServiceAccount
,
error
)
{
key
:=
&
api
.
ServiceAccount
{
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
namespace
}}
accounts
,
err
:=
e
.
serviceAccounts
.
Index
(
"namespace"
,
key
)
...
...
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