mirror of
https://github.com/grafana/grafana.git
synced 2026-07-29 15:59:50 -05:00
K8s: update hack codegen script (#81216)
This commit is contained in:
+12
-8
@@ -14,14 +14,18 @@ total 0
|
||||
lrwxr-xr-x 1 ryan staff 37 Oct 5 09:34 grafana -> /Users/ryan/workspace/grafana/grafana
|
||||
```
|
||||
|
||||
You can clone k8s [code-generator](https://github.com/kubernetes/code-generator) here and use `CODEGEN_PKG=<CODE-GENERATOR-GIT-ROOT>` when running the `update-codegen.sh` script.
|
||||
The current workflow is to run the following:
|
||||
|
||||
The current workflow (sorry!) is to:
|
||||
```shell
|
||||
# ensure k8s.io/code-generator pkg is up to date
|
||||
go mod download
|
||||
|
||||
1. update the script to point to the group+version you want
|
||||
2. run the `update-codegen.sh` script. This will produce a bunch of new files
|
||||
3. move `pkg/generated/openapi/zz_generated.openapi.go` to `pkg/apis/{group/version}/zz_generated.openapi.go`.
|
||||
4. edit the package name so it is {version} and remove the boilerplate k8s kinds
|
||||
5. `rm -rf pkg/generated` -- we are not yet using most of the generated client stuff
|
||||
# the happy path
|
||||
./hack/update-codegen.sh
|
||||
|
||||
Once we are more comfortable with the outputs and process, we will build these steps into a more standard codegen pattern, but until then... happy hacking!
|
||||
# if wanting to agree to a change which introduces different openapi violations, run with the bool set to true
|
||||
UPDATE_API_KNOWN_VIOLATIONS=true ./hack/update-codegen.sh
|
||||
```
|
||||
|
||||
Note that the script deletes existing openapi go code and regenerates in place so that you will temporarily see
|
||||
deleted files in your `git status`. After a successful run, you should see them restored.
|
||||
|
||||
Reference in New Issue
Block a user