Skip to content

Commit

Permalink
fix: expose flight sql addr in peers.json
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielc committed Dec 17, 2024
1 parent 3a80d21 commit 929347b
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 13 deletions.
2 changes: 2 additions & 0 deletions common/src/peer_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ pub struct CeramicPeerInfo {
pub ipfs_rpc_addr: String,
/// Ceramic API address of the peer.
pub ceramic_addr: String,
/// Flight SQL API address of the peer.
pub flight_addr: String,
/// Set of p2p addresses of the peer.
/// Each address contains the /p2p/<peer_id> protocol.
pub p2p_addrs: Vec<String>,
Expand Down
7 changes: 7 additions & 0 deletions operator/src/network/ceramic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,13 @@ impl CeramicInfo {
self.stateful_set, self.service
)
}
/// Determine the Flight SQL address of a Ceramic peer
pub fn flight_addr(&self, ns: &str, peer: i32) -> String {
format!(
"http://{}-{peer}.{}.{ns}.svc.cluster.local:{CERAMIC_ONE_FLIGHT_SQL_PORT}",
self.stateful_set, self.service
)
}
}

impl From<&CeramicInfo> for IpfsInfo {
Expand Down
38 changes: 26 additions & 12 deletions operator/src/network/controller.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion operator/src/network/testdata/ceramic_weighted_peers
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Request {
body: {
"apiVersion": "v1",
"data": {
"peers.json": "[{\"ceramic\":{\"peerId\":\"peer_id_0\",\"ipfsRpcAddr\":\"http://ceramic-0-0.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-0.ceramic-0.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_1\",\"ipfsRpcAddr\":\"http://ceramic-0-1.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-1.ceramic-0.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_2\",\"ipfsRpcAddr\":\"http://ceramic-0-2.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-2.ceramic-0.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_3\",\"ipfsRpcAddr\":\"http://ceramic-0-3.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-3.ceramic-0.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_4\",\"ipfsRpcAddr\":\"http://ceramic-0-4.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-4.ceramic-0.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_5\",\"ipfsRpcAddr\":\"http://ceramic-0-5.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-5.ceramic-0.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_6\",\"ipfsRpcAddr\":\"http://ceramic-0-6.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-6.ceramic-0.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_7\",\"ipfsRpcAddr\":\"http://ceramic-0-7.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-7.ceramic-0.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_8\",\"ipfsRpcAddr\":\"http://ceramic-0-8.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-8.ceramic-0.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_9\",\"ipfsRpcAddr\":\"http://ceramic-0-9.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-9.ceramic-0.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_10\",\"ipfsRpcAddr\":\"http://ceramic-1-0.ceramic-1.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-1-0.ceramic-1.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_11\",\"ipfsRpcAddr\":\"http://ceramic-1-1.ceramic-1.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-1-1.ceramic-1.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_12\",\"ipfsRpcAddr\":\"http://ceramic-2-0.ceramic-2.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-2-0.ceramic-2.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_13\",\"ipfsRpcAddr\":\"http://ceramic-3-0.ceramic-3.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-3-0.ceramic-3.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_14\",\"ipfsRpcAddr\":\"http://ceramic-4-0.ceramic-4.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-4-0.ceramic-4.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_15\",\"ipfsRpcAddr\":\"http://ceramic-5-0.ceramic-5.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-5-0.ceramic-5.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_16\",\"ipfsRpcAddr\":\"http://ceramic-6-0.ceramic-6.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-6-0.ceramic-6.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_17\",\"ipfsRpcAddr\":\"http://ceramic-7-0.ceramic-7.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-7-0.ceramic-7.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_18\",\"ipfsRpcAddr\":\"http://ceramic-8-0.ceramic-8.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-8-0.ceramic-8.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_19\",\"ipfsRpcAddr\":\"http://ceramic-9-0.ceramic-9.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-9-0.ceramic-9.keramik-test.svc.cluster.local:7007\",\"p2pAddrs\":[]}},{\"ipfs\":{\"peerId\":\"cas_peer_id\",\"ipfsRpcAddr\":\"http://cas-ipfs-0.cas-ipfs.keramik-test.svc.cluster.local:5101\",\"p2pAddrs\":[]}}]"
"peers.json": "[{\"ceramic\":{\"peerId\":\"peer_id_0\",\"ipfsRpcAddr\":\"http://ceramic-0-0.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-0.ceramic-0.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-0-0.ceramic-0.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_1\",\"ipfsRpcAddr\":\"http://ceramic-0-1.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-1.ceramic-0.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-0-1.ceramic-0.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_2\",\"ipfsRpcAddr\":\"http://ceramic-0-2.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-2.ceramic-0.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-0-2.ceramic-0.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_3\",\"ipfsRpcAddr\":\"http://ceramic-0-3.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-3.ceramic-0.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-0-3.ceramic-0.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_4\",\"ipfsRpcAddr\":\"http://ceramic-0-4.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-4.ceramic-0.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-0-4.ceramic-0.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_5\",\"ipfsRpcAddr\":\"http://ceramic-0-5.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-5.ceramic-0.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-0-5.ceramic-0.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_6\",\"ipfsRpcAddr\":\"http://ceramic-0-6.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-6.ceramic-0.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-0-6.ceramic-0.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_7\",\"ipfsRpcAddr\":\"http://ceramic-0-7.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-7.ceramic-0.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-0-7.ceramic-0.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_8\",\"ipfsRpcAddr\":\"http://ceramic-0-8.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-8.ceramic-0.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-0-8.ceramic-0.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_9\",\"ipfsRpcAddr\":\"http://ceramic-0-9.ceramic-0.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-0-9.ceramic-0.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-0-9.ceramic-0.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_10\",\"ipfsRpcAddr\":\"http://ceramic-1-0.ceramic-1.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-1-0.ceramic-1.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-1-0.ceramic-1.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_11\",\"ipfsRpcAddr\":\"http://ceramic-1-1.ceramic-1.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-1-1.ceramic-1.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-1-1.ceramic-1.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_12\",\"ipfsRpcAddr\":\"http://ceramic-2-0.ceramic-2.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-2-0.ceramic-2.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-2-0.ceramic-2.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_13\",\"ipfsRpcAddr\":\"http://ceramic-3-0.ceramic-3.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-3-0.ceramic-3.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-3-0.ceramic-3.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_14\",\"ipfsRpcAddr\":\"http://ceramic-4-0.ceramic-4.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-4-0.ceramic-4.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-4-0.ceramic-4.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_15\",\"ipfsRpcAddr\":\"http://ceramic-5-0.ceramic-5.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-5-0.ceramic-5.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-5-0.ceramic-5.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_16\",\"ipfsRpcAddr\":\"http://ceramic-6-0.ceramic-6.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-6-0.ceramic-6.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-6-0.ceramic-6.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_17\",\"ipfsRpcAddr\":\"http://ceramic-7-0.ceramic-7.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-7-0.ceramic-7.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-7-0.ceramic-7.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_18\",\"ipfsRpcAddr\":\"http://ceramic-8-0.ceramic-8.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-8-0.ceramic-8.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-8-0.ceramic-8.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ceramic\":{\"peerId\":\"peer_id_19\",\"ipfsRpcAddr\":\"http://ceramic-9-0.ceramic-9.keramik-test.svc.cluster.local:5101\",\"ceramicAddr\":\"http://ceramic-9-0.ceramic-9.keramik-test.svc.cluster.local:7007\",\"flightAddr\":\"http://ceramic-9-0.ceramic-9.keramik-test.svc.cluster.local:5102\",\"p2pAddrs\":[]}},{\"ipfs\":{\"peerId\":\"cas_peer_id\",\"ipfsRpcAddr\":\"http://cas-ipfs-0.cas-ipfs.keramik-test.svc.cluster.local:5101\",\"p2pAddrs\":[]}}]"
},
"kind": "ConfigMap",
"metadata": {
Expand Down
Loading

0 comments on commit 929347b

Please sign in to comment.