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

Change 'make generate' to write only a single CRD #978

Merged
merged 2 commits into from
Mar 25, 2020
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
14 changes: 14 additions & 0 deletions .ci/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ fi
# move the generated CRD to the same location the operator-sdk places
mv deploy/crds/jaegertracing.io_jaegers.yaml deploy/crds/jaegertracing.io_jaegers_crd.yaml

# the controller-gen will generate a list of CRDs, but the operator-sdk tooling expects
# a single item
# the proper solutions are, in order:
# 1) find a controller-gen switch that makes it write only one CRD. Such a switch doesn't exist yet: https://git.io/JvX5D
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth opening an issue in the controller-gen repo to let them know that this is causing problems.

# 2) use a YAML command line tool to get the first item from the file
# 3) chop off the first two lines of the file
# the last option is the easiest to implement for now, also because `tail` is found everywhere
echo "$(tail -n +3 deploy/crds/jaegertracing.io_jaegers_crd.yaml)" > deploy/crds/jaegertracing.io_jaegers_crd.yaml
jpkrohling marked this conversation as resolved.
Show resolved Hide resolved

if ! [[ "$(head -n 1 deploy/crds/jaegertracing.io_jaegers_crd.yaml)" == "apiVersion"* ]]; then
echo "The generated CRD doesn't seem valid. Make sure the controller-gen is generating the CRD in the expected format. Aborting."
exit 1
fi

# generate the schema validation (openapi) stubs
${OPENAPIGEN} --logtostderr=true -o "" -i ./pkg/apis/jaegertracing/v1 -O zz_generated.openapi -p ./pkg/apis/jaegertracing/v1 -h /dev/null -r "-"
RT=$?
Expand Down
2 changes: 0 additions & 2 deletions deploy/crds/jaegertracing.io_jaegers_crd.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
Expand Down