Add generator kustomization references (#5447)

* Initial configMapGenerator ref

* Draft configMapGenerator options

* ConfigMapArgs

* Add sources

* Begin to restructure generator spec

* Add ObjectMeta

* Draft kustomization.md

* Draft kustomization file links

* Move bases weight

* Update generatorArgs link to commmon generatorOptions

* Remove api/generators for now

* Update generatorOptions

* Add generatorArgs header

* Add secretGenerator

* Remove ObjectMeta for now

* Draft generators

* Fix secretGenerator

* Cleanup

* Add include shortcode, cleanup generators

* Use common includes

* Update object metadata description

* spelling

* Improve args description
This commit is contained in:
Nick
2024-01-10 11:27:05 -08:00
committed by GitHub
parent f72db33d5e
commit f3fedac429
13 changed files with 354 additions and 102 deletions

View File

@@ -4,112 +4,28 @@ linkTitle: "generatorOptions"
type: docs
weight: 8
description: >
Control behavior of [ConfigMap](https://kubernetes.io/docs/concepts/configuration/configmap/) and
[Secret](https://kubernetes.io/docs/concepts/configuration/secret/) generators.
Modify behavior of generators.
---
Additionally, generatorOptions can be set on a per resource level within each
generator. For details on per-resource generatorOptions usage see
[configMapGenerator](/docs/reference/api/kustomization-file/configmapgenerator/) and see [secretGenerator](/docs/reference/api/kustomization-file/secretgenerator/).
`apiVersion: kustomize.config.k8s.io/v1beta1`
```yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
### generatorOptions
GeneratorOptions modifies resource generation behavior.
generatorOptions:
# labels to add to all generated resources
labels:
kustomize.generated.resources: somevalue
# annotations to add to all generated resources
annotations:
kustomize.generated.resource: somevalue
# disableNameSuffixHash is true disables the default behavior of adding a
# suffix to the names of generated resources that is a hash of
# the resource contents.
disableNameSuffixHash: true
# if set to true, the immutable property is added to generated resources
immutable: true
```
---
## Example I
* **labels** (map[string]string), optional
Using ConfigMap
Labels to add to all generated resources.
### Input Files
* **annotations** (map[string]string), optional
```yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
configMapGenerator:
- name: my-application-properties
files:
- application.properties
generatorOptions:
labels:
kustomize.generated.resources: config-label
annotations:
kustomize.generated.resource: config-annotation
```
Annotations to add to all generated resources.
```yaml
# application.properties
FOO=Bar
```
* **disableNameSuffixHash** (bool), optional
### Output File
DisableNameSuffixHash if true disables the default behavior of adding a suffix to the names of generated resources that is a hash of the resource contents.
```yaml
apiVersion: v1
data:
application.properties: |-
# application.properties
FOO=Bar
kind: ConfigMap
metadata:
annotations:
kustomize.generated.resource: config-annotation
labels:
kustomize.generated.resources: config-label
name: my-application-properties-f7mm6mhf59
```
* **immutable** (bool), optional
## Example II
Using Secrets
### Input Files
```yaml
# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
secretGenerator:
- name: app-tls
files:
- "tls.cert"
- "tls.key"
type: "kubernetes.io/tls"
generatorOptions:
labels:
kustomize.generated.resources: secret-label
annotations:
kustomize.generated.resource: secret-annotation
disableNameSuffixHash: true
```
### Output File
```yaml
apiVersion: v1
data:
tls.cert: TFMwdExTMUNSVWQuLi50Q2c9PQ==
tls.key: TFMwdExTMUNSVWQuLi4wdExRbz0=
kind: Secret
metadata:
annotations:
kustomize.generated.resource: secret-annotation
labels:
kustomize.generated.resources: secret-label
name: app-tls
type: kubernetes.io/tls
```
Immutable if true add to all generated resources.