Skip to content

Commit a02a68b

Browse files
Added config watcher (#1)
Added Kubernetes configuration watcher. It uses the Kubernetes API to watch for changes on ConfigMap or Secret resources and create files in the target directory corresponding to the resource's `data` field. Multiple Kubernetes namespaces can be watched for changes. An optional webhook URL is invoked when a change in resource results in a file content change in the target directory. There are no guards for duplicate keys in ConfigMap resources. Added `Dockerfile` and GitHub Actions to run the available tests.
1 parent bddf26d commit a02a68b

File tree

17 files changed

+1934
-8
lines changed

17 files changed

+1934
-8
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2+
# Ignore build and test binaries.
3+
4+
# top-level directories to ignore
5+
bin/
6+
tmp/

.github/workflows/test.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "main"
8+
9+
jobs:
10+
continuous:
11+
name: Continuous
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.12"]
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
cache: 'pip'
26+
- name: Install dependencies
27+
run: |
28+
pip install -r config_watcher/test-requirements.txt
29+
pip install -r config_watcher/requirements.txt
30+
- name: Test code formatting
31+
run: |
32+
make fmt
33+
status="$(git status --porcelain)"
34+
if [ -n "$status" ]; then
35+
echo "ERROR: There are unexpected code changes" >&2
36+
echo "$status" >&2
37+
git diff >&2
38+
exit 1
39+
fi
40+
- name: Run static checks
41+
run: make lint
42+
- name: Run tests
43+
run: make test
44+
- name: Test report
45+
uses: dorny/test-reporter@v1
46+
if: always()
47+
with:
48+
name: results-config-watcher-${{ matrix.python-version }}
49+
path: test-results/reports/config_watcher.xml
50+
reporter: java-junit
51+
fail-on-error: true
52+
- name: Upload test results
53+
if: always()
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: test-results-${{ matrix.python-version }}
57+
path: |
58+
test-results/config_watcher
59+
retention-days: 7

.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,14 @@ cython_debug/
168168
#.idea/
169169

170170
# PyPI configuration file
171-
.pypirc
171+
.pypirc
172+
173+
# Temporary directories
174+
bin
175+
tmp
176+
177+
# Test artifacts
178+
test-results
179+
180+
# IDE specific files
181+
.vscode

0 commit comments

Comments
 (0)