Repository navigation
Ignore Kubernetes service-link CLOCKD_PORT env var - #2
Merged
Merged
Conversation
A Service named "clockd" makes Kubernetes inject legacy Docker-link vars (CLOCKD_PORT=tcp://<cluster-ip>:8000) into every pod in the namespace. Since env vars now override YAML config, this collided with the CLOCKD_ prefix and crash-looped the pod at startup with a port validation error. - Filter tcp:// values for the port field out of the env settings source - Set enableServiceLinks: false in the example k8s manifest - Add regression tests; real integer CLOCKD_PORT values still override
nathan-v
force-pushed
the
fix/k8s-service-links
branch
from
July 14, 2026 00:14
195fa71 to
bc5f1f7
Compare
nathan-v
enabled auto-merge (squash)
July 14, 2026 00:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the production CrashLoopBackOff that took Clockd offline for ~24h.
Kubernetes injects legacy Docker-link env vars for every Service in a namespace: a Service named
clockdproducesCLOCKD_PORT=tcp://<cluster-ip>:8000in every pod. Since #1 made env vars override YAML config (for Secret-based credential injection), that injected value beat the ConfigMap'sport: 8000and failed integer validation, crashing the app at startup on every restart.Changes
src/clockd/config.py: wrap the env settings source to droptcp://…values for theportfield. Real integerCLOCKD_PORTvalues still override YAML as intended.deploy/k8s-example.yaml: setenableServiceLinks: false(with an explanatory comment) so the example manifest doesn't reproduce the collision. This is also the mitigation applied to the live deployment.tests/test_config.py: three regression tests — service-link value ignored with YAML port, without YAML port, and a legitimate env port still winning.Testing
pytest -q), ruff check + format clean.