Skip to content

Commit 0d1cce8

Browse files
authored
Merge pull request kubernetes-sigs#624 from pivotal-k8s/document-envvars
📖 Document environment variables supported by envtest
2 parents f4f5505 + 77e2eb9 commit 0d1cce8

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). 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+
*/
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 == "" {
@@ -121,7 +133,8 @@ type Environment struct {
121133
AttachControlPlaneOutput bool
122134
}
123135

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.
125138
func (te *Environment) Stop() error {
126139
if te.useExistingCluster() {
127140
return nil

0 commit comments

Comments
 (0)