Flux-mixin
use jsonnet
We recommend to use go-jsonnet. It's an implementation of Jsonnet in pure Go. It is feature complete but is not as heavily exercised as the Jsonnet C++ implementation.
To install:
go get github.com/google/go-jsonnet/cmd/jsonnet
Flux-mixin
uses jsonnet-bundler (the jsonnet package manager) to manage its dependencies.
We recommended you to use jsonnet-bundler
to install or update if you decide to use flux-mixin
as a dependency for your custom mixins.
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
Flux-mixin can support dashboards across multiple clusters. You need either a multi-cluster Thanos installation with external_labels
configured or a Cortex system where a cluster label exists. To enable this feature you need to configure the following:
// Opt-in to multiCluster dashboards by overriding this and the clusterLabel.
showMultiCluster: true,
clusterLabel: '<your cluster label>',
Alerts and dashboards will be generated to files/
directory using:
jb install
make alerts
make dashboards
To use the flux-mixin
as a dependency, simply use the jsonnet-bundler
to install:
$ mkdir custom-mixin; cd custom-mixin
$ jb init # Create/Initial empty `jsonnetfile.json` for dependency management
# Install flux-mixin dependency
$ jb install github.com/fluxcd-community/flux-mixin
in a directory, add a file mixin.libsonnet
:
local flux = import "github.com/fluxcd-community/flux-mixin/mixin.libsonnet"; // import full path to avoid collusion with other mixin
flux {
_config+:: {
showMultiCluster: true,
clusterLabel: 'cluster',
},
}
Then generate the alerts and dashboards
$ mkdir -p files/dashboards
$ jsonnet -J vendor -S -e 'std.manifestYamlDoc((import "mixin.libsonnet").prometheusAlerts)' > flies/alerts.yml
$ jsonnet -J vendor -m files/dashboards -e '(import "mixin.libsonnet").grafanaDashboards'