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
98a52fd6
Commit
98a52fd6
authored
Mar 13, 2017
by
Klaus Ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generated client-go.
parent
3f24d465
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
helpers.go
staging/src/k8s.io/client-go/pkg/api/helpers.go
+3
-3
helpers.go
staging/src/k8s.io/client-go/pkg/api/v1/helpers.go
+5
-5
No files found.
staging/src/k8s.io/client-go/pkg/api/helpers.go
View file @
98a52fd6
...
@@ -467,7 +467,7 @@ const (
...
@@ -467,7 +467,7 @@ const (
// AddOrUpdateTolerationInPod tries to add a toleration to the pod's toleration list.
// AddOrUpdateTolerationInPod tries to add a toleration to the pod's toleration list.
// Returns true if something was updated, false otherwise.
// Returns true if something was updated, false otherwise.
func
AddOrUpdateTolerationInPod
(
pod
*
Pod
,
toleration
*
Toleration
)
(
bool
,
error
)
{
func
AddOrUpdateTolerationInPod
(
pod
*
Pod
,
toleration
*
Toleration
)
bool
{
podTolerations
:=
pod
.
Spec
.
Tolerations
podTolerations
:=
pod
.
Spec
.
Tolerations
var
newTolerations
[]
Toleration
var
newTolerations
[]
Toleration
...
@@ -475,7 +475,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
...
@@ -475,7 +475,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
for
i
:=
range
podTolerations
{
for
i
:=
range
podTolerations
{
if
toleration
.
MatchToleration
(
&
podTolerations
[
i
])
{
if
toleration
.
MatchToleration
(
&
podTolerations
[
i
])
{
if
Semantic
.
DeepEqual
(
toleration
,
podTolerations
[
i
])
{
if
Semantic
.
DeepEqual
(
toleration
,
podTolerations
[
i
])
{
return
false
,
nil
return
false
}
}
newTolerations
=
append
(
newTolerations
,
*
toleration
)
newTolerations
=
append
(
newTolerations
,
*
toleration
)
updated
=
true
updated
=
true
...
@@ -490,7 +490,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
...
@@ -490,7 +490,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
}
}
pod
.
Spec
.
Tolerations
=
newTolerations
pod
.
Spec
.
Tolerations
=
newTolerations
return
true
,
nil
return
true
}
}
// MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>,
// MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>,
...
...
staging/src/k8s.io/client-go/pkg/api/v1/helpers.go
View file @
98a52fd6
...
@@ -276,9 +276,9 @@ const (
...
@@ -276,9 +276,9 @@ const (
AffinityAnnotationKey
string
=
"scheduler.alpha.kubernetes.io/affinity"
AffinityAnnotationKey
string
=
"scheduler.alpha.kubernetes.io/affinity"
)
)
//
Tries to add a toleration to annotations list. Returns true if something was updated
//
AddOrUpdateTolerationInPod tries to add a toleration to the pod's toleration list.
// false otherwise.
//
Returns true if something was updated,
false otherwise.
func
AddOrUpdateTolerationInPod
(
pod
*
Pod
,
toleration
*
Toleration
)
(
bool
,
error
)
{
func
AddOrUpdateTolerationInPod
(
pod
*
Pod
,
toleration
*
Toleration
)
bool
{
podTolerations
:=
pod
.
Spec
.
Tolerations
podTolerations
:=
pod
.
Spec
.
Tolerations
var
newTolerations
[]
Toleration
var
newTolerations
[]
Toleration
...
@@ -286,7 +286,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
...
@@ -286,7 +286,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
for
i
:=
range
podTolerations
{
for
i
:=
range
podTolerations
{
if
toleration
.
MatchToleration
(
&
podTolerations
[
i
])
{
if
toleration
.
MatchToleration
(
&
podTolerations
[
i
])
{
if
api
.
Semantic
.
DeepEqual
(
toleration
,
podTolerations
[
i
])
{
if
api
.
Semantic
.
DeepEqual
(
toleration
,
podTolerations
[
i
])
{
return
false
,
nil
return
false
}
}
newTolerations
=
append
(
newTolerations
,
*
toleration
)
newTolerations
=
append
(
newTolerations
,
*
toleration
)
updated
=
true
updated
=
true
...
@@ -301,7 +301,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
...
@@ -301,7 +301,7 @@ func AddOrUpdateTolerationInPod(pod *Pod, toleration *Toleration) (bool, error)
}
}
pod
.
Spec
.
Tolerations
=
newTolerations
pod
.
Spec
.
Tolerations
=
newTolerations
return
true
,
nil
return
true
}
}
// MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>,
// MatchToleration checks if the toleration matches tolerationToMatch. Tolerations are unique by <key,effect,operator,value>,
...
...
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