chatbot

package module
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

README

Chatbot

Chatbot is a Slack bot to deploy things to Kubernetes

Requirements

This assumes you already have a kubernetes cluster. Tested with kubectl v1.11.1.

Setup

To run Chatbot on Slack, first you need to create a new bot user integration on Slack and get the token (See Slack bot users for more details).

Then you need to know the channel ids where you want to run the Chatbot. You can get them on https://slack.com/api/channels.list?token={REPLACE WITH YOUR TOKEN}

How to run

Binary

You just need to supply one environment variable, which is the slack token you've created earlier:
CHATBOT_SLACK_TOKEN=your_token CHATBOT_CLUSTER_NAME=your_net_name go run cmd/bot/main.go

How to use

After creating and setting up a bot - invite it to your desired Slack channel(s) by mentioning it.

Supported commands
  • !deploy your_cluster your_app your_container your/docker:image, currently supports deployments and statefulsets,
    where your_cluster is CHATBOT_CLUSTER_NAME,your_app is a statefulset/deployment name, your_container is a container name within a pod and image is the image you want
    to deploy. Note, that it automatically forces redeploy even if the image name is the same as the last deployed one
    but if you want to force pull - you need to specify imagePullPolicy: Always for your container in the manifest.
  • !reset your_cluster your_app, basically resets data for statefulesets, where your_cluster is CHATBOT_CLUSTER_NAME,
    your_app is your app label and it's name.
  • A link with concrete commands per artifact can be found here

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Log

func Log(str string, args ...interface{})

Types

type Command

type Command interface {
	// Func returns a command that could be run on slack
	Func() func(*bot.Cmd) (string, error)
	// Func3 returns an async command that should run on slack
	Func3() func(*bot.Cmd) (bot.CmdResultV3, error)
	// Register registers the func in global slack command registry
	Register()
}

Command represents a command that could be run on slack

func NewDeployCommand

func NewDeployCommand(clusterName string) Command

func NewP2PCommand added in v0.0.5

func NewP2PCommand(clusterName string) Command

func NewResetCommand

func NewResetCommand(clusterName string) Command

Directories

Path Synopsis
cmd
bot

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL