/k8s-mattermost-informer

Informs a Mattermost channel if an annotated pod goes into crash loop.

Primary LanguageGoMIT LicenseMIT

k8s-mattermost-informer

This Kubernetes controller informs you when a Kubernetes Pod repeatedly dies (CrashLoopBackOff) while providing additional information like exit code and logs. This is my first attempt at writing a Kubernetes controller, if you have any feedback please open an issue.

Usage

Step 1: Add a config map for the Mattermost Informer

apiVersion: v1
data:
  channel: <channel-name>
  password: <your-user-password>
  team: <team-name>
  url: <your-mattermost-url>
  user: <your-user>
kind: ConfigMap
metadata:
  name: mattermost-informer-cfg

This step is required to create a valid configuration for our Mattermost informer.

Step 2: Deploy the informer

$ kubectl apply -f informer.yaml

You may want to update the namespace references, since the informer only watches a given namespace.

Step 3: Annotate pods

To begin watching pods, you only have to add the following annotation to the pod spec.

annotations:
  espe.tech/mattermost: inform

You may optionally set the backoff interval in seconds using espe.tech/mattermost-backoff.