Merge pull request #265 from alex1989hu/doc/add-v2-code-generator-readme

doc: add workaround for hack/update-generated-code.sh
This commit is contained in:
Kubernetes Prow Robot
2020-03-22 11:14:45 -07:00
committed by GitHub

View File

@@ -10,7 +10,35 @@ This is the script to update clientset/informers/listers and API deepcopy code u
Make sure to run this script after making changes to /pkg/apis/volumesnapshot/v1beta1/types.go.
To run this script, simply run: ./hack/update-generated-code.sh from the project root directory.
To run this script, you have to patch it:
```patch
diff --git a/hack/update-generated-code.sh b/hack/update-generated-code.sh
--- a/hack/update-generated-code.sh
+++ b/hack/update-generated-code.sh
@@ -27,7 +27,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
# instead of the $GOPATH directly. For normal projects this can be dropped.
bash ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
- github.com/kubernetes-csi/external-snapshotter/pkg/client github.com/kubernetes-csi/external-snapshotter/pkg/apis \
+ github.com/kubernetes-csi/external-snapshotter/v2/pkg/client github.com/kubernetes-csi/external-snapshotter/v2/pkg/apis \
volumesnapshot:v1beta1 \
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt
```
Once you are done with patching, continue:
```bash
rm -fr v2/
ln -sfvn $(pwd) v2
rm -fr pkg/client
```
Run: ./hack/update-generated-code.sh from the project root directory.
Do not forget to revert previously applied workaround:
```bash
git checkout -- v2/
git checkout -- hack/update-generated-code.sh
```
## update-crd.sh