doc: add workaround for hack/update-generated-code.sh

code-generator incorrectly resolve package path: wants to
write into v2/ directory instead of resolving v2 as package
path

Provide steps to successfully execute code-generator

Signed-off-by: Alex Szakaly <alex.szakaly@gmail.com>
This commit is contained in:
Alex Szakaly
2020-03-04 22:25:25 +01:00
parent 3dd4e07599
commit 14eaac289b

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. 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 ## update-crd.sh