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
1721done
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
3742done
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
5258done
0 commit comments