console/deployment/utils/botkube.ts
renovate[bot] 1afe0ec73a
Update dependency @theguild/prettier-config to v1 (#676)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Kamil Kisiela <kamil.kisiela@gmail.com>
2022-11-24 10:00:41 +00:00

86 lines
2.2 KiB
TypeScript

import * as k8s from '@pulumi/kubernetes';
import { Output } from '@pulumi/pulumi';
export class BotKube {
deploy(config: {
slackChannelName: string;
slackToken: Output<string>;
clusterName: string;
enableKubectl: boolean;
}) {
const ns = new k8s.core.v1.Namespace('botkube', {
metadata: {
name: 'botkube',
},
});
new k8s.helm.v3.Chart(
'botkube',
{
chart: 'botkube',
version: '0.12.4',
namespace: ns.metadata.name,
fetchOpts: {
repo: 'https://infracloudio.github.io/charts',
},
values: {
communications: {
slack: {
enabled: true,
channel: config.slackChannelName,
token: config.slackToken,
notiftype: 'short',
},
},
config: {
resources: [
{
name: 'apps/v1/deployments',
namespaces: {
include: ['default', 'ingress-nginx'],
},
events: ['all'],
},
{
name: 'v1/pods',
namespaces: {
include: ['default', 'ingress-nginx'],
},
events: ['all'],
},
],
recommendations: true,
settings: {
clustername: config.clusterName,
kubectl: {
defaultNamespace: 'default',
restrictAccess: 'true',
enabled: String(config.enableKubectl),
commands: {
verbs: ['cluster-info', 'describe', 'get', 'logs', 'top', 'restart'],
resources: [
'deployments',
'pods',
'namespaces',
'services',
'daemonsets',
'httpproxy',
'statefulsets',
'nodes',
],
},
},
},
},
image: {
repository: 'infracloudio/botkube',
tag: 'v0.12.4',
},
},
},
{
dependsOn: [ns],
},
);
}
}