Skip to content
Slack notifications for Weave Flux without Weave Cloud
Go Makefile Dockerfile
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd Fixed casing error on 'exporter_type' preventing setting any other th… Sep 4, 2019
examples Release v0.3.8 Jul 11, 2019
pkg - If any exporter.Send() fails the `/v6/events` endpoint will return … Jul 29, 2019
tests Update Kube example manifests to apps/v1 Jun 19, 2019
.dockerignore
.drone.yml fix tagging Feb 10, 2019
.git-semver Add .git-semver back. Oct 24, 2018
CHANGELOG Release v0.3.8 Jul 11, 2019
Dockerfile Switch to Hone, drop vendor directory. Jul 11, 2019
Honefile update kaniko image Jul 27, 2019
LICENSE Add license, fixes #11 Oct 2, 2018
Makefile
OWNERS add owners file Jul 11, 2019
README.md
go.mod convert to Go module Jun 17, 2019
go.sum convert to Go module Jun 17, 2019
skaffold.yaml Initial commit May 14, 2018

README.md

Fluxcloud is a tool to receive events from the Weave flux.

build status

Weave Flux is a useful tool for managing the state of your Kubernetes cluster.

Fluxcloud is a valid upstream for Weave, allowing you to send Flux events to Slack or a webhook without using Weave Cloud.

Setup

Please see the Weave Flux setup documentation for setting up Flux.

To use Fluxcloud, you can deploy fluxcloud as either a sidecar to Flux or a seperate deployment.

To deploy as a sidecar, see examples/flux-deployment-sidecar.yaml. To deploy independently, see examples/fluxcloud.yaml.

Set the following environment variables in your chosen deployment:

  • SLACK_URL: the Slack webhook URL to use.
  • SLACK_USERNAME: the Slack username to use when sending messages.
  • SLACK_TOKEN (optional): legacy Slack API token to use.
  • SLACK_CHANNEL: the Slack channel to send messages to.
  • SLACK_ICON_EMOJI: the Slack emoji to use as the icon.
  • MSTEAMS_URL: the Microsoft Teams webhook URL to use
  • GITHUB_URL: the URL to the Github repository that Flux uses, used for Slack links.
  • WEBHOOK_URL: if the exporter is "webhook", then the URL to use for the webhook.
  • EXPORTER_TYPE (optional): The types of exporter to use in comma delimited form. (Ex: slack,webhook) (Choices: slack, msteams, webhook, Default: slack)
  • JAEGER_ENDPOINT (optional): endpoint to report Jaeger traces to.

And then apply the configuration:

kubectl apply -f examples/fluxcloud.yaml

Set the --connect flag on Flux to --connect=ws://fluxcloud.

Exporters

There are multiple exporters that you can use with fluxcloud. If there is not a suitable one already, feel free to contribute one by implementing the exporter interface!

Slack

The default exporter to use is Slack. To use the Slack exporter, set the SLACK_URL, SLACK_USERNAME, and SLACK_CHANNEL environment variables to use. You can also optionally set the EXPORTER_TYPE to "slack".

Sending notifications to multiple channels

If sending notifications to only one channel is unsufficient for your use case you can configure fluxcloud to send them to multiple channels based upon the namespace(s) from the created and/or updated resources. This is done by setting a comma separated <channel>=<namespace> string as the SLACK_CHANNEL environment variable.

If you for example want to send notifications of all events to #k8s-events but only events from namespace team-b to #teamb you would set the following string: SLACK_CHANNEL=#k8s-events=*,#team-b=team-b.

Microsoft Teams

Set the environment variable MSTEAMS_URL to the URL generated on activation of an Incoming Webhook in a Microsoft Teams channel.

Webhooks

Events can be sent to an arbitrary webhook by setting the EXPORTER_TYPE to "webhook" and then setting the WEBHOOK_URL to the URL to send the webhook to.

Fluxcloud will send a POST request to the provided URL with the encoded event as the payload.

Formatting commit links

By default, commit links are formatted for Github. It is possible to format them for another VCS system, such as Bitbucket, by overriding the commit template.

The commit template is a go template that supports two variables:

  • VCSLink: which is the GITHUB_URL configuration option.
  • Commit: which is the commit id.

The default is:

{{ .VCSLink }}/commit/{{ .Commit }}

For example, to override to work for Bitbucket, set the COMMIT_TEMPLATE environment variable to:

{{ .VCSLink }}/commits/{{ .Commit }}

Versioning

Fluxcloud follows semver for versioning, but also publishes development images tagged with $BRANCH-$COMMIT.

To track release images:

fluxctl policy -c kube-system:deployment/fluxcloud --tag-all='v0*'

To track the latest pre-release images:

fluxctl policy -c kube-system:deployment/fluxcloud --tag-all='master-*'

And then you can automate it:

fluxctl automate -c kube-system:deployment/fluxcloud

Build

To build fluxcloud, you can either use go:

go build -o fluxcloud ./cmd/

Or, to run a full CI build, download hone:

hone
You can’t perform that action at this time.