Deployment and Script update (#398)

* Add check for current kube context

* Update dev and testnet deploys

* Make prettier happy
pull/400/head
Mattie Conover 3 years ago committed by GitHub
parent 1e93e7c897
commit f7e76f97e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      typescript/infra/config/environments/dev/agent.ts
  2. 2
      typescript/infra/config/environments/testnet/agent.ts
  3. 13
      typescript/infra/scripts/deploy-agents.ts
  4. 10
      typescript/infra/src/agents/index.ts

@ -9,7 +9,7 @@ export const agent: AgentConfig<DevNetworks> = {
runEnv: 'dev',
docker: {
repo: 'gcr.io/abacus-labs-dev/abacus-agent',
tag: 'f30aa0a68a645bf966638e145ba8a4e15f80280e',
tag: 'sha-af9568a',
},
domainNames,
validatorSets: validators,

@ -9,7 +9,7 @@ export const agent: AgentConfig<TestnetNetworks> = {
runEnv: 'testnet',
docker: {
repo: 'gcr.io/abacus-labs-dev/abacus-agent',
tag: 'sha-cc6c2db',
tag: 'sha-af9568a',
},
aws: {
region: 'us-east-1',

@ -1,4 +1,7 @@
import { runAgentHelmCommand } from '../src/agents';
import {
getCurrentKubernetesContext,
runAgentHelmCommand,
} from '../src/agents';
import { HelmCommand } from '../src/utils/helm';
import { getEnvironmentConfig } from './utils';
@ -6,6 +9,14 @@ import { getEnvironmentConfig } from './utils';
async function deploy() {
const config = await getEnvironmentConfig();
const currentKubeContext = await getCurrentKubernetesContext();
if (!currentKubeContext.endsWith(`-${config.agent.runEnv}`)) {
console.error(
`Attempting to deploy ${config.agent.runEnv} to ${currentKubeContext}`,
);
process.exit(1);
}
// Note the create-keys script should be ran prior to running this script.
// At the moment, `runAgentHelmCommand` has the side effect of creating keys / users
// if they do not exist. It's possible for a race condition to occur where creation of

@ -397,3 +397,13 @@ export async function runKeymasterHelmCommand(
await rm('config.json');
return;
}
export async function getCurrentKubernetesContext(): Promise<string> {
const [stdout] = await execCmd(
`kubectl config current-context`,
{ encoding: 'utf8' },
false,
false,
);
return stdout.trimEnd();
}

Loading…
Cancel
Save