https://github.com/mark8s/crd-demo
https://github.com/mark8s/crd-demo
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mark8s/crd-demo
- Owner: mark8s
- Created: 2022-03-10T10:00:38.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-03-10T10:00:54.000Z (over 3 years ago)
- Last Synced: 2025-02-06T22:42:24.603Z (9 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### k8s client 调用 crd
参考:
> https://www.martin-helmich.de/en/blog/kubernetes-crd-client.html
> https://www.cnblogs.com/double12gzh/p/13734830.html
```yaml
go get k8s.io/client-go@v0.17.0
go get k8s.io/apimachinery@v0.17.0
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.5
controller-gen object paths=./api/types/v1alpha1/project.go
```
#### 效果
自定义一个crd和cd,并apply到k8s中。通过注册client,使用client进行cr的crud以及watch操作。
使用了`controller-gen`生成了部分代码。