Skip to content

Commit 1877ff6

Browse files
authored
Merge pull request #4088 from onflow/BN2-prefixing-fixes
Update automation to fully handle prefixing
2 parents 42cb96b + d502d57 commit 1877ff6

File tree

8 files changed

+68
-51
lines changed

8 files changed

+68
-51
lines changed

integration/benchnet2/Makefile

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ ifeq ($(strip $(FLOW_GO_TAG)),)
1010
$(eval FLOW_GO_TAG=$(BRANCH_NAME))
1111
endif
1212

13-
14-
1513
# default value of the Docker base registry URL which can be overriden when invoking the Makefile
1614
DOCKER_REGISTRY := us-west1-docker.pkg.dev/dl-flow-benchnet-automation/benchnet
1715

@@ -75,20 +73,20 @@ clean-gen-helm:
7573
rm -f template-data.json
7674

7775
k8s-secrets-create:
78-
bash ./create-secrets.sh
76+
bash ./create-secrets.sh ${PROJECT_NAME} ${NAMESPACE}
7977

8078
helm-deploy:
81-
helm upgrade --install -f ./values.yml ${NAMESPACE} ./flow --set commit="${PROJECT_NAME}" --debug --namespace ${NAMESPACE}
79+
helm upgrade --install -f ./values.yml ${PROJECT_NAME} ./flow --set commit="${PROJECT_NAME}" --debug --namespace ${NAMESPACE}
8280

8381
k8s-delete:
84-
helm delete ${NAMESPACE} --namespace ${NAMESPACE}
85-
kubectl delete pvc -l service=flow --namespace ${NAMESPACE}
82+
helm delete ${PROJECT_NAME} --namespace ${NAMESPACE}
83+
kubectl delete pvc -l project=${PROJECT_NAME} --namespace ${NAMESPACE}
8684

8785
k8s-delete-secrets:
88-
kubectl delete secrets -l service=flow --namespace ${NAMESPACE}
86+
kubectl delete secrets -l project=${PROJECT_NAME} --namespace ${NAMESPACE}
8987

90-
k8s-expose-locally:
91-
kubectl port-forward service/access1 9000:9000 --namespace ${NAMESPACE}
88+
k8s-expose-locally: validate
89+
kubectl port-forward service/access1-${PROJECT_NAME} 9000:9000 --namespace ${NAMESPACE}
9290

9391
k8s-pod-health:
9492
kubectl get pods
@@ -99,8 +97,7 @@ k8s-test-network-accessibility:
9997

10098
clone-flow: clean-flow
10199
# this cloned repo will be used for generating bootstrap info specific to that tag / version
102-
git clone --depth 1 --branch $(FLOW_GO_TAG) https://github.com/onflow/flow-go.git
100+
git clone --depth 1 --branch $(FLOW_GO_TAG) https://github.com/onflow/flow-go.git --single-branch
103101

104-
105102
clean-flow:
106103
rm -rf flow-go

integration/benchnet2/automate/templates/helm-values-all-nodes.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ execution:
8888
resources:
8989
requests:
9090
cpu: "200m"
91-
memory: "512Mi"
91+
memory: "1024Mi"
92+
limits:
93+
cpu: "800m"
94+
memory: "10Gi"
9295
storage: 10G
9396
nodes:
9497
{{- range $val := .}}{{if eq ($val.role) ("execution")}}
Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash
22

3+
# Set Arguments
4+
PROJECT_NAME=$1
5+
NAMESPACE=$2
6+
37
# Create execution-state secrets required to run network
48
# Note - As K8s secrets cannot contain forward slashes, we remove the path prefix
59
# Note - Since this is non-secret, this could be a configmap rather than a secret
@@ -8,12 +12,12 @@ for f in bootstrap/execution-state/*; do
812
# Example start bootstrap/execution-state/00000000
913
# Example result 00000000
1014
PREFIXREMOVED=${f//bootstrap\/execution-state\//};
11-
PREFIXREMOVED="$PROJECT_NAME$PREFIXREMOVED";
12-
15+
PREFIXREMOVED="$PROJECT_NAME.$PREFIXREMOVED";
1316

1417
# Create the secret after string manipulation
15-
kubectl create secret generic $PREFIXREMOVED --from-file=$f;
16-
kubectl label secret $PREFIXREMOVED "service=flow"
18+
kubectl create secret generic $PREFIXREMOVED --from-file=$f --namespace=$NAMESPACE;
19+
kubectl label secret $PREFIXREMOVED "service=flow" --namespace=$NAMESPACE
20+
kubectl label secret $PREFIXREMOVED "project=$PROJECT_NAME" --namespace=$NAMESPACE
1721
done
1822

1923
# Create private-root-information secrets required to run network
@@ -24,16 +28,17 @@ for f in bootstrap/private-root-information/*/*; do
2428
# Remove the bootstrap/private-root-information/private-node-info_ prefix to ensure NodeId is retained
2529
# Example result 416c65782048656e74736368656c00e4e3235298a4b91382ecd84f13b9c237e6/node-info.priv.json
2630
PREFIXREMOVED=${f//bootstrap\/private-root-information\/private-node-info_/};
27-
PREFIXREMOVED="$PROJECT_NAME$PREFIXREMOVED";
31+
PREFIXREMOVED="$PROJECT_NAME.$PREFIXREMOVED";
2832

2933
# Substitute the forward slash "/" for a period "."
3034
# Example $PREFIXREMOVED value 416c65782048656e74736368656c00e4e3235298a4b91382ecd84f13b9c237e6/node-info.priv.json
3135
# Example result after string manipulation 416c65782048656e74736368656c00e4e3235298a4b91382ecd84f13b9c237e6.node-info.priv.json
3236
KEYNAME=${PREFIXREMOVED//\//.}
3337

3438
# Create the secret after string manipulation
35-
kubectl create secret generic $KEYNAME --from-file=$f;
36-
kubectl label secret $KEYNAME "service=flow"
39+
kubectl create secret generic $KEYNAME --from-file=$f --namespace=$NAMESPACE;
40+
kubectl label secret $KEYNAME "service=flow" --namespace=$NAMESPACE
41+
kubectl label secret $KEYNAME "project=$PROJECT_NAME" --namespace=$NAMESPACE
3742
done
3843

3944
# Create public-root-information secrets required to run network
@@ -44,9 +49,10 @@ for f in bootstrap/public-root-information/*.json; do
4449
# Example start bootstrap/public-root-information/node-infos.pub.json
4550
# Example result node-info.pub.json
4651
PREFIXREMOVED=${f//bootstrap\/public-root-information\//};
47-
PREFIXREMOVED="$PROJECT_NAME$PREFIXREMOVED";
52+
PREFIXREMOVED="$PROJECT_NAME.$PREFIXREMOVED";
4853

4954
# Create the secret after string manipulation
50-
kubectl create secret generic $PREFIXREMOVED --from-file=$f ;
51-
kubectl label secret $PREFIXREMOVED "service=flow"
55+
kubectl create secret generic $PREFIXREMOVED --from-file=$f --namespace=$NAMESPACE ;
56+
kubectl label secret $PREFIXREMOVED "service=flow" --namespace=$NAMESPACE
57+
kubectl label secret $PREFIXREMOVED "project=$PROJECT_NAME" --namespace=$NAMESPACE
5258
done

integration/benchnet2/flow/templates/access.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,27 +92,29 @@ spec:
9292
volumes:
9393
- name: node-info-priv-json
9494
secret:
95-
secretName: {{ $v.nodeId }}.node-info.priv.json
95+
secretName: {{ $.Values.commit }}.{{ $v.nodeId }}.node-info.priv.json
9696

9797
- name: node-info-pub-json
9898
secret:
99-
secretName: node-infos.pub.json
99+
secretName: {{ $.Values.commit }}.node-infos.pub.json
100100

101101
- name: root-block-json
102102
secret:
103-
secretName: root-block.json
103+
secretName: {{ $.Values.commit }}.root-block.json
104104

105105
- name: root-protocol-state-snapshot-json
106106
secret:
107-
secretName: root-protocol-state-snapshot.json
107+
secretName: {{ $.Values.commit }}.root-protocol-state-snapshot.json
108108

109109
- name: secretsdb-key
110110
secret:
111-
secretName: {{ $v.nodeId }}.secretsdb-key
111+
secretName: {{ $.Values.commit }}.{{ $v.nodeId }}.secretsdb-key
112112

113113
volumeClaimTemplates:
114114
- metadata:
115115
name: data
116+
labels:
117+
project: {{ $.Values.commit }}
116118
spec:
117119
accessModes: ["ReadWriteOnce"]
118120
resources:

integration/benchnet2/flow/templates/collection.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,31 +97,33 @@ spec:
9797
volumes:
9898
- name: node-info-priv-json
9999
secret:
100-
secretName: {{ $v.nodeId }}.node-info.priv.json
100+
secretName: {{ $.Values.commit }}.{{ $v.nodeId }}.node-info.priv.json
101101

102102
- name: node-info-pub-json
103103
secret:
104-
secretName: node-infos.pub.json
104+
secretName: {{ $.Values.commit }}.node-infos.pub.json
105105

106106
- name: root-block-json
107107
secret:
108-
secretName: root-block.json
108+
secretName: {{ $.Values.commit }}.root-block.json
109109

110110
- name: root-protocol-state-snapshot-json
111111
secret:
112-
secretName: root-protocol-state-snapshot.json
112+
secretName: {{ $.Values.commit }}.root-protocol-state-snapshot.json
113113

114114
- name: node-machine-account-info-priv-json
115115
secret:
116-
secretName: {{ $v.nodeId }}.node-machine-account-info.priv.json
116+
secretName: {{ $.Values.commit }}.{{ $v.nodeId }}.node-machine-account-info.priv.json
117117

118118
- name: secretsdb-key
119119
secret:
120-
secretName: {{ $v.nodeId }}.secretsdb-key
120+
secretName: {{ $.Values.commit }}.{{ $v.nodeId }}.secretsdb-key
121121

122122
volumeClaimTemplates:
123123
- metadata:
124124
name: data
125+
labels:
126+
project: {{ $.Values.commit }}
125127
spec:
126128
accessModes: ["ReadWriteOnce"]
127129
resources:

integration/benchnet2/flow/templates/consensus.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,35 +101,37 @@ spec:
101101
volumes:
102102
- name: node-info-priv-json
103103
secret:
104-
secretName: {{ $v.nodeId }}.node-info.priv.json
104+
secretName: {{ $.Values.commit }}.{{ $v.nodeId }}.node-info.priv.json
105105

106106
- name: node-info-pub-json
107107
secret:
108-
secretName: node-infos.pub.json
108+
secretName: {{ $.Values.commit }}.node-infos.pub.json
109109

110110
- name: root-block-json
111111
secret:
112-
secretName: root-block.json
112+
secretName: {{ $.Values.commit }}.root-block.json
113113

114114
- name: root-protocol-state-snapshot-json
115115
secret:
116-
secretName: root-protocol-state-snapshot.json
116+
secretName: {{ $.Values.commit }}.root-protocol-state-snapshot.json
117117

118118
- name: node-machine-account-info-priv-json
119119
secret:
120-
secretName: {{ $v.nodeId }}.node-machine-account-info.priv.json
120+
secretName: {{ $.Values.commit }}.{{ $v.nodeId }}.node-machine-account-info.priv.json
121121

122122
- name: random-beacon-priv-json
123123
secret:
124-
secretName: {{ $v.nodeId }}.random-beacon.priv.json
124+
secretName: {{ $.Values.commit }}.{{ $v.nodeId }}.random-beacon.priv.json
125125

126126
- name: secretsdb-key
127127
secret:
128-
secretName: {{ $v.nodeId }}.secretsdb-key
128+
secretName: {{ $.Values.commit }}.{{ $v.nodeId }}.secretsdb-key
129129

130130
volumeClaimTemplates:
131131
- metadata:
132132
name: data
133+
labels:
134+
project: {{ $.Values.commit }}
133135
spec:
134136
accessModes: ["ReadWriteOnce"]
135137
resources:

integration/benchnet2/flow/templates/execution.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,31 +95,33 @@ spec:
9595
volumes:
9696
- name: execution-state
9797
secret:
98-
secretName: "00000000"
98+
secretName: "{{ $.Values.commit }}.00000000"
9999

100100
- name: node-info-priv-json
101101
secret:
102-
secretName: {{ $v.nodeId }}.node-info.priv.json
102+
secretName: {{ $.Values.commit }}.{{ $v.nodeId }}.node-info.priv.json
103103

104104
- name: node-info-pub-json
105105
secret:
106-
secretName: node-infos.pub.json
106+
secretName: {{ $.Values.commit }}.node-infos.pub.json
107107

108108
- name: root-block-json
109109
secret:
110-
secretName: root-block.json
110+
secretName: {{ $.Values.commit }}.root-block.json
111111

112112
- name: root-protocol-state-snapshot-json
113113
secret:
114-
secretName: root-protocol-state-snapshot.json
114+
secretName: {{ $.Values.commit }}.root-protocol-state-snapshot.json
115115

116116
- name: secretsdb-key
117117
secret:
118-
secretName: {{ $v.nodeId }}.secretsdb-key
118+
secretName: {{ $.Values.commit }}.{{ $v.nodeId }}.secretsdb-key
119119

120120
volumeClaimTemplates:
121121
- metadata:
122122
name: data
123+
labels:
124+
project: {{ $.Values.commit }}
123125
spec:
124126
accessModes: ["ReadWriteOnce"]
125127
resources:

integration/benchnet2/flow/templates/verification.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ spec:
2020
app: {{ $k }}
2121
nodeType: verification
2222
service: flow
23+
project: {{ $.Values.commit }}
2324

2425
template:
2526
metadata:
@@ -92,27 +93,29 @@ spec:
9293

9394
- name: node-info-priv-json
9495
secret:
95-
secretName: {{ $v.nodeId }}.node-info.priv.json
96+
secretName: {{ $.Values.commit }}.{{ $v.nodeId }}.node-info.priv.json
9697

9798
- name: node-info-pub-json
9899
secret:
99-
secretName: node-infos.pub.json
100+
secretName: {{ $.Values.commit }}.node-infos.pub.json
100101

101102
- name: root-block-json
102103
secret:
103-
secretName: root-block.json
104+
secretName: {{ $.Values.commit }}.root-block.json
104105

105106
- name: root-protocol-state-snapshot-json
106107
secret:
107-
secretName: root-protocol-state-snapshot.json
108+
secretName: {{ $.Values.commit }}.root-protocol-state-snapshot.json
108109

109110
- name: secretsdb-key
110111
secret:
111-
secretName: {{ $v.nodeId }}.secretsdb-key
112+
secretName: {{ $.Values.commit }}.{{ $v.nodeId }}.secretsdb-key
112113

113114
volumeClaimTemplates:
114115
- metadata:
115116
name: data
117+
labels:
118+
project: {{ $.Values.commit }}
116119
spec:
117120
accessModes: ["ReadWriteOnce"]
118121
resources:

0 commit comments

Comments
 (0)