chore: Generating CRDs supports multiple versions (#5497)
Generating CRDs supports multiple versions
This commit is contained in:
@@ -6,6 +6,7 @@ CRD_OPTIONS="$1"
|
||||
PKGS="$2"
|
||||
GENS="$3"
|
||||
IFS=" " read -r -a PKGS <<< "${PKGS}"
|
||||
export GOFLAGS=-mod=readonly
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
cd "${KUBE_ROOT}" || exit
|
||||
@@ -13,23 +14,9 @@ cd "${KUBE_ROOT}" || exit
|
||||
for PKG in "${PKGS[@]}"; do
|
||||
if grep -qw "deepcopy" <<<"${GENS}"; then
|
||||
echo "Generating deepcopy for ${PKG}"
|
||||
if [[ "$PKG" =~ /\*$ ]]; then
|
||||
PKG=${PKG%??}
|
||||
DIR=$(go list -e -test=false -export=false -deps=false -find=false -tags ignore_autogenerated -f "{{.Dir}}" "kubesphere.io/api/${PKG}")
|
||||
# shellcheck disable=SC2010
|
||||
ls -1 -F "${DIR}" | grep '/$' | xargs -n 1 -I{} go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go object:headerFile=./hack/boilerplate.go.txt paths=kubesphere.io/api/"${PKG}"/{}
|
||||
else
|
||||
go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go object:headerFile=./hack/boilerplate.go.txt paths=kubesphere.io/api/"${PKG}"
|
||||
fi
|
||||
go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go object:headerFile=./hack/boilerplate.go.txt paths=./staging/src/kubesphere.io/api/"${PKG}"
|
||||
else
|
||||
echo "Generating manifests for ${PKG}"
|
||||
if [[ "$PKG" =~ /\*$ ]]; then
|
||||
PKG=${PKG%??}
|
||||
DIR=$(go list -e -test=false -export=false -deps=false -find=false -tags ignore_autogenerated -f "{{.Dir}}" "kubesphere.io/api/${PKG}")
|
||||
# shellcheck disable=SC2010
|
||||
ls -1 -F "${DIR}" | grep '/$' | xargs -n 1 -I{} go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go object:headerFile=./hack/boilerplate.go.txt paths=kubesphere.io/api/"${PKG}"/{} rbac:roleName=controller-perms "${CRD_OPTIONS}" output:crd:artifacts:config=config/crds
|
||||
else
|
||||
go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go object:headerFile=./hack/boilerplate.go.txt paths=kubesphere.io/api/"${PKG}" rbac:roleName=controller-perms "${CRD_OPTIONS}" output:crd:artifacts:config=config/crds
|
||||
fi
|
||||
go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go object:headerFile=./hack/boilerplate.go.txt paths=./staging/src/kubesphere.io/api/"${PKG}" rbac:roleName=controller-perms "${CRD_OPTIONS}" output:crd:artifacts:config=config/ks-core/crds
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user