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
e28404b2
Commit
e28404b2
authored
Dec 02, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #17946 from jhadvig/label_msg
Auto commit by PR queue bot
parents
c76ff237
f55809b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
label.go
pkg/kubectl/cmd/label.go
+13
-1
No files found.
pkg/kubectl/cmd/label.go
View file @
e28404b2
...
@@ -20,6 +20,7 @@ import (
...
@@ -20,6 +20,7 @@ import (
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"io"
"io"
"reflect"
"strings"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
...
@@ -227,6 +228,7 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri
...
@@ -227,6 +228,7 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri
}
}
var
outputObj
runtime
.
Object
var
outputObj
runtime
.
Object
dataChangeMsg
:=
"not labeled"
if
cmdutil
.
GetFlagBool
(
cmd
,
"dry-run"
)
{
if
cmdutil
.
GetFlagBool
(
cmd
,
"dry-run"
)
{
err
=
labelFunc
(
info
.
Object
,
overwrite
,
resourceVersion
,
lbls
,
remove
)
err
=
labelFunc
(
info
.
Object
,
overwrite
,
resourceVersion
,
lbls
,
remove
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -239,6 +241,13 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri
...
@@ -239,6 +241,13 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
meta
,
err
:=
api
.
ObjectMetaFor
(
obj
)
for
_
,
label
:=
range
remove
{
if
_
,
ok
:=
meta
.
Labels
[
label
];
!
ok
{
fmt
.
Fprintf
(
out
,
"label %q not found.
\n
"
,
label
)
}
}
if
err
:=
labelFunc
(
obj
,
overwrite
,
resourceVersion
,
lbls
,
remove
);
err
!=
nil
{
if
err
:=
labelFunc
(
obj
,
overwrite
,
resourceVersion
,
lbls
,
remove
);
err
!=
nil
{
return
err
return
err
}
}
...
@@ -246,6 +255,9 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri
...
@@ -246,6 +255,9 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
if
!
reflect
.
DeepEqual
(
oldData
,
newData
)
{
dataChangeMsg
=
"labeled"
}
patchBytes
,
err
:=
strategicpatch
.
CreateTwoWayMergePatch
(
oldData
,
newData
,
obj
)
patchBytes
,
err
:=
strategicpatch
.
CreateTwoWayMergePatch
(
oldData
,
newData
,
obj
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -267,7 +279,7 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri
...
@@ -267,7 +279,7 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri
if
outputFormat
!=
""
{
if
outputFormat
!=
""
{
return
f
.
PrintObject
(
cmd
,
outputObj
,
out
)
return
f
.
PrintObject
(
cmd
,
outputObj
,
out
)
}
}
cmdutil
.
PrintSuccess
(
mapper
,
false
,
out
,
info
.
Mapping
.
Resource
,
info
.
Name
,
"labeled"
)
cmdutil
.
PrintSuccess
(
mapper
,
false
,
out
,
info
.
Mapping
.
Resource
,
info
.
Name
,
dataChangeMsg
)
return
nil
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