Skip to content

Commit bfb00ec

Browse files
authored
Add common Tasks to documentation (#5383)
* Add labels, annotations, namespaces, and names tasks * Remove redundant information from ref/labels ref/annotations * Update labels and annotations example names for consistency * Remove name, prefix and suffix api examples * Add link to tasks in reference * Add link to tasks section for ref/configMapGenerator and ref/secretGenerator * Add Labels/Annotatations headers * Add Labels * Add Template Labels * Cleanup Add Template Labels * Consolidate commonLabels and labels.includeSelectors * Improve commonAnnotations example * Add labels and annotations ref links * Add generated ConfigMap to namespace example * Add name headers * Change header weights so they appear in sidebar * Add namespace/name links * Add generated ConfigMap to namePrefix example * Add name propagation example * Add more description of name propagation * template labels * Address feedback for labels * Address names feedback * Update for consistency * Address feedback * Remove API
1 parent 0122aa8 commit bfb00ec

File tree

10 files changed

+547
-531
lines changed

10 files changed

+547
-531
lines changed

site/content/en/docs/Reference/API/Kustomization File/commonAnnotations.md

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,52 +7,4 @@ description: >
77
Add annotations to add all resources.
88
---
99

10-
Add annotations to all resources. If the annotation key already is present on the resource,
11-
the value will be overridden.
12-
13-
```yaml
14-
apiVersion: kustomize.config.k8s.io/v1beta1
15-
kind: Kustomization
16-
17-
commonAnnotations:
18-
oncallPager: 800-555-1212
19-
```
20-
21-
## Example
22-
23-
### File Input
24-
25-
```yaml
26-
# kustomization.yaml
27-
apiVersion: kustomize.config.k8s.io/v1beta1
28-
kind: Kustomization
29-
30-
commonAnnotations:
31-
oncallPager: 800-555-1212
32-
33-
resources:
34-
- deploy.yaml
35-
```
36-
37-
```yaml
38-
# deploy.yaml
39-
apiVersion: apps/v1
40-
kind: Deployment
41-
metadata:
42-
name: example
43-
spec:
44-
...
45-
```
46-
47-
### Build Output
48-
49-
```yaml
50-
apiVersion: apps/v1
51-
kind: Deployment
52-
metadata:
53-
name: example
54-
annotations:
55-
oncallPager: 800-555-1212
56-
spec:
57-
...
58-
```
10+
The Tasks section contains examples of how to use [`commonAnnotations`](/docs/tasks/labels_and_annotations/).

site/content/en/docs/Reference/API/Kustomization File/commonLabels.md

Lines changed: 1 addition & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -7,101 +7,4 @@ description: >
77
Add labels and selectors to add all resources.
88
---
99

10-
[labels]: /docs/reference/api/kustomization-file/labels/
11-
12-
Add labels and selectors to all resources. If the label key already is present on the resource,
13-
the value will be overridden.
14-
15-
An alternative to this field is the [labels] field, which allows adding labels without also automatically
16-
injecting corresponding selectors.
17-
18-
{{% pageinfo color="warning" %}}
19-
Selectors for resources such as Deployments and Services shouldn't be changed once the
20-
resource has been applied to a cluster.
21-
22-
Changing commonLabels to live resources could result in failures.
23-
{{% /pageinfo %}}
24-
25-
```yaml
26-
apiVersion: kustomize.config.k8s.io/v1beta1
27-
kind: Kustomization
28-
29-
commonLabels:
30-
someName: someValue
31-
owner: alice
32-
app: bingo
33-
```
34-
35-
## Example
36-
37-
### File Input
38-
39-
```yaml
40-
# kustomization.yaml
41-
apiVersion: kustomize.config.k8s.io/v1beta1
42-
kind: Kustomization
43-
44-
commonLabels:
45-
someName: someValue
46-
owner: alice
47-
app: bingo
48-
49-
resources:
50-
- deploy.yaml
51-
- service.yaml
52-
```
53-
54-
```yaml
55-
# deploy.yaml
56-
apiVersion: apps/v1
57-
kind: Deployment
58-
metadata:
59-
name: example
60-
```
61-
62-
```yaml
63-
# service.yaml
64-
apiVersion: v1
65-
kind: Service
66-
metadata:
67-
name: example
68-
```
69-
70-
### Build Output
71-
72-
```yaml
73-
apiVersion: v1
74-
kind: Service
75-
metadata:
76-
labels:
77-
app: bingo
78-
owner: alice
79-
someName: someValue
80-
name: example
81-
spec:
82-
selector:
83-
app: bingo
84-
owner: alice
85-
someName: someValue
86-
---
87-
apiVersion: apps/v1
88-
kind: Deployment
89-
metadata:
90-
labels:
91-
app: bingo
92-
owner: alice
93-
someName: someValue
94-
name: example
95-
spec:
96-
selector:
97-
matchLabels:
98-
app: bingo
99-
owner: alice
100-
someName: someValue
101-
template:
102-
metadata:
103-
labels:
104-
app: bingo
105-
owner: alice
106-
someName: someValue
107-
```
10+
The Tasks section contains examples of how to use [`commonLabels`](/docs/tasks/labels_and_annotations/).

site/content/en/docs/Reference/API/Kustomization File/configMapGenerator.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ weight: 6
66
description: >
77
Generate ConfigMap resources.
88
---
9+
10+
The Tasks section contains examples of how to use [`configMapGenerator`](/docs/tasks/configmap_generator/).

site/content/en/docs/Reference/API/Kustomization File/labels.md

Lines changed: 1 addition & 228 deletions
Original file line numberDiff line numberDiff line change
@@ -7,231 +7,4 @@ description: >
77
Add labels and optionally selectors to all resources.
88
---
99

10-
A field that allows adding labels without also automatically injecting corresponding selectors.
11-
This can be used instead of the `commonLabels` field, which always adds selectors.
12-
13-
{{% pageinfo color="warning" %}}
14-
Selectors for resources such as Deployments and Services shouldn't be changed once the
15-
resource has been applied to a cluster.
16-
17-
Changing `includeSelectors` to `true` or changing labels when `includeSelectors` is `true` in live resources
18-
is equivalent to changing `commonLabels` and could result in failures.
19-
{{% /pageinfo %}}
20-
21-
The following flags are available:
22-
* `includeTemplates`: When set will also apply labels to metadata/labels and spec/template/metadata/labels. This can be used to add labels to Pods from owner resources, such as Deployments and StatefulSets, without modifying selectors. False by default.
23-
* `includeSelectors`: When set will apply labels to metadata/labels, selectors, and spec/template/metadata/labels. False by default.
24-
25-
```yaml
26-
apiVersion: kustomize.config.k8s.io/v1beta1
27-
kind: Kustomization
28-
29-
labels:
30-
- pairs:
31-
someName: someValue
32-
owner: alice
33-
app: bingo
34-
includeSelectors: true # <-- false by default
35-
includeTemplates: true # <-- false by default
36-
```
37-
38-
## Example 1 - selectors and templates NOT modified
39-
40-
### File Input
41-
42-
```yaml
43-
# kustomization.yaml
44-
apiVersion: kustomize.config.k8s.io/v1beta1
45-
kind: Kustomization
46-
47-
labels:
48-
- pairs:
49-
someName: someValue
50-
owner: alice
51-
app: bingo
52-
53-
resources:
54-
- deploy.yaml
55-
- service.yaml
56-
```
57-
58-
```yaml
59-
# deploy.yaml
60-
apiVersion: apps/v1
61-
kind: Deployment
62-
metadata:
63-
name: example
64-
```
65-
66-
```yaml
67-
# service.yaml
68-
apiVersion: v1
69-
kind: Service
70-
metadata:
71-
name: example
72-
```
73-
74-
### Build Output
75-
76-
```yaml
77-
apiVersion: v1
78-
kind: Service
79-
metadata:
80-
labels:
81-
app: bingo
82-
owner: alice
83-
someName: someValue
84-
name: example
85-
---
86-
apiVersion: apps/v1
87-
kind: Deployment
88-
metadata:
89-
labels:
90-
app: bingo
91-
owner: alice
92-
someName: someValue
93-
name: example
94-
```
95-
96-
97-
## Example 2 - selectors modified
98-
99-
### File Input
100-
101-
```yaml
102-
# kustomization.yaml
103-
apiVersion: kustomize.config.k8s.io/v1beta1
104-
kind: Kustomization
105-
106-
labels:
107-
- pairs:
108-
someName: someValue
109-
owner: alice
110-
app: bingo
111-
includeSelectors: true
112-
113-
resources:
114-
- deploy.yaml
115-
- service.yaml
116-
```
117-
118-
```yaml
119-
# deploy.yaml
120-
apiVersion: apps/v1
121-
kind: Deployment
122-
metadata:
123-
name: example
124-
```
125-
126-
```yaml
127-
# service.yaml
128-
apiVersion: v1
129-
kind: Service
130-
metadata:
131-
name: example
132-
```
133-
134-
### Build Output
135-
136-
```yaml
137-
apiVersion: v1
138-
kind: Service
139-
metadata:
140-
labels:
141-
app: bingo
142-
owner: alice
143-
someName: someValue
144-
name: example
145-
spec:
146-
selector:
147-
app: bingo
148-
owner: alice
149-
someName: someValue
150-
---
151-
apiVersion: apps/v1
152-
kind: Deployment
153-
metadata:
154-
labels:
155-
app: bingo
156-
owner: alice
157-
someName: someValue
158-
name: example
159-
spec:
160-
selector:
161-
matchLabels:
162-
app: bingo
163-
owner: alice
164-
someName: someValue
165-
template:
166-
metadata:
167-
labels:
168-
app: bingo
169-
owner: alice
170-
someName: someValue
171-
```
172-
173-
## Example 3 - templates modified
174-
175-
### File Input
176-
177-
```yaml
178-
# kustomization.yaml
179-
apiVersion: kustomize.config.k8s.io/v1beta1
180-
kind: Kustomization
181-
182-
labels:
183-
- pairs:
184-
someName: someValue
185-
owner: alice
186-
app: bingo
187-
includeTemplates: true
188-
189-
resources:
190-
- deploy.yaml
191-
- service.yaml
192-
```
193-
194-
```yaml
195-
# deploy.yaml
196-
apiVersion: apps/v1
197-
kind: Deployment
198-
metadata:
199-
name: example
200-
```
201-
202-
```yaml
203-
# service.yaml
204-
apiVersion: v1
205-
kind: Service
206-
metadata:
207-
name: example
208-
```
209-
210-
### Build Output
211-
212-
```yaml
213-
apiVersion: v1
214-
kind: Service
215-
metadata:
216-
labels:
217-
app: bingo
218-
owner: alice
219-
someName: someValue
220-
name: example
221-
---
222-
apiVersion: apps/v1
223-
kind: Deployment
224-
metadata:
225-
labels:
226-
app: bingo
227-
owner: alice
228-
someName: someValue
229-
name: example
230-
spec:
231-
template:
232-
metadata:
233-
labels:
234-
app: bingo
235-
owner: alice
236-
someName: someValue
237-
```
10+
The Tasks section contains examples of how to use [`labels`](/docs/tasks/labels_and_annotations/).

0 commit comments

Comments
 (0)