Skip to content

Commit 33d53c1

Browse files
committed
Update testdata for CRD v1
This updates the testdata for CRD v1. All the changes are just description wrapping. We only test generation of CRD v1, since we now rely entirely on the k/apiextensions-apiserver conversion logic to do the hoisting of the common versions (and have separate tests for that).
1 parent 7e1b9da commit 33d53c1

File tree

4 files changed

+4862
-4682
lines changed

4 files changed

+4862
-4682
lines changed

.run-controller-gen.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
# This builds and runs controller-gen in a particular context
4+
# it's the equivalent of `go run sigs.k8s.io/controller-tools/cmd/controller-gen`
5+
# if you could somehow do that without modifying your go.mod.
6+
7+
current_dir=$(pwd)
8+
if ! readlink -f . &>/dev/null; then
9+
echo "you're probably on OSX. Please install gnu readlink -- otherwise you're missing the most useful readlink flag."
10+
exit 1
11+
fi
12+
13+
cd $(dirname $(readlink -f ${BASH_SOURCE[0]}))
14+
go run -v -exec "./.run-in.sh ${current_dir} " ./cmd/controller-gen $@

.run-in.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
# run something in a directory
4+
# goes hand-in .run-controller-gen.sh
5+
6+
cd $1
7+
shift
8+
$@

pkg/crd/testdata/cronjob_types.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
*/
1515

16-
//go:generate controller-gen crd paths=. output:dir=.
16+
// TODO(directxman12): test this across both versions (right now we're just
17+
// trusting k/k conversion, which is probably fine though)
18+
19+
//go:generate ../../../.run-controller-gen.sh crd:crdVersions=v1 paths=. output:dir=.
1720

1821
// +groupName=testdata.kubebuilder.io
1922
// +versionName=v1

0 commit comments

Comments
 (0)