Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Qing Ye committed Sep 25, 2021
1 parent d9f6f41 commit f8bbb47
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
builds:
- main: main.go
binary: helm3-monitor
env:
- CGO_ENABLED=0
goos:
- darwin
- linux
Expand Down
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# helm3-monitor
Monitor K8S Helm3 release, rollback on Prometheus query
# Helm3 Monitor Plugin

Monitor a Helm3 release, rollback to a previous version depending on the result of a PromQL (Prometheus) query result

## Install

```shell
> helm plugin install https://github.com/yq314/helm3-monitor
```

## Usage

A rollback happen only if the number of result from the query is greater than 0.

You can find a step-by-step example in the ./examples directory.

```shell
> helm monitor prometheus --prometheus=http://prometheus:9090 \
<release_name> \
'rate(http_requests_total{statusClass!="2XX"}[5m]) / rate(http_requests_total[5m]) > 0.01'
```
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Install Prometheus
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add kube-state-metrics https://kubernetes.github.io/kube-state-metrics
helm repo update
helm --namespace prometheus install -f ./prometheus.yml --create-namespace prometheus prometheus-community/prometheus
helm --namespace prometheus upgrade -i -f ./prometheus.yml --create-namespace prometheus prometheus-community/prometheus
```

Install Infrabin
Expand Down
18 changes: 9 additions & 9 deletions scripts/install_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ fi

echo "$url"

#mkdir -p "bin"
#mkdir -p "releases/v${version}"
#
#if [ -x "$(which curl 2>/dev/null)" ]; then
# curl -sSL "${url}" -o "releases/v${version}.tar.gz"
#else
# wget -q "${url}" -O "releases/v${version}.tar.gz"
#fi
#tar xzf "releases/v${version}.tar.gz" -C "releases/v${version}"
mkdir -p "bin"
mkdir -p "releases/v${version}"

if [ -x "$(which curl 2>/dev/null)" ]; then
curl -sSL "${url}" -o "releases/v${version}.tar.gz"
else
wget -q "${url}" -O "releases/v${version}.tar.gz"
fi
tar xzf "releases/v${version}.tar.gz" -C "releases/v${version}"
mv "releases/v${version}/helm3-monitor" "bin/helm3-monitor" || \
mv "releases/v${version}/helm3-monitor.exe" "bin/helm3-monitor"
mv "releases/v${version}/completion.yaml" .
Expand Down

0 comments on commit f8bbb47

Please sign in to comment.