From 9f2fe72f2742715e4ac5d40957c10830dde63a22 Mon Sep 17 00:00:00 2001 From: Nick Capps Date: Tue, 30 Jan 2024 17:51:01 -0800 Subject: [PATCH] Add fields to kustomization file ref --- .../Kustomization File/commonAnnotations.md | 15 ++++++-- .../API/Kustomization File/commonLabels.md | 16 +++++++-- .../API/Kustomization File/labels.md | 34 ++++++++++++++++-- .../API/Kustomization File/namePrefix.md | 15 ++++++-- .../API/Kustomization File/nameSuffix.md | 15 ++++++-- .../API/Kustomization File/namespace.md | 13 ++++++- .../API/Transformers/LabelTransformer.md | 29 +++++++++++++++ .../API/Transformers/NamespaceTransformer.md | 36 +++++++++++++++++++ .../API/Transformers/PrefixTransformer.md | 29 +++++++++++++++ .../API/Transformers/SuffixTransformer.md | 29 +++++++++++++++ 10 files changed, 220 insertions(+), 11 deletions(-) create mode 100644 site/content/en/docs/Reference/API/Transformers/LabelTransformer.md create mode 100644 site/content/en/docs/Reference/API/Transformers/NamespaceTransformer.md create mode 100644 site/content/en/docs/Reference/API/Transformers/PrefixTransformer.md create mode 100644 site/content/en/docs/Reference/API/Transformers/SuffixTransformer.md diff --git a/site/content/en/docs/Reference/API/Kustomization File/commonAnnotations.md b/site/content/en/docs/Reference/API/Kustomization File/commonAnnotations.md index 1c72a082a14..b27569702b2 100644 --- a/site/content/en/docs/Reference/API/Kustomization File/commonAnnotations.md +++ b/site/content/en/docs/Reference/API/Kustomization File/commonAnnotations.md @@ -4,7 +4,18 @@ linkTitle: "commonAnnotations" type: docs weight: 3 description: > - Add annotations to add all resources. + Add Annotations to all objects. --- +`apiVersion: kustomize.config.k8s.io/v1beta1` -The Tasks section contains examples of how to use [`commonAnnotations`](/docs/tasks/labels_and_annotations/). +See the [Tasks section] for examples of how to use `commonAnnotations`. + +### commonAnnotations +Adds [Annotations] to all objects. + +* **commonAnnotations** (map[string]string) + + Annotations to add to all objects. + +[Tasks section]: /docs/tasks/labels_and_annotations/ +[Annotations]: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ diff --git a/site/content/en/docs/Reference/API/Kustomization File/commonLabels.md b/site/content/en/docs/Reference/API/Kustomization File/commonLabels.md index b9d73b2bb34..2dcaed33942 100644 --- a/site/content/en/docs/Reference/API/Kustomization File/commonLabels.md +++ b/site/content/en/docs/Reference/API/Kustomization File/commonLabels.md @@ -4,7 +4,19 @@ linkTitle: "commonLabels" type: docs weight: 4 description: > - Add labels and selectors to add all resources. + Add Labels and Selectors to all objects. --- +`apiVersion: kustomize.config.k8s.io/v1beta1` -The Tasks section contains examples of how to use [`commonLabels`](/docs/tasks/labels_and_annotations/). +See the [Tasks section] for examples of how to use `commonLabels`. + +### commonLabels +Adds [Labels and Selectors] to objects. + +* **commonLabels** (map[string]string) + + Labels to add to all objects. Labels will be added to the object selector and template fields where applicable. + + +[Tasks section]: /docs/tasks/labels_and_annotations/ +[Labels and Selectors]: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ diff --git a/site/content/en/docs/Reference/API/Kustomization File/labels.md b/site/content/en/docs/Reference/API/Kustomization File/labels.md index 7ada7e9c7f4..73644398a94 100644 --- a/site/content/en/docs/Reference/API/Kustomization File/labels.md +++ b/site/content/en/docs/Reference/API/Kustomization File/labels.md @@ -4,7 +4,37 @@ linkTitle: "labels" type: docs weight: 10 description: > - Add labels and optionally selectors to all resources. + Add labels and optionally selectors to all objects. --- +`apiVersion: kustomize.config.k8s.io/v1beta1` -The Tasks section contains examples of how to use [`labels`](/docs/tasks/labels_and_annotations/). +See the [Tasks section] for examples of how to use `labels`. + +### labels +Adds labels and optionally selectors to all objects. + +* **labels** ([]Label) + + List of labels and label selector options. + + _Label holds labels to add to objects and options for customizing how those labels are applied, potentially using selectors and template metadata._ + + * **pairs** (map[string]string) + + Map of labels that the transformer will add to resources. + + * **includeSelectors** (bool), optional + + IncludeSelectors indicates whether the transformer should include the fieldSpecs for selectors. Custom fieldSpec specified by `fields` will be merged with builtin fieldSpecs if this is true. Defaults to false. + + * **includeTemplates** (bool), optional + + IncludeTemplates indicates whether the transformer should include the `spec/template/metadata` fieldSpec. Custom fieldSpecs specified by `fields` will be merged with the `spec/template/metadata` fieldSpec if this is true. If IncludeSelectors is true, IncludeTemplates is not needed. Defaults to false. + + * **fieldSpecs** (\[\][FieldSpec]({{< relref "../Common%20Definitions/FieldSpec.md" >}})), optional + + FieldSpecs specifies the field on each resource that LabelTransformer should add the label to. It essentially allows the user to re-define the field path of the Kubernetes labels field from `metadata/labels` for different resources. + + +[Tasks section]: /docs/tasks/labels_and_annotations/ +[Labels and Selectors]: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ diff --git a/site/content/en/docs/Reference/API/Kustomization File/namePrefix.md b/site/content/en/docs/Reference/API/Kustomization File/namePrefix.md index d88d6177750..1d6d8e063c1 100644 --- a/site/content/en/docs/Reference/API/Kustomization File/namePrefix.md +++ b/site/content/en/docs/Reference/API/Kustomization File/namePrefix.md @@ -4,7 +4,18 @@ linkTitle: "namePrefix" type: docs weight: 11 description: > - Prepends the value to the names of all resources and references. + Add prefixes to the names of all resources. --- +`apiVersion: kustomize.config.k8s.io/v1beta1` -The Tasks section contains examples of how to use [`namePrefix`](/docs/tasks/namespaces_and_names/). +See the [Tasks section] for examples of how to use `namePrefix`. + +### namePrefix +Add prefixes to the names of all resources. + +* **namePrefix** (string) + + NamePrefix will add a prefix the names of all resources mentioned in the Kustomization file including generated resources such as ConfigMaps and Secrets. + + +[Tasks section]: /docs/tasks/namespaces_and_names/ diff --git a/site/content/en/docs/Reference/API/Kustomization File/nameSuffix.md b/site/content/en/docs/Reference/API/Kustomization File/nameSuffix.md index 5f8347da56f..d0f3c4d860f 100644 --- a/site/content/en/docs/Reference/API/Kustomization File/nameSuffix.md +++ b/site/content/en/docs/Reference/API/Kustomization File/nameSuffix.md @@ -4,7 +4,18 @@ linkTitle: "nameSuffix" type: docs weight: 13 description: > - Appends the value to the names of all resources and references. + Add suffixes to the names of all resources. --- +`apiVersion: kustomize.config.k8s.io/v1beta1` -The Tasks section contains examples of how to use [`nameSuffix`](/docs/tasks/namespaces_and_names/). +See the [Tasks section] for examples of how to use `nameSuffix`. + +### nameSuffix +Add suffixes to the names of all resources. + +* **nameSuffix** (string) + + NameSuffix will add a suffix the names of all resources mentioned in the Kustomization file including generated resources such as ConfigMaps and Secrets. + + +[Tasks section]: /docs/tasks/namespaces_and_names/ diff --git a/site/content/en/docs/Reference/API/Kustomization File/namespace.md b/site/content/en/docs/Reference/API/Kustomization File/namespace.md index d72134a236a..2000f6af538 100644 --- a/site/content/en/docs/Reference/API/Kustomization File/namespace.md +++ b/site/content/en/docs/Reference/API/Kustomization File/namespace.md @@ -6,5 +6,16 @@ weight: 12 description: > Adds namespace to all resources. --- +`apiVersion: kustomize.config.k8s.io/v1beta1` -The Tasks section contains examples of how to use [`namespace`](/docs/tasks/namespaces_and_names/). +See the [Tasks section] for examples of how to use `namespace`. + +### namespace +Adds namespace to all resources. + +* **namespace** (string) + + Namespace to add to all resources. This will override Namespace values that already exist. + + +[Tasks section]: /docs/tasks/namespaces_and_names/ diff --git a/site/content/en/docs/Reference/API/Transformers/LabelTransformer.md b/site/content/en/docs/Reference/API/Transformers/LabelTransformer.md new file mode 100644 index 00000000000..3931c6b5508 --- /dev/null +++ b/site/content/en/docs/Reference/API/Transformers/LabelTransformer.md @@ -0,0 +1,29 @@ +--- +title: "LabelTransformer" +linkTitle: "LabelTransformer" +weight: 2 +date: 2024-02-01 +description: > + LabelTransformer adds labels to user-input resources. +--- + +See [Transformers]({{< relref "../Transformers" >}}) for common required fields. + +* **apiVersion**: builtin +* **kind**: LabelTransformer +* **metadata** ([ObjectMeta](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta)) + + Standard object's metadata. + +* **labels** (map[string]string) + + Map of labels that LabelTransformer will add to resources. + + If not specified, LabelTransformer leaves the resources unchanged. + +* **fieldSpecs** (\[\][FieldSpec]({{< relref "../Common%20Definitions/FieldSpec.md" >}})) + + fieldSpecs specifies the field on each resource that LabelTransformer should add the labels to. + It essentially allows the user to re-define the field path of the Kubernetes labels field from `metadata/labels` for different resources. + + If not specified, LabelTransformer applies the labels to the `metadata/labels` field of all resources. diff --git a/site/content/en/docs/Reference/API/Transformers/NamespaceTransformer.md b/site/content/en/docs/Reference/API/Transformers/NamespaceTransformer.md new file mode 100644 index 00000000000..6e6a4fa018d --- /dev/null +++ b/site/content/en/docs/Reference/API/Transformers/NamespaceTransformer.md @@ -0,0 +1,36 @@ +--- +title: "NamespaceTransformer" +linkTitle: "NamespaceTransformer" +weight: 3 +date: 2024-02-06 +description: > + NamespaceTransformer sets the Namespace of user-input namespaced resources. +--- + +See [Transformers]({{< relref "../Transformers" >}}) for common required fields. + +* **apiVersion**: builtin +* **kind**: NamespaceTransformer +* **metadata** ([ObjectMeta](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta)) + + Standard object's metadata. + +* **fieldSpecs** (\[\][FieldSpec]({{< relref "../Common%20Definitions/FieldSpec.md" >}})), optional + + fieldSpecs allows the user to re-define the field path of the Kubernetes Namespace field from `metadata/namespace` for different resources. + + If not specified, NamespaceTransformer applies the namespace to the `metadata/namespace` field of all resources. + +* **unsetOnly** (bool), optional + + UnsetOnly indicates whether the NamespaceTransformer will only set namespace fields that are currently unset. Defaults to false. + +* **setRoleBindingSubjects** (RoleBindingSubjectMode), optional + + SetRoleBindingSubjects determines which subject fields in RoleBinding and ClusterRoleBinding objects will have their namespace fields set. Overrides field specs provided for these types. + + _RoleBindingSubjectMode specifies which subjects will be set. It can be one of three possible values:_ + + - `defaultOnly` (default): namespace will be set only on subjects named "default". + - `allServiceAccounts`: Namespace will be set on all subjects with `kind: ServiceAccount`. + - `none`: All subjects will be skipped. diff --git a/site/content/en/docs/Reference/API/Transformers/PrefixTransformer.md b/site/content/en/docs/Reference/API/Transformers/PrefixTransformer.md new file mode 100644 index 00000000000..f5ec383db02 --- /dev/null +++ b/site/content/en/docs/Reference/API/Transformers/PrefixTransformer.md @@ -0,0 +1,29 @@ +--- +title: "PrefixTransformer" +linkTitle: "PrefixTransformer" +weight: 4 +date: 2024-02-01 +description: > + PrefixTransformer adds prefixes to the names of user-input resources. +--- + +See [Transformers]({{< relref "../Transformers" >}}) for common required fields. + +* **apiVersion**: builtin +* **kind**: PrefixTransformer +* **metadata** ([ObjectMeta](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta)) + + Standard object's metadata. + +* **prefix** (string) + + Prefix is the value that PrefixTransformer will prepend to the names of resources. + + If not specified, PrefixTransformer leaves the names of resources unchanged. + +* **fieldSpecs** (\[\][FieldSpec]({{< relref "../Common%20Definitions/FieldSpec.md" >}})) + + fieldSpecs specifies the field on each resource that PrefixTransformer should add the prefix to. + It essentially allows the user to re-define the field path of the Kubernetes name field from `metadata/name` for different resources. + + If not specified, PrefixTransformer applies the prefix to the `metadata/name` field of all resources. diff --git a/site/content/en/docs/Reference/API/Transformers/SuffixTransformer.md b/site/content/en/docs/Reference/API/Transformers/SuffixTransformer.md new file mode 100644 index 00000000000..4decfc9a990 --- /dev/null +++ b/site/content/en/docs/Reference/API/Transformers/SuffixTransformer.md @@ -0,0 +1,29 @@ +--- +title: "SuffixTransformer" +linkTitle: "SuffixTransformer" +weight: 5 +date: 2024-02-12 +description: > + SuffixTransformer adds suffixes to the names of user-input resources. +--- + +See [Transformers]({{< relref "../Transformers" >}}) for common required fields. + +* **apiVersion**: builtin +* **kind**: SuffixTransformer +* **metadata** ([ObjectMeta](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/#ObjectMeta)) + + Standard object's metadata. + +* **suffix** (string) + + Suffix is the value that SuffixTransformer will postfix to the names of resources. + + If not specified, SuffixTransformer leaves the names of resources unchanged. + +* **fieldSpecs** (\[\][FieldSpec]({{< relref "../Common%20Definitions/FieldSpec.md" >}})) + + fieldSpecs specifies the field on each resource that SuffixTransformer should add the suffix to. + It essentially allows the user to re-define the field path of the Kubernetes name field from `metadata/name` for different resources. + + If not specified, SuffixTransformer applies the suffix to the `metadata/name` field of all resources.