jhunt / lkebot

A Slack Bot for deploying LKE Clusters as R&D Lab Environments
3 stars 2 forks source link

LKEBot - A Slack Bot for Deploying Lab LKE Clusters

This is a Slack Bot for managing a dynamic fleet of Linode LKE clusters, with an upper limit on deployment counts and sizing, geared towards chat-ops teams who want short-lived, ephemeral Kubernetes clusters for testing and deployment.

Running the Bot

To run the bot, use the filefrog/lkebot image, and your foavorite orchestrator / command-line flags:

docker run --restart=always -d \
  -e LINODE_TOKEN=$LINODE_TOKEN \
  filefrog/lkebot:latest

Interaction

In direct one-on-one messages, commands can be sent as-is:

Direct Message Session

If you invite the bot to a channel, channel members will be able to interact with it by prefixing the command with a lone @-name:

Channel Session

The following commands are known:

help

Prints out a helpful reminder of how to interact with the chatbot.

This command takes no arguments.

help command

info

Prints out the chatbot configuration, including defaults and upper limits.

This command takes no arguments.

info command

list

Queries the Linode API (caching the results) and then prints out the current status of deployed clusters, their sizing, and expiration times (relatively speaking).

This command takes no arguments.

list command

deploy

Deploys a new LKE Kubernetes cluster.

Usage:

deploy NAME [-v K8S-VERSION] [-r REGION] [-i INSTANCE] [-n NODES] [--for HOURS]

deploy command

The following flags are defined:

If any or all of these options are omitted, suitable built-in and operator-provided defaults are used.

renew

Renew the lease on a deployed cluster.

Usage:

renew NAME [--for HOURS]

renew command

The following flags are defined:

expire

Immediately expires a cluster's lease, making it sweepable (without explicitly tearing it down).

Usage:

expire NAME

This command takes no additional arguments.

expire command

teardown

Immediately tear down a cluster, deleting its worker nodes, and obliterating all workloads running on it.

Usage:

teardown NAME

This command takes no additional arugments

teardown command

access

Retrieves and prints a suitable KUBECONFIG for accessing this cluster via the kubectl CLI.

Usage:

access NAME

This command takes no additional arugments

access command

Configuration

You can configure the bot via either command-line flags or environment variables. Here's the list of knobs and levers you can fiddle with: