mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 15:05:20 +00:00
Record kubectl commands
This commit is contained in:
@@ -97,6 +97,7 @@ func NewCmdEdit(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
cmd.Flags().String("output-version", "", "Output the formatted object with the given version (default api-version).")
|
||||
cmd.Flags().Bool("windows-line-endings", gruntime.GOOS == "windows", "Use Windows line-endings (default Unix line-endings)")
|
||||
cmdutil.AddApplyAnnotationFlags(cmd)
|
||||
cmdutil.AddRecordFlag(cmd)
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -232,6 +233,12 @@ func RunEdit(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []strin
|
||||
if err := kubectl.CreateOrUpdateAnnotation(cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag), updates, encoder); err != nil {
|
||||
return preservedFile(err, file, out)
|
||||
}
|
||||
if cmdutil.ShouldRecord(cmd, updates) {
|
||||
err = cmdutil.RecordChangeCause(updates.Object, f.Command())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// encode updates back to "edited" since we'll only generate patch from "edited"
|
||||
if edited, err = runtime.Encode(encoder, updates.Object); err != nil {
|
||||
return preservedFile(err, file, out)
|
||||
|
||||
Reference in New Issue
Block a user