From ca0b5efdcf9504bbf0c8f23a0bc2035d78b09db7 Mon Sep 17 00:00:00 2001 From: Phillip Wittrock Date: Tue, 15 May 2018 12:53:53 -0700 Subject: [PATCH] Add section on boilerplate to the docs. --- docs/book/SUMMARY.md | 1 + docs/book/beyond_basics/boilerplate.md | 24 ++++++++++++++++++++++++ docs/book/quick_start.md | 3 +++ 3 files changed, 28 insertions(+) create mode 100644 docs/book/beyond_basics/boilerplate.md diff --git a/docs/book/SUMMARY.md b/docs/book/SUMMARY.md index efe0e9d96bd..2bd3074f101 100644 --- a/docs/book/SUMMARY.md +++ b/docs/book/SUMMARY.md @@ -29,6 +29,7 @@ ### Beyond the Basics * Development Workflow + * [Defining Boilerplate License Headers](beyond_basics/boilerplate.md) * [Running Tests](beyond_basics/running_tests.md) * [Generating API Documentation](beyond_basics/generating_documentation.md) * [Updating Kubebuilder](beyond_basics/upgrading_kubebuilder.md) diff --git a/docs/book/beyond_basics/boilerplate.md b/docs/book/beyond_basics/boilerplate.md new file mode 100644 index 00000000000..561c6cf3149 --- /dev/null +++ b/docs/book/beyond_basics/boilerplate.md @@ -0,0 +1,24 @@ +{% panel style="info", title="Under Development" %} +This book is being actively developed. +{% endpanel %} + +# Defining Boilerplate License Headers + +{% method %} + +It is possible to add boilerplate license headers to all generated code by +modifying `hack/boilerplate.go.txt`. + +If you don't create `boilerplate.go.txt` an empty version will be created for you by +`kubebuilder init`. Modifying this file will only impact files created afterward. + +{% sample lang="bash" %} + +```bash +mkdir hack +echo "// MY LICENSE" > hack/boilerplate.go.txt +kubebuilder init --domain k8s.io +``` + +{% endmethod %} + diff --git a/docs/book/quick_start.md b/docs/book/quick_start.md index fc43ede41c6..ffc05a2bc26 100644 --- a/docs/book/quick_start.md +++ b/docs/book/quick_start.md @@ -37,6 +37,9 @@ export PATH=$PATH:/usr/local/kubebuilder/bin Initialize the project directory with the canonical project structure and go dependencies. +**Note:** To add a boilerplate header to generated files, create `hack/boilerplate.go.txt` +and add your boilerplate before running `kubebuilder init`. + {% sample lang="bash" %} ```bash kubebuilder init --domain k8s.io