Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f60ca960d6 | |||
| 69b24e9e09 | |||
| 651682092a | |||
| e982d69dd6 | |||
| 7a9b1cb675 | |||
|
9be8681761
|
|||
|
5293e94e21
|
|||
| 83cd217fb5 | |||
| 5b9dc135e3 | |||
| 8170cbaa0d | |||
| a5a8ac6090 | |||
| 9d56171a31 | |||
|
8582f07d3f
|
|||
| a257fabbc8 | |||
| d95d216e0b | |||
| ad1db6b5e3 | |||
| 85f607ac20 |
@@ -0,0 +1,30 @@
|
|||||||
|
name: cron-checker
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
go-version: 'stable'
|
||||||
|
- name: Run tests
|
||||||
|
run: go test -race -coverprofile=coverage.txt ./...
|
||||||
|
|
||||||
|
vulnerabilities:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
go-version: 'stable'
|
||||||
|
- name: Check vulnerabilities
|
||||||
|
run: |
|
||||||
|
go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||||
|
govulncheck ./...
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
uses: unboundsoftware/shared-workflows/.gitea/workflows/Release.yml@main
|
||||||
@@ -2,6 +2,23 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [1.4.0] - 2026-01-09
|
||||||
|
|
||||||
|
### 🚀 Features
|
||||||
|
|
||||||
|
- Migrate from GitLab CI to Gitea Actions
|
||||||
|
- Add release workflow using shared workflow
|
||||||
|
|
||||||
|
### 📚 Documentation
|
||||||
|
|
||||||
|
- Add CLAUDE.md for Claude Code guidance
|
||||||
|
|
||||||
|
### ⚙️ Miscellaneous Tasks
|
||||||
|
|
||||||
|
- *(deps)* Update golang:1.25.5 docker digest to ad03ba9
|
||||||
|
- *(deps)* Update actions/checkout action to v6
|
||||||
|
- *(deps)* Update actions/setup-go action to v6
|
||||||
|
|
||||||
## [1.3.18] - 2025-12-18
|
## [1.3.18] - 2025-12-18
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
# CLAUDE.md
|
||||||
|
|
||||||
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||||
|
|
||||||
|
## Project Overview
|
||||||
|
|
||||||
|
A Kubernetes monitoring tool that checks for CronJobs not running according to schedule and sends Slack notifications. It runs as a container inside a K8s cluster, polling all CronJobs every 60 seconds.
|
||||||
|
|
||||||
|
## Common Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run tests
|
||||||
|
go test ./...
|
||||||
|
|
||||||
|
# Run tests with race detection and coverage
|
||||||
|
go test -race -coverprofile=coverage.txt ./...
|
||||||
|
|
||||||
|
# Build the binary
|
||||||
|
CGO_ENABLED=0 go build -o release/cron-checker -ldflags '-w -s'
|
||||||
|
|
||||||
|
# Check for vulnerabilities
|
||||||
|
govulncheck ./...
|
||||||
|
|
||||||
|
# Format and vet
|
||||||
|
go fmt ./...
|
||||||
|
go vet ./...
|
||||||
|
|
||||||
|
# Check for unused modules
|
||||||
|
go mod tidy
|
||||||
|
```
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
This is a single-file Go application (`main.go`) with comprehensive tests (`main_test.go`).
|
||||||
|
|
||||||
|
**Core Components:**
|
||||||
|
- `doCheck()` - Main loop that polls K8s CronJobs, parses cron schedules, and sends Slack alerts for overdue jobs
|
||||||
|
- `Client` / `ClientProvider` interfaces - Abstractions over K8s client for testability
|
||||||
|
- `ConfigProvider` / `InClusterProvider` - Handles K8s in-cluster authentication
|
||||||
|
|
||||||
|
**Key Dependencies:**
|
||||||
|
- `k8s.io/client-go` - Kubernetes API client
|
||||||
|
- `github.com/robfig/cron` - Cron schedule parsing
|
||||||
|
- `github.com/multiplay/go-slack` - Slack webhook integration
|
||||||
|
- `github.com/alecthomas/kingpin/v2` - CLI flag parsing
|
||||||
|
|
||||||
|
**Configuration:**
|
||||||
|
- `SLACK_URL` env var or `--slack-url` flag (required) - Slack webhook URL for notifications
|
||||||
|
|
||||||
|
## Building Docker Image
|
||||||
|
|
||||||
|
The Dockerfile performs a multi-stage build that runs fmt, vet, and tests before building:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t cron-checker .
|
||||||
|
```
|
||||||
|
|
||||||
|
To extract coverage report:
|
||||||
|
```bash
|
||||||
|
docker build --target export -o . .
|
||||||
|
```
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM amd64/golang:1.25.5@sha256:0c27bcf0df81eca89f87e1e78be5ad5e36487f0eaf71cd900ba14ee7621d3e70 as build
|
FROM amd64/golang:1.25.5@sha256:ad03ba93327b8a6143b49373790b5d92c28067bdb814418509466122ee9c9e63 as build
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
ENV CGO_ENABLED=0
|
ENV CGO_ENABLED=0
|
||||||
ADD . /build
|
ADD . /build
|
||||||
|
|||||||
Reference in New Issue
Block a user