Skip to content

Commit

Permalink
fix: listen on the IPv6 unspecified address
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbeaumont committed Sep 14, 2024
1 parent ea844b8 commit 7f9fed0
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 36 deletions.
18 changes: 9 additions & 9 deletions control-plane/agents/src/bin/core/tests/controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ async fn store_lease_lock() {

let lease_ttl = std::time::Duration::from_secs(2);
let _core_agent = Etcd::new_leased(
["0.0.0.0:2379"],
["[::]:2379"],
ControlPlaneService::CoreAgent.to_string(),
lease_ttl,
)
.await
.unwrap();

let mut store = Client::connect(["0.0.0.0:2379"], None)
let mut store = Client::connect(["[::]:2379"], None)
.await
.expect("Failed to connect to etcd.");

Expand All @@ -100,7 +100,7 @@ async fn store_lease_lock() {

tokio::time::sleep(lease_ttl).await;

let mut etcd = Etcd::new("0.0.0.0:2379").await.unwrap();
let mut etcd = Etcd::new("[::]:2379").await.unwrap();
let svc = ControlPlaneService::CoreAgent;
let obj: StoreLeaseOwner = etcd
.get_obj(&StoreLeaseOwnerKey::new(&svc))
Expand All @@ -114,7 +114,7 @@ async fn store_lease_lock() {
);

let _core_agent2 = Etcd::new_leased(
["0.0.0.0:2379"],
["[::]:2379"],
ControlPlaneService::CoreAgent.to_string(),
lease_ttl,
)
Expand All @@ -134,7 +134,7 @@ async fn core_agent_lease_lock() {
.await
.unwrap();

let mut store = Client::connect(["0.0.0.0:2379"], None)
let mut store = Client::connect(["[::]:2379"], None)
.await
.expect("Failed to connect to etcd.");

Expand All @@ -144,7 +144,7 @@ async fn core_agent_lease_lock() {

tokio::time::sleep(lease_ttl).await;

let mut etcd = Etcd::new("0.0.0.0:2379").await.unwrap();
let mut etcd = Etcd::new("[::]:2379").await.unwrap();
let svc = ControlPlaneService::CoreAgent;
let obj: StoreLeaseOwner = etcd
.get_obj(&StoreLeaseOwnerKey::new(&svc))
Expand All @@ -158,7 +158,7 @@ async fn core_agent_lease_lock() {
);

let _core_agent2 = Etcd::new_leased(
["0.0.0.0:2379"],
["[::]:2379"],
ControlPlaneService::CoreAgent.to_string(),
lease_ttl,
)
Expand Down Expand Up @@ -192,7 +192,7 @@ async fn core_agent_lease_lock() {
tokio::time::sleep(lease_ttl_wait).await;

let _core_agent2 = Etcd::new_leased(
["0.0.0.0:2379"],
["[::]:2379"],
ControlPlaneService::CoreAgent.to_string(),
lease_ttl,
)
Expand Down Expand Up @@ -229,7 +229,7 @@ async fn etcd_pagination() {
.await
.unwrap();

let mut etcd = Etcd::new("0.0.0.0:2379").await.unwrap();
let mut etcd = Etcd::new("[::]:2379").await.unwrap();

let node_prefix = key_prefix_obj(StorableObjectType::NodeSpec, ApiVersion::V0);
let volume_prefix = key_prefix_obj(StorableObjectType::VolumeSpec, ApiVersion::V0);
Expand Down
2 changes: 1 addition & 1 deletion control-plane/agents/src/bin/core/tests/pool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ async fn test_disown_missing_replica_owners() {

// Modify the replica spec in the store so that the replica has a volume and nexus owner;
// neither of which exist.
let mut etcd = Etcd::new("0.0.0.0:2379").await.unwrap();
let mut etcd = Etcd::new("[::]:2379").await.unwrap();
let mut replica: ReplicaSpec = etcd
.get_obj(&ReplicaSpecKey::from(&replica_id))
.await
Expand Down
4 changes: 2 additions & 2 deletions control-plane/agents/src/bin/core/tests/volume/hotspare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ async fn hotspare_replica_count_spread(cluster: &Cluster) {
// by increasing the replica count from 1 to `replica_count` under the core agent
cluster.composer().stop("core").await.unwrap();

let mut store = Etcd::new("0.0.0.0:2379")
let mut store = Etcd::new("[::]:2379")
.await
.expect("Failed to connect to etcd.");

Expand Down Expand Up @@ -463,7 +463,7 @@ async fn hotspare_nexus_replica_count(cluster: &Cluster) {
.with_max_retries(10)
.with_req_timeout(Duration::from_millis(500))
.with_timeout_backoff(Duration::from_millis(50));
let mut store = Etcd::new("0.0.0.0:2379")
let mut store = Etcd::new("[::]:2379")
.await
.expect("Failed to connect to etcd.");

Expand Down
2 changes: 1 addition & 1 deletion control-plane/agents/src/bin/core/tests/volume/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ async fn nexus_persistence_test_iteration(
.await
.unwrap();

let mut store = Etcd::new("0.0.0.0:2379")
let mut store = Etcd::new("[::]:2379")
.await
.expect("Failed to connect to etcd.");
let mut nexus_info: NexusInfo = store
Expand Down
2 changes: 1 addition & 1 deletion control-plane/agents/src/bin/core/tests/watch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async fn watch() {
let watches = client.get_watch_volume(&volume.spec().uuid).await.unwrap();
assert!(watches.is_empty());

let mut store = Etcd::new("0.0.0.0:2379")
let mut store = Etcd::new("[::]:2379")
.await
.expect("Failed to connect to etcd.");

Expand Down
4 changes: 2 additions & 2 deletions control-plane/csi-driver/src/bin/node/main_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ pub(super) async fn main() -> anyhow::Result<()> {
.long("grpc-endpoint")
.value_name("ENDPOINT")
.help("ip address where this instance runs, and optionally the gRPC port")
.default_value("0.0.0.0")
.default_value("[::]")
.required(false)
)
.arg(
Expand Down Expand Up @@ -440,7 +440,7 @@ fn validate_endpoints(
// sent in registration request.
if registration_enabled && grpc_endpoint_url.ip().is_unspecified() {
return Err(anyhow::format_err!(
"gRPC endpoint: `0.0.0.0` is not allowed if registration is enabled"
"gRPC endpoint: `[::]`/`0.0.0.0` is not allowed if registration is enabled"
));
}
Ok(grpc_endpoint_url)
Expand Down
4 changes: 2 additions & 2 deletions control-plane/csi-driver/src/bin/node/shutdown_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ mod tests {
tokio::spawn(async move {
if let Err(e) = Server::builder()
.add_service(NodePluginServer::new(NodePluginSvc::new(first_sender)))
.serve_with_shutdown("0.0.0.0:50011".parse().unwrap(), wait(shutdown_receiver))
.serve_with_shutdown("[::]:50011".parse().unwrap(), wait(shutdown_receiver))
.await
{
panic!("gRPC server failed with error: {e}");
}
});
tokio::time::sleep(Duration::from_millis(250)).await;
let channel =
tonic::transport::Endpoint::from(Uri::from_str("https://0.0.0.0:50011").unwrap())
tonic::transport::Endpoint::from(Uri::from_str("https://[::]:50011").unwrap())
.connect()
.await
.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions control-plane/rest/service/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use utils::DEFAULT_GRPC_CLIENT_ADDR;
#[structopt(name = utils::package_description!(), version = utils::version_info_str!())]
pub(crate) struct CliArgs {
/// The bind address for the REST interface (with HTTPS)
/// Default: 0.0.0.0:8080
#[clap(long, default_value = "0.0.0.0:8080")]
/// Default: [::]:8080
#[clap(long, default_value = "[::]:8080")]
https: String,
/// The bind address for the REST interface (with HTTP)
#[clap(long)]
Expand Down
2 changes: 1 addition & 1 deletion deployer/src/infra/agents/ha/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl ComponentAction for HaClusterAgent {
fn configure(&self, options: &StartOptions, cfg: Builder) -> Result<Builder, Error> {
let mut spec = ContainerSpec::from_binary(
"agent-ha-cluster",
Binary::from_dbg("agent-ha-cluster").with_args(vec!["-g=0.0.0.0:11500"]),
Binary::from_dbg("agent-ha-cluster").with_args(vec!["-g=[::]:11500"]),
)
.with_portmap("11500", "11500");

Expand Down
6 changes: 3 additions & 3 deletions deployer/src/infra/etcd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ impl ComponentAction for Etcd {
"--data-dir",
"/tmp/etcd-data",
"--advertise-client-urls",
"http://0.0.0.0:2379",
"http://[::]:2379",
"--listen-client-urls",
"http://0.0.0.0:2379",
"http://[::]:2379",
// these ensure fast startup since it's not a cluster anyway
"--heartbeat-interval=1",
"--election-timeout=5",
Expand All @@ -38,7 +38,7 @@ impl ComponentAction for Etcd {
}
async fn wait_on(&self, options: &StartOptions, _cfg: &ComposeTest) -> Result<(), Error> {
if !options.no_etcd {
let _store = EtcdStore::new("0.0.0.0:2379")
let _store = EtcdStore::new("[::]:2379")
.await
.expect("Failed to connect to etcd.");
}
Expand Down
2 changes: 1 addition & 1 deletion tests/bdd/features/csi/node/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def monitor(proc, result):
"sudo",
os.environ["WORKSPACE_ROOT"] + "/target/debug/csi-node",
"--csi-socket=/var/tmp/csi-node.sock",
"--grpc-endpoint=0.0.0.0:50050",
"--grpc-endpoint=[::]:50050",
"--node-name=msn-test",
"--nvme-io-timeout=33s",
f"--nvme-nr-io-queues={io_queues}",
Expand Down
4 changes: 2 additions & 2 deletions tests/bdd/features/ha/cluster-agent/test_cluster_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def the_request_should_be_failed(context):


def cluster_agent_rpc_handle():
return ClusterAgentHandle("0.0.0.0:11500")
return ClusterAgentHandle("[::]:11500")


@pytest.fixture(scope="module")
Expand All @@ -77,7 +77,7 @@ def context():
@pytest.fixture
def register_node_agent(context):
hdl = cluster_agent_rpc_handle()
req = pb.HaNodeInfo(nodename="test", endpoint="0.0.0.0:1111")
req = pb.HaNodeInfo(nodename="test", endpoint="[::]:1111")

context["attempt"] = hdl.api.RegisterNodeAgent(req)

Expand Down
2 changes: 1 addition & 1 deletion utils/deployer-cluster/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ impl Cluster {

/// remove etcd store lock for `name` instance
pub async fn remove_store_lock(&self, name: ControlPlaneService) {
let mut store = etcd_client::Client::connect(["0.0.0.0:2379"], None)
let mut store = etcd_client::Client::connect(["[::]:2379"], None)
.await
.expect("Failed to connect to etcd.");
store
Expand Down
2 changes: 1 addition & 1 deletion utils/pstor-usage/src/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl Simulation {
};
let cleanup = cluster.is_none() || self.total_stats;

let etcd = Etcd::new(Url::parse("http://0.0.0.0:2379")?).await?;
let etcd = Etcd::new(Url::parse("http://[::]:2379")?).await?;

// create some pools as backing for the volumes
let four_mb = 4096 * 1024;
Expand Down
6 changes: 3 additions & 3 deletions utils/pstor/src/tests/etcd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{
};
use tokio::task::JoinHandle;

static ETCD_ENDPOINT: &str = "0.0.0.0:2379";
static ETCD_ENDPOINT: &str = "[::]:2379";

#[derive(Serialize, Deserialize, Debug, PartialEq)]
struct TestStruct {
Expand All @@ -30,9 +30,9 @@ async fn etcd() {
"--data-dir",
"/tmp/etcd-data",
"--advertise-client-urls",
"http://0.0.0.0:2379",
"http://[::]:2379",
"--listen-client-urls",
"http://0.0.0.0:2379",
"http://[::]:2379",
]),
)
.with_portmap("2379", "2379")
Expand Down
8 changes: 4 additions & 4 deletions utils/utils-lib/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ pub const LOKI_LABEL: &str = "app=loki";
pub const LOKI_PORT: &str = "http-metrics";

/// The default value to be assigned as GRPC server addr if not overridden.
pub const DEFAULT_GRPC_SERVER_ADDR: &str = "0.0.0.0:50051";
pub const DEFAULT_GRPC_SERVER_ADDR: &str = "[::]:50051";

/// The default value to be assigned as GRPC client addr if not overridden.
pub const DEFAULT_GRPC_CLIENT_ADDR: &str = "https://core:50051";

/// The default value to be assigned as JSON GRPC server addr if not overridden.
pub const DEFAULT_JSON_GRPC_SERVER_ADDR: &str = "0.0.0.0:50052";
pub const DEFAULT_JSON_GRPC_SERVER_ADDR: &str = "[::]:50052";

/// The default value to be assigned as JSON GRPC client addr if not overridden.
pub const DEFAULT_JSON_GRPC_CLIENT_ADDR: &str = "https://jsongrpc:50052";
Expand All @@ -98,13 +98,13 @@ pub const DEFAULT_JSON_GRPC_CLIENT_ADDR: &str = "https://jsongrpc:50052";
pub const DEFAULT_GRPC_CLIENT_CONCURRENCY: usize = 25;

/// The default value to be assigned as cluster agent GRPC server addr if not overridden.
pub const DEFAULT_CLUSTER_AGENT_SERVER_ADDR: &str = "0.0.0.0:11500";
pub const DEFAULT_CLUSTER_AGENT_SERVER_ADDR: &str = "[::]:11500";

/// The default value to be assigned as cluster agent GRPC client addr if not overridden.
pub const DEFAULT_CLUSTER_AGENT_CLIENT_ADDR: &str = "https://agent-ha-cluster:11500";

/// The default value to be assigned as node-agent GRPC server addr if not overridden.
pub const DEFAULT_NODE_AGENT_SERVER_ADDR: &str = "0.0.0.0:11600";
pub const DEFAULT_NODE_AGENT_SERVER_ADDR: &str = "[::]:11600";

/// The default worker threads cap for the api-rest service.
pub const DEFAULT_REST_MAX_WORKER_THREADS: &str = "8";
Expand Down

0 comments on commit 7f9fed0

Please sign in to comment.