Skip to content

Commit

Permalink
use new pvcs
Browse files Browse the repository at this point in the history
  • Loading branch information
MicaiahReid committed Sep 19, 2023
1 parent f005a21 commit bb415fc
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ impl StacksDevnetApiK8sManager {

let bitcoind_conf = format!(
r#"
datadir=/etc/bitcoin
server=1
regtest=1
rpcallowip=0.0.0.0/0
Expand Down Expand Up @@ -876,6 +877,9 @@ impl StacksDevnetApiK8sManager {
)
.await?;

self.deploy_pvc(StacksDevnetPvc::BitcoindNode, &namespace)
.await?;

self.deploy_pod(StacksDevnetPod::BitcoindNode, &namespace)
.await?;

Expand Down Expand Up @@ -1052,6 +1056,9 @@ impl StacksDevnetApiK8sManager {
)
.await?;

self.deploy_pvc(StacksDevnetPvc::StacksNode, &namespace)
.await?;

self.deploy_pod(StacksDevnetPod::StacksNode, &namespace)
.await?;

Expand Down
4 changes: 4 additions & 0 deletions src/resources/pvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ use strum_macros::EnumIter;
#[derive(EnumIter, Debug)]
pub enum StacksDevnetPvc {
StacksApi,
StacksNode,
BitcoindNode,
}

impl fmt::Display for StacksDevnetPvc {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
StacksDevnetPvc::StacksApi => write!(f, "stacks-api-pvc"),
StacksDevnetPvc::StacksNode => write!(f, "stacks-node-pvc"),
StacksDevnetPvc::BitcoindNode => write!(f, "bitcoind-node-pvc"),
}
}
}
2 changes: 2 additions & 0 deletions src/resources/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ fn it_prints_correct_name_for_pod(pod: StacksDevnetPod) -> String {
}

#[test_case(StacksDevnetPvc::StacksApi => is equal_to "stacks-api-pvc".to_string(); "for StacksApi")]
#[test_case(StacksDevnetPvc::StacksNode => is equal_to "stacks-node-pvc".to_string(); "for StacksNode")]
#[test_case(StacksDevnetPvc::BitcoindNode => is equal_to "bitcoind-node-pvc".to_string(); "for BitcoindNode")]
fn it_prints_correct_name_for_pvc(pvc: StacksDevnetPvc) -> String {
pvc.to_string()
}
Expand Down
6 changes: 6 additions & 0 deletions src/template_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ pub fn get_yaml_from_resource(resource: StacksDevnetResource) -> &'static str {
StacksDevnetResource::Pvc(StacksDevnetPvc::StacksApi) => {
include_str!("../templates/stacks-api-pvc.template.yaml")
}
StacksDevnetResource::Pvc(StacksDevnetPvc::StacksNode) => {
include_str!("../templates/stacks-node-pvc.template.yaml")
}
StacksDevnetResource::Pvc(StacksDevnetPvc::BitcoindNode) => {
include_str!("../templates/bitcoind-node-pvc.template.yaml")
}
StacksDevnetResource::Service(StacksDevnetService::StacksApi) => {
include_str!("../templates/stacks-api-service.template.yaml")
}
Expand Down
10 changes: 8 additions & 2 deletions templates/bitcoind-chain-coordinator-pod.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
containers:
- command:
- /usr/local/bin/bitcoind
- -conf=/etc/bitcoin/bitcoin.conf
- -conf=/tmp/conf/bitcoin.conf
- -nodebuglogfile
- -pid=/run/bitcoind.pid
image: quay.io/hirosystems/bitcoind:devnet-v3
Expand All @@ -23,9 +23,12 @@ spec:
name: rpc
protocol: TCP
volumeMounts:
- mountPath: /etc/bitcoin
- mountPath: /tmp/conf
name: bitcoind-conf-volume
readOnly: true
- mountPath: /etc/bitcoin
name: bitcoind-data-volume
readOnly: false
- command:
- ./stacks-network
- --namespace=$(NAMESPACE)
Expand Down Expand Up @@ -74,3 +77,6 @@ spec:
- configMap:
name: project-dir-conf
name: project-dir-conf-volume
- persistentVolumeClaim:
claimName: bitcoind-node-pvc
name: bitcoind-data-volume
10 changes: 8 additions & 2 deletions templates/stacks-node-pod.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ spec:
- mountPath: /src/stacks-node
name: stacks-node-conf-volume
readOnly: true
- mountPath: /devnet
name: stacks-node-data-volume
readOnly: false
volumes:
- configMap:
- name: stacks-node-conf-volume
configMap:
name: stacks-node-conf
name: stacks-node-conf-volume
- name: stacks-node-data-volume
persistentVolumeClaim:
claimName: stacks-node-pvc

0 comments on commit bb415fc

Please sign in to comment.