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
83e06d9f
Unverified
Commit
83e06d9f
authored
Jan 25, 2017
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Add the ability to edit fields within a config map."
This reverts commit
31eca372
.
parent
5ab741de
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1 addition
and
118 deletions
+1
-118
.generated_docs
.generated_docs
+0
-2
kubectl-edit-configmap.1
docs/man/man1/kubectl-edit-configmap.1
+0
-3
kubectl_edit_configmap.md
docs/user-guide/kubectl/kubectl_edit_configmap.md
+0
-7
known-flags.txt
hack/verify-flags/known-flags.txt
+0
-1
BUILD
pkg/kubectl/cmd/BUILD
+0
-1
edit.go
pkg/kubectl/cmd/edit.go
+1
-8
edit_configmap.go
pkg/kubectl/cmd/edit_configmap.go
+0
-96
No files found.
.generated_docs
View file @
83e06d9f
...
@@ -58,7 +58,6 @@ docs/man/man1/kubectl-create.1
...
@@ -58,7 +58,6 @@ docs/man/man1/kubectl-create.1
docs/man/man1/kubectl-delete.1
docs/man/man1/kubectl-delete.1
docs/man/man1/kubectl-describe.1
docs/man/man1/kubectl-describe.1
docs/man/man1/kubectl-drain.1
docs/man/man1/kubectl-drain.1
docs/man/man1/kubectl-edit-configmap.1
docs/man/man1/kubectl-edit.1
docs/man/man1/kubectl-edit.1
docs/man/man1/kubectl-exec.1
docs/man/man1/kubectl-exec.1
docs/man/man1/kubectl-explain.1
docs/man/man1/kubectl-explain.1
...
@@ -143,7 +142,6 @@ docs/user-guide/kubectl/kubectl_delete.md
...
@@ -143,7 +142,6 @@ docs/user-guide/kubectl/kubectl_delete.md
docs/user-guide/kubectl/kubectl_describe.md
docs/user-guide/kubectl/kubectl_describe.md
docs/user-guide/kubectl/kubectl_drain.md
docs/user-guide/kubectl/kubectl_drain.md
docs/user-guide/kubectl/kubectl_edit.md
docs/user-guide/kubectl/kubectl_edit.md
docs/user-guide/kubectl/kubectl_edit_configmap.md
docs/user-guide/kubectl/kubectl_exec.md
docs/user-guide/kubectl/kubectl_exec.md
docs/user-guide/kubectl/kubectl_explain.md
docs/user-guide/kubectl/kubectl_explain.md
docs/user-guide/kubectl/kubectl_expose.md
docs/user-guide/kubectl/kubectl_expose.md
...
...
docs/man/man1/kubectl-edit-configmap.1
deleted
100644 → 0
View file @
5ab741de
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
docs/user-guide/kubectl/kubectl_edit_configmap.md
deleted
100644 → 0
View file @
5ab741de
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[

]()
<!-- END MUNGE: GENERATED_ANALYTICS -->
hack/verify-flags/known-flags.txt
View file @
83e06d9f
...
@@ -97,7 +97,6 @@ concurrent-resource-quota-syncs
...
@@ -97,7 +97,6 @@ concurrent-resource-quota-syncs
concurrent-serviceaccount-token-syncs
concurrent-serviceaccount-token-syncs
concurrent-service-syncs
concurrent-service-syncs
config-map
config-map
config-map-data
config-map-namespace
config-map-namespace
config-sync-period
config-sync-period
configure-cloud-routes
configure-cloud-routes
...
...
pkg/kubectl/cmd/BUILD
View file @
83e06d9f
...
@@ -38,7 +38,6 @@ go_library(
...
@@ -38,7 +38,6 @@ go_library(
"describe.go",
"describe.go",
"drain.go",
"drain.go",
"edit.go",
"edit.go",
"edit_configmap.go",
"exec.go",
"exec.go",
"explain.go",
"explain.go",
"expose.go",
"expose.go",
...
...
pkg/kubectl/cmd/edit.go
View file @
83e06d9f
...
@@ -101,20 +101,12 @@ func NewCmdEdit(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
...
@@ -101,20 +101,12 @@ func NewCmdEdit(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
Long
:
editLong
,
Long
:
editLong
,
Example
:
fmt
.
Sprintf
(
editExample
),
Example
:
fmt
.
Sprintf
(
editExample
),
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
args
=
append
([]
string
{
"configmap"
},
args
...
)
err
:=
RunEdit
(
f
,
out
,
errOut
,
cmd
,
args
,
options
)
err
:=
RunEdit
(
f
,
out
,
errOut
,
cmd
,
args
,
options
)
cmdutil
.
CheckErr
(
err
)
cmdutil
.
CheckErr
(
err
)
},
},
ValidArgs
:
validArgs
,
ValidArgs
:
validArgs
,
ArgAliases
:
argAliases
,
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"
usage
:=
"to use to edit the resource"
cmdutil
.
AddFilenameOptionFlags
(
cmd
,
options
,
usage
)
cmdutil
.
AddFilenameOptionFlags
(
cmd
,
options
,
usage
)
cmdutil
.
AddValidateFlags
(
cmd
)
cmdutil
.
AddValidateFlags
(
cmd
)
...
@@ -124,6 +116,7 @@ func addEditFlags(cmd *cobra.Command, options *resource.FilenameOptions) {
...
@@ -124,6 +116,7 @@ func addEditFlags(cmd *cobra.Command, options *resource.FilenameOptions) {
cmdutil
.
AddApplyAnnotationFlags
(
cmd
)
cmdutil
.
AddApplyAnnotationFlags
(
cmd
)
cmdutil
.
AddRecordFlag
(
cmd
)
cmdutil
.
AddRecordFlag
(
cmd
)
cmdutil
.
AddInclude3rdPartyFlags
(
cmd
)
cmdutil
.
AddInclude3rdPartyFlags
(
cmd
)
return
cmd
}
}
func
RunEdit
(
f
cmdutil
.
Factory
,
out
,
errOut
io
.
Writer
,
cmd
*
cobra
.
Command
,
args
[]
string
,
options
*
resource
.
FilenameOptions
)
error
{
func
RunEdit
(
f
cmdutil
.
Factory
,
out
,
errOut
io
.
Writer
,
cmd
*
cobra
.
Command
,
args
[]
string
,
options
*
resource
.
FilenameOptions
)
error
{
...
...
pkg/kubectl/cmd/edit_configmap.go
deleted
100644 → 0
View file @
5ab741de
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
cmd
import
(
"bytes"
"fmt"
"io"
"os"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/apis/meta/v1"
cmdutil
"k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/cmd/util/editor"
"k8s.io/kubernetes/pkg/kubectl/resource"
)
// NewCmdEditConfigMap is a macro command to edit config maps
func
NewCmdEditConfigMap
(
f
cmdutil
.
Factory
,
cmdOut
,
errOut
io
.
Writer
)
*
cobra
.
Command
{
options
:=
&
resource
.
FilenameOptions
{}
cmd
:=
&
cobra
.
Command
{
Use
:
"configmap"
,
Aliases
:
[]
string
{
"cm"
},
Short
:
"Edit a config map object."
,
Long
:
"Edit and update a config map object"
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
RunEditConfigMap
(
cmd
,
f
,
args
,
cmdOut
,
errOut
,
options
)
},
}
addEditFlags
(
cmd
,
options
)
cmd
.
Flags
()
.
String
(
"config-map-data"
,
""
,
"If non-empty, specify the name of a data slot in a config map to edit."
)
return
cmd
}
// RunEditConfigMap runs the edit command for config maps. It either edits the complete map
// or it edits individual files inside the config map.
func
RunEditConfigMap
(
cmd
*
cobra
.
Command
,
f
cmdutil
.
Factory
,
args
[]
string
,
cmdOut
,
errOut
io
.
Writer
,
options
*
resource
.
FilenameOptions
)
error
{
dataFile
:=
cmdutil
.
GetFlagString
(
cmd
,
"config-map-data"
)
if
len
(
dataFile
)
==
0
{
// We need to add the resource type back on to the front
args
=
append
([]
string
{
"configmap"
},
args
...
)
return
RunEdit
(
f
,
cmdOut
,
errOut
,
cmd
,
args
,
options
)
}
cmdNamespace
,
_
,
err
:=
f
.
DefaultNamespace
()
if
err
!=
nil
{
return
err
}
cs
,
err
:=
f
.
ClientSet
()
if
err
!=
nil
{
return
err
}
configMap
,
err
:=
cs
.
Core
()
.
ConfigMaps
(
cmdNamespace
)
.
Get
(
args
[
0
],
v1
.
GetOptions
{})
if
err
!=
nil
{
return
err
}
value
,
found
:=
configMap
.
Data
[
dataFile
]
if
!
found
{
keys
:=
[]
string
{}
for
key
:=
range
configMap
.
Data
{
keys
=
append
(
keys
,
key
)
}
return
fmt
.
Errorf
(
"No such data file (%s), filenames are: %v
\n
"
,
dataFile
,
keys
)
}
edit
:=
editor
.
NewDefaultEditor
(
os
.
Environ
())
data
,
file
,
err
:=
edit
.
LaunchTempFile
(
fmt
.
Sprintf
(
"%s-edit-"
,
dataFile
),
""
,
bytes
.
NewBuffer
([]
byte
(
value
)))
defer
func
()
{
os
.
Remove
(
file
)
}()
if
err
!=
nil
{
return
err
}
configMap
.
Data
[
dataFile
]
=
string
(
data
)
if
_
,
err
:=
cs
.
Core
()
.
ConfigMaps
(
cmdNamespace
)
.
Update
(
configMap
);
err
!=
nil
{
return
err
}
return
nil
}
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