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
a11819e4
Commit
a11819e4
authored
May 12, 2015
by
Derek Carr
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8057 from kargakis/rework-resize
resize: Use Resize method
parents
1e5b19dd
69a96f3e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
17 deletions
+10
-17
resize.go
pkg/kubectl/cmd/resize.go
+5
-10
resize.go
pkg/kubectl/resize.go
+5
-7
No files found.
pkg/kubectl/cmd/resize.go
View file @
a11819e4
...
...
@@ -26,7 +26,6 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl"
cmdutil
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/resource"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/wait"
)
const
(
...
...
@@ -105,15 +104,11 @@ func RunResize(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []str
resourceVersion
:=
cmdutil
.
GetFlagString
(
cmd
,
"resource-version"
)
currentSize
:=
cmdutil
.
GetFlagInt
(
cmd
,
"current-replicas"
)
precondition
:=
&
kubectl
.
ResizePrecondition
{
currentSize
,
resourceVersion
}
cond
:=
kubectl
.
ResizeCondition
(
resizer
,
precondition
,
info
.
Namespace
,
info
.
Name
,
uint
(
count
))
msg
:=
"resized"
if
err
=
wait
.
Poll
(
retryFrequency
,
retryTimeout
,
cond
);
err
!=
nil
{
msg
=
fmt
.
Sprintf
(
"Failed to resize controller in spite of retrying for %s"
,
retryTimeout
)
if
err
!=
nil
{
return
err
}
retry
:=
&
kubectl
.
RetryParams
{
Interval
:
retryFrequency
,
Timeout
:
retryTimeout
}
if
err
:=
resizer
.
Resize
(
info
.
Namespace
,
info
.
Name
,
uint
(
count
),
precondition
,
retry
,
nil
);
err
!=
nil
{
return
err
}
fmt
.
Fprint
f
(
out
,
"%s
\n
"
,
msg
)
fmt
.
Fprint
(
out
,
"resized
\n
"
)
return
nil
}
pkg/kubectl/resize.go
View file @
a11819e4
...
...
@@ -102,7 +102,7 @@ type ReplicationControllerResizer struct {
}
type
RetryParams
struct
{
interval
,
t
imeout
time
.
Duration
Interval
,
T
imeout
time
.
Duration
}
func
NewRetryParams
(
interval
,
timeout
time
.
Duration
)
*
RetryParams
{
...
...
@@ -153,18 +153,16 @@ func (resizer *ReplicationControllerResizer) Resize(namespace, name string, newS
}
if
retry
==
nil
{
// Make it try only once, immediately
retry
=
&
RetryParams
{
interval
:
time
.
Millisecond
,
t
imeout
:
time
.
Millisecond
}
retry
=
&
RetryParams
{
Interval
:
time
.
Millisecond
,
T
imeout
:
time
.
Millisecond
}
}
cond
:=
ResizeCondition
(
resizer
,
preconditions
,
namespace
,
name
,
newSize
)
if
err
:=
wait
.
Poll
(
retry
.
interval
,
retry
.
t
imeout
,
cond
);
err
!=
nil
{
if
err
:=
wait
.
Poll
(
retry
.
Interval
,
retry
.
T
imeout
,
cond
);
err
!=
nil
{
return
err
}
if
waitForReplicas
!=
nil
{
rc
:=
&
api
.
ReplicationController
{
ObjectMeta
:
api
.
ObjectMeta
{
Namespace
:
namespace
,
Name
:
name
}}
if
err
:=
wait
.
Poll
(
waitForReplicas
.
interval
,
waitForReplicas
.
timeout
,
resizer
.
c
.
ControllerHasDesiredReplicas
(
rc
));
err
!=
nil
{
return
err
}
return
wait
.
Poll
(
waitForReplicas
.
Interval
,
waitForReplicas
.
Timeout
,
resizer
.
c
.
ControllerHasDesiredReplicas
(
rc
))
}
return
nil
}
...
...
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