Skip to content

Commit 8b54fd1

Browse files
authored
Merge pull request #54 from target/cron
address cron job confusion and update dependencies
2 parents 58025dc + b364db3 commit 8b54fd1

19 files changed

+230
-227
lines changed

CHANGELOG.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
11
# pod-reaper: kills pods dead
22

3+
### 2.6.0
4+
- adjusted cron `SCHEDULE` for optional seconds, non optional day of week
5+
6+
### 2.5.0
7+
- added multiple logging formats
8+
9+
### 2.4.1
10+
- added configurable `LOG_LEVEL`
11+
12+
### 2.4.0
13+
- added `UNREADY` rule to kill pods based on duration of time not passing readiness checks
14+
315
### 2.3.0
416
- added `POD_STATUSES` rule (can now filter/kill `Evicted` pods)
517

618
### 2.2.0
7-
819
- added configurable `GRACE_PERIOD` to control soft vs hard pod kills
920

1021
### 2.1.0
11-
1222
- Added logging via [logrus](https://github.com/sirupsen/logrus)
1323

1424
## 2.0.0
15-
1625
- removed `POLL_INTERVAL` environment variable in favor of cron schedule
1726
- added `SCHEDULE` environment variable to control when pods are inspected for reaping
1827
- makes use of https://godoc.org/github.com/robfig/cron
1928
- refactored packages for clarity
2029
- testing refactor for clarity
21-
2230
### 1.1.0
23-
2431
- added ability to only reap pods with specified labels
2532

2633
## 1.0.0
27-
2834
- redesign of the reaper to be built on modular rules
2935
- rules must implement two methods `load()` and `shouldReap(pod)`
3036
- rules determine whether or not they get loaded at runtime via environment variables

Dockerfile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# Build
2-
FROM golang:1.9 AS build
2+
FROM golang:1.14 AS build
33
WORKDIR /go/src/github.com/target/pod-reaper
44
ENV CGO_ENABLED=0 GOOS=linux
5-
RUN go get github.com/Masterminds/glide
6-
COPY glide.* ./
7-
RUN glide install --strip-vendor
8-
COPY reaper/*.go ./reaper/
9-
COPY rules/*.go ./rules/
10-
RUN go test $(glide nv)
11-
RUN go build -o pod-reaper -a -installsuffix go ./reaper
5+
COPY ./ ./
6+
RUN go get github.com/Masterminds/glide \
7+
&& glide install --strip-vendor \
8+
&& go test $(glide nv) \
9+
&& go build -o pod-reaper -a -installsuffix go ./reaper
1210

1311
# Application
1412
FROM scratch

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Controls the grace period between a soft pod termination and a hard termination.
5151

5252
Default value: "@every 1m"
5353

54-
Controls how frequently pod-reaper queries kubernetes for pods. The format follows the upstream cron library https://godoc.org/github.com/robfig/cron. For most use cases, the interval format `@every 1h2m3s` is sufficient. But more complex use cases can make use of the `* * * * *` notation.
54+
Controls how frequently pod-reaper queries kubernetes for pods. The format follows the upstream cron library https://godoc.org/github.com/robfig/cron. For most use cases, the interval format `@every 1h2m3s` is sufficient. But more complex use cases can make use of the `* * * * *` notation. The cron parser used can optionally support seconds if a sixth parameter is add. `12 * * * * *` for example will run on the 12th second of every minute.
5555

5656
### `RUN_DURATION`
5757

examples/complex-deployment.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ spec:
9999
# randomly flag 30% of pods whenever they are checked
100100
- name: CHAOS_CHANCE
101101
value: ".3"
102+
# increase logging
103+
- name: LOG_LEVEL
104+
value: debug
102105

103106
- name: chaos # reaper 2
104107
image: target/pod-reaper
@@ -110,12 +113,15 @@ spec:
110113
cpu: 20m
111114
memory: 20Mi
112115
env:
113-
# cron job based schedule
116+
# cron job based schedule (with seconds)
114117
- name: SCHEDULE
115-
value: "0/5 * * * *"
118+
value: "15 * * * * *"
116119
# randomly flag 5% of pods whenever they are checked
117120
- name: CHAOS_CHANCE
118121
value: ".05"
122+
# increase logging
123+
- name: LOG_LEVEL
124+
value: debug
119125

120126
- name: error # reaper 3
121127
image: target/pod-reaper
@@ -130,7 +136,10 @@ spec:
130136
env:
131137
# check pods every 3 min
132138
- name: SCHEDULE
133-
value: "@every 3m"
139+
value: "0/3 * * * *"
134140
# check if container status is in the set { Error, ErrImagePull, ImagePullBackOff }
135141
- name: CONTAINER_STATUSES
136142
value: "Error,ErrImagePull,ImagePullBackOff"
143+
# increase logging
144+
- name: LOG_LEVEL
145+
value: debug

0 commit comments

Comments
 (0)