mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Record kubectl commands
This commit is contained in:
@@ -95,6 +95,7 @@ func NewCmdExposeService(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
usage := "Filename, directory, or URL to a file identifying the resource to expose a service"
|
||||
kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage)
|
||||
cmdutil.AddApplyAnnotationFlags(cmd)
|
||||
cmdutil.AddRecordFlag(cmd)
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -210,6 +211,12 @@ func RunExpose(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []str
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if cmdutil.ShouldRecord(cmd, info) {
|
||||
if err := cmdutil.RecordChangeCause(object, f.Command()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
info.Refresh(object, true)
|
||||
// TODO: extract this flag to a central location, when such a location exists.
|
||||
if cmdutil.GetFlagBool(cmd, "dry-run") {
|
||||
return f.PrintObject(cmd, object, out)
|
||||
|
||||
Reference in New Issue
Block a user