|
| 1 | +--- |
| 2 | +title: 为指标生成参考文档 |
| 3 | +content_type: task |
| 4 | +weight: 100 |
| 5 | +--- |
| 6 | +<!-- |
| 7 | +title: Generating reference documentation for metrics |
| 8 | +content_type: task |
| 9 | +weight: 100 |
| 10 | +--> |
| 11 | + |
| 12 | +<!-- overview --> |
| 13 | + |
| 14 | +<!-- |
| 15 | +This page demonstrates the generation of metrics reference documentation. |
| 16 | +--> |
| 17 | +本页演示如何生成指标参考文档。 |
| 18 | + |
| 19 | +## {{% heading "prerequisites" %}} |
| 20 | + |
| 21 | +{{< include "prerequisites-ref-docs.md" >}} |
| 22 | + |
| 23 | +<!-- steps --> |
| 24 | + |
| 25 | +<!-- |
| 26 | +## Clone the Kubernetes repository |
| 27 | +
|
| 28 | +The metric generation happens in the Kubernetes repository. |
| 29 | +To clone the repository, change directories to where you want the clone to exist. |
| 30 | +
|
| 31 | +Then, execute the following command: |
| 32 | +--> |
| 33 | +## 克隆 Kubernetes 仓库 {#cloning-the-kubernetes-repository} |
| 34 | + |
| 35 | +指标的生成发生在 Kubernetes 仓库中。 |
| 36 | +要克隆此仓库,请将目录更改为你要克隆到的目标位置。 |
| 37 | + |
| 38 | +然后,执行以下命令: |
| 39 | + |
| 40 | +```shell |
| 41 | +git clone https://www.github.com/kubernetes/kubernetes |
| 42 | +``` |
| 43 | + |
| 44 | +<!-- |
| 45 | +This creates a `kubernetes` folder in your current working directory. |
| 46 | +--> |
| 47 | +这将在当前工作目录中创建一个 `kubernetes` 文件夹。 |
| 48 | + |
| 49 | +<!-- |
| 50 | +## Generate the metrics |
| 51 | +
|
| 52 | +Inside the cloned Kubernetes repository, locate the |
| 53 | +`test/instrumentation/documentation` directory. |
| 54 | +The metrics documentation is generated in this directory. |
| 55 | +--> |
| 56 | +## 生成指标 {#generate-the-metrics} |
| 57 | + |
| 58 | +在克隆的 Kubernetes 仓库中,找到 `test/instrumentation/documentation` 目录。 |
| 59 | +指标文档将在此目录中生成。 |
| 60 | + |
| 61 | +<!-- |
| 62 | +With each release, new metrics are added. |
| 63 | +After you run the metrics documentation generator script, copy the |
| 64 | +metrics documentation to the Kubernetes website and |
| 65 | +publish the updated metrics documentation. |
| 66 | +
|
| 67 | +To generate the latest metrics, make sure you are in the root of the cloned Kubernetes directory. |
| 68 | +Then, execute the following command: |
| 69 | +--> |
| 70 | +每次发布都会添加新的指标。你在运行指标文档生成脚本之后, |
| 71 | +将指标文档复制到 Kubernetes 网站并发布更新的指标文档。 |
| 72 | + |
| 73 | +要生成最新的指标,请确保你位于已克隆的 Kubernetes 仓库的根目录中。 |
| 74 | +然后,执行以下命令: |
| 75 | + |
| 76 | +```shell |
| 77 | +./test/instrumentation/update-documentation.sh |
| 78 | +``` |
| 79 | + |
| 80 | +<!-- |
| 81 | +To check for changes, execute: |
| 82 | +--> |
| 83 | +要检查变更,执行以下命令: |
| 84 | + |
| 85 | +```shell |
| 86 | +git status |
| 87 | +``` |
| 88 | + |
| 89 | +<!-- |
| 90 | +The output is similar to: |
| 91 | +--> |
| 92 | +输出类似于: |
| 93 | + |
| 94 | +``` |
| 95 | +./test/instrumentation/documentation/documentation.md |
| 96 | +./test/instrumentation/documentation/documentation-list.yaml |
| 97 | +``` |
| 98 | + |
| 99 | +<!-- |
| 100 | +## Copy the generated metrics documentation file to the Kubernetes website repository |
| 101 | +
|
| 102 | +1. Set the Kubernetes website root environment variable. |
| 103 | +
|
| 104 | + Execute the following command to set the website root: |
| 105 | +--> |
| 106 | +## 将生成的指标文档文件复制到 Kubernetes 网站仓库 {#copy-the-generated-metrics-documentation-file-to-the-kubernetes-website-repository} |
| 107 | + |
| 108 | +1. 设置 Kubernetes 网站根环境变量 |
| 109 | + |
| 110 | + 执行以下命令设置网站根目录: |
| 111 | + |
| 112 | + ```shell |
| 113 | + export WEBSITE_ROOT=<path to website root> |
| 114 | + ``` |
| 115 | + |
| 116 | +<!-- |
| 117 | +2. Copy the generated metrics file to the Kubernetes website repository. |
| 118 | +--> |
| 119 | +2. 将生成的指标文件复制到 Kubernetes 网站仓库。 |
| 120 | + |
| 121 | + ```shell |
| 122 | + cp ./test/instrumentation/documentation/documentation.md "${WEBSITE_ROOT}/content/en/docs/reference/instrumentation/metrics.md" |
| 123 | + ``` |
| 124 | + |
| 125 | + {{< note >}} |
| 126 | + <!-- |
| 127 | + If you get an error, check that you have permission to copy the file. |
| 128 | + You can use `chown` to change the file ownership back to your own user. |
| 129 | + --> |
| 130 | + 如果出现错误,请检查你是否有权限复制文件。 |
| 131 | + 你可以使用 `chown` 命令将文件所有权更改回你自己的用户。 |
| 132 | + {{< /note >}} |
| 133 | + |
| 134 | +<!-- |
| 135 | +## Create a pull request |
| 136 | +
|
| 137 | +To create a pull request, follow the instructions in [Opening a pull request](/docs/contribute/new-content/open-a-pr/). |
| 138 | +--> |
| 139 | +## 创建 PR {#creating-a-pull-request} |
| 140 | + |
| 141 | +要创建 PR,请按照[提 PR](/zh-cn/docs/contribute/new-content/open-a-pr/) 中的说明操作。 |
| 142 | + |
| 143 | +## {{% heading "whatsnext" %}} |
| 144 | + |
| 145 | +<!-- |
| 146 | +* [Contribute-upstream](/docs/contribute/generate-ref-docs/contribute-upstream/) |
| 147 | +* [Generating Reference Docs for Kubernetes Components and Tools](/docs/contribute/generate-ref-docs/kubernetes-components/) |
| 148 | +* [Generating Reference Documentation for kubectl Commands](/docs/contribute/generate-ref-docs/kubectl/) |
| 149 | +--> |
| 150 | +* [贡献上游](/zh-cn/docs/contribute/generate-ref-docs/contribute-upstream/) |
| 151 | +* [为 Kubernetes 组件和工具生成参考文档](/zh-cn/docs/contribute/generate-ref-docs/kubernetes-components/) |
| 152 | +* [为 kubectl 命令生成参考文档](/zh-cn/docs/contribute/generate-ref-docs/kubectl/) |
0 commit comments