Merge pull request #38445 from brendandburns/configmap2

Automatic merge from submit-queue (batch tested with PRs 38445, 40292)

Add the ability to edit fields within a config map.

Addresses part of https://github.com/kubernetes/kubernetes/issues/36222

Example command:

```console
$ kubectl edit configmap foo --config-map-data=bar
```

Will open the data element named `bar` in the `ConfigMap` named `foo` in `$EDITOR`, the edited contents are then updated back to the config map.

@kubernetes/sig-cli 

```release-note
Add a special purpose tool for editing individual fields in a ConfigMap with kubectl
```
This commit is contained in:
Kubernetes Submit Queue
2017-01-23 08:11:06 -08:00
committed by GitHub
7 changed files with 118 additions and 1 deletions

View File

@@ -101,12 +101,20 @@ func NewCmdEdit(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
Long: editLong,
Example: fmt.Sprintf(editExample),
Run: func(cmd *cobra.Command, args []string) {
args = append([]string{"configmap"}, args...)
err := RunEdit(f, out, errOut, cmd, args, options)
cmdutil.CheckErr(err)
},
ValidArgs: validArgs,
ArgAliases: argAliases,
}
addEditFlags(cmd, options)
cmd.AddCommand(NewCmdEditConfigMap(f, out, errOut))
return cmd
}
func addEditFlags(cmd *cobra.Command, options *resource.FilenameOptions) {
usage := "to use to edit the resource"
cmdutil.AddFilenameOptionFlags(cmd, options, usage)
cmdutil.AddValidateFlags(cmd)
@@ -116,7 +124,6 @@ func NewCmdEdit(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
cmdutil.AddApplyAnnotationFlags(cmd)
cmdutil.AddRecordFlag(cmd)
cmdutil.AddInclude3rdPartyFlags(cmd)
return cmd
}
func RunEdit(f cmdutil.Factory, out, errOut io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions) error {