Skip to content

Release v2.1.x: Penguin-DAL migration, centralized libs, and test suite overhaul - #46

Open
PenguinzTech wants to merge 198 commits into
mainfrom
v2.1.x
Open

Release v2.1.x: Penguin-DAL migration, centralized libs, and test suite overhaul#46
PenguinzTech wants to merge 198 commits into
mainfrom
v2.1.x

Conversation

@PenguinzTech

Copy link
Copy Markdown
Contributor

This pull request merges the v2.1.x branch into main, representing a significant modernization and consolidation of the Squawk codebase.

Key Changes

1. Architectural Consolidation

  • Centralized Libraries: Removed vendored libraries in favor of centralized .
  • Penguin-DAL Migration: Migrated and from PyDAL to , including new SQLAlchemy schemas and Alembic migrations.
  • Service Consolidation: Removed separate and components, integrating DHCP and Time (NTP/PTP) services directly across components.

2. Frontend Modernization

  • React WebUI: Converted the Flask web console to an API-only backend with a modern React-based WebUI ().
  • Dependency Hardening: Pinned and dependencies to exact versions and immutable SHA references.
  • Component Integration: Integrated (LoginPageBuilder, SidebarMenu, AppConsoleVersion) into the frontend applications.

3. Testing & Quality Assurance

  • Comprehensive Test Suite: Added a new directory with E2E (Playwright), Integration, Load, and Smoke tests.
  • Coverage Improvements: Achieved 100% coverage for key frontend components (Login, Sidebar) and improved Python test coverage for backend services.
  • CI/CD Hardening: Updated GitHub Actions workflows with security scanning (Trivy), dependency monitoring, and standardized build processes.

4. Infrastructure & Deployment

  • Standardized K8s: Added standardized Kubernetes deployment configurations and deployment scripts (, ).
  • Security Fixes: Resolved high-severity vulnerabilities in Next.js and other dependencies.

5. Documentation & Standards

  • Unified Documentation: Massive overhaul of and project-wide documentation to meet new base standards.
  • Standardized Templates: Added GitHub issue templates for bugs, features, and security reports.

PenguinzTech and others added 30 commits December 11, 2025 10:18
Version files added (all at v1.0.0):
- dns-client-go/.version - Go DNS client
- dns-server/.version - DNS server
- dns-client/.version - Python DNS client (docker-client)
- dns-server/flask_app/.version - Web console (webui)

Workflow updates:
- Go client workflow now uses dns-client-go/.version
- Build triggers only when component's .version changes
- Added Windows ARM64 to build targets (6 platforms total)
- Release tags now use format: v{VERSION}-go-client

Release notes reorganized with sections for each package:
- go-client, dns-server, docker-client, webui
- Each with independent versioning and changelogs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add .version file monitoring to all build workflows
- Implement epoch64 timestamp-based naming (alpha/beta-<epoch64>)
- Add version-based release naming (vX.X.X-alpha/beta)
- Add auto pre-release creation on .version changes
- Add security scanning (gosec for Go, bandit for Python, npm audit for Node.js)
- Create comprehensive docs/WORKFLOWS.md
- Update docs/STANDARDS.md with CI/CD section
- Update CLAUDE.md with CI/CD section and pre-commit checklist

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Backend:
- Add DHCP models (pools, leases, reservations, servers) with PyDAL
- Add Time models (servers, sync logs, clients, config) with PTP/NTP support
- Add full REST API for DHCP pool management and lease tracking
- Add full REST API for time server management and sync operations
- Fix RBAC middleware: add check_team_access function
- Fix team model: remove unsupported PyDAL unique constraint

Frontend:
- Add TypeScript types for DHCP and Time services
- Add DHCPPools management component with utilization visualization
- Add TimeServers management component with PTP/NTP protocol selection
- Integrate new tabs into Management page

Go Client:
- Add NTP client package with automatic server failover
- Add NTP forwarder to intercept OS time requests (port 123)
- Add time configuration with environment variable support
- Add CLI commands: time query, time forward, time status
- Add comprehensive unit and integration tests

Documentation:
- Update API.md with DHCP and Time API endpoints
- Update ARCHITECTURE.md with network services diagrams
- Update STANDARDS.md with service-specific guidelines

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Restructure from server-side templates to a three-container architecture:
- Flask backend serves JSON-only REST API with JWT + Flask-Login auth
- React WebUI (Vite + TypeScript + Tailwind) as separate nginx container
- DNS server unchanged

Flask changes: add Flask-JWT-Extended, Flask-CORS, Flask-Limiter; convert
all dashboard routes to /api/v1/ JSON endpoints; add safe PyDAL row
serialization (exact type checks to exclude RecordUpdater/LazySet);
enforce auth on all API endpoints.

Docker: add Dockerfile.api for Flask, dns-webui service with nginx
reverse proxy, update docker-compose.yml with new services.

Tests: add comprehensive smoke test suite (130 tests) covering container
health, API endpoints, JWT auth flows, pagination, and response formats.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixes Dependabot alerts #33 and #34:
- CVE: Next.js HTTP request deserialization DoS (high)
- CVE: Next.js Image Optimizer DoS (medium)

Also fixes js-yaml prototype pollution via npm audit fix.

Remaining 2 moderate alerts (eslint stack overflow, Next.js PPR memory)
require breaking major version upgrades and have no stable patches.

quic-go alerts (#28-30) are already resolved on this branch (v0.59.0
includes all patches).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The root Dockerfile's dns-server and dns-client stages both COPY docs/
into the image. The .dockerignore was excluding the docs directory,
which would cause the CI docker-multi-build job to fail.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit addresses all identified security vulnerabilities across Python,
Node.js, and Go components, and adds extensive smoke test coverage for both
alpha (local) and beta (K8s) environments to ensure production readiness.

Security Fixes:
- Python: Update cryptography (41→44), PyMySQL (1.1.0→1.1.1), Pillow (10→11),
  aiohttp (3.9→3.11.11), add defusedxml for XXE prevention
- Node.js: Update react-router-dom (6→7), eslint (8→9), vite (5→7),
  next (15→16) to fix XSS, DoS, and stack overflow vulnerabilities
- Go: Fix integer overflow in NTP time handling, replace math/rand with
  crypto/rand, enforce TLS 1.2+ minimum, update quic-go to v0.59.0

New Features:
- Add version management script (scripts/version/update-version.sh)
  supporting major/minor/patch/build version increments
- Add 150 mock tests for isolated component testing (DNS client/server,
  Manager API, database operations)
- Add 79 comprehensive smoke tests covering security, edge cases,
  integration, and user experience for alpha and beta environments

Test Coverage:
- Security: 32 tests (auth, authorization, input validation, injection
  prevention, CORS, TLS, data isolation)
- Edge Cases: 37 tests (boundaries, special chars, concurrency, large
  datasets, error recovery)
- Integration: 39 tests (component communication, data flow, K8s
  integration, monitoring)
- User Experience: 24 tests (page loads, forms, navigation, error messages)
- Mock Tests: 150 tests (fast, isolated, no network/database dependencies)

Version: Bump to v2.1.1.1770072428 (patch increment for security fixes)

Resolves: Critical PyMySQL SQL injection, XSS in react-router, integer
overflow in Go NTP client, weak RNG in HTTP backoff, TLS misconfiguration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Install shared/react_libs dependencies before webui build to resolve
zod module import error during vite build.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update dal2-beta cluster deployment to use the pre-existing
penguintech-wildcard-tls certificate from cert-manager instead of
generating a new certificate.

Changes:
- Create comprehensive K8s manifests in k8s/manifests/
- Configure ingress for squawk.penguintech.io with proper TLS
- Use pre-existing Cloudflare wildcard certificate (penguintech-wildcard-tls)
- Deploy DNS server, Flask API, WebUI, and Valkey services
- Add health checks, resource limits, and HA configuration (2 replicas)
- Configure proper routing: / → webui, /api/v1 → flask-api, /dns-query → dns-server

Ingress Configuration:
- Host: squawk.penguintech.io
- TLS Secret: penguintech-wildcard-tls (Cloudflare wildcard cert)
- SSL redirect enabled
- NGINX ingress class

Deployed to: dal2-beta cluster, squawk namespace

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove restrictive security contexts and add emptyDir volumes for
directories that need write access (database logs, nginx cache).

Fixes:
- flask-api: Health check path /api/v1/health → /health
- flask-api: Add volume mount for /app/flask_app/databases
- webui: Add volume mounts for nginx cache and run directories
- All: Remove runAsUser/runAsNonRoot to allow containers to start properly

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change @penguin/react_libs reference from local file path to GitHub
repository to ensure consistent versioning across all PenguinTech projects.

- Update package.json to reference github:penguintechinc/penguin-libs#main
- Install @penguintechinc/react-libs from main branch
- Remove dependency on local shared/react_libs copy

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace local copies of shared libraries with git-referenced dependencies
from github.com/penguintechinc/penguin-libs. This ensures consistent
versioning across all PenguinTech projects.

- Remove entire shared/ directory (react_libs, node_libs, go_libs, py_libs,
  licensing, database) including duplicate shared/shared/ nested copy
- Update Dockerfile to remove COPY shared/react_libs build steps
- Update tailwind.config.js content path to node_modules dist
- Update all imports from @penguin/react_libs to @penguintechinc/react-libs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PenguinzTech and others added 27 commits July 26, 2026 20:57
- .pre-commit-config.yaml: hadolint rev conflict (v2.13.1 vs v2.14.0,
  the newer valid tag already canonical on v2.1.x since #78) resolved
  to v2.14.0. flake8 section already auto-merged to the canonical
  single-.flake8-source-of-truth form from #78 -- no conflict there.
- dns-server rate-limiter test bug (found during this merge's
  full-suite re-verification, unrelated to either branch's own diff):
  the app_with_rate_limiting fixture set rate_limiter.rps/.burst
  attributes on the module-level singleton AFTER its InMemoryBackend
  was already constructed with the default burst=100, so the token
  bucket's actual capacity never reflected the test's burst=3.0
  override and 429s never fired. Fixed by reinitializing the backend
  after setting the attributes; also moved CACHE_DIR/JWT_PUBLIC_KEY
  env-var setup to conftest module level (before any app.* import)
  so app.main only ever imports once, correctly configured, instead
  of racing test-file import order. Test-harness-only -- production
  configures these once at real startup.

Full suite: manager 234/234, dns-server 103/103, dhcp-server 32/32,
ntp-server 51/51, squawk-client 13/13.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…o this PR)

Same pre-existing cosmetic whitespace issue caught while merging PR #69
earlier -- this worktree's v2.1.x snapshot predates that fix. Pure
whitespace/EOF, not part of PR #77's changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…diation

chore(deps): remediate dependabot vulnerabilities
- dns-server/app/main.py: combined imports -- this branch's
  domain_policy/jwt_verify additions plus already-merged #65's
  rate-limit config vars and RateLimiter import. Also removed a
  redundant local re-import of verify_squawk_jwt/JWT_PUBLIC_KEY
  (leftover from #65's original code) that was shadowing the combined
  module-level import and tripping flake8's F401 check.
- dns-server/app/services/prometheus_metrics.py: combined two
  independent new methods (record_policy_denial from this branch,
  record_rate_limited_query from #65) on the same metrics class --
  their backing Counter definitions survived the auto-merge intact.
- manager/backend/app/services/auth_service.py: auto-merged cleanly
  but silently dropped the `List` import from typing while THIS
  branch's new allowed_domains: Optional[List[str]] parameter still
  uses it -- classic silent-auto-merge risk. Restored.

Full manager suite: 264/264 passing. dns-server: 112/112 real tests
passing (8 rate-limiter test errors are a pre-existing bug already
fixed in #77, not yet in this branch's v2.1.x snapshot -- will
re-verify after pulling latest v2.1.x).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat(nhi): per-identity DNS domain allowlists enforced at DoH
- app/blueprints/auth.py: both grant handlers (client_credentials and
  token-exchange) needed to combine THIS branch's dpop_jkt binding
  with #71's already-merged allowed_domains DB-fetch, both passed to
  create_machine_access_token.
- app/services/auth_service.py: create_machine_access_token's
  signature/docstring/body combined to accept and apply both dpop_jkt
  (RFC 9449 cnf claim) and allowed_domains (dns_domains claim).
- app/schema.py + tests/test_schema.py: dpop_replay table (this
  branch) combined with audit_event (#61, already merged) -- this
  branch predates that merge so git saw it as new.
- alembic: two real chain issues, both from this branch predating
  later merges:
  1. 011_dpop_replays.py had NO revision/down_revision identifiers at
     all (a genuine bug -- alembic could never have discovered this
     migration). Added revision="011_dpop_replays",
     down_revision="010_dns_domain_allowlists" (010 is #71's migration,
     merged after this branch was authored; the file's stale docstring
     said "Depends on: 009").
  2. 008_add_mfa_fields (re-chained onto 009 in an earlier standalone
     v2.1.x fix, before #71 existed) and 010_dns_domain_allowlists both
     forked from 009, creating two heads. Re-chained
     008_add_mfa_fields -> 011_dpop_replays so the graph is linear
     again with 008_add_mfa_fields as the single head.

Full manager suite: 293/293 passing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat(auth): DPoP sender-constrained tokens for machine identities
- app/__init__.py: combined scim_bp registration (this branch) with
  machine_clients_bp/oidc_trust_anchors_bp/audit_bp (already merged).
- app/middleware/auth.py: combined this branch's verify_jwt/has_scope
  helpers with the already-merged dpop_bound_token decorator --
  independent, unrelated functions.
- app/schema.py + tests/test_schema.py: scim_tokens table combined
  with machine_client/oidc_trust_anchor/dpop_replay/audit_event
  (all already merged).
- alembic: no chain fix needed this time -- 010_add_scim_provisioning
  already correctly points down_revision to 008_add_mfa_fields (its
  actual parent when this branch was authored off feature/mfa-totp),
  and that chain now correctly terminates the full linear graph as a
  single head.

Full manager suite: 323/323 passing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat(scim): SCIM 2.0 user provisioning with deprovision-kills-sessions
- .gitleaks.toml: both branches independently created this file
  (add/add conflict). Kept origin/v2.1.x's version -- accumulated and
  already validated across #69/#71/#73/#77's resolutions.
- .pre-commit-config.yaml: same flake8/hadolint divergence resolved
  identically to prior merges this session (single .flake8 source of
  truth + flake8-bugbear; hadolint v2.14.0).
- app/schema.py: auth_user gained sso_provider/sso_subject (this
  branch) alongside external_id (#73 SCIM, already merged) -- both
  independent new columns, combined.
- app/services/scopes.py: sso:write/sso:admin (this branch) combined
  with audit:read (already merged, SystemAdmin-only).
- tests/test_schema.py: expected-tables set now covers sso_providers/
  sso_login_attempts alongside scim_tokens/machine_client/
  oidc_trust_anchor/dpop_replay/audit_event (all already merged).
- alembic: SSO's own chain (008_add_mfa_fields -> 009_add_sso_providers
  -> 010_add_sso_login_attempts -> 011_allow_null_password_hash) and
  SCIM's chain (008_add_mfa_fields -> 010_add_scim_provisioning) both
  forked from the same parent, authored independently off
  feature/mfa-totp. Re-chained 009_add_sso_providers to depend on
  010_add_scim_provisioning (SCIM's already-merged migration) instead,
  restoring a single linear head.

Full manager suite: 339/339 passing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…lated to this PR)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat(auth): enterprise OIDC SSO login with JIT provisioning (security-hardened)
- .gitleaks.toml: another add/add conflict (same file independently
  created on this branch and on v2.1.x). Took v2.1.x's canonical
  version, validated across every prior merge this session.
- .pre-commit-config.yaml: same flake8/hadolint divergence resolved
  identically to every other merge in this batch.
- app/schema.py: saml_provider/saml_assertion_id tables inserted
  cleanly (origin/v2.1.x had no competing content at this exact
  insertion point -- its own new tables live elsewhere in the file).
- requirements.in/.txt: pysaml2 (this branch) combined with boto3 +
  opentelemetry-* (already merged). pysaml2==7.4.2 confirmed already
  present in the shared venv at the correct pinned version.
- tests/test_schema.py: saml_providers/saml_assertion_ids combined
  with scim_tokens/machine_client/oidc_trust_anchor/dpop_replay/
  audit_event (all already merged).
- tests/test_sso.py: TestIDTokenValidation (the real signature-path
  test coverage added when fixing #74's missing `jwt` import) existed
  only on origin/v2.1.x -- this branch predates that fix. Kept it,
  nothing on this side to preserve at that insertion point.
- alembic: no chain fix needed -- SAML's own migrations
  (012_add_saml_providers -> 013_add_saml_assertion_ids) already
  correctly chain from 011_allow_null_password_hash (SSO's actual
  tip when this branch was authored off feature/sso-oidc-login).
  Single linear head confirmed across the full 19-migration graph.

Full manager suite: 361/361 passing -- the final combined total
across every merged PR in this session's enterprise-hardening effort.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat(auth): SAML 2.0 SSO service provider (enterprise, XSW-hardened)
chore(helm): expose SPIFFE values; migrate env values files to house naming
Process error: after merging #74 (SSO) into v2.1.x, I deleted my LOCAL
feature/sso-oidc-login branch ref but never deleted or retargeted the
REMOTE branch/PR. #76 (SAML)'s base silently remained
feature/sso-oidc-login instead of v2.1.x, so `gh pr merge 76` merged
SAML into that orphaned remote branch -- completely disconnected from
v2.1.x. GitHub still shows PR #76 as MERGED, but v2.1.x itself never
received any of it (confirmed: alembic versions/ was missing
012_add_saml_providers.py and 013_add_saml_assertion_ids.py entirely).

Nothing was lost -- the fully-resolved SAML merge commit (d7ffab1,
carrying all of #76's conflict resolution work) still existed on the
orphaned branch. Merged it into the actual v2.1.x tip here: clean, no
conflicts (SAML's changes are manager/backend-only; v2.1.x's only
change since d7ffab1's parent was #72's Helm-only work).

Verified: 19 alembic migrations, single linear head
(013_add_saml_assertion_ids). Full manager suite: 361/361 passing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…cio-tools

opentelemetry-proto==1.24.0 requires protobuf<5.0, but grpcio-tools>=1.69.0
requires protobuf>=5.29.2 — every fresh install of manager/backend or
dns-server hit an unresolvable dependency conflict. Bumping OTel to
1.44.0/0.65b0 resolves it; verified via a full clean docker build.
…e, unbuildable python3.13 install

Two independent bugs made every build of this Dockerfile fail:

1. FROM ghcr.io/aptible/supercronic:0.2.47 does not exist under any tag
   (confirmed: docker pull returns "denied" for :0.2.47, :v0.2.47, and
   :latest alike). supercronic ships as a GitHub release binary, not a
   container image — install it via curl instead.

2. debian:bookworm-slim + apt-get install python3.13 fails outright:
   python3.13 is absent from both the bookworm main and bookworm-backports
   apt repos. Switch to python:3.13-slim-bookworm (same digest dns-server
   already uses successfully), which provides python3.13 natively.

Also adds .dockerignore — COPY . /app/ (after venv creation) would
otherwise let a stray local venv/ directory in the build context overwrite
the freshly-built /app/venv with host-absolute-path shebangs, breaking
gunicorn at runtime with "no such file or directory".

Verified: full docker build succeeds through dependency installation and
image export (blocked only by the separate, pre-existing penguin-limiter
PyPI package gap — not introduced or fixed by this change).
…ache volume

getattr(logging, LOG_LEVEL) with LOG_LEVEL="info" (the chart's lowercase
default) resolves to logging.info — the FUNCTION, not the logging.INFO
level constant — since Python's logging module has both. basicConfig()
then raises TypeError on startup: "Level not an integer or a valid
string". Fix: .upper() the value with a safe INFO fallback.

Also adds the readOnlyRootFilesystem volume manager_client.py's
CACHE_DIR (default /app/cache) needs — without it, persisting the
manager-sync cache crashes with "Read-only file system: '/app/cache'".

.dockerignore added for the same stray-venv risk documented in the
manager Dockerfile fix (different commit, same root cause).
…VEL crash

- `python3 bins/server.py` (bare script path) puts the script's own
  directory (/app/bins) on sys.path[0] instead of the WORKDIR (/app), so
  `from app.config import ...` fails with ModuleNotFoundError on every
  startup. Module mode (`python3 -m bins.server`) fixes it.
- penguin-dal doesn't bundle a DB driver by design (it supports
  postgresql/mysql/sqlite) — DATABASE_URL here is postgresql, so
  psycopg2-binary must be a direct dependency; it was missing entirely.
- Same LOG_LEVEL case-sensitivity crash as dns-server's app/main.py
  (see that commit) — getattr(logging, "info") resolves to the function,
  not the level constant.

Verified: docker build succeeds; the built image's module import and
health-check path both run cleanly.
dhcp-server had zero schema-management mechanism — no Alembic, no
SQLAlchemy create_all(), nothing. It queries db.dhcp_pool/dhcp_lease/
dhcp_reservation via penguin-dal reflection, which requires those tables
to already exist; on a fresh database every request 500s.

Adds app/schema.py (SQLAlchemy Table definitions — single source of
truth, mirrors the columns db.py actually reads/writes), alembic.ini,
alembic/env.py (reads DATABASE_URL, matching this service's existing env
var name), and an initial migration creating dhcp_pool/dhcp_reservation/
dhcp_lease with the same structure as manager's copies of these tables,
minus the team/dns_zone foreign keys that don't apply to this service's
isolated database (per-service DB account requirement — see
backend-database.md).

Verified: alembic upgrade head / downgrade base both run cleanly against
a throwaway SQLite database, producing the exact schema db.py queries.
…writable /tmp

- dhcp-server and ntp-server both already read JWT_SECRET_KEY from the
  squawk-jwt-secret Secret, expecting manager to sign with the same
  value — but manager's own deployment template never wired SECRET_KEY
  or JWT_SECRET_KEY at all. Every token they'd verify would mismatch.
- VALKEY_HOST pointed at "{fullname}-valkey", but the Service is named
  plain "valkey" (see dns-server's matching valkeyHost value, and
  templates/valkey-service.yml). VALKEY_HOST/PORT are also unused by
  app/config.py, which only reads REDIS_URL or VALKEY_URL as a full
  connection string — so the rate limiter's RedisStorage silently fell
  back to localhost:6379 and crashed with ConnectionError on every boot.
- readOnlyRootFilesystem forbids writes to /tmp; gunicorn's gthread
  worker needs a writable tmpdir for its per-worker heartbeat file,
  crashing with "No usable temporary directory found" otherwise.
- fsGroup/runAsGroup added so the non-root container can actually read
  the jwt-keys Secret volume (mode 0440, owned root:root without them).
  runAsUser must also be set at pod level, not just container level —
  containerd's sandbox spec generation rejects a pod-level runAsGroup
  with no accompanying pod-level runAsUser.

Verified end-to-end against a local MicroK8s deployment: manager reaches
1/1 Running and stays stable with zero restarts.
…sGroup/Valkey gaps

maxUnavailable: 0 + maxSurge: 0 under RollingUpdate is an invalid K8s API
combination — every `helm upgrade` failed outright with "may not be 0
when maxSurge is 0". Switched to Recreate, which is also the semantically
correct strategy here: this is a singleton cron scheduler, and two
instances running concurrently would duplicate scheduled jobs.

Also carries the same fsGroup/runAsGroup/runAsUser and Valkey hostname
fixes as manager-deployment.yml (same commit rationale) — this pod mounts
the identical jwt-keys Secret and would hit the identical read-permission
gap.
…al server IP

squawk-client-go's shared DoH client (pkg/client/doh_client.go) refuses
a hostname for SQUAWK_SERVER_URL — "server URL must use an IP address...
to prevent DNS resolution loops" — since it's the DoH client bootstrapping
its own upstream and resolving that hostname could form a loop. Both
k8s-dns-deployment.yml and squawk-client-deployment.yml configured it
with the dns-server hostname anyway, crash-looping every pod on startup.

Fixed by building SQUAWK_SERVER_URL from Kubernetes' auto-injected
Service env vars (DNS_SERVER_SERVICE_HOST/_PORT, from the "dns-server"
Service) instead of a hostname — the binary's IP-only requirement is the
same in every environment, not alpha-specific, so this isn't a values
override.

squawk-client-deployment.yml had a second, independent bug: its `args`
invoked the ROOT cobra command (`--server ... --udp --tcp`), which
defaults to a one-shot query mode requiring `-d <domain>` and isn't the
UDP/TCP bridge daemon at all. The actual daemon lives behind the
"forward" subcommand, which reads config from the env vars already set
rather than needing CLI flags.

Removes the now-dead k8sDns.env.squawkServerUrl values.yaml key — SQUAWK_
SERVER_URL is no longer values-driven, so leaving it would misleadingly
suggest overriding it still does something.
…rver

k8s-dns watches Services/Endpoints via the in-cluster Kubernetes API
client (client-go informers in squawk-client-go/pkg/k8swatcher). Under
default-deny-all, no existing egress rule permitted reaching the
apiserver — and no namespaceSelector-based rule ever could: the
"kubernetes" Service has no podSelector (it's backed by a manually-
managed Endpoints object pointing at a hostNetwork static pod), so it's
invisible to namespace/pod-label-based egress matching. The watcher's
initial List/Watch call silently blackholed and the pod never became
ready.

Added an unrestricted (ipBlock 0.0.0.0/0) egress rule scoped to k8s-dns
on ports 443/6443, matching the same reasoning as the Cilium
kube-apiserver edge case (see the deploying-app skill), generalized to
any NetworkPolicy-enforcing CNI.
…-bugs

fix: 9 deployment-blocking bugs found running Squawk locally end-to-end
dnspython>=2.7.0
requests>=2.32.3
PyYAML>=6.0.2
cryptography==48.0.1
dnspython>=2.7.0
requests>=2.32.3
PyYAML>=6.0.2
cryptography==48.0.1
# does not set, breaking route registration.
quart==0.20.0
flask==3.0.0
werkzeug==3.1.4
# does not set, breaking route registration.
quart==0.20.0
flask==3.0.0
werkzeug==3.1.4
dnspython>=2.7.0
requests>=2.32.3
PyYAML>=6.0.2
cryptography==48.0.1
penguin-limiter's RedisStorage.__init__(self, client, key_prefix=...)
takes an already-constructed redis-py client (it calls
client.register_script(...) internally) — not a connection URL. Manager
called RedisStorage(url=_storage_url), which crashed create_app() with
TypeError: RedisStorage.__init__() got an unexpected keyword argument
'url', discovered now that penguin-limiter is actually published and
this code path runs for the first time end-to-end.

Verified: built the real Dockerfile, ran the container against a live
Valkey instance via gunicorn (not just an import check) — all 4 workers
boot, /health returns 200, container stays up.
…client-api

fix(manager): RedisStorage expects a client instance, not a URL string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants