Merge pull request #1922 from bzub/cmd_config_docs

cmd/config: Documentation nits + updates.
This commit is contained in:
Jeff Regan
2019-12-11 12:59:41 -08:00
committed by GitHub
17 changed files with 182 additions and 190 deletions

View File

@@ -284,8 +284,7 @@ Following is an example of running the ` + "`" + `kustomize config run` + "`" +
name: http name: http
selector: selector:
app: nginx app: nginx
instance: my-instance instance: my-instance`
`
var ConfigIoLong = `# Configuration IO API Semantics var ConfigIoLong = `# Configuration IO API Semantics

View File

@@ -180,7 +180,7 @@ order they appear in the file).
would then write the container stdout back to example/, replacing the directory would then write the container stdout back to example/, replacing the directory
file contents. file contents.
See ` + "`" + `kustomize config help docs-fn` + "`" + ` for more details on writing functions. See ` + "`" + `kustomize help config docs-fn` + "`" + ` for more details on writing functions.
` `
var RunFnsExamples = ` var RunFnsExamples = `
kustomize config run example/` kustomize config run example/`
@@ -220,15 +220,15 @@ var TreeExamples = `
kustomize config tree my-dir/ --field "metadata.annotations.foo" kustomize config tree my-dir/ --field "metadata.annotations.foo"
# print the "foo"" annotation # print the "foo"" annotation
kubectl get all -o yaml | kustomize config tree my-dir/ --structure=graph \ kubectl get all -o yaml | kustomize config tree \
--field="status.conditions[type=Completed].status" --field="status.conditions[type=Completed].status"
# print live Resources from a cluster using graph for structure # print live Resources from a cluster using owners for graph structure
kubectl get all -o yaml | kustomize config tree --replicas --name --image --structure=graph kubectl get all -o yaml | kustomize config tree --replicas --name --image \
--graph-structure=owners
# print live Resources with status condition fields
# print live Resources using graph for structure kubectl get all -o yaml | kustomize config tree \
kubectl get all,applications,releasetracks -o yaml | kustomize config tree --structure=graph \
--name --image --replicas \ --name --image --replicas \
--field="status.conditions[type=Completed].status" \ --field="status.conditions[type=Completed].status" \
--field="status.conditions[type=Complete].status" \ --field="status.conditions[type=Complete].status" \

View File

@@ -146,7 +146,6 @@ var ConfigurationBasicsLong = `
- list elements may be indexed by a field value using list[field=value] - list elements may be indexed by a field value using list[field=value]
- '.' as part of a key or value may be escaped as '\.' - '.' as part of a key or value may be escaped as '\.'
$ kustomize config grep "spec.status.spec.containers[name=nginx].image=mysql:5\.6" wordpress/ $ kustomize config grep "spec.status.spec.containers[name=nginx].image=mysql:5\.6" wordpress/
apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1 apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
kind: Deployment kind: Deployment
@@ -166,7 +165,6 @@ var ConfigurationBasicsLong = `
tier: mysql tier: mysql
... ...
` + "`" + `grep` + "`" + ` may be used with kubectl to search for Resources in a cluster matching a value. ` + "`" + `grep` + "`" + ` may be used with kubectl to search for Resources in a cluster matching a value.
kubectl get all -o yaml | kustomize config grep "spec.replicas>0" | kustomize config tree --replicas kubectl get all -o yaml | kustomize config grep "spec.replicas>0" | kustomize config tree --replicas
@@ -323,7 +321,6 @@ var FunctionBasicsLong = `
re-run ` + "`" + `run` + "`" + `. this will apply the updated replicas to the generated Resources, re-run ` + "`" + `run` + "`" + `. this will apply the updated replicas to the generated Resources,
but keep the fields that you manually added to the generated Resource configuration. but keep the fields that you manually added to the generated Resource configuration.
# run the function # run the function
kustomize config run local-resource/ kustomize config run local-resource/

View File

@@ -23,7 +23,7 @@ Tutorials:
Run 'kustomize help config tutorial-TUTORIAL' Run 'kustomize help config tutorial-TUTORIAL'
$ kustomize help config tutorials-basics $ kustomize help config tutorials-command-basics
Command Documentation: Command Documentation:

View File

@@ -279,4 +279,3 @@ Following is an example of running the `kustomize config run` using the precedin
selector: selector:
app: nginx app: nginx
instance: my-instance instance: my-instance

View File

@@ -45,7 +45,7 @@ metadata:
config.kubernetes.io/index: 2 config.kubernetes.io/index: 2
``` ```
This represents the thrid Resource in the file. This represents the third Resource in the file.
### `config.kubernetes.io/local-config` ### `config.kubernetes.io/local-config`

View File

@@ -46,7 +46,7 @@ order they appear in the file).
would then write the container stdout back to example/, replacing the directory would then write the container stdout back to example/, replacing the directory
file contents. file contents.
See `kustomize config help docs-fn` for more details on writing functions. See `kustomize help config docs-fn` for more details on writing functions.
### Examples ### Examples

View File

@@ -38,15 +38,15 @@ from the cluster, the Resource graph structure may be used instead.
kustomize config tree my-dir/ --field "metadata.annotations.foo" kustomize config tree my-dir/ --field "metadata.annotations.foo"
# print the "foo"" annotation # print the "foo"" annotation
kubectl get all -o yaml | kustomize config tree my-dir/ --structure=graph \ kubectl get all -o yaml | kustomize config tree \
--field="status.conditions[type=Completed].status" --field="status.conditions[type=Completed].status"
# print live Resources from a cluster using graph for structure # print live Resources from a cluster using owners for graph structure
kubectl get all -o yaml | kustomize config tree --replicas --name --image --structure=graph kubectl get all -o yaml | kustomize config tree --replicas --name --image \
--graph-structure=owners
# print live Resources with status condition fields
# print live Resources using graph for structure kubectl get all -o yaml | kustomize config tree \
kubectl get all,applications,releasetracks -o yaml | kustomize config tree --structure=graph \
--name --image --replicas \ --name --image --replicas \
--field="status.conditions[type=Completed].status" \ --field="status.conditions[type=Completed].status" \
--field="status.conditions[type=Complete].status" \ --field="status.conditions[type=Complete].status" \

View File

@@ -142,7 +142,6 @@
- list elements may be indexed by a field value using list[field=value] - list elements may be indexed by a field value using list[field=value]
- '.' as part of a key or value may be escaped as '\.' - '.' as part of a key or value may be escaped as '\.'
$ kustomize config grep "spec.status.spec.containers[name=nginx].image=mysql:5\.6" wordpress/ $ kustomize config grep "spec.status.spec.containers[name=nginx].image=mysql:5\.6" wordpress/
apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1 apiVersion: apps/v1 # for k8s versions before 1.9.0 use apps/v1beta2 and before 1.8.0 use extensions/v1beta1
kind: Deployment kind: Deployment
@@ -162,7 +161,6 @@
tier: mysql tier: mysql
... ...
`grep` may be used with kubectl to search for Resources in a cluster matching a value. `grep` may be used with kubectl to search for Resources in a cluster matching a value.
kubectl get all -o yaml | kustomize config grep "spec.replicas>0" | kustomize config tree --replicas kubectl get all -o yaml | kustomize config grep "spec.replicas>0" | kustomize config tree --replicas

View File

@@ -44,7 +44,6 @@
re-run `run`. this will apply the updated replicas to the generated Resources, re-run `run`. this will apply the updated replicas to the generated Resources,
but keep the fields that you manually added to the generated Resource configuration. but keep the fields that you manually added to the generated Resource configuration.
# run the function # run the function
kustomize config run local-resource/ kustomize config run local-resource/

View File

@@ -17,9 +17,9 @@ Resource configuration, and looks for invalid configuration.
The function is invoked by authoring a [local Resource](local-resource) The function is invoked by authoring a [local Resource](local-resource)
with `metadata.configFn` and running: with `metadata.configFn` and running:
kustomize config run local-resources/ kustomize config run local-resource/
This exists non-zero if there is an error. This exits non-zero if there is an error.
## Running the Example ## Running the Example

View File

@@ -27,7 +27,7 @@ function input, and writing the function output.
The function is invoked by authoring a [local Resource](local-resource) The function is invoked by authoring a [local Resource](local-resource)
with `metadata.configFn` and running: with `metadata.configFn` and running:
kustomize config run local-resources/ kustomize config run local-resource/
This generates the `local-resources/config` directory containing the template output. This generates the `local-resources/config` directory containing the template output.
@@ -47,7 +47,7 @@ This will create the directory
local-resource/config local-resource/config
Add an annotation to the StatefulSet Resource and change the replica count of the Add an annotation to the Deployment Resource and change the replica count of the
`kind: Nginx` Resource in `example-use.yaml`. Rerun the template: `kind: Nginx` Resource in `example-use.yaml`. Rerun the template:
kustomize config run local-resource/ kustomize config run local-resource/

View File

@@ -22,7 +22,7 @@ heavy lifting of implementing the function interface.
The function is invoked by authoring a [local Resource](local-resource) The function is invoked by authoring a [local Resource](local-resource)
with `metadata.configFn` and running: with `metadata.configFn` and running:
kustomize config run local-resources/ kustomize config run local-resource/
This generates the `local-resources/config` directory containing the template output. This generates the `local-resources/config` directory containing the template output.

View File

@@ -17,7 +17,7 @@ Resource configuration, and looks for invalid configuration.
The function is invoked by authoring a [local Resource](local-resource) The function is invoked by authoring a [local Resource](local-resource)
with `metadata.configFn` and running: with `metadata.configFn` and running:
kustomize config run local-resources/ kustomize config run local-resource/
This exists non-zero if there is an error. This exists non-zero if there is an error.