Skip to content

Commit c0be9aa

Browse files
author
Maria Ntalla
committed
Document environment variables
supported by envtest
1 parent 801e12a commit c0be9aa

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

pkg/envtest/server.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,18 @@ import (
3333

3434
var log = logf.RuntimeLog.WithName("test-env")
3535

36-
// Default binary path for test framework
36+
/*
37+
It's possible to override some defaults, by setting the following environment variables:
38+
USE_EXISTING_CLUSTER (boolean): if set to true, envtest will use an existing cluster
39+
TEST_ASSET_KUBE_APISERVER (string): path to the api-server binary to use
40+
TEST_ASSET_ETCD (string): path to the etcd binary to use
41+
TEST_ASSET_KUBECTL (string): path to the kubectl binary to use
42+
KUBEBUILDER_ASSETS (string): directory containing the binaries to use (api-server, etcd and kubectl)
43+
KUBEBUILDER_CONTROLPLANE_START_TIMEOUT (string supported by time.ParseDuration): timeout for test control plane to start
44+
KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT (string supported by time.ParseDuration): timeout for test control plane to start
45+
KUBEBUILDER_ATTACH_CONTROL_PLANE_OUTPUT (boolean): if set to true, the control plane's stdout and stderr are attached to os.Stdout and os.Stderr
46+
47+
*/
3748
const (
3849
envUseExistingCluster = "USE_EXISTING_CLUSTER"
3950
envKubeAPIServerBin = "TEST_ASSET_KUBE_APISERVER"
@@ -51,6 +62,7 @@ const (
5162
defaultKubebuilderControlPlaneStopTimeout = 20 * time.Second
5263
)
5364

65+
// Default binary path for test framework
5466
func defaultAssetPath(binary string) string {
5567
assetPath := os.Getenv(envKubebuilderPath)
5668
if assetPath == "" {
@@ -118,7 +130,8 @@ type Environment struct {
118130
AttachControlPlaneOutput bool
119131
}
120132

121-
// Stop stops a running server
133+
// Stop stops a running server.
134+
// If USE_EXISTING_CLUSTER is set to true, this method is a no-op.
122135
func (te *Environment) Stop() error {
123136
if te.useExistingCluster() {
124137
return nil

0 commit comments

Comments
 (0)