Skip to content

Commit 5f3adde

Browse files
authored
docs: update README.md to English and improve documentation (#228)
1 parent 22728ab commit 5f3adde

File tree

1 file changed

+70
-58
lines changed

1 file changed

+70
-58
lines changed

README.md

Lines changed: 70 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,101 @@
11
# kube-job-notifier
2-
For kubernetes job notification tool
32

4-
## Description
5-
- Notification Kubernetes Job start, success, and failure.
3+
A tool for monitoring Kubernetes job execution status and sending notifications to Slack and Datadog.
64

7-
## Usage
5+
## Features
86

9-
### Notification setting(Slack only)
10-
- Please set environment variable
7+
- Notifications for Kubernetes job start, success, and failure
8+
- Slack notifications with log attachments
9+
- Datadog service check notifications
10+
- Support for multiple container log collection
11+
- Per-job notification customization
12+
- Easy deployment with Helm charts
1113

14+
## Installation
15+
16+
### Installation with Helm (Recommended)
17+
18+
```bash
19+
helm repo add kube-job-notifier https://yutachaos.github.io/kube-job-notifier/
20+
helm install kube-job-notifier/kube-job-notifier --generate-name
21+
```
22+
23+
### Installation with Manifests
24+
25+
1. Apply the manifests:
26+
```bash
27+
kubectl apply -f manifests/sample/
1228
```
29+
30+
2. Verify the deployment:
31+
```bash
32+
kubectl get po
33+
```
34+
35+
## Configuration
36+
37+
### Slack Notification Settings
38+
39+
Configure using environment variables:
40+
41+
```bash
1342
export SLACK_TOKEN=YOUR_SLACK_TOKEN
1443
export SLACK_CHANNEL=YOUR_NOTIFICATION_CHANNEL_ID
15-
export SLACK_STARTED_NOTIFY=true # OPTIONAL DEFAULT true
16-
export SLACK_SUCCEEDED_NOTIFY=true # OPTIONAL DEFAULT true
17-
export SLACK_FAILED_NOTIFY=true # OPTIONAL DEFAULT true
18-
export SLACK_USERNAME=YOUR_NOTIFICATION_USERNAME # OPTIONAL
19-
export SLACK_SUCCEED_CHANNEL=YOUR_NOTIFICATION_CHANNEL_ID # OPTIONAL
20-
export SLACK_FAILED_CHANNEL=YOUR_NOTIFICATION_CHANNEL_ID # OPTIONAL
21-
export DATADOG_ENABLED=true # OPTIONAL DEFAULT false
22-
export NAMESPACE=KUBERNETES_NAMESPACE # OPTIONAL
44+
export SLACK_STARTED_NOTIFY=true # Optional, default: true
45+
export SLACK_SUCCEEDED_NOTIFY=true # Optional, default: true
46+
export SLACK_FAILED_NOTIFY=true # Optional, default: true
47+
export SLACK_USERNAME=YOUR_NOTIFICATION_USERNAME # Optional
48+
export SLACK_SUCCEED_CHANNEL=YOUR_NOTIFICATION_CHANNEL_ID # Optional
49+
export SLACK_FAILED_CHANNEL=YOUR_NOTIFICATION_CHANNEL_ID # Optional
50+
export DATADOG_ENABLED=true # Optional, default: false
51+
export NAMESPACE=KUBERNETES_NAMESPACE # Optional
2352
```
2453

25-
It will take SLACK_CHANNEL as default channel which may be overwritten by SLACK_SUCCEED_CHANNEL, SLACK_FAILED_CHANNEL environment variables.
54+
### Job Annotation Configuration
2655

27-
Another way of overriding behaviour is using job annotations in k8s. Available job annotations to override are:
56+
You can customize notification channels per job:
2857

2958
```
30-
- kube-job-notifier/default-channel - will be used as channel for a notification if similar success channel annotation is empty
31-
- kube-job-notifier/success-channel - will be used as channel for a success job notification
32-
- kube-job-notifier/started-channel - will be used as channel for a started job notification
33-
- kube-job-notifier/failed-channel - will be used as channel for a failed job notification
59+
kube-job-notifier/default-channel - Default notification channel
60+
kube-job-notifier/success-channel - Channel for successful job notifications
61+
kube-job-notifier/started-channel - Channel for job start notifications
62+
kube-job-notifier/failed-channel - Channel for failed job notifications
3463
```
3564

36-
Also it's possible to suppress notification per job:
65+
You can also suppress notifications:
3766

3867
```
39-
- kube-job-notifier/suppress-success-notification - suppress notification for succesfully finished job even if SLACK_SUCCEEDED_NOTIFY environment variable set to true
40-
- kube-job-notifier/suppress-started-notification - suppress notification when job is started even if SLACK_STARTED_NOTIFY environment variable set to true
41-
- kube-job-notifier/suppress-failed-notification - suppress notification when job is failed even if SLACK_FAILED_NOTIFY environment variable set to true
42-
```
43-
#### slack permissions
44-
- Required permission above.
45-
```
46-
chat:write
47-
files:write
68+
kube-job-notifier/suppress-success-notification - Suppress success notifications
69+
kube-job-notifier/suppress-started-notification - Suppress start notifications
70+
kube-job-notifier/suppress-failed-notification - Suppress failure notifications
4871
```
4972

50-
### Event subscription setting(Current Datadog support only)
51-
- Datadog service checks are sent when the Job succeeds or fails.
52-
- More information https://docs.datadoghq.com/developers/service_checks/dogstatsd_service_checks_submission/
73+
### Slack Permission Requirements
5374

54-
### Job with multiple containers logging
75+
The following permissions are required:
76+
- `chat:write`
77+
- `files:write`
5578

56-
By default for cron jobs logs are attached from container with the same name as a cron job. This can be overwritten by adding *kube-job-notifier/log-mode* annotation.
79+
### Datadog Integration
5780

58-
- *ownerContainer* - get logs only from container with the same name as cron job (default behaviour if annotation is not presented);
59-
- *podOnly* - get logs from the pod, works perfectly with pod with single container;
60-
- *podContainers* - get logs from all pod containers and concatenate them.
81+
- Sends Datadog service checks when jobs succeed or fail
82+
- For more details: https://docs.datadoghq.com/developers/service_checks/dogstatsd_service_checks_submission/
6183

62-
### Run
84+
### Multiple Container Log Collection
6385

64-
#### Local
86+
You can specify log collection mode using the `kube-job-notifier/log-mode` annotation:
6587

66-
`go run *.go -kubeconfig {YOUR_KUBECONFIG_PATH}`
67-
68-
#### Kubernetes
88+
- `ownerContainer` - Get logs only from container with the same name as the job (default)
89+
- `podOnly` - Get logs from the pod, works perfectly with single container pods
90+
- `podContainers` - Get logs from all pod containers and concatenate them
6991

70-
- Run your kubernetes cluster.(Note default namespace is `default`). If change apply namespace, please edit manifest.
71-
- Setting SLACK_TOKEN and SLACK_CHANNEL in manifest/sample/deployment.yaml.
72-
- Apply manifest
73-
`kubectl apply -f manifests/sample/`
74-
- Check running
92+
## Running Locally
7593

94+
```bash
95+
go run *.go -kubeconfig {YOUR_KUBECONFIG_PATH}
7696
```
77-
kubectl get po
78-
NAME READY STATUS RESTARTS AGE
79-
kube-job-notifier-deployment-698fbc8b54-ffk2q 1/1 Running 0 8m12s
80-
```
81-
82-
#### Install with Helm
83-
`helm repo add kube-job-notifier https://yutachaos.github.io/kube-job-notifier/`
84-
`helm install kube-job-notifier/kube-job-notifier --generate-name`
8597

86-
#### Document
98+
## Documentation
8799

88-
https://yutachaos.github.io/kube-job-notifier/
100+
For detailed documentation, visit: https://yutachaos.github.io/kube-job-notifier/
89101

0 commit comments

Comments
 (0)