mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
kustomize docs tweaks
This commit is contained in:
@@ -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:
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
```
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
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/)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user