correct spelling, minor word ordering

This commit is contained in:
Karen Bradshaw
2019-03-07 10:14:07 -05:00
parent 284efc709c
commit 7b82154c4c

View File

@@ -1,6 +1,7 @@
# Transformer Configurations
Kustomize computes the resources by applying a series of transformers:
Kustomize computes the configuration of a resource by applying a series of transformers:
- namespace transformer
- prefix/suffix transformer
- label transformer
@@ -8,30 +9,36 @@ Kustomize computes the resources by applying a series of transformers:
- name reference transformer
- variable reference transformer
Each transformer takes a list of resources and modifies certain fields. The modification is based on the transformer's rule.
The fields to update is the transformer's configuration, which is a list of filedspec that can be represented in YAML format.
Each transformer takes a list of resources and modifies certain fields in the resource based upon the transformer's configuration. A transformer's configuration is a list of `fieldSpec`, represented in YAML format.
## fieldSpec
FieldSpec is a type to represent a path to a field in one kind of resources. It has following format
```
## FieldSpec
FieldSpec is a type that represents a path to a field in a resource such as `Job`. Here is the `fieldSpec` format:
```yaml
group: some-group
version: some-version
kind: some-kind
path: path/to/the/field
create: false
```
If `create` is set to true, it indicates the transformer to create the path if it is not found in the resources. This is most useful for label and annotation transformers, where the path for labels or annotations may not be set before the transformation.
## prefix/suffix transformer
Name prefix suffix transformer adds prefix and suffix to the `metadata/name` field for all resources with following configuration:
```
If `create` is set to `true`, the transformer creates the path to the field in the resource if the path is not already found. This is most useful for label and annotation transformers, where the path for labels or annotations may not be set before the transformation.
## Prefix/suffix transformer
The prefix/suffix transformer adds a prefix/suffix to the `metadata/name` field for all resources. Here is an example of a prefix transformer configuration:
```yaml
namePrefix:
- path: metadata/name
```
## label transformer
Label transformer adds labels to `metadata/labels` field for all resources. It also adds labels to `spec/selector` field in all Service and to `spec/selector/matchLabels` field in all Deployment.
```
## Label transformer
The label transformer adds labels to the `metadata/labels` field for all resources. It also adds labels to the `spec/selector` field in all Service resources as well as the `spec/selector/matchLabels` field in all Deployment resources.
```yaml
commonLabels:
- path: metadata/labels
create: true
@@ -44,15 +51,17 @@ commonLabels:
- path: spec/selector/matchLabels
create: true
kind: Deployment
(etc.)
# add additional paths to resource fields
```
## name reference transformer
Name reference transformer's configuration is different from all other transformers. It contains a list of namebackreferences, which represented all the possible fields that a type could be used as a reference in other types of resources. A namebackreference contains a type such as ConfigMap as well as a list of FieldSpecs where ConfigMap is referenced. Here is an example.
```
## Name reference transformer
Name reference transformer's configuration is different from all other transformers. It contains a list of `nameReferences`, which represent all of the possible fields that a type could be used as a reference in other types of resources. A `nameReference` contains a type such as ConfigMap as well as a list of `fieldSpecs` where ConfigMap is referenced in other resources. Here is an example.
```yaml
kind: ConfigMap
version: v1
FieldSpecs:
fieldSpecs:
- kind: Pod
version: v1
path: spec/volumes/configMap/name
@@ -60,10 +69,12 @@ FieldSpecs:
path: spec/template/spec/volumes/configMap/name
- kind: Job
path: spec/template/spec/volumes/configMap/name
(etc.)
```
Name reference transformer configuration contains a list of such namebackreferences for ConfigMap, Secret, Service, Role, ServiceAccount and so on.
# add additional paths to resource fields
```
Name reference transformer's configuration contains a list of `nameReferences` for resources such as ConfigMap, Secret, Service, Role, and ServiceAccount. Here is an example configuration:
```yaml
nameReference:
- kind: ConfigMap
version: v1
@@ -74,7 +85,7 @@ nameReference:
- path: spec/containers/env/valueFrom/configMapKeyRef/name
version: v1
kind: Pod
(etc.)
# add additional paths to resource fields
- kind: Secret
version: v1
fieldSpecs:
@@ -84,12 +95,14 @@ nameReference:
- path: spec/containers/env/valueFrom/secretKeyRef/name
version: v1
kind: Pod
(etc.)
# add additional paths to resource fields
```
## customizing transformer configurations
## Customizing transformer configurations
Kustomize has a default set of transformer configurations. You can save the default transformer configurations
to a local directory by calling `kustomize config save -d`. Kustomize allows modifying those configuration files and using them in a kustomization.yaml file. This tutorial shows how to customize those configurations to:
Kustomize has a default set of configurations. They can be saved to local directory through `kustomize config save -d`. Kustomize allows modifying those configuration files and using them in kustomization.yaml file. This tutorial shows how to customize those configurations to
- [support a CRD type](crd/README.md)
- add extra fields for variable substitution
- add extra fields for name reference