Skip to content

Commit

Permalink
Merge pull request #449 from adohe/support_use_existing_cluster
Browse files Browse the repository at this point in the history
✨ Allow setting "UseExistingCluster" via environment
  • Loading branch information
k8s-ci-robot committed May 30, 2019
2 parents 0532336 + 31d8c66 commit 5320b25
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/envtest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"time"

apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
Expand All @@ -34,6 +35,7 @@ var log = logf.RuntimeLog.WithName("test-env")

// Default binary path for test framework
const (
envUseExistingCluster = "USE_EXISTING_CLUSTER"
envKubeAPIServerBin = "TEST_ASSET_KUBE_APISERVER"
envEtcdBin = "TEST_ASSET_ETCD"
envKubectlBin = "TEST_ASSET_KUBECTL"
Expand Down Expand Up @@ -122,6 +124,10 @@ func (te Environment) getAPIServerFlags() []string {

// Start starts a local Kubernetes server and updates te.ApiserverPort with the port it is listening on
func (te *Environment) Start() (*rest.Config, error) {
if !te.UseExistingCluster {
// Check USE_EXISTING_CLUSTER env then
te.UseExistingCluster = strings.ToLower(os.Getenv(envUseExistingCluster)) == "true"
}
if te.UseExistingCluster {
log.V(1).Info("using existing cluster")
if te.Config == nil {
Expand Down

0 comments on commit 5320b25

Please sign in to comment.