5.6 KiB
5.6 KiB
Migration Summary: Pushgateway → gitops-status-server
This document summarizes the changes made to migrate the rsyslog repository from Pushgateway metrics to JSON status updates for gitops-status-server.
What Changed
1. New Files Created
update-gitops-status.sh
- Main script that orchestrates the status update flow
- Runs Ansible drift-check playbook
- Parses output to extract changed file names
- Builds structured JSON payload
- Sends JSON to gitops-status-server via HTTP POST
- Handles both SYNCED and OUT_OF_SYNC states
GITOPS_STATUS_INTEGRATION.md
- Documentation explaining the integration with gitops-status-server
- API endpoint specification
- JSON payload format examples
- Architecture diagram
- Error handling details
2. Modified Files
.woodpecker.yml
Changes:
- Updated header comments to reflect new JSON status flow
- Renamed step:
update-sync-metric→update-gitops-status - Removed Pushgateway environment variable (
PUSHGATEWAY_URL) - Added new environment variables:
GITOPS_STATUS_SERVER_URLREPO_NAMESERVER_NAME
- Added
jqpackage installation for JSON formatting - Added
bashpackage to cron step (required by update-gitops-status.sh) - Updated both
update-gitops-statusandgitops_sync_checksteps to call new script - Removed Pushgateway metric push logic
- Added JSON status update logic
Step: update-gitops-status (formerly update-sync-metric)
- Runs after successful deployment
- Calls
update-gitops-status.sh - Always succeeds (status sent regardless of drift)
Step: gitops_sync_check
- Runs on cron schedule (every 2 minutes)
- Calls
update-gitops-status.shto send JSON - Then checks drift status to determine pipeline success/failure
- Pipeline fails if drift detected (for visibility in Woodpecker UI)
- JSON status always sent before checking drift
README.md
Changes:
- Updated pipeline flow diagrams
- Replaced "Prometheus" with "gitops-status-server" in diagrams
- Removed "sync metric" section
- Added "GitOps status JSON format" section with examples
- Updated pipeline step descriptions to mention JSON status
- Added
update-gitops-status.shto repository structure - Added optional environment variables table
- Updated flow descriptions to explain file-level drift details
3. Unchanged Files
The following files remain unchanged and continue to work as before:
ansible/playbooks/drift-check.yml- Still works as-isansible/playbooks/apply.yml- Deploy logic unchangedansible/playbooks/validate.yml- Validation logic unchangedansible/inventory/hosts.yml- Inventory unchangedansible/inventory/group_vars/all.yml- Variables unchangedansible.cfg- Ansible config unchangedapply.sh- Local apply script unchangeddrift-check.sh- Local drift check script unchangedfiles/rsyslog.conf- Config files unchangedfiles/rsyslog.d/30-lab.conf- Config files unchanged
Behavior Changes
Before (Pushgateway)
drift-check → calculate status (0 or 1) → push to Pushgateway → Prometheus scrapes
Output:
gitops_sync_status{repo="rsyslog",server="rsyslog-lab"} 1
After (gitops-status-server)
drift-check → extract changed files → build JSON → POST to gitops-status-server → Grafana queries
Output:
{
"repo": "rsyslog",
"server": "rsyslog-lab",
"sync_status": "OUT_OF_SYNC",
"drift_count": 2,
"files": [
{ "name": "rsyslog.conf" },
{ "name": "rsyslog.d/30-lab.conf" }
],
"last_check": "2026-04-21T10:32:15Z"
}
Benefits
- Richer data: File-level drift information instead of just a binary status
- Better visualization: Grafana can display which specific files have drifted
- Detailed tracking: Know exactly what changed, not just that something changed
- Timestamp tracking: Last check time included in JSON
- Drift count: Quick numeric indicator of severity
- Extensible: JSON format can be easily extended with additional fields
Migration Checklist
- Create
update-gitops-status.shscript - Update
.woodpecker.ymlpipeline - Update
README.mddocumentation - Create
GITOPS_STATUS_INTEGRATION.mdintegration docs - Remove Pushgateway environment variables
- Add gitops-status-server environment variables
- Update pipeline step names
- Add required packages (jq, bash)
- Test JSON generation logic
- Update flow diagrams
Testing Recommendations
-
Test the script locally:
export GITOPS_STATUS_SERVER_URL="http://localhost:80" export REPO_NAME="rsyslog" export SERVER_NAME="rsyslog-lab" ./update-gitops-status.sh -
Test in Woodpecker:
- Trigger a push to master → check
update-gitops-statusstep - Wait for cron run → check
gitops_sync_checkstep - Manually edit a file on server → wait for next cron → verify OUT_OF_SYNC status
- Trigger a push to master → check
-
Verify gitops-status-server:
- Check that JSON is received at POST endpoint
- Verify
/status.jsonserves the latest data - Confirm Grafana dashboard displays drift details
Rollback Plan
If needed, the old Pushgateway approach can be restored by:
- Reverting
.woodpecker.ymlto previous version - Removing
update-gitops-status.sh - Restoring Pushgateway environment variables
All Ansible playbooks remain unchanged, so they will work with either approach.
Notes
- The rsyslog repo now focuses only on status generation and sending
- gitops-status-server is responsible for serving data to Grafana
- No changes to observability-stack app are needed on the rsyslog side
- This migration is specific to rsyslog repo; other repos can follow same pattern