Skip to content

Commit

Permalink
be consistent with crdb socket addr vs ip/port pair
Browse files Browse the repository at this point in the history
  • Loading branch information
jgallagher committed May 28, 2024
1 parent 312e11d commit 7e3ca84
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 26 deletions.
34 changes: 11 additions & 23 deletions sled-agent/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1703,37 +1703,29 @@ impl ServiceManager {
return Err(Error::SledAgentNotReady);
};

let crdb_listen_addr = *underlay_address;
let crdb_listen_port = COCKROACH_ADMIN_PORT;
let crdb_listen_ip = *underlay_address;
let crdb_address = SocketAddr::new(
IpAddr::V6(crdb_listen_addr),
IpAddr::V6(crdb_listen_ip),
COCKROACH_PORT,
);
)
.to_string();
let admin_address = SocketAddr::new(
IpAddr::V6(crdb_listen_addr),
IpAddr::V6(crdb_listen_ip),
COCKROACH_ADMIN_PORT,
);
)
.to_string();

let nw_setup_service = Self::zone_network_setup_install(
&info.underlay_address,
&installed_zone,
&crdb_listen_addr,
&crdb_listen_ip,
)?;

let dns_service = Self::dns_install(info, None, &None).await?;

// Configure the CockroachDB service.
let cockroachdb_config = PropertyGroupBuilder::new("config")
.add_property(
"listen_addr",
"astring",
crdb_listen_addr.to_string(),
)
.add_property(
"listen_port",
"astring",
crdb_listen_port.to_string(),
)
.add_property("listen_addr", "astring", &crdb_address)
.add_property("store", "astring", "/data");
let cockroachdb_service =
ServiceBuilder::new("oxide/cockroachdb").add_instance(
Expand All @@ -1747,13 +1739,9 @@ impl ServiceManager {
.add_property(
"cockroach_address",
"astring",
&crdb_address.to_string(),
crdb_address,
)
.add_property(
"http_address",
"astring",
&admin_address.to_string(),
);
.add_property("http_address", "astring", admin_address);
let cockroach_admin_service =
ServiceBuilder::new("oxide/cockroach-admin").add_instance(
ServiceInstanceBuilder::new("default")
Expand Down
1 change: 0 additions & 1 deletion smf/cockroachdb/manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

<property_group name='config' type='application'>
<propval name='listen_addr' type='astring' value='unknown' />
<propval name='listen_port' type='astring' value='unknown' />
<propval name='store' type='astring' value='unknown' />
</property_group>

Expand Down
3 changes: 1 addition & 2 deletions smf/cockroachdb/method_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ set -o pipefail
. /lib/svc/share/smf_include.sh

LISTEN_ADDR="$(svcprop -c -p config/listen_addr "${SMF_FMRI}")"
LISTEN_PORT="$(svcprop -c -p config/listen_port "${SMF_FMRI}")"
DATASTORE="$(svcprop -c -p config/store "${SMF_FMRI}")"

# We need to tell CockroachDB the DNS names or IP addresses of the other nodes
Expand All @@ -25,7 +24,7 @@ fi

args=(
'--insecure'
'--listen-addr' "[$LISTEN_ADDR]:$LISTEN_PORT"
'--listen-addr' "$LISTEN_ADDR"
'--http-addr' '127.0.0.1:8080'
'--store' "$DATASTORE"
'--join' "$JOIN_ADDRS"
Expand Down

0 comments on commit 7e3ca84

Please sign in to comment.