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
466abb01
Unverified
Commit
466abb01
authored
Apr 09, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Apr 09, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #76233 from draveness/feature/refactor-framework-rc-util
refactor: remove unused function and add comments in rc util
parents
407269d9
7e63c16b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
41 deletions
+0
-41
rc_util.go
test/e2e/framework/rc_util.go
+0
-41
No files found.
test/e2e/framework/rc_util.go
View file @
466abb01
...
@@ -25,7 +25,6 @@ import (
...
@@ -25,7 +25,6 @@ import (
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/util/wait"
clientset
"k8s.io/client-go/kubernetes"
clientset
"k8s.io/client-go/kubernetes"
...
@@ -82,46 +81,6 @@ func RcByNameContainer(name string, replicas int32, image string, labels map[str
...
@@ -82,46 +81,6 @@ func RcByNameContainer(name string, replicas int32, image string, labels map[str
}
}
}
}
// ScaleRCByLabels scales an RC via ns/label lookup. If replicas == 0 it waits till
// none are running, otherwise it does what a synchronous scale operation would do.
func
ScaleRCByLabels
(
clientset
clientset
.
Interface
,
scalesGetter
scaleclient
.
ScalesGetter
,
ns
string
,
l
map
[
string
]
string
,
replicas
uint
)
error
{
listOpts
:=
metav1
.
ListOptions
{
LabelSelector
:
labels
.
SelectorFromSet
(
labels
.
Set
(
l
))
.
String
()}
rcs
,
err
:=
clientset
.
CoreV1
()
.
ReplicationControllers
(
ns
)
.
List
(
listOpts
)
if
err
!=
nil
{
return
err
}
if
len
(
rcs
.
Items
)
==
0
{
return
fmt
.
Errorf
(
"RC with labels %v not found in ns %v"
,
l
,
ns
)
}
Logf
(
"Scaling %v RCs with labels %v in ns %v to %v replicas."
,
len
(
rcs
.
Items
),
l
,
ns
,
replicas
)
for
_
,
labelRC
:=
range
rcs
.
Items
{
name
:=
labelRC
.
Name
if
err
:=
ScaleRC
(
clientset
,
scalesGetter
,
ns
,
name
,
replicas
,
false
);
err
!=
nil
{
return
err
}
rc
,
err
:=
clientset
.
CoreV1
()
.
ReplicationControllers
(
ns
)
.
Get
(
name
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
err
}
if
replicas
==
0
{
ps
,
err
:=
testutils
.
NewPodStore
(
clientset
,
rc
.
Namespace
,
labels
.
SelectorFromSet
(
rc
.
Spec
.
Selector
),
fields
.
Everything
())
if
err
!=
nil
{
return
err
}
defer
ps
.
Stop
()
if
err
=
waitForPodsGone
(
ps
,
10
*
time
.
Second
,
10
*
time
.
Minute
);
err
!=
nil
{
return
fmt
.
Errorf
(
"error while waiting for pods gone %s: %v"
,
name
,
err
)
}
}
else
{
if
err
:=
testutils
.
WaitForPodsWithLabelRunning
(
clientset
,
ns
,
labels
.
SelectorFromSet
(
labels
.
Set
(
rc
.
Spec
.
Selector
)));
err
!=
nil
{
return
err
}
}
}
return
nil
}
type
updateRcFunc
func
(
d
*
v1
.
ReplicationController
)
type
updateRcFunc
func
(
d
*
v1
.
ReplicationController
)
// UpdateReplicationControllerWithRetries retries updating the given rc on conflict with the following steps:
// UpdateReplicationControllerWithRetries retries updating the given rc on conflict with the following steps:
...
...
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