1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
## set
[Alpha] Set values on Resources fields values.
### Synopsis
Set values on Resources fields. May set either the complete or partial field value.
`set` identifies setters using field metadata published as OpenAPI extensions.
`set` parses both the Kubernetes OpenAPI, as well OpenAPI published inline in
the configuration as comments.
`set` maybe be used to:
- edit configuration programmatically from the cli
- create reusable bundles of configuration with custom setters
DIR
A directory containing Resource configuration.
NAME
Optional. The name of the setter to perform or display.
VALUE
Optional. The value to set on the field.
To print the possible setters for the Resources in a directory, run
`list-setters` on a directory -- e.g. `kustomize cfg list-setters DIR/`.
#### Tips
- A description of the value may be specified with `--description`.
- The last setter for the field's value may be defined with `--set-by`.
- Create custom setters on Resources, Kustomization.yaml's, patches, etc
The description and setBy fields are left unmodified unless specified with flags.
To create a custom setter for a field see: `kustomize help cfg create-setter`
### Examples
Resource YAML: Name Prefix Setter
# DIR/resources.yaml
...
metadata:
name: PREFIX-app1 # {"type":"string","x-kustomize":{"setter":[{"name":"name-prefix","value":"PREFIX"}]}}
...
---
...
metadata:
name: PREFIX-app2 # {"type":"string","x-kustomize":{"setter":[{"name":"name-prefix","value":"PREFIX"}]}}
...
List setters: Show the possible setters
$ config list-setters DIR/
NAME DESCRIPTION VALUE TYPE COUNT SETBY
name-prefix '' PREFIX string 2
Perform set: set a new value, owner and description
$ kustomize cfg set DIR/ name-prefix "test" --description "test environment" --set-by "dev"
set 2 values
List setters: Show the new values
$ config list-setters DIR/
NAME DESCRIPTION VALUE TYPE COUNT SETBY
name-prefix 'test environment' test string 2 dev
New Resource YAML:
# DIR/resources.yaml
...
metadata:
name: test-app1 # {"description":"test environment","type":"string","x-kustomize":{"setBy":"dev","setter":[{"name":"name-prefix","value":"test"}]}}
...
---
...
metadata:
name: test-app2 # {"description":"test environment","type":"string","x-kustomize":{"setBy":"dev","setter":[{"name":"name-prefix","value":"test"}]}}
...
|