I followed the quick start, generated a demo project, but then running make test failed with:
[BeforeSuite] BeforeSuite
.../my-operator/api/v1alpha1/suite_test.go:48
Unexpected error:
<*errors.errorString | 0xc0003c63a0>: {
s: "failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory",
}
failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directory
occurred
.../my-operator/api/v1alpha1/suite_test.go:60
Kubebuilder version:
$ kubebuilder version
Version: version.Version{KubeBuilderVersion:"2.0.0-alpha.4", KubernetesVendor:"1.14.1", GitCommit:"a2db52f1f6fab178cb7f0ea51294faca6dfd9509", BuildDate:"2019-06-07T23:12:53Z", GoOs:"unknown", GoArch:"unknown"}
/kind bug
do you have files in /usr/local/kubebuilder/bin?
Ah, I installed kubebuilder at /$HOME/opt/ instead of /usr/local. It would be nice if the generated test could detect the location automatically.
The problem was solved by adding a symbolic link from /usr/local/kubebuilder to /$HOME/opt/kubebuilder.
For posterity, you can also set the KUBEBUILDER_ASSETS environment variable.
Most helpful comment
For posterity, you can also set the
KUBEBUILDER_ASSETSenvironment variable.