-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration tests should use 127.0.0.1 consistently #4254
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,7 +82,7 @@ func (fakeKubeletClient) GetPodStatus(host, podNamespace, podID string) (api.Pod | |
default: | ||
glog.Fatalf("Can't get info for: '%v', '%v - %v'", host, podNamespace, podID) | ||
} | ||
r, err := c.GetPodStatus("localhost", podNamespace, podID) | ||
r, err := c.GetPodStatus("127.0.0.1", podNamespace, podID) | ||
if err != nil { | ||
return r, err | ||
} | ||
|
@@ -114,7 +114,7 @@ func (h *delegateHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { | |
|
||
func startComponents(manifestURL string) (apiServerURL string) { | ||
// Setup | ||
servers := []string{"http://localhost:4001"} | ||
servers := []string{} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was an artifact of the bad behavior of |
||
glog.Infof("Creating etcd client pointing to %v", servers) | ||
machineList := []string{"localhost", "127.0.0.1"} | ||
|
||
|
@@ -163,6 +163,11 @@ func startComponents(manifestURL string) (apiServerURL string) { | |
glog.Fatalf("Nonnumeric port? %v", err) | ||
} | ||
|
||
publicAddress := net.ParseIP(host) | ||
if publicAddress == nil { | ||
glog.Fatalf("no public address for %s", host) | ||
} | ||
|
||
// Create a master and install handlers into mux. | ||
m := master.New(&master.Config{ | ||
Client: cl, | ||
|
@@ -174,7 +179,7 @@ func startComponents(manifestURL string) (apiServerURL string) { | |
AdmissionControl: admit.NewAlwaysAdmit(), | ||
ReadWritePort: portNumber, | ||
ReadOnlyPort: portNumber, | ||
PublicAddress: net.ParseIP(host), | ||
PublicAddress: publicAddress, | ||
CacheTimeout: 2 * time.Second, | ||
}) | ||
handler.delegate = m.Handler | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,12 +40,12 @@ kube::etcd::start() { | |
# Start etcd | ||
ETCD_DIR=$(mktemp -d -t test-etcd.XXXXXX) | ||
kube::log::usage "etcd -data-dir ${ETCD_DIR} --bind-addr ${host}:${port} >/dev/null 2>/dev/null" | ||
etcd -data-dir ${ETCD_DIR} -addr ${host}:${port} >/dev/null 2>/dev/null & | ||
etcd -data-dir ${ETCD_DIR} --bind-addr ${host}:${port} >/dev/null 2>/dev/null & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the bug from etcd 0.4.6 -> 2.0.0 - it behaves differently. |
||
ETCD_PID=$! | ||
|
||
echo "Waiting for etcd to come up." | ||
kube::util::wait_for_url "http://${testhost}:${port}/v2/machines" "etcd: " 0.25 80 | ||
curl -X PUT "http://${testhost}:${port}/v2/keys/_test" | ||
kube::util::wait_for_url "http://${host}:${port}/v2/machines" "etcd: " 0.25 80 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was code I put in before I figured out what was wrong with -addr vs -bind-addr |
||
curl -X PUT "http://${host}:${port}/v2/keys/_test" | ||
} | ||
|
||
kube::etcd::cleanup() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,7 +93,7 @@ sudo "${GO_OUT}/kube-apiserver" \ | |
--address="${API_HOST}" \ | ||
--port="${API_PORT}" \ | ||
--runtime_config=api/v1beta3 \ | ||
--etcd_servers="http://localhost:4001" \ | ||
--etcd_servers="http://127.0.0.1:4001" \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was changed when upgrading to 2, and I'm reverting it back now that we're using -bind-addr |
||
--portal_net="10.0.0.0/24" \ | ||
--cors_allowed_origins="${API_CORS_ALLOWED_ORIGINS}" >"${APISERVER_LOG}" 2>&1 & | ||
APISERVER_PID=$! | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more correct - we're saying "use the host at 127.0.0.1" instead of "resolve localhost".