-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.ts
32 lines (26 loc) · 1.19 KB
/
update.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { flags } from '@oclif/command';
import { executeCommand } from '../../../modules/shared/helpers/execute-command';
import { BaseCommand } from '../../../modules/shared/base-commands/base-command';
export default class KubeDeploymentUpdate extends BaseCommand {
static description = 'Trigger an update on a deployment';
static aliases = ['kdu'];
static flags = {
bin: flags.string({
char: 'b',
description: 'The path to the kubectl executable',
required: false,
default: 'kubectl',
}),
};
static args = [
{ name: 'deployment', required: true, description: 'The name of the deployment that you would like to update' },
{ name: 'namespace', default: 'default', description: 'The namespace that the deployment is in' },
];
async run() {
const { args, flags } = this.parse(KubeDeploymentUpdate);
this.log(`Updating deployment ${args.deployment}`);
await executeCommand(
`kubectl patch deployment "${args.deployment}" --namespace=${args.namespace} -p "{\\"spec\\":{\\"template\\":{\\"metadata\\":{\\"labels\\":{\\"date\\":\\"\`date +'%s'\`\\"}}}}}"`,
);
}
}