mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-09-15 12:18:57 +00:00
Merge pull request #2641 from jijiew/doc
doc for kustomize config delete setter
This commit is contained in:
65
cmd/config/docs/commands/delete-setter.md
Normal file
65
cmd/config/docs/commands/delete-setter.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
## delete-setter
|
||||||
|
|
||||||
|
[Alpha] Delete a custom setter for a Resource field
|
||||||
|
|
||||||
|
### Synopsis
|
||||||
|
|
||||||
|
Delete a custom setter for a Resource field.
|
||||||
|
|
||||||
|
DIR
|
||||||
|
|
||||||
|
A directory containing Resource configuration.
|
||||||
|
|
||||||
|
NAME
|
||||||
|
|
||||||
|
The name of the setter to create.
|
||||||
|
|
||||||
|
### Deleting a Custom Setter
|
||||||
|
|
||||||
|
**Given the YAML:**
|
||||||
|
|
||||||
|
# resource.yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
...
|
||||||
|
spec:
|
||||||
|
...
|
||||||
|
ports:
|
||||||
|
...
|
||||||
|
- name: http
|
||||||
|
port: 8080 # {"type":"integer","x-kustomize":{"partialFieldSetters":[{"name":"http-port","value":"8080"}]}}
|
||||||
|
...
|
||||||
|
|
||||||
|
**Delete setter:**
|
||||||
|
|
||||||
|
# delete a setter for ports
|
||||||
|
$ kustomize cfg set create DIR/ http-port
|
||||||
|
|
||||||
|
comment will be removed for this field is not settable any more.
|
||||||
|
|
||||||
|
**Newly modified YAML:**
|
||||||
|
|
||||||
|
# resource.yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
...
|
||||||
|
spec:
|
||||||
|
...
|
||||||
|
ports:
|
||||||
|
...
|
||||||
|
- name: http
|
||||||
|
port: 8080
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
### Deleting a setter used in substitution
|
||||||
|
|
||||||
|
If the setter is also used in substitution, it will ask you to delete the substitution first.
|
||||||
|
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
# delete a setter for port
|
||||||
|
kustomize cfg create-setter DIR/ port
|
||||||
@@ -6,6 +6,7 @@ package commands
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"sigs.k8s.io/kustomize/cmd/config/ext"
|
"sigs.k8s.io/kustomize/cmd/config/ext"
|
||||||
|
"sigs.k8s.io/kustomize/cmd/config/internal/generateddocs/commands"
|
||||||
"sigs.k8s.io/kustomize/kyaml/openapi"
|
"sigs.k8s.io/kustomize/kyaml/openapi"
|
||||||
"sigs.k8s.io/kustomize/kyaml/setters2/settersutil"
|
"sigs.k8s.io/kustomize/kyaml/setters2/settersutil"
|
||||||
)
|
)
|
||||||
@@ -16,9 +17,9 @@ func NewDeleteSetterRunner(parent string) *DeleteSetterRunner {
|
|||||||
c := &cobra.Command{
|
c := &cobra.Command{
|
||||||
Use: "delete-setter DIR NAME",
|
Use: "delete-setter DIR NAME",
|
||||||
Args: cobra.MinimumNArgs(2),
|
Args: cobra.MinimumNArgs(2),
|
||||||
Short: "delete values on Resources fields.",
|
Short: commands.DeleteSetterShort,
|
||||||
Long: "",
|
Long: commands.DeleteSetterLong,
|
||||||
Example: "",
|
Example: commands.DeleteSetterExamples,
|
||||||
PreRunE: r.preRunE,
|
PreRunE: r.preRunE,
|
||||||
RunE: r.runE,
|
RunE: r.runE,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,22 @@ var CreateSetterExamples = `
|
|||||||
kustomize cfg create-setter DIR/ image-tag v1.0.1 --type "string" \
|
kustomize cfg create-setter DIR/ image-tag v1.0.1 --type "string" \
|
||||||
--field image --description "current stable release"`
|
--field image --description "current stable release"`
|
||||||
|
|
||||||
|
var DeleteSetterShort = `[Alpha] Delete a custom setter for a Resource field`
|
||||||
|
var DeleteSetterLong = `
|
||||||
|
Delete a custom setter for a Resource field.
|
||||||
|
|
||||||
|
DIR
|
||||||
|
|
||||||
|
A directory containing Resource configuration.
|
||||||
|
|
||||||
|
NAME
|
||||||
|
|
||||||
|
The name of the setter to create.
|
||||||
|
`
|
||||||
|
var DeleteSetterExamples = `
|
||||||
|
# delete a setter for port
|
||||||
|
kustomize cfg create-setter DIR/ port`
|
||||||
|
|
||||||
var FmtShort = `[Alpha] Format yaml configuration files.`
|
var FmtShort = `[Alpha] Format yaml configuration files.`
|
||||||
var FmtLong = `
|
var FmtLong = `
|
||||||
[Alpha] Format yaml configuration files.
|
[Alpha] Format yaml configuration files.
|
||||||
|
|||||||
Reference in New Issue
Block a user