@@ -33,7 +33,18 @@ import (
33
33
34
34
var log = logf .RuntimeLog .WithName ("test-env" )
35
35
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). Defaults to /usr/local/kubebuilder/bin.
43
+ KUBEBUILDER_CONTROLPLANE_START_TIMEOUT (string supported by time.ParseDuration): timeout for test control plane to start. Defaults to 20s.
44
+ KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT (string supported by time.ParseDuration): timeout for test control plane to start. Defaults to 20s.
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
+ */
37
48
const (
38
49
envUseExistingCluster = "USE_EXISTING_CLUSTER"
39
50
envKubeAPIServerBin = "TEST_ASSET_KUBE_APISERVER"
@@ -51,6 +62,7 @@ const (
51
62
defaultKubebuilderControlPlaneStopTimeout = 20 * time .Second
52
63
)
53
64
65
+ // Default binary path for test framework
54
66
func defaultAssetPath (binary string ) string {
55
67
assetPath := os .Getenv (envKubebuilderPath )
56
68
if assetPath == "" {
@@ -121,7 +133,8 @@ type Environment struct {
121
133
AttachControlPlaneOutput bool
122
134
}
123
135
124
- // Stop stops a running server
136
+ // Stop stops a running server.
137
+ // If USE_EXISTING_CLUSTER is set to true, this method is a no-op.
125
138
func (te * Environment ) Stop () error {
126
139
if te .useExistingCluster () {
127
140
return nil
0 commit comments