Skip to content

how to use kubebuilder helm plugin? #4799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kikyoulg opened this issue May 8, 2025 · 3 comments
Open

how to use kubebuilder helm plugin? #4799

kikyoulg opened this issue May 8, 2025 · 3 comments

Comments

@kikyoulg
Copy link

kikyoulg commented May 8, 2025

my kubebuilder version is 4.5.2,use command "kubebuilder init --plugins=helm/v1-alpha",then what next to do?

@camilamacedo86
Copy link
Member

camilamacedo86 commented May 8, 2025

my kubebuilder version is 4.5.2,use command "kubebuilder init --plugins=helm/v1-alpha",then what next to do?

I see that a Helm chart is now scaffolded under the dist/chart directory, as shown in this example:
https://github.com/kubernetes-sigs/kubebuilder/tree/master/testdata/project-v4-with-plugins/dist/chart

That means we now have two distribution options for delivering solutions to users:

This is also well documented in the generated README.md for the project scaffold:

## Project Distribution
Following the options to release and provide this solution to the users.
### By providing a bundle with all YAML files
1. Build the installer for the image built and published in the registry:
```sh
make build-installer IMG=<some-registry>/project-v4-with-plugins:tag
```
**NOTE:** The makefile target mentioned above generates an 'install.yaml'
file in the dist directory. This file contains all the resources built
with Kustomize, which are necessary to install this project without its
dependencies.
2. Using the installer
Users can just run 'kubectl apply -f <URL for YAML BUNDLE>' to install
the project, i.e.:
```sh
kubectl apply -f https://raw.githubusercontent.com/<org>/project-v4-with-plugins/<tag or branch>/dist/install.yaml
```
### By providing a Helm Chart
1. Build the chart using the optional helm plugin
```sh
kubebuilder edit --plugins=helm/v1-alpha
```
2. See that a chart was generated under 'dist/chart', and users
can obtain this solution from there.
**NOTE:** If you change the project, you need to update the Helm Chart
using the same command above to sync the latest changes. Furthermore,
if you create webhooks, you need to use the above command with
the '--force' flag and manually ensure that any custom configuration
previously added to 'dist/chart/values.yaml' or 'dist/chart/manager/manager.yaml'

@kikyoulg
Copy link
Author

kikyoulg commented May 8, 2025

我的kubebuilder版本是4.5.2,使用命令“kubebuilder init --plugins=helm/v1-alpha”,那么下一步该做什么呢?

我看到目录下现在已经搭建了一个 Helm 图表dist/chart,如下例所示: https://github.com/kubernetes-sigs/kubebuilder/tree/master/testdata/project-v4-with-plugins/dist/chart

这意味着我们现在有两种分发选项来向用户提供解决方案:

  • 提供生成的 YAML 包(例如:https ://github.com/kubernetes-sigs/kubebuilder/blob/master/testdata/project-v4-with-plugins/dist/install.yaml )
  • 或者提供 Helm chart

README.md这在为项目脚手架生成的文件中也有详细记录:

kubebuilder/testdata/project-v4-with-plugins/README.md

第 69 至 110 行 5d42475

##项目分布

按照选项发布并向用户提供此解决方案。

###通过提供包含所有 YAML 文件的包

1.为在 registry 中构建和发布的镜像构建安装程序:

使构建安装程序 IMG= <some-registry> / project -v4 - with-plugins:tag

**注意:**上面提到的 makefile 目标生成一个“install.yaml”
dist 目录中的文件。此文件包含构建的所有资源
与 Kustomize 一起使用,这是安装此项目所必需的,无需
依赖项。

2.使用安装程序

用户只需运行“kubectl apply -f < YAML BUNDLE的URL >”即可安装
项目,即:

kubectl apply -f https://raw.githubusercontent.com/ < org > /project-v4-with-plugins/ <标签或分支> /dist/install.yaml

###通过提供 Helm Chart

1.使用可选的helm插件构建图表

kubebuilder 编辑 --plugins=helm/v1-alpha

2.看到在 'dist/chart' 下生成了一个图表,并且用户
可以从那里获得这个解决方案。

**注意:**如果您更改项目,则需要更新 Helm Chart
使用上述相同的命令同步最新更改。此外,
如果你创建 webhook,则需要使用上述命令
'--force' 标志并手动确保任何自定义配置
先前添加到“dist/chart/values.yaml”或“dist/chart/manager/manager.yaml”

thanks for your fast reply,but i dont konw how to use this generate file,it seems like a helm chart and helm value,how to change this chart to operator ?and how to install this helm chart to k8s ? i guess this helm plugin can auto change helm chart to k8s operaotr ,maybe i am wrong ,this plugin can just generate a helm chart and chart value

@camilamacedo86
Copy link
Member

thanks for your fast reply,but i dont konw how to use this generate file,it seems like a helm chart and helm value,how to change this chart to operator

The intention is not change the chart to OPERATOR at all
The intention is to ONLY package the solution using HelmChart to allow distribution.
Please, check the Readme of the project scaffold with the tool.
As the links shared: #4799 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants