diff --git a/docs/api-reference/kustomization/commonannotations/index.html b/docs/api-reference/kustomization/commonannotations/index.html index ae0266850..7f610dc08 100644 --- a/docs/api-reference/kustomization/commonannotations/index.html +++ b/docs/api-reference/kustomization/commonannotations/index.html @@ -667,6 +667,17 @@ + + @@ -712,12 +723,40 @@

commonAnnotations

Add annotations to add all resources.
-

Add annotations (non-identifying metadata) to all resources. These are key value pairs.

+

Add annotations to all resources. If the annotation key already is present on the resource, +the value will be overridden.

apiVersion: kustomize.config.k8s.io/v1beta1
 kind: Kustomization
 
 commonAnnotations:
   oncallPager: 800-555-1212
+

Example

+

File Input

+
# kustomization.yaml
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+commonAnnotations:
+  oncallPager: 800-555-1212
+
+resources:
+- deploy.yaml
+
# deploy.yaml
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: example
+spec:
+  ...
+

Build Output

+
apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: example
+  annotations:
+    oncallPager: 800-555-1212
+spec:
+  ...
 
@@ -773,7 +812,7 @@ -
Last modified June 7, 2020: Convert docs to docsy (42497c66) +
Last modified June 11, 2020: kustomize docs tweaks (6c540986)
diff --git a/docs/api-reference/kustomization/commonlabels/index.html b/docs/api-reference/kustomization/commonlabels/index.html index 5706ef373..e2160d682 100644 --- a/docs/api-reference/kustomization/commonlabels/index.html +++ b/docs/api-reference/kustomization/commonlabels/index.html @@ -667,6 +667,17 @@ + +
@@ -712,7 +723,17 @@

commonLabels

Add labels and selectors to add all resources.
-

Add labels and selectors to all resources.

+

Add labels and selectors to all resources. If the label key already is present on the resource, +the value will be overridden.

+ + +
+

Selectors for resources such as Deployments and Services shouldn’t be changed once the +resource has been applied to a cluster.

+

Changing commonLabels to live resources could result in failures.

+ +
+
apiVersion: kustomize.config.k8s.io/v1beta1
 kind: Kustomization
 
@@ -720,6 +741,65 @@
   someName: someValue
   owner: alice
   app: bingo
+

Example

+

File Input

+
# kustomization.yaml
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+commonLabels:
+  someName: someValue
+  owner: alice
+  app: bingo
+
+resources:
+- deploy.yaml
+- service.yaml
+
# deploy.yaml
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: example
+
# service.yaml
+apiVersion: v1
+kind: Service
+metadata:
+  name: example
+

Build Output

+
apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    app: bingo
+    owner: alice
+    someName: someValue
+  name: example
+spec:
+  selector:
+    app: bingo
+    owner: alice
+    someName: someValue
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  labels:
+    app: bingo
+    owner: alice
+    someName: someValue
+  name: example
+spec:
+  selector:
+    matchLabels:
+      app: bingo
+      owner: alice
+      someName: someValue
+  template:
+    metadata:
+      labels:
+        app: bingo
+        owner: alice
+        someName: someValue
 
@@ -775,7 +855,7 @@ -
Last modified June 7, 2020: Convert docs to docsy (42497c66) +
Last modified June 11, 2020: kustomize docs tweaks (6c540986)
diff --git a/docs/api-reference/kustomization/index.xml b/docs/api-reference/kustomization/index.xml index 8cbe9c497..747748d82 100644 --- a/docs/api-reference/kustomization/index.xml +++ b/docs/api-reference/kustomization/index.xml @@ -46,12 +46,40 @@ ordered relative to other input resources.</p> - <p>Add annotations (non-identifying metadata) to all resources. These are key value pairs.</p> + <p>Add annotations to all resources. If the annotation key already is present on the resource, +the value will be overridden.</p> <div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>kustomize.config.k8s.io/v1beta1<span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>Kustomization<span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">commonAnnotations</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">oncallPager</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">800-555-1212</span><span style="color:#f8f8f8;text-decoration:underline"> +</span></code></pre></div><h2 id="example">Example</h2> +<h3 id="file-input">File Input</h3> +<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#8f5902;font-style:italic"># kustomization.yaml</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>kustomize.config.k8s.io/v1beta1<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>Kustomization<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">commonAnnotations</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">oncallPager</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">800-555-1212</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">resources</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span>- deploy.yaml<span style="color:#f8f8f8;text-decoration:underline"> +</span></code></pre></div><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#8f5902;font-style:italic"># deploy.yaml</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>apps/v1<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>Deployment<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>example<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span>...<span style="color:#f8f8f8;text-decoration:underline"> +</span></code></pre></div><h3 id="build-output">Build Output</h3> +<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>apps/v1<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>Deployment<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>example<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">annotations</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">oncallPager</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#0000cf;font-weight:bold">800-555-1212</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span>...<span style="color:#f8f8f8;text-decoration:underline"> </span></code></pre></div> @@ -65,7 +93,17 @@ ordered relative to other input resources.</p> - <p>Add labels and selectors to all resources.</p> + <p>Add labels and selectors to all resources. If the label key already is present on the resource, +the value will be overridden.</p> + + +<div class="pageinfo pageinfo-warning"> +<p>Selectors for resources such as Deployments and Services shouldn&rsquo;t be changed once the +resource has been applied to a cluster.</p> +<p>Changing commonLabels to live resources could result in failures.</p> + +</div> + <div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>kustomize.config.k8s.io/v1beta1<span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>Kustomization<span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#f8f8f8;text-decoration:underline"> @@ -73,6 +111,65 @@ ordered relative to other input resources.</p> </span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">someName</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>someValue<span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">owner</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>alice<span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">app</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>bingo<span style="color:#f8f8f8;text-decoration:underline"> +</span></code></pre></div><h2 id="example">Example</h2> +<h3 id="file-input">File Input</h3> +<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#8f5902;font-style:italic"># kustomization.yaml</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>kustomize.config.k8s.io/v1beta1<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>Kustomization<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">commonLabels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">someName</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>someValue<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">owner</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>alice<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">app</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>bingo<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">resources</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span>- deploy.yaml<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span>- service.yaml<span style="color:#f8f8f8;text-decoration:underline"> +</span></code></pre></div><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#8f5902;font-style:italic"># deploy.yaml</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>apps/v1<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>Deployment<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>example<span style="color:#f8f8f8;text-decoration:underline"> +</span></code></pre></div><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#8f5902;font-style:italic"># service.yaml</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>v1<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>Service<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>example<span style="color:#f8f8f8;text-decoration:underline"> +</span></code></pre></div><h3 id="build-output">Build Output</h3> +<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>v1<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>Service<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">app</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>bingo<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">owner</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>alice<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">someName</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>someValue<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>example<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">selector</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">app</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>bingo<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">owner</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>alice<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">someName</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>someValue<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span>---<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>apps/v1<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>Deployment<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">app</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>bingo<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">owner</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>alice<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">someName</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>someValue<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">name</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>example<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">spec</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">selector</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">matchLabels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">app</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>bingo<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">owner</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>alice<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">someName</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>someValue<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">template</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">metadata</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">labels</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">app</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>bingo<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">owner</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>alice<span style="color:#f8f8f8;text-decoration:underline"> +</span><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#204a87;font-weight:bold">someName</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>someValue<span style="color:#f8f8f8;text-decoration:underline"> </span></code></pre></div> @@ -353,10 +450,18 @@ if it is not set on a resource.</p> - <p>Each entry in this list should resolve to patch object, which includes a patch and a target selector. -The patch can be either a strategic merge patch or a JSON patch. It can be either a patch file, or an inline -string. The target selects resources by group, version, kind, name, namespace, labelSelector and -annotationSelector. Any resource which matches all the specified fields has the patch applied.</p> + <p>Patches (also call overlays) add or override fields on resources. They are provided using the +<code>patches</code> Kustomization field.</p> +<p>The <code>patches</code> field contains a list of patches to be applied in the order they are specified.</p> +<p>Each patch may:</p> +<ul> +<li>be either a <a href="https://kubernetes-sigs.github.io/kustomize/kustomize/api-reference/glossary#patchstrategicmerge">strategic merge</a> patch, or a <a href="https://kubernetes-sigs.github.io/kustomize/kustomize/api-reference/glossary#patchjson6902">JSON</a> patch</li> +<li>be either a file, or an inline string</li> +<li>target a single resource or multiple resources</li> +</ul> +<p>The patch target selects resources by group, version, kind, name, namespace, labelSelector and +annotationSelector. Any resource which matches all the <strong>specified</strong> fields has the patch applied +to it (regular expressions).</p> <div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#204a87;font-weight:bold">apiVersion</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>kustomize.config.k8s.io/v1beta1<span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#f8f8f8;text-decoration:underline"></span><span style="color:#204a87;font-weight:bold">kind</span><span style="color:#000;font-weight:bold">:</span><span style="color:#f8f8f8;text-decoration:underline"> </span>Kustomization<span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#f8f8f8;text-decoration:underline"> diff --git a/docs/api-reference/kustomization/patches/index.html b/docs/api-reference/kustomization/patches/index.html index 732e05075..9234ebb88 100644 --- a/docs/api-reference/kustomization/patches/index.html +++ b/docs/api-reference/kustomization/patches/index.html @@ -712,10 +712,18 @@

patches

Patch resources
-

Each entry in this list should resolve to patch object, which includes a patch and a target selector. -The patch can be either a strategic merge patch or a JSON patch. It can be either a patch file, or an inline -string. The target selects resources by group, version, kind, name, namespace, labelSelector and -annotationSelector. Any resource which matches all the specified fields has the patch applied.

+

Patches (also call overlays) add or override fields on resources. They are provided using the +patches Kustomization field.

+

The patches field contains a list of patches to be applied in the order they are specified.

+

Each patch may:

+
    +
  • be either a strategic merge patch, or a JSON patch
  • +
  • be either a file, or an inline string
  • +
  • target a single resource or multiple resources
  • +
+

The patch target selects resources by group, version, kind, name, namespace, labelSelector and +annotationSelector. Any resource which matches all the specified fields has the patch applied +to it (regular expressions).

apiVersion: kustomize.config.k8s.io/v1beta1
 kind: Kustomization
 
@@ -793,7 +801,7 @@ is equivalent to ^myapp$.

-
Last modified June 7, 2020: Convert docs to docsy (42497c66) +
Last modified June 11, 2020: kustomize docs tweaks (6c540986)
diff --git a/docs/contributing/docs/index.html b/docs/contributing/docs/index.html index 30610f484..16b9b9c20 100644 --- a/docs/contributing/docs/index.html +++ b/docs/contributing/docs/index.html @@ -350,6 +350,12 @@
  • Prerequisites
  • Development
  • Publishing
  • +
  • Publishing docs to your kustomize fork + +
  • @@ -400,17 +406,17 @@ forked from the docsy-example<

    Development

    -

    The docs are in the site directory

    +

    The doc input files are in the site directory. The site can be hosted locally using +hugo serve.

    cd site/
    -

    To view the docs run

    -
    hugo serve
    +hugo serve
     
    ...
     Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
     Web Server is available at http://localhost:1313/kustomize/ (bind address 127.0.0.1)
    -

    and visit the URL that is printed

    -

    Publishing

    -

    The site content is compiled by Hugo into the docs folder using the hugo command:

    -
    hugo
    +

    Publishing

    +

    Hugo compiles the files under site Hugo into html which it puts in the docs folder:

    +
    cd site/
    +hugo
     
                       | EN  
     -------------------+-----
       Pages            | 99  
    @@ -421,7 +427,38 @@ Web Server is available at http://localhost:1313/kustomize/ |  2  
       Sitemaps         |  1  
       Cleaned          |  0  
    -

    Add the site and docs folders to a commit, and create a PR.

    +

    Add the site/ and docs/ folders to a commit, then create a PR.

    +

    Publishing docs to your kustomize fork

    +

    It is possible to have the kustomize docs published to your forks github pages.

    +

    Setup GitHub Pages for the fork

    +
      +
    1. Go to the forked repo’s Settings tab + +
    2. +
    3. Go to the GitHub Pages section
    4. +
    5. Set the source to master branch /docs folder
    6. +
    +

    Publish to the fork’s GitHub Pages

    + + +
    +

    Changes must be pushed to the fork’s master branch to be served as the fork’s GitHub Page.

    + +
    + +
      +
    1. Make a change to a file under site/content
    2. +
    3. Run hugo from the site/ directory
    4. +
    5. Add the site and docs directories to the master branch
    6. +
    7. Commit and push the changes to the remote fork’s master branch
    8. +
    9. After a few minutes, the docs should be served from the fork’s GitHub Page + +
    10. +
    diff --git a/docs/sitemap.xml b/docs/sitemap.xml index a5a0edad5..71006307b 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -169,12 +169,12 @@ https://kubernetes-sigs.github.io/kustomize/api-reference/kustomization/commonannotations/ - 2020-06-07T21:07:46-07:00 + 2020-06-11T21:40:35-07:00 https://kubernetes-sigs.github.io/kustomize/api-reference/kustomization/commonlabels/ - 2020-06-07T21:07:46-07:00 + 2020-06-11T21:40:35-07:00 @@ -249,7 +249,7 @@ https://kubernetes-sigs.github.io/kustomize/api-reference/kustomization/patches/ - 2020-06-07T21:07:46-07:00 + 2020-06-11T21:40:35-07:00 diff --git a/site/content/en/api-reference/kustomization/commonannotations/_index.md b/site/content/en/api-reference/kustomization/commonannotations/_index.md index 126f9cd87..3ce09107b 100644 --- a/site/content/en/api-reference/kustomization/commonannotations/_index.md +++ b/site/content/en/api-reference/kustomization/commonannotations/_index.md @@ -6,7 +6,8 @@ description: > Add annotations to add all resources. --- -Add annotations (non-identifying metadata) to all resources. These are key value pairs. +Add annotations to all resources. If the annotation key already is present on the resource, +the value will be overridden. ```yaml apiVersion: kustomize.config.k8s.io/v1beta1 @@ -15,3 +16,43 @@ kind: Kustomization commonAnnotations: oncallPager: 800-555-1212 ``` + +## Example + +### File Input + +```yaml +# kustomization.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +commonAnnotations: + oncallPager: 800-555-1212 + +resources: +- deploy.yaml +``` + +```yaml +# deploy.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: example +spec: + ... +``` + +### Build Output + +```yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: example + annotations: + oncallPager: 800-555-1212 +spec: + ... +``` + diff --git a/site/content/en/api-reference/kustomization/commonlabels/_index.md b/site/content/en/api-reference/kustomization/commonlabels/_index.md index b86005bfe..069b3dfd5 100644 --- a/site/content/en/api-reference/kustomization/commonlabels/_index.md +++ b/site/content/en/api-reference/kustomization/commonlabels/_index.md @@ -6,7 +6,15 @@ description: > Add labels and selectors to add all resources. --- -Add labels and selectors to all resources. +Add labels and selectors to all resources. If the label key already is present on the resource, +the value will be overridden. + +{{% pageinfo color="warning" %}} +Selectors for resources such as Deployments and Services shouldn't be changed once the +resource has been applied to a cluster. + +Changing commonLabels to live resources could result in failures. +{{% /pageinfo %}} ```yaml apiVersion: kustomize.config.k8s.io/v1beta1 @@ -17,3 +25,77 @@ commonLabels: owner: alice app: bingo ``` + +## Example + +### File Input + +```yaml +# kustomization.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +commonLabels: + someName: someValue + owner: alice + app: bingo + +resources: +- deploy.yaml +- service.yaml +``` + +```yaml +# deploy.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: example +``` + +```yaml +# service.yaml +apiVersion: v1 +kind: Service +metadata: + name: example +``` + +### Build Output + +```yaml +apiVersion: v1 +kind: Service +metadata: + labels: + app: bingo + owner: alice + someName: someValue + name: example +spec: + selector: + app: bingo + owner: alice + someName: someValue +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: bingo + owner: alice + someName: someValue + name: example +spec: + selector: + matchLabels: + app: bingo + owner: alice + someName: someValue + template: + metadata: + labels: + app: bingo + owner: alice + someName: someValue +``` \ No newline at end of file diff --git a/site/content/en/api-reference/kustomization/patches/_index.md b/site/content/en/api-reference/kustomization/patches/_index.md index b58fd286c..43c417fb1 100644 --- a/site/content/en/api-reference/kustomization/patches/_index.md +++ b/site/content/en/api-reference/kustomization/patches/_index.md @@ -6,10 +6,23 @@ description: > Patch resources --- -Each entry in this list should resolve to patch object, which includes a patch and a target selector. -The patch can be either a strategic merge patch or a JSON patch. It can be either a patch file, or an inline -string. The target selects resources by group, version, kind, name, namespace, labelSelector and -annotationSelector. Any resource which matches all the specified fields has the patch applied. +[strategic merge]: /kustomize/api-reference/glossary#patchstrategicmerge +[JSON]: /kustomize/api-reference/glossary#patchjson6902 + +Patches (also call overlays) add or override fields on resources. They are provided using the +`patches` Kustomization field. + +The `patches` field contains a list of patches to be applied in the order they are specified. + +Each patch may: + +- be either a [strategic merge] patch, or a [JSON] patch +- be either a file, or an inline string +- target a single resource or multiple resources + +The patch target selects resources by group, version, kind, name, namespace, labelSelector and +annotationSelector. Any resource which matches all the **specified** fields has the patch applied +to it (regular expressions). ```yaml apiVersion: kustomize.config.k8s.io/v1beta1 diff --git a/site/content/en/contributing/docs/_index.md b/site/content/en/contributing/docs/_index.md index 96d5062f9..5dc23ec3d 100644 --- a/site/content/en/contributing/docs/_index.md +++ b/site/content/en/contributing/docs/_index.md @@ -18,15 +18,11 @@ forked from the [docsy-example](https://github.com/google/docsy-example) ## Development -The docs are in the `site` directory +The doc input files are in the `site` directory. The site can be hosted locally using +`hugo serve`. ```shell script cd site/ -``` - -To view the docs run - -```shell script hugo serve ``` @@ -36,13 +32,12 @@ Running in Fast Render Mode. For full rebuilds on change: hugo server --disableF Web Server is available at http://localhost:1313/kustomize/ (bind address 127.0.0.1) ``` -and visit the URL that is printed - ## Publishing -The `site` content is compiled by Hugo into the `docs` folder using the hugo command: +Hugo compiles the files under `site` Hugo into html which it puts in the `docs` folder: ```shell script +cd site/ hugo ``` @@ -59,4 +54,29 @@ hugo Cleaned | 0 ``` -Add the `site` and `docs` folders to a commit, and create a PR. \ No newline at end of file +Add the `site/` and `docs/` folders to a commit, then create a PR. + +## Publishing docs to your kustomize fork + +It is possible to have the kustomize docs published to your forks github pages. + +### Setup GitHub Pages for the fork + +1. Go to the *forked repo's* **Settings** tab + - e.g. [https://github.com/pwittrock/kustomize](https://github.com/pwittrock/kustomize) +2. Go to the **GitHub Pages** section +3. Set the source to master branch **/docs folder** + +### Publish to the fork's GitHub Pages + +{{% pageinfo color="info" %}} +Changes must be pushed to the fork's **master branch** to be served as the fork's GitHub Page. +{{% /pageinfo %}} + +1. Make a change to a file under `site/content` +2. Run `hugo` from the `site/` directory +3. Add the `site` and `docs` directories to the **master branch** +4. Commit and push the changes to the *remote fork's* **master branch** +5. After a few minutes, the docs should be served from the fork's GitHub Page + - e.g. [https://pwittrock.github.io/kustomize/](https://pwittrock.github.io/kustomize/) +