|
@@ -2,6 +2,7 @@ import * as awsx from '@pulumi/awsx'
|
|
import * as eks from '@pulumi/eks'
|
|
import * as eks from '@pulumi/eks'
|
|
import * as pulumi from '@pulumi/pulumi'
|
|
import * as pulumi from '@pulumi/pulumi'
|
|
import * as k8s from '@pulumi/kubernetes'
|
|
import * as k8s from '@pulumi/kubernetes'
|
|
|
|
+import { configMapFromFile } from './configMap'
|
|
|
|
|
|
const config = new pulumi.Config()
|
|
const config = new pulumi.Config()
|
|
const awsConfig = new pulumi.Config('aws')
|
|
const awsConfig = new pulumi.Config('aws')
|
|
@@ -57,6 +58,44 @@ export const namespaceName = ns.metadata.name
|
|
|
|
|
|
const appLabels = { appClass: name }
|
|
const appLabels = { appClass: name }
|
|
|
|
|
|
|
|
+// const subkeyJob = new k8s.batch.v1.Job(
|
|
|
|
+// 'subkey-job',
|
|
|
|
+// {
|
|
|
|
+// metadata: {
|
|
|
|
+// namespace: namespaceName,
|
|
|
|
+// },
|
|
|
|
+// spec: {
|
|
|
|
+// completions: 3,
|
|
|
|
+// backoffLimit: 0,
|
|
|
|
+// template: {
|
|
|
|
+// spec: {
|
|
|
|
+// containers: [
|
|
|
|
+// {
|
|
|
|
+// name: 'subkey-node',
|
|
|
|
+// image: 'parity/subkey:latest',
|
|
|
|
+// args: ['generate-node-key'],
|
|
|
|
+// },
|
|
|
|
+// ],
|
|
|
|
+// restartPolicy: 'Never',
|
|
|
|
+// },
|
|
|
|
+// },
|
|
|
|
+// },
|
|
|
|
+// },
|
|
|
|
+// { ...resourceOptions }
|
|
|
|
+// )
|
|
|
|
+
|
|
|
|
+const jsonModifyConfig = new configMapFromFile(
|
|
|
|
+ 'json-modify-config',
|
|
|
|
+ {
|
|
|
|
+ filePath: 'json_modify.py',
|
|
|
|
+ namespaceName: namespaceName,
|
|
|
|
+ },
|
|
|
|
+ resourceOptions
|
|
|
|
+).configName
|
|
|
|
+
|
|
|
|
+const dataPath = '/subkey-data'
|
|
|
|
+const builderPath = '/builder-data'
|
|
|
|
+
|
|
const deployment = new k8s.apps.v1.Deployment(
|
|
const deployment = new k8s.apps.v1.Deployment(
|
|
name,
|
|
name,
|
|
{
|
|
{
|
|
@@ -72,14 +111,111 @@ const deployment = new k8s.apps.v1.Deployment(
|
|
labels: appLabels,
|
|
labels: appLabels,
|
|
},
|
|
},
|
|
spec: {
|
|
spec: {
|
|
|
|
+ initContainers: [
|
|
|
|
+ {
|
|
|
|
+ name: 'subkey-node',
|
|
|
|
+ image: 'parity/subkey:latest',
|
|
|
|
+ command: ['/bin/sh', '-c'],
|
|
|
|
+ args: [
|
|
|
|
+ `subkey generate-node-key >> ${dataPath}/subkey 2>> ${dataPath}/subkey; echo '\n\n' >> ${dataPath}/subkey`,
|
|
|
|
+ ],
|
|
|
|
+ volumeMounts: [
|
|
|
|
+ {
|
|
|
|
+ name: 'subkey-data',
|
|
|
|
+ mountPath: dataPath,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: 'subkey-node-1',
|
|
|
|
+ image: 'parity/subkey:latest',
|
|
|
|
+ command: ['/bin/sh', '-c'],
|
|
|
|
+ args: [`subkey generate-node-key >> ${dataPath}/subkey 2>> ${dataPath}/subkey`],
|
|
|
|
+ volumeMounts: [
|
|
|
|
+ {
|
|
|
|
+ name: 'subkey-data',
|
|
|
|
+ mountPath: dataPath,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: 'busybox',
|
|
|
|
+ image: 'busybox',
|
|
|
|
+ command: ['/bin/sh', '-c'],
|
|
|
|
+ args: [`cat ${dataPath}/subkey`],
|
|
|
|
+ volumeMounts: [
|
|
|
|
+ {
|
|
|
|
+ name: 'subkey-data',
|
|
|
|
+ mountPath: dataPath,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: 'builder-node',
|
|
|
|
+ image: 'joystream/node:latest',
|
|
|
|
+ command: ['/bin/sh', '-c'],
|
|
|
|
+ args: [
|
|
|
|
+ '/joystream/chain-spec-builder generate -a 2 --chain-spec-path /builder-data/chainspec.json --deployment live --endowed 1 --keystore-path /builder-data/data >> /builder-data/seeds.txt',
|
|
|
|
+ ],
|
|
|
|
+ volumeMounts: [
|
|
|
|
+ {
|
|
|
|
+ name: 'builder-data',
|
|
|
|
+ mountPath: builderPath,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: 'json-modify',
|
|
|
|
+ image: 'python',
|
|
|
|
+ command: ['python'],
|
|
|
|
+ args: ['/scripts/json_modify.py', '--path', '/builder-data/chainspec.json', '--prefix', '8129'],
|
|
|
|
+ volumeMounts: [
|
|
|
|
+ {
|
|
|
|
+ mountPath: '/scripts/json_modify.py',
|
|
|
|
+ name: 'json-modify-script',
|
|
|
|
+ subPath: 'fileData',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: 'builder-data',
|
|
|
|
+ mountPath: builderPath,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
containers: [
|
|
containers: [
|
|
{
|
|
{
|
|
name: 'joystream-node',
|
|
name: 'joystream-node',
|
|
image: 'joystream/node:latest',
|
|
image: 'joystream/node:latest',
|
|
ports: [{ containerPort: 9944 }, { containerPort: 9933 }],
|
|
ports: [{ containerPort: 9944 }, { containerPort: 9933 }],
|
|
|
|
+ args: ['--dev'],
|
|
|
|
+ volumeMounts: [
|
|
|
|
+ {
|
|
|
|
+ name: 'subkey-data',
|
|
|
|
+ mountPath: dataPath,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: 'builder-data',
|
|
|
|
+ mountPath: builderPath,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ volumes: [
|
|
|
|
+ {
|
|
|
|
+ name: 'subkey-data',
|
|
|
|
+ emptyDir: {},
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: 'builder-data',
|
|
|
|
+ emptyDir: {},
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: 'json-modify-script',
|
|
|
|
+ configMap: {
|
|
|
|
+ name: jsonModifyConfig,
|
|
|
|
+ },
|
|
},
|
|
},
|
|
],
|
|
],
|
|
- volumes: [],
|
|
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
@@ -100,6 +236,7 @@ const service = new k8s.core.v1.Service(
|
|
name: 'query-node',
|
|
name: 'query-node',
|
|
},
|
|
},
|
|
spec: {
|
|
spec: {
|
|
|
|
+ type: 'NodePort',
|
|
ports: [
|
|
ports: [
|
|
{ name: 'port-1', port: 9944 },
|
|
{ name: 'port-1', port: 9944 },
|
|
{ name: 'port-2', port: 9933 },
|
|
{ name: 'port-2', port: 9933 },
|
|
@@ -116,4 +253,8 @@ export const serviceName = service.metadata.name
|
|
// When "done", this will print the public IP.
|
|
// When "done", this will print the public IP.
|
|
export let serviceHostname: pulumi.Output<string>
|
|
export let serviceHostname: pulumi.Output<string>
|
|
|
|
|
|
-serviceHostname = service.status.loadBalancer.ingress[0].hostname
|
|
|
|
|
|
+if (isMinikube) {
|
|
|
|
+ serviceHostname = service.spec.clusterIP
|
|
|
|
+} else {
|
|
|
|
+ serviceHostname = service.status.loadBalancer.ingress[0].hostname
|
|
|
|
+}
|