|
| 1 | +--- |
| 2 | +title: Generating reference documentation for metrics |
| 3 | +content_type: task |
| 4 | +weight: 100 |
| 5 | +--- |
| 6 | + |
| 7 | +<!-- overview --> |
| 8 | + |
| 9 | +This page demonstrates the generation of metrics reference documentation |
| 10 | + |
| 11 | +## {{% heading "prerequisites" %}} |
| 12 | + |
| 13 | +{{< include "prerequisites-ref-docs.md" >}} |
| 14 | + |
| 15 | +<!-- steps --> |
| 16 | + |
| 17 | +## Cloning the Kubernetes repository |
| 18 | + |
| 19 | +The metric generation happens in the Kubernetes repository. |
| 20 | +To clone the repository, Change directories to where you want the clone to exist. |
| 21 | + |
| 22 | +Then, execute the following command: |
| 23 | + |
| 24 | +```shell |
| 25 | +git clone https://www.github.com/kubernetes/kubernetes |
| 26 | +``` |
| 27 | + |
| 28 | +This creates a `kubernetes` folder in your current working directory. |
| 29 | + |
| 30 | +## Generate the metrics |
| 31 | + |
| 32 | +Inside the cloned Kubernetes repository, locate the |
| 33 | +`test/instrumentation/documentation` directory. |
| 34 | +The metrics documentation is generated in this directory. |
| 35 | + |
| 36 | +With each release, new metrics are added. |
| 37 | +After you run the metrics documentation generator script, copy the |
| 38 | +metrics documentation to the Kubernetes website and |
| 39 | +publish the updated metrics documentation. |
| 40 | + |
| 41 | +To generate the latest metrics, Make sure you are in the root of the cloned Kubernetes directory. |
| 42 | +Then, execute the following command: |
| 43 | + |
| 44 | +```shell |
| 45 | +./test/instrumentation/update-documentation.sh |
| 46 | +``` |
| 47 | + |
| 48 | +To check for changes, execute: |
| 49 | + |
| 50 | +```shell |
| 51 | +git status |
| 52 | +``` |
| 53 | + |
| 54 | +The output is similar to |
| 55 | + |
| 56 | +``` |
| 57 | +./test/instrumentation/documentation/documentation.md |
| 58 | +./test/instrumentation/documentation/documentation-list.yaml |
| 59 | +``` |
| 60 | + |
| 61 | +## Copy the generated metrics documentation file to the Kubernetes website repository |
| 62 | + |
| 63 | +1. Set the Kubernetes website root environment variable |
| 64 | + |
| 65 | +Execute the following command to set the website root: |
| 66 | + |
| 67 | +```shell |
| 68 | +export WEBSITE_ROOT=<path to website root> |
| 69 | +``` |
| 70 | + |
| 71 | + |
| 72 | +2. Copy operation |
| 73 | + |
| 74 | +Copy the generated metrics file to the Kubernetes website repository. |
| 75 | + |
| 76 | +```shell |
| 77 | +cp ./test/instrumentation/documentation/documentation.md "${WEBSITE_ROOT}/content/en/docs/reference/instrumentation/metrics.md" |
| 78 | +``` |
| 79 | + |
| 80 | +{{< note >}} |
| 81 | +If you get an error, check that you have permission to copy the file. |
| 82 | +You can use `chown` to change the file ownership back to your own user. |
| 83 | +{{< /note >}} |
| 84 | + |
| 85 | +## Creating a pull request |
| 86 | + |
| 87 | +To create a pull request, Follow the instructions in [Opening a pull request](/docs/contribute/new-content/open-a-pr/) |
| 88 | + |
| 89 | +## {{% heading "whatsnext" %}} |
| 90 | + |
| 91 | +* [Contribute-upstream](/docs/contribute/generate-ref-docs/contribute-upstream/) |
| 92 | +* [Generating Reference Docs for Kubernetes Components and Tools](/docs/contribute/generate-ref-docs/kubernetes-components/) |
| 93 | +* [Generating Reference Documentation for kubectl Commands](/docs/contribute/generate-ref-docs/kubectl/) |
| 94 | + |
| 95 | + |
0 commit comments