Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate CRDs with structural schema #1885

Merged
merged 8 commits into from
Sep 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions hack/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ RUN mkdir -p /go/src/k8s.io && \
git clone -b kubernetes-1.15.3 https://github.com/kubernetes/apimachinery && \
# vendor code-generator go modules to be compatible with pre-1.15
cd /go/src/k8s.io/code-generator && GO111MODULE=on go mod vendor && \
go get -d sigs.k8s.io/controller-tools/cmd/controller-gen && \
cd /go/src/sigs.k8s.io/controller-tools && GO111MODULE=on go mod vendor && \
go get golang.org/x/tools/cmd/goimports && \
cd /go/src/golang.org/x/tools && \
git checkout 40a48ad93fbe707101afb2099b738471f70594ec && \
Expand Down
136 changes: 136 additions & 0 deletions hack/crd-gen/main.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 17 additions & 2 deletions hack/update-generated-crd-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,27 @@ if [[ ! -d "${GOPATH}/src/k8s.io/code-generator" ]]; then
exit 1
fi

cd ${GOPATH}/src/k8s.io/code-generator
if [[ ! -d "${GOPATH}/src/sigs.k8s.io/controller-tools" ]]; then
echo "sigs.k8s.io/controller-tools missing from GOPATH"
exit 1
fi

./generate-groups.sh \
${GOPATH}/src/k8s.io/code-generator/generate-groups.sh \
all \
github.com/heptio/velero/pkg/generated \
github.com/heptio/velero/pkg/apis \
"velero:v1" \
--go-header-file ${GOPATH}/src/github.com/heptio/velero/hack/boilerplate.go.txt \
$@

if [[ "$@" == "--verify-only" ]]; then
# skip generating CRD manifests
exit
fi

go run ${GOPATH}/src/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go \
crd \
output:dir=pkg/generated/crds/manifests \
paths=./pkg/apis/velero/v1/...

go generate ./pkg/generated/crds
69 changes: 69 additions & 0 deletions pkg/generated/crds/crds.go

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pkg/generated/crds/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Package crds embeds the controller-tools generated CRD manifests
package crds

//go:generate go run ../../../hack/crd-gen/main.go
Loading