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
✨ Allow passing the assets path bin via the env config #1214
✨ Allow passing the assets path bin via the env config #1214
Conversation
1ca5a31
to
aa49d4f
Compare
/test pull-controller-runtime-test-master |
aa49d4f
to
8347433
Compare
8347433
to
275d18a
Compare
/test pull-controller-runtime-test-master |
275d18a
to
3b86f6a
Compare
8450022
to
8d02d33
Compare
ae9401c
to
c656739
Compare
362e9ad
to
24a75dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: Overall, I think the priority should change a bit -- environment variables are intended as overrides, so I think they should be on top. Otherwise, if I store things elsewhere on my system, or want to test with a different version, I can't
pkg/envtest/server.go
Outdated
@@ -113,6 +116,10 @@ type Environment struct { | |||
// values are merged. | |||
CRDDirectoryPaths []string | |||
|
|||
// AbsBinaryDirectory is the path where the binaries required for the envtest are | |||
// locate in the environment | |||
AbsBinaryDirectory string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name is a bit unclear. Can we make this TestBinariesDirectory
or BinaryAssetsDirectory
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
1c6bf85
to
07c7a67
Compare
The suggestions made are applied now. |
pkg/envtest/server.go
Outdated
assetPath := os.Getenv(envKubebuilderPath) | ||
if assetPath == "" { | ||
assetPath = defaultKubebuilderPath | ||
// getBinAssetPath will return the path for the binary informed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// getBinAssetPath will return the path for the binary informed | |
// getBinAssetPath returns a path for binary from the following list of locations, | |
// ordered by precedence: | |
// 1. KUBEBUILDER_ASSETS | |
// 2. Environment.BinaryAssetsDirectory | |
// 3. The default path, "/usr/local/kubebuilder/bin" |
pkg/envtest/server.go
Outdated
@@ -113,6 +117,10 @@ type Environment struct { | |||
// values are merged. | |||
CRDDirectoryPaths []string | |||
|
|||
// BinaryAssetsDirectory is the path where the binaries required for the envtest are | |||
// locate in the environment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// locate in the environment | |
// located in the local environment. This field can be overridden by setting KUBEBUILDER_ASSETS. |
07c7a67
to
21c6666
Compare
Hi @estroz, Thank you for the review. All done 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, coderanger, DirectXMan12, estroz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
The priority here is:
TEST_ASSET_KUBE_APISERVER
,TEST_ASSET_ETCD
,TEST_ASSET_KUBECTL
KUBEBUILDER_ASSETS
Environment{}
/usr/local/kubebuilder/bin
Motivation
Allow passing the bin path to simplify the required implementation to config the EnvTest when the bin is not in the default path. Currently, if a developer would like to try to get the bins from a specific dir if they exist would be required an implementation such as:
With this change we can just: