Skip to content

Commit

Permalink
Set the --advertise-address when starting Kubernetes API server in te…
Browse files Browse the repository at this point in the history
…sts. (#529)

Fixes #509

If the user has no default route when running the tests, the Kubernetes API server will refuse to start as the --advertise-address argument is missing which makes Kubernetes look up the default address.

This appends a specific --advertise-address to the Kubernetes API server flags in integration tests.
  • Loading branch information
jbarrick-mesosphere committed Jul 9, 2019
1 parent 8f5f345 commit 94ca01d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/test/utils/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,9 @@ type TestEnvironment struct {
// StartTestEnvironment is a wrapper for controller-runtime's envtest that creates a Kubernetes API server and etcd
// suitable for use in tests.
func StartTestEnvironment() (env TestEnvironment, err error) {
env.Environment = &envtest.Environment{}
env.Environment = &envtest.Environment{
KubeAPIServerFlags: append(envtest.DefaultKubeAPIServerFlags, "--advertise-address={{ if .URL }}{{ .URL.Hostname }}{{ end }}"),
}

// Retry up to three times for the test environment to start up in case there is a port collision (#510).
for i := 0; i < 3; i++ {
Expand Down

0 comments on commit 94ca01d

Please sign in to comment.