Skip to content

Efrat19/devops-task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Devops Task

What is it

slack chatbot

Available Commands

/k-bot pods

/k-bot logs [service] [tail]

metrics:

k-bot exports metrics on the same port as the app (defaults to 1012) on /metrics route In addition to usage metrics, a custom metric is also exported:

kbot_requests_total

  • Type: Counter
  • Labels: command, userID

Installation

  • create the signing secret (from slack)
~ $ k create secret generic k-bot-slack-secret --from-literal secret=xxxxxx 
  • Install the helm3 chart. In values.yaml, you will have to provide the ingress host name, slack signing secret details, and enable rbac if your cluster needs it.
~ $ helm3 install chart/k-bot --generate-name --namespace default
NAME: k-bot-1597572730
LAST DEPLOYED: Sun Aug 16 13:12:13 2020
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
  http://k-bot.yourdomain.io/

Tests

~ $ cd src
~ $ go test
Registering counter vector
PASS
ok      github.com/Efrat19/devops-task/src      0.683s

Meeting Task Requirements

1.Production-readiness: code should be reliable, tested and clean.

  • Small reusable functions
  • The code follows clean code principles
  • The code follows Go error handling best practices

2.Developer Experience (DX): deliver easy-to-use, self-service experience.

  • Command Help Text
  • Markdown Formatting

3.Security.

The code uses slack built-in token-based authentication to secure the communication using a signing secret

4.Observability: easily investigate and learn how the bot is being used.

  • Various log levels (debug, info, warn and error)
  • Clear error messages
  • usage metrics exported in prometheus-readable format

Projects Steps

  • k8s client:
    • get name, age, and /version of each running pod
    • get x log lines
  • slack server
    • accept slash command
  • expose metrics
    • requests counter
  • tests
  • errors handling
  • logs

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors