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
0bf25618
Unverified
Commit
0bf25618
authored
Feb 21, 2018
by
Maciej Szulik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate kubectl scale job
parent
6e6c4ce1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
cmd.go
pkg/kubectl/cmd/cmd.go
+1
-1
scale.go
pkg/kubectl/cmd/scale.go
+12
-8
No files found.
pkg/kubectl/cmd/cmd.go
View file @
0bf25618
...
@@ -270,7 +270,7 @@ func NewKubectlCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cob
...
@@ -270,7 +270,7 @@ func NewKubectlCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cob
Commands
:
[]
*
cobra
.
Command
{
Commands
:
[]
*
cobra
.
Command
{
rollout
.
NewCmdRollout
(
f
,
out
,
err
),
rollout
.
NewCmdRollout
(
f
,
out
,
err
),
NewCmdRollingUpdate
(
f
,
out
),
NewCmdRollingUpdate
(
f
,
out
),
NewCmdScale
(
f
,
out
),
NewCmdScale
(
f
,
out
,
err
),
NewCmdAutoscale
(
f
,
out
),
NewCmdAutoscale
(
f
,
out
),
},
},
},
},
...
...
pkg/kubectl/cmd/scale.go
View file @
0bf25618
...
@@ -57,7 +57,7 @@ var (
...
@@ -57,7 +57,7 @@ var (
)
)
// NewCmdScale returns a cobra command with the appropriate configuration and flags to run scale
// NewCmdScale returns a cobra command with the appropriate configuration and flags to run scale
func
NewCmdScale
(
f
cmdutil
.
Factory
,
out
io
.
Writer
)
*
cobra
.
Command
{
func
NewCmdScale
(
f
cmdutil
.
Factory
,
out
,
errOut
io
.
Writer
)
*
cobra
.
Command
{
options
:=
&
resource
.
FilenameOptions
{}
options
:=
&
resource
.
FilenameOptions
{}
validArgs
:=
[]
string
{
"deployment"
,
"replicaset"
,
"replicationcontroller"
,
"job"
,
"statefulset"
}
validArgs
:=
[]
string
{
"deployment"
,
"replicaset"
,
"replicationcontroller"
,
"job"
,
"statefulset"
}
...
@@ -72,7 +72,7 @@ func NewCmdScale(f cmdutil.Factory, out io.Writer) *cobra.Command {
...
@@ -72,7 +72,7 @@ func NewCmdScale(f cmdutil.Factory, out io.Writer) *cobra.Command {
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
cmdutil
.
CheckErr
(
cmdutil
.
ValidateOutputArgs
(
cmd
))
cmdutil
.
CheckErr
(
cmdutil
.
ValidateOutputArgs
(
cmd
))
shortOutput
:=
cmdutil
.
GetFlagString
(
cmd
,
"output"
)
==
"name"
shortOutput
:=
cmdutil
.
GetFlagString
(
cmd
,
"output"
)
==
"name"
err
:=
RunScale
(
f
,
out
,
cmd
,
args
,
shortOutput
,
options
)
err
:=
RunScale
(
f
,
out
,
errOut
,
cmd
,
args
,
shortOutput
,
options
)
cmdutil
.
CheckErr
(
err
)
cmdutil
.
CheckErr
(
err
)
},
},
ValidArgs
:
validArgs
,
ValidArgs
:
validArgs
,
...
@@ -95,12 +95,17 @@ func NewCmdScale(f cmdutil.Factory, out io.Writer) *cobra.Command {
...
@@ -95,12 +95,17 @@ func NewCmdScale(f cmdutil.Factory, out io.Writer) *cobra.Command {
}
}
// RunScale executes the scaling
// RunScale executes the scaling
func
RunScale
(
f
cmdutil
.
Factory
,
out
io
.
Writer
,
cmd
*
cobra
.
Command
,
args
[]
string
,
shortOutput
bool
,
options
*
resource
.
FilenameOptions
)
error
{
func
RunScale
(
f
cmdutil
.
Factory
,
out
,
errOut
io
.
Writer
,
cmd
*
cobra
.
Command
,
args
[]
string
,
shortOutput
bool
,
options
*
resource
.
FilenameOptions
)
error
{
cmdNamespace
,
enforceNamespace
,
err
:=
f
.
DefaultNamespace
()
cmdNamespace
,
enforceNamespace
,
err
:=
f
.
DefaultNamespace
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
count
:=
cmdutil
.
GetFlagInt
(
cmd
,
"replicas"
)
if
count
<
0
{
return
cmdutil
.
UsageErrorf
(
cmd
,
"The --replicas=COUNT flag is required, and COUNT must be greater than or equal to 0"
)
}
selector
:=
cmdutil
.
GetFlagString
(
cmd
,
"selector"
)
selector
:=
cmdutil
.
GetFlagString
(
cmd
,
"selector"
)
all
:=
cmdutil
.
GetFlagBool
(
cmd
,
"all"
)
all
:=
cmdutil
.
GetFlagBool
(
cmd
,
"all"
)
...
@@ -121,11 +126,6 @@ func RunScale(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []strin
...
@@ -121,11 +126,6 @@ func RunScale(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []strin
return
err
return
err
}
}
count
:=
cmdutil
.
GetFlagInt
(
cmd
,
"replicas"
)
if
count
<
0
{
return
cmdutil
.
UsageErrorf
(
cmd
,
"The --replicas=COUNT flag is required, and COUNT must be greater than or equal to 0"
)
}
infos
:=
[]
*
resource
.
Info
{}
infos
:=
[]
*
resource
.
Info
{}
err
=
r
.
Visit
(
func
(
info
*
resource
.
Info
,
err
error
)
error
{
err
=
r
.
Visit
(
func
(
info
*
resource
.
Info
,
err
error
)
error
{
if
err
==
nil
{
if
err
==
nil
{
...
@@ -146,6 +146,10 @@ func RunScale(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []strin
...
@@ -146,6 +146,10 @@ func RunScale(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []strin
}
}
mapping
:=
info
.
ResourceMapping
()
mapping
:=
info
.
ResourceMapping
()
if
mapping
.
Resource
==
"jobs"
{
fmt
.
Fprintf
(
errOut
,
"%s scale job is DEPRECATED and will be removed in a future version."
,
cmd
.
Parent
()
.
Name
())
}
scaler
,
err
:=
f
.
Scaler
(
mapping
)
scaler
,
err
:=
f
.
Scaler
(
mapping
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
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