Merge pull request #88739 from julianvmodesto/diff-server-side-field-manager
Set field manager for kubectl diff --server-side Kubernetes-commit: 58779450489888e1355357978311f09015b69d51
This commit is contained in:
commit
9a3954bf65
|
|
@ -568,7 +568,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/api",
|
||||
"Rev": "510bcd53e1cf"
|
||||
"Rev": "b3bd583303d6"
|
||||
},
|
||||
{
|
||||
"ImportPath": "k8s.io/apimachinery",
|
||||
|
|
|
|||
4
go.mod
4
go.mod
|
|
@ -37,7 +37,7 @@ require (
|
|||
golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7
|
||||
gopkg.in/yaml.v2 v2.2.8
|
||||
gotest.tools v2.2.0+incompatible // indirect
|
||||
k8s.io/api v0.0.0-20200307122242-510bcd53e1cf
|
||||
k8s.io/api v0.0.0-20200309160345-b3bd583303d6
|
||||
k8s.io/apimachinery v0.0.0-20200307122051-2b7fa1cb5395
|
||||
k8s.io/cli-runtime v0.0.0-20200307124427-99b536c4b997
|
||||
k8s.io/client-go v0.0.0-20200307122516-5194bac86967
|
||||
|
|
@ -54,7 +54,7 @@ require (
|
|||
replace (
|
||||
golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13
|
||||
golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13
|
||||
k8s.io/api => k8s.io/api v0.0.0-20200307122242-510bcd53e1cf
|
||||
k8s.io/api => k8s.io/api v0.0.0-20200309160345-b3bd583303d6
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200307122051-2b7fa1cb5395
|
||||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20200307124427-99b536c4b997
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20200307122516-5194bac86967
|
||||
|
|
|
|||
2
go.sum
2
go.sum
|
|
@ -306,7 +306,7 @@ gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
|
|||
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
k8s.io/api v0.0.0-20200307122242-510bcd53e1cf/go.mod h1:4LcBtPb1OoMEmTvQLypv2jGrtMEK8ZRCPQyc+uOSi4o=
|
||||
k8s.io/api v0.0.0-20200309160345-b3bd583303d6/go.mod h1:4LcBtPb1OoMEmTvQLypv2jGrtMEK8ZRCPQyc+uOSi4o=
|
||||
k8s.io/apimachinery v0.0.0-20200307122051-2b7fa1cb5395/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA=
|
||||
k8s.io/cli-runtime v0.0.0-20200307124427-99b536c4b997/go.mod h1:/iZjMCD5/3wfEqXl8DAqo58AJtq+BlFyUJOQUw3eeiw=
|
||||
k8s.io/client-go v0.0.0-20200307122516-5194bac86967/go.mod h1:Ys+cjVY1SiB17qdMz+qc3ItvCfnYLsgVt49tSUmvwTo=
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ type DiffOptions struct {
|
|||
FilenameOptions resource.FilenameOptions
|
||||
|
||||
ServerSideApply bool
|
||||
FieldManager string
|
||||
ForceConflicts bool
|
||||
|
||||
OpenAPISchema openapi.Resources
|
||||
|
|
@ -296,6 +297,7 @@ type InfoObject struct {
|
|||
OpenAPI openapi.Resources
|
||||
Force bool
|
||||
ServerSideApply bool
|
||||
FieldManager string
|
||||
ForceConflicts bool
|
||||
genericclioptions.IOStreams
|
||||
}
|
||||
|
|
@ -317,6 +319,7 @@ func (obj InfoObject) Merged() (runtime.Object, error) {
|
|||
}
|
||||
options := metav1.PatchOptions{
|
||||
Force: &obj.ForceConflicts,
|
||||
FieldManager: obj.FieldManager,
|
||||
DryRun: []string{metav1.DryRunAll},
|
||||
}
|
||||
return resource.NewHelper(obj.Info.Client, obj.Info.Mapping).Patch(
|
||||
|
|
@ -441,6 +444,7 @@ func (o *DiffOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error {
|
|||
}
|
||||
|
||||
o.ServerSideApply = cmdutil.GetServerSideApplyFlag(cmd)
|
||||
o.FieldManager = cmdutil.GetFieldManagerFlag(cmd)
|
||||
o.ForceConflicts = cmdutil.GetForceConflictsFlag(cmd)
|
||||
if o.ForceConflicts && !o.ServerSideApply {
|
||||
return fmt.Errorf("--force-conflicts only works with --server-side")
|
||||
|
|
@ -529,6 +533,7 @@ func (o *DiffOptions) Run() error {
|
|||
OpenAPI: o.OpenAPISchema,
|
||||
Force: force,
|
||||
ServerSideApply: o.ServerSideApply,
|
||||
FieldManager: o.FieldManager,
|
||||
ForceConflicts: o.ForceConflicts,
|
||||
IOStreams: o.Diff.IOStreams,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue