Skip to content

Commit 5e8095a

Browse files
committed
use new pvcs
1 parent f127710 commit 5e8095a

File tree

6 files changed

+35
-4
lines changed

6 files changed

+35
-4
lines changed

src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ impl StacksDevnetApiK8sManager {
796796

797797
let bitcoind_conf = format!(
798798
r#"
799+
datadir=/etc/bitcoin
799800
server=1
800801
regtest=1
801802
rpcallowip=0.0.0.0/0
@@ -876,6 +877,9 @@ impl StacksDevnetApiK8sManager {
876877
)
877878
.await?;
878879

880+
self.deploy_pvc(StacksDevnetPvc::BitcoindNode, &namespace)
881+
.await?;
882+
879883
self.deploy_pod(StacksDevnetPod::BitcoindNode, &namespace)
880884
.await?;
881885

@@ -1052,6 +1056,9 @@ impl StacksDevnetApiK8sManager {
10521056
)
10531057
.await?;
10541058

1059+
self.deploy_pvc(StacksDevnetPvc::StacksNode, &namespace)
1060+
.await?;
1061+
10551062
self.deploy_pod(StacksDevnetPod::StacksNode, &namespace)
10561063
.await?;
10571064

src/resources/pvc.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ use strum_macros::EnumIter;
44
#[derive(EnumIter, Debug)]
55
pub enum StacksDevnetPvc {
66
StacksApi,
7+
StacksNode,
8+
BitcoindNode,
79
}
810

911
impl fmt::Display for StacksDevnetPvc {
1012
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1113
match self {
1214
StacksDevnetPvc::StacksApi => write!(f, "stacks-api-pvc"),
15+
StacksDevnetPvc::StacksNode => write!(f, "stacks-node-pvc"),
16+
StacksDevnetPvc::BitcoindNode => write!(f, "bitcoind-node-pvc"),
1317
}
1418
}
1519
}

src/resources/tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ fn it_prints_correct_name_for_pod(pod: StacksDevnetPod) -> String {
2626
}
2727

2828
#[test_case(StacksDevnetPvc::StacksApi => is equal_to "stacks-api-pvc".to_string(); "for StacksApi")]
29+
#[test_case(StacksDevnetPvc::StacksNode => is equal_to "stacks-node-pvc".to_string(); "for StacksNode")]
30+
#[test_case(StacksDevnetPvc::BitcoindNode => is equal_to "bitcoind-node-pvc".to_string(); "for BitcoindNode")]
2931
fn it_prints_correct_name_for_pvc(pvc: StacksDevnetPvc) -> String {
3032
pvc.to_string()
3133
}

src/template_parser.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ pub fn get_yaml_from_resource(resource: StacksDevnetResource) -> &'static str {
4141
StacksDevnetResource::Pvc(StacksDevnetPvc::StacksApi) => {
4242
include_str!("../templates/stacks-api-pvc.template.yaml")
4343
}
44+
StacksDevnetResource::Pvc(StacksDevnetPvc::StacksNode) => {
45+
include_str!("../templates/stacks-node-pvc.template.yaml")
46+
}
47+
StacksDevnetResource::Pvc(StacksDevnetPvc::BitcoindNode) => {
48+
include_str!("../templates/bitcoind-node-pvc.template.yaml")
49+
}
4450
StacksDevnetResource::Service(StacksDevnetService::StacksApi) => {
4551
include_str!("../templates/stacks-api-service.template.yaml")
4652
}

templates/bitcoind-chain-coordinator-pod.template.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ spec:
99
containers:
1010
- command:
1111
- /usr/local/bin/bitcoind
12-
- -conf=/etc/bitcoin/bitcoin.conf
12+
- -conf=/tmp/conf/bitcoin.conf
1313
- -nodebuglogfile
1414
- -pid=/run/bitcoind.pid
1515
image: quay.io/hirosystems/bitcoind:devnet-v3
@@ -23,9 +23,12 @@ spec:
2323
name: rpc
2424
protocol: TCP
2525
volumeMounts:
26-
- mountPath: /etc/bitcoin
26+
- mountPath: /tmp/conf
2727
name: bitcoind-conf-volume
2828
readOnly: true
29+
- mountPath: /etc/bitcoin
30+
name: bitcoind-data-volume
31+
readOnly: false
2932
- command:
3033
- ./stacks-network
3134
- --namespace=$(NAMESPACE)
@@ -74,3 +77,6 @@ spec:
7477
- configMap:
7578
name: project-dir-conf
7679
name: project-dir-conf-volume
80+
- persistentVolumeClaim:
81+
claimName: bitcoind-node-pvc
82+
name: bitcoind-data-volume

templates/stacks-node-pod.template.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ spec:
3232
- mountPath: /src/stacks-node
3333
name: stacks-node-conf-volume
3434
readOnly: true
35+
- mountPath: /devnet
36+
name: stacks-node-data-volume
37+
readOnly: false
3538
volumes:
36-
- configMap:
39+
- name: stacks-node-conf-volume
40+
configMap:
3741
name: stacks-node-conf
38-
name: stacks-node-conf-volume
42+
- name: stacks-node-data-volume
43+
persistentVolumeClaim:
44+
claimName: stacks-node-pvc

0 commit comments

Comments
 (0)