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
ff386b7a
Commit
ff386b7a
authored
Feb 01, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #20093 from liggitt/annotate_label_patch
Auto commit by PR queue bot
parents
174521ee
d7f547b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
annotate.go
pkg/kubectl/cmd/annotate.go
+9
-2
label.go
pkg/kubectl/cmd/label.go
+8
-2
No files found.
pkg/kubectl/cmd/annotate.go
View file @
ff386b7a
...
...
@@ -23,6 +23,7 @@ import (
"io"
"strings"
"github.com/golang/glog"
"github.com/spf13/cobra"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/kubectl"
...
...
@@ -206,8 +207,9 @@ func (o AnnotateOptions) RunAnnotate() error {
return
err
}
patchBytes
,
err
:=
strategicpatch
.
CreateTwoWayMergePatch
(
oldData
,
newData
,
obj
)
createdPatch
:=
err
==
nil
if
err
!=
nil
{
return
err
glog
.
V
(
2
)
.
Infof
(
"couldn't compute patch: %v"
,
err
)
}
mapping
:=
info
.
ResourceMapping
()
...
...
@@ -217,7 +219,12 @@ func (o AnnotateOptions) RunAnnotate() error {
}
helper
:=
resource
.
NewHelper
(
client
,
mapping
)
outputObj
,
err
:=
helper
.
Patch
(
namespace
,
name
,
api
.
StrategicMergePatchType
,
patchBytes
)
var
outputObj
runtime
.
Object
if
createdPatch
{
outputObj
,
err
=
helper
.
Patch
(
namespace
,
name
,
api
.
StrategicMergePatchType
,
patchBytes
)
}
else
{
outputObj
,
err
=
helper
.
Replace
(
namespace
,
name
,
false
,
obj
)
}
if
err
!=
nil
{
return
err
}
...
...
pkg/kubectl/cmd/label.go
View file @
ff386b7a
...
...
@@ -23,6 +23,7 @@ import (
"reflect"
"strings"
"github.com/golang/glog"
"github.com/spf13/cobra"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/kubectl"
...
...
@@ -259,8 +260,9 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri
dataChangeMsg
=
"labeled"
}
patchBytes
,
err
:=
strategicpatch
.
CreateTwoWayMergePatch
(
oldData
,
newData
,
obj
)
createdPatch
:=
err
==
nil
if
err
!=
nil
{
return
err
glog
.
V
(
2
)
.
Infof
(
"couldn't compute patch: %v"
,
err
)
}
mapping
:=
info
.
ResourceMapping
()
...
...
@@ -270,7 +272,11 @@ func RunLabel(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []stri
}
helper
:=
resource
.
NewHelper
(
client
,
mapping
)
outputObj
,
err
=
helper
.
Patch
(
namespace
,
name
,
api
.
StrategicMergePatchType
,
patchBytes
)
if
createdPatch
{
outputObj
,
err
=
helper
.
Patch
(
namespace
,
name
,
api
.
StrategicMergePatchType
,
patchBytes
)
}
else
{
outputObj
,
err
=
helper
.
Replace
(
namespace
,
name
,
false
,
obj
)
}
if
err
!=
nil
{
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