Skip to content

Commit

Permalink
#459: Upgrading k8s yb cluster fails when bind address is private ip …
Browse files Browse the repository at this point in the history
…of pod.

Summary:
We wanted to use the public/broadcast address or hostname even if private ip changes (in kubernetes setup). The API for this, `UsePublicIp`, was missing a check to return true when `use_private_ip` is set to `never`.

Test Plan:
Tested via the following steps:
- Added 127.0.0.1 as node1, and same for 2 & 3, in /etc/hosts.
- Then started masters of a local RF=3 cluster (on Mac) using: ~/code/yugabyte/build/latest/bin/yb-master --webserver_interface 127.0.0.1 --rpc_bind_addresses=127.0.0.1 --server_broadcast_addresses=node1:7100 --master_addresses node1:7100,node2:7100,node3:7100 --fs_data_dirs "/tmp/yblocal1/" >& /tmp/yb-master_1.out &
- Killed 3rd master.
- Remapped node3 in /etc/hosts to 127.0.0.4.
- Restarted yb-master with 127.0.0.4 for rpc/web addresses, but with node3 in broadcast.
Ensured the new node became a follower in the quorum.

Repeated the same with yb-tserver, but ran into an issue - tracked in #461.

Reviewers: bogdan, sergei, karthik

Reviewed By: karthik

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D5428
  • Loading branch information
bbaddepudi committed Sep 5, 2018
1 parent 8438e9f commit a0a2072
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/yb/common/wire_protocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ bool UsePublicIp(const CloudInfoPB& connect_to,
const CloudInfoPB& connect_from) {
auto mode = GetMode();

if (mode == UsePrivateIpMode::never) {
return true;
}
if (connect_to.placement_cloud() != connect_from.placement_cloud()) {
return true;
}
Expand Down

0 comments on commit a0a2072

Please sign in to comment.