From 7b82154c4c2915b9b91512ca4b426aa8181e45d3 Mon Sep 17 00:00:00 2001 From: Karen Bradshaw Date: Thu, 7 Mar 2019 10:14:07 -0500 Subject: [PATCH 1/4] correct spelling, minor word ordering --- examples/transformerconfigs/README.md | 63 ++++++++++++++++----------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/examples/transformerconfigs/README.md b/examples/transformerconfigs/README.md index 292cc3e4b..ab93ab595 100644 --- a/examples/transformerconfigs/README.md +++ b/examples/transformerconfigs/README.md @@ -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 From 942e36e19f8c1ef310f60135a843f4fb9c98f109 Mon Sep 17 00:00:00 2001 From: Karen Bradshaw Date: Tue, 12 Mar 2019 21:18:18 -0400 Subject: [PATCH 2/4] a few more changes --- examples/transformerconfigs/README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/examples/transformerconfigs/README.md b/examples/transformerconfigs/README.md index ab93ab595..536978aaf 100644 --- a/examples/transformerconfigs/README.md +++ b/examples/transformerconfigs/README.md @@ -13,7 +13,7 @@ Each transformer takes a list of resources and modifies certain fields in the re ## FieldSpec -FieldSpec is a type that represents a path to a field in a resource such as `Job`. Here is the `fieldSpec` format: +FieldSpec is a type that represents a path to a field in one kind of resource, such as `Job`. ```yaml group: some-group @@ -27,7 +27,7 @@ If `create` is set to `true`, the transformer creates the path to the field in t ## 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: +The prefix/suffix transformer adds a prefix/suffix to the `metadata/name` field for all resources. Here is the default prefix transformer configuration: ```yaml namePrefix: @@ -51,7 +51,6 @@ commonLabels: - path: spec/selector/matchLabels create: true kind: Deployment -# add additional paths to resource fields ``` ## Name reference transformer @@ -69,7 +68,6 @@ fieldSpecs: path: spec/template/spec/volumes/configMap/name - kind: Job path: spec/template/spec/volumes/configMap/name -# 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: @@ -95,13 +93,13 @@ nameReference: - path: spec/containers/env/valueFrom/secretKeyRef/name version: v1 kind: Pod - # add additional paths to resource fields ``` ## 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 transformer configurations. You can view the default transformer configurations by saving them to a local directory by calling kustomize config save -d. + +Kustomize also supports adding extra transformer configurations by adding configuration files in the 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 From 65886f12581c106b20a8ffc7c0401b19e5b4e829 Mon Sep 17 00:00:00 2001 From: Karen Bradshaw Date: Fri, 15 Mar 2019 16:34:47 -0400 Subject: [PATCH 3/4] address comments --- examples/transformerconfigs/README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/transformerconfigs/README.md b/examples/transformerconfigs/README.md index 536978aaf..293ae7332 100644 --- a/examples/transformerconfigs/README.md +++ b/examples/transformerconfigs/README.md @@ -1,19 +1,21 @@ # Transformer Configurations -Kustomize computes the configuration of a resource by applying a series of transformers: +Kustomize creates new resources by applying a series of transformations to an original +set of resources. Kustomize provides the following default transformers: -- namespace transformer -- prefix/suffix transformer -- label transformer -- annotation transformer -- name reference transformer -- variable reference transformer +- namespace +- prefix/suffix +- label +- annotation +- name reference +- variable reference -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. +A `fieldSpec` list, in a transformer's configuration, determines which resource types and which fields +within those types the transformer can modify. ## FieldSpec -FieldSpec is a type that represents a path to a field in one kind of resource, such as `Job`. +FieldSpec is a type that represents a path to a field in one kind of resource. ```yaml group: some-group @@ -97,10 +99,8 @@ nameReference: ## Customizing transformer configurations -Kustomize has a default set of transformer configurations. You can view the default transformer configurations by saving them to a local directory by calling kustomize config save -d. - -Kustomize also supports adding extra transformer configurations by adding configuration files in the kustomization.yaml file. This tutorial shows how to customize those configurations to: +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`, and then modify and use these configurations. Kustomize also supports adding new transformer configurations to kustomization.yaml. 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 +- add extra fields for name reference \ No newline at end of file From f850ca63f4311712a1b7f1d39dd7ccfefaa2c139 Mon Sep 17 00:00:00 2001 From: Karen Bradshaw Date: Sat, 16 Mar 2019 16:49:16 -0400 Subject: [PATCH 4/4] remove extra comment --- examples/transformerconfigs/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/transformerconfigs/README.md b/examples/transformerconfigs/README.md index 293ae7332..dcab70902 100644 --- a/examples/transformerconfigs/README.md +++ b/examples/transformerconfigs/README.md @@ -57,7 +57,7 @@ commonLabels: ## 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. +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 @@ -85,7 +85,7 @@ nameReference: - path: spec/containers/env/valueFrom/configMapKeyRef/name version: v1 kind: Pod - # add additional paths to resource fields + # ... - kind: Secret version: v1 fieldSpecs: @@ -99,7 +99,7 @@ nameReference: ## 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`, and then modify and use these configurations. Kustomize also supports adding new transformer configurations to kustomization.yaml. This tutorial shows how to customize those configurations to: +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`, and modify and use these configurations. Kustomize also supports adding new transformer configurations to kustomization.yaml. This tutorial shows how to customize those configurations to: - [support a CRD type](crd/README.md) - add extra fields for variable substitution