Skip to content

Commit f226288

Browse files
authored
Merge pull request #199 from Peefy/publish-kubernetes-module-guide
docs: add kubernetes module publish docs
2 parents 5e83a13 + 5554e66 commit f226288

File tree

6 files changed

+372
-8
lines changed

6 files changed

+372
-8
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: "Publish Kubernetes Modules"
3+
sidebar_position: 4
4+
---
5+
6+
## Introduction
7+
8+
The community KCL module registry is located at [Artifact Hub](https://artifacthub.io/packages/search?org=kcl&sort=relevance&page=1) and welcomes participation at the [GitHub repository](https://github.com/kcl-lang/artifacthub) using pull requests. This section explains how to publish Kubernetes modules and work with the module registry.
9+
10+
> NOTE: If you want to publish your KCL modules to the `kcl-lang` official registry, then the source code of your KCL modules will be saved in this repo, you need to submit the source code of your module to this repository via PRs. But KCL also makes it possible to create and run your own kcl module registry such as OCI registries e.g., Docker Hub, Github Packages and Harbor, etc.
11+
12+
> NOTE: The KCL module does not limit your configuration or policy code content. It can be a workload configuration for applications like Helm Chart, or it can be a Kubernetes validation code or a general code library. However, we strongly recommend that you provide a brief introduction and usage of a kcl module in the documentation.
13+
14+
## Prerequisite
15+
16+
+ Install [kcl](https://kcl-lang.io/docs/user_docs/getting-started/install/)
17+
18+
## Quick Start
19+
20+
### Publish KCL module by PR
21+
22+
#### 1. Fork and Clone the code repository
23+
24+
First, you need to clone the repository
25+
26+
```
27+
git clone https://github.com/{your_github_id}/artifacthub --depth=1
28+
```
29+
30+
#### 2. Create a branch for your module
31+
32+
We recommend that your branch name be: `publish-pkg-<pkg_name>`, `<pkg_name>` is the name of your module.
33+
34+
Take the module `helloworld` as an example
35+
36+
Enter the artifacthub directory you downloaded
37+
38+
```shell
39+
cd artifacthub
40+
```
41+
42+
Create a branch `publish-pkg-helloworld` for the module `helloworld`
43+
44+
```shell
45+
git checkout -b publish-pkg-helloworld
46+
```
47+
48+
#### 3. Add your KCL module
49+
50+
You need to move your module to the current directory. In our example, we use the `kcl mod init` command to create the module `helloworld`
51+
52+
```shell
53+
kcl mod init helloworld
54+
```
55+
56+
You can add a `README.md` file to the root directory of the module to display on the homepage of AH.
57+
58+
```shell
59+
echo "## Introduction" >> helloworld/README.md
60+
echo "This is a kcl module named helloworld." >> helloworld/README.md
61+
```
62+
63+
Generate reference documents for your module (optional).
64+
65+
```shell
66+
kcl doc generate
67+
```
68+
69+
#### 4. Commit your module
70+
71+
You can use the following command to commit your module
72+
73+
Use `git add .` command to add your module to the staging area of git
74+
75+
```shell
76+
git add .
77+
```
78+
79+
Use `git commit -s` command to commit your module, we recommend that your commit message follow the format "publish module <pkg_name>".
80+
81+
```shell
82+
git commit -m "publish module helloworld" -s
83+
```
84+
85+
Use `git push` command to submit your module to your branch `publish-pkg-<pkg_name>`
86+
87+
```shell
88+
git push
89+
```
90+
91+
#### 5. Submit a PR
92+
93+
Finally, you need to submit a PR to the main branch of the repository with your branch `publish-pkg-<pkg_name>`.
94+
95+
- [How to create PR](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)

docs/user_docs/guides/working-with-k8s/_4-publish-modules.md

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
title: "发布 Kubernetes 模块"
3+
sidebar_position: 4
4+
---
5+
6+
## 简介
7+
8+
社区官方的 KCL 模块 Registry 位于 [Artifact Hub](https://artifacthub.io/packages/search?org=kcl&sort=relevance&page=1),欢迎通过在 [GitHub 仓库](https://github.com/kcl-lang/artifacthub) 提交 pull requests 参与共建。本部分介绍如何发布 Kubernetes 模块并使用模块 Registry。
9+
10+
> 注意:如果您想将您的 KCL 模块发布到 `kcl-lang` 官方 Registry 中,则您的 KCL 模块的源代码将需要保存在上述存储库中。但是,KCL 允许接入三方的 Registry,例如各种 OCI Registry,如Docker Hub、Github Packages 和 Harbor 等。只需通过 `kcl registry login` 命令登录到对应的 Registry 即可。
11+
12+
> 注意:KCL 模块不会限制模块中配置或策略代码的具体内容。它可以是一个与 Kubernetes Helm Chart 类似的用于发布的应用程序工作负载配置,也可以是一段策略代码用于校验 Kubernetes 配置或者使用 CRD 转换而来的 KCL Schema。但是,我们强烈建议您在文档中提供有关 KCL 模块的简要介绍文档和具体用法。
13+
14+
## 先决条件
15+
16+
+ 安装 [kcl](https://kcl-lang.io/docs/user_docs/getting-started/install/)
17+
18+
## 快速入门
19+
20+
### 通过 GitHub PR 发布 KCL 模块
21+
22+
#### 1. Fork 并克隆代码存储库
23+
24+
```shell
25+
git clone https://github.com/{your_github_id}/artifacthub --depth=1
26+
```
27+
28+
#### 2. 创建分支
29+
30+
我们建议您的分支名称为:`publish-pkg-<pkg_name>``<pkg_name>` 是您的 KCL 模块的称。以模块 helloworld 为例
31+
32+
进入您下载的 artifacthub 目录
33+
34+
```shell
35+
cd artifacthub
36+
```
37+
38+
为模块 `helloworld` 创建一个名为 `publish-pkg-helloworld` 的分支
39+
40+
```shell
41+
git checkout -b publish-pkg-helloworld
42+
```
43+
44+
#### 3. 添加您的 KCL 模块
45+
46+
在我们的示例中,使用 `kcl mod init` 命令创建模块 `helloworld`
47+
48+
```shell
49+
kcl mod init helloworld
50+
```
51+
52+
您可以在模块的根目录添加一个 `README.md` 文件,以在 Artifact Hub 的模块主页上显示。
53+
54+
```shell
55+
echo "## Introduction" >> helloworld/README.md
56+
echo "This is a kcl module named helloworld." >> helloworld/README.md
57+
```
58+
59+
为模块生成参考文档(可选)
60+
61+
```shell
62+
kcl doc generate
63+
```
64+
65+
#### 4. 提交代码
66+
67+
您可以使用以下命令提交您的模块
68+
69+
使用 `git add .` 命令将您的模块添加到git的暂存区
70+
71+
```shell
72+
git add .
73+
```
74+
75+
使用 `git commit -s` 命令提交您的模块,我们建议您的提交消息遵循格式 `"publish module <pkg_name>"`
76+
77+
```shell
78+
git commit -m "publish module helloworld" -s
79+
```
80+
81+
提交分支
82+
83+
```shell
84+
git push
85+
```
86+
87+
#### 5. 提交 PR
88+
89+
最后,您需要提交一个 PR 到存储库的主分支,包括您的分支 `publish-pkg-<pkg_name>`
90+
91+
- [如何创建 PR](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)

i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/working-with-k8s/_4-publish-modules.md

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
title: "发布 Kubernetes 模块"
3+
sidebar_position: 4
4+
---
5+
6+
## 简介
7+
8+
社区官方的 KCL 模块 Registry 位于 [Artifact Hub](https://artifacthub.io/packages/search?org=kcl&sort=relevance&page=1),欢迎通过在 [GitHub 仓库](https://github.com/kcl-lang/artifacthub) 提交 pull requests 参与共建。本部分介绍如何发布 Kubernetes 模块并使用模块 Registry。
9+
10+
> 注意:如果您想将您的 KCL 模块发布到 `kcl-lang` 官方 Registry 中,则您的 KCL 模块的源代码将需要保存在上述存储库中。但是,KCL 允许接入三方的 Registry,例如各种 OCI Registry,如Docker Hub、Github Packages 和 Harbor 等。只需通过 `kcl registry login` 命令登录到对应的 Registry 即可。
11+
12+
> 注意:KCL 模块不会限制模块中配置或策略代码的具体内容。它可以是一个与 Kubernetes Helm Chart 类似的用于发布的应用程序工作负载配置,也可以是一段策略代码用于校验 Kubernetes 配置或者使用 CRD 转换而来的 KCL Schema。但是,我们强烈建议您在文档中提供有关 KCL 模块的简要介绍文档和具体用法。
13+
14+
## 先决条件
15+
16+
+ 安装 [kcl](https://kcl-lang.io/docs/user_docs/getting-started/install/)
17+
18+
## 快速入门
19+
20+
### 通过 GitHub PR 发布 KCL 模块
21+
22+
#### 1. Fork 并克隆代码存储库
23+
24+
```shell
25+
git clone https://github.com/{your_github_id}/artifacthub --depth=1
26+
```
27+
28+
#### 2. 创建分支
29+
30+
我们建议您的分支名称为:`publish-pkg-<pkg_name>``<pkg_name>` 是您的 KCL 模块的称。以模块 helloworld 为例
31+
32+
进入您下载的 artifacthub 目录
33+
34+
```shell
35+
cd artifacthub
36+
```
37+
38+
为模块 `helloworld` 创建一个名为 `publish-pkg-helloworld` 的分支
39+
40+
```shell
41+
git checkout -b publish-pkg-helloworld
42+
```
43+
44+
#### 3. 添加您的 KCL 模块
45+
46+
在我们的示例中,使用 `kcl mod init` 命令创建模块 `helloworld`
47+
48+
```shell
49+
kcl mod init helloworld
50+
```
51+
52+
您可以在模块的根目录添加一个 `README.md` 文件,以在 Artifact Hub 的模块主页上显示。
53+
54+
```shell
55+
echo "## Introduction" >> helloworld/README.md
56+
echo "This is a kcl module named helloworld." >> helloworld/README.md
57+
```
58+
59+
为模块生成参考文档(可选)
60+
61+
```shell
62+
kcl doc generate
63+
```
64+
65+
#### 4. 提交代码
66+
67+
您可以使用以下命令提交您的模块
68+
69+
使用 `git add .` 命令将您的模块添加到git的暂存区
70+
71+
```shell
72+
git add .
73+
```
74+
75+
使用 `git commit -s` 命令提交您的模块,我们建议您的提交消息遵循格式 `"publish module <pkg_name>"`
76+
77+
```shell
78+
git commit -m "publish module helloworld" -s
79+
```
80+
81+
提交分支
82+
83+
```shell
84+
git push
85+
```
86+
87+
#### 5. 提交 PR
88+
89+
最后,您需要提交一个 PR 到存储库的主分支,包括您的分支 `publish-pkg-<pkg_name>`
90+
91+
- [如何创建 PR](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: "Publish Kubernetes Modules"
3+
sidebar_position: 4
4+
---
5+
6+
## Introduction
7+
8+
The community KCL module registry is located at [Artifact Hub](https://artifacthub.io/packages/search?org=kcl&sort=relevance&page=1) and welcomes participation at the [GitHub repository](https://github.com/kcl-lang/artifacthub) using pull requests. This section explains how to publish Kubernetes modules and work with the module registry.
9+
10+
> NOTE: If you want to publish your KCL modules to the `kcl-lang` official registry, then the source code of your KCL modules will be saved in this repo, you need to submit the source code of your module to this repository via PRs. But KCL also makes it possible to create and run your own kcl module registry such as OCI registries e.g., Docker Hub, Github Packages and Harbor, etc.
11+
12+
> NOTE: The KCL module does not limit your configuration or policy code content. It can be a workload configuration for applications like Helm Chart, or it can be a Kubernetes validation code or a general code library. However, we strongly recommend that you provide a brief introduction and usage of a kcl module in the documentation.
13+
14+
## Prerequisite
15+
16+
+ Install [kcl](https://kcl-lang.io/docs/user_docs/getting-started/install/)
17+
18+
## Quick Start
19+
20+
### Publish KCL module by PR
21+
22+
#### 1. Fork and Clone the code repository
23+
24+
First, you need to clone the repository
25+
26+
```
27+
git clone https://github.com/{your_github_id}/artifacthub --depth=1
28+
```
29+
30+
#### 2. Create a branch for your module
31+
32+
We recommend that your branch name be: `publish-pkg-<pkg_name>`, `<pkg_name>` is the name of your module.
33+
34+
Take the module `helloworld` as an example
35+
36+
Enter the artifacthub directory you downloaded
37+
38+
```shell
39+
cd artifacthub
40+
```
41+
42+
Create a branch `publish-pkg-helloworld` for the module `helloworld`
43+
44+
```shell
45+
git checkout -b publish-pkg-helloworld
46+
```
47+
48+
#### 3. Add your KCL module
49+
50+
You need to move your module to the current directory. In our example, we use the `kcl mod init` command to create the module `helloworld`
51+
52+
```shell
53+
kcl mod init helloworld
54+
```
55+
56+
You can add a `README.md` file to the root directory of the module to display on the homepage of AH.
57+
58+
```shell
59+
echo "## Introduction" >> helloworld/README.md
60+
echo "This is a kcl module named helloworld." >> helloworld/README.md
61+
```
62+
63+
Generate reference documents for your module (optional).
64+
65+
```shell
66+
kcl doc generate
67+
```
68+
69+
#### 4. Commit your module
70+
71+
You can use the following command to commit your module
72+
73+
Use `git add .` command to add your module to the staging area of git
74+
75+
```shell
76+
git add .
77+
```
78+
79+
Use `git commit -s` command to commit your module, we recommend that your commit message follow the format "publish module <pkg_name>".
80+
81+
```shell
82+
git commit -m "publish module helloworld" -s
83+
```
84+
85+
Use `git push` command to submit your module to your branch `publish-pkg-<pkg_name>`
86+
87+
```shell
88+
git push
89+
```
90+
91+
#### 5. Submit a PR
92+
93+
Finally, you need to submit a PR to the main branch of the repository with your branch `publish-pkg-<pkg_name>`.
94+
95+
- [How to create PR](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)

0 commit comments

Comments
 (0)