Browse Source

Let user specify custom node image

Anuj Bansal 3 years ago
parent
commit
e0a2656ffb

+ 3 - 0
devops/infrastructure/node-network/Pulumi.yaml

@@ -19,3 +19,6 @@ template:
     isLoadBalancerReady:
       description: Whether the load balancer service is ready and has been assigned an IP
       default: false
+    nodeImage:
+      description: Docker image with tag to be used as validator and RPC nodes
+      default: 'joystream/node:latest'

+ 2 - 1
devops/infrastructure/node-network/README.md

@@ -38,7 +38,8 @@ After cloning this repo, from this working directory, run these commands:
 
    ```bash
    $ pulumi config set-all --plaintext aws:region=us-east-1 --plaintext aws:profile=joystream-user \
-    --plaintext numberOfValidators=2 --plaintext isMinikube=true --plaintext networkSuffix=8122
+    --plaintext numberOfValidators=2 --plaintext isMinikube=true --plaintext networkSuffix=8122 \
+    --plaintext nodeImage=joystream/node:latest
    ```
 
    If you want to build the stack on AWS set the `isMinikube` config to `false`

+ 5 - 4
devops/infrastructure/node-network/index.ts

@@ -56,6 +56,7 @@ const networkSuffix = config.get('networkSuffix') || '8129'
 const numberOfValidators = config.getNumber('numberOfValidators') || 1
 const chainDataPath = '/chain-data'
 const chainSpecPath = `${chainDataPath}/chainspec-raw.json`
+const nodeImage = config.get('nodeImage') || 'joystream/node:latest'
 
 const subkeyContainers = getSubkeyContainers(numberOfValidators, chainDataPath)
 let pvcClaimName: pulumi.Output<any>
@@ -126,7 +127,7 @@ const chainDataPrepareJob = new k8s.batch.v1.Job(
             ...subkeyContainers,
             {
               name: 'builder-node',
-              image: 'joystream/node:latest',
+              image: nodeImage,
               command: ['/bin/sh', '-c'],
               args: [
                 `/joystream/chain-spec-builder generate -a ${numberOfValidators} \
@@ -167,7 +168,7 @@ const chainDataPrepareJob = new k8s.batch.v1.Job(
             },
             {
               name: 'raw-chain-spec',
-              image: 'joystream/node:latest',
+              image: nodeImage,
               command: ['/bin/sh', '-c'],
               args: [`/joystream/node build-spec --chain ${chainDataPath}/chainspec.json --raw > ${chainSpecPath}`],
               volumeMounts: [
@@ -206,7 +207,7 @@ const validators = []
 for (let i = 1; i <= numberOfValidators; i++) {
   const validator = new ValidatorServiceDeployment(
     `node-${i}`,
-    { namespace: namespaceName, index: i, chainSpecPath, dataPath: chainDataPath, pvc: pvcClaimName },
+    { namespace: namespaceName, index: i, chainSpecPath, dataPath: chainDataPath, pvc: pvcClaimName, nodeImage },
     { ...resourceOptions, dependsOn: chainDataPrepareJob }
   )
   validators.push(validator)
@@ -231,7 +232,7 @@ const deployment = new k8s.apps.v1.Deployment(
           containers: [
             {
               name: 'rpc-node',
-              image: 'joystream/node:latest',
+              image: nodeImage,
               ports: [
                 { name: 'rpc-9944', containerPort: 9944 },
                 { name: 'rpc-9933', containerPort: 9933 },

+ 2 - 1
devops/infrastructure/node-network/validator.ts

@@ -17,7 +17,7 @@ export class ValidatorServiceDeployment extends pulumi.ComponentResource {
     const labels = { app: name }
     const container: k8stypes.core.v1.Container = {
       name: `joystream-node-${args.index}`,
-      image: 'joystream/node:latest',
+      image: nodeImage,
       args: [
         '--chain',
         args.chainSpecPath,
@@ -90,5 +90,6 @@ export interface ServiceDeploymentArgs {
   index: number
   chainSpecPath: string
   dataPath: string
+  nodeImage: string
   pvc: pulumi.OutputInstance<any>
 }