Repository navigation
fix: test endpoints, probe knobs, clearer docs - #27
Merged
Merged
Conversation
Readme now spells out what this is for (drop into an env and poke probes, routing, headers, params) next to cluster-utils. Also wired up the bits that were half done or missing: - /version with real ldflags Version/GitHash - controllable /health* and /ready* via HEALTHY/READY env or ?ok=0 - /status/:code, /delay/:seconds, /echo - /metrics actually registered + request counter middleware - AUTH_TOKEN env for a fixed bearer token - more tests, swagger regen, k8s readinessProbe
Probes now follow kube roles properly: - /startupz latches after cold start (STARTUP_BOOT_DELAY), sticky until reset - /livez and /readyz use mode+delay (env seed or PUT /a/control/probes) - fail = 503, delaySeconds can trip short probe timeouts - sample manifest uses startup/live/ready with timeoutSeconds: 1 Also kept /healthz /ready aliases and documented the whole thing.
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
mode=flap alternates ok/fail either on a wall-clock half-period (flapSeconds, default 5) or every Nth request (flapEvery). Control API reports current phase; README + k8s examples updated.
Spell out how to get the bearer (AUTH_TOKEN, docker/kubectl logs, swagger) and add practical curl recipes for ingress, env dumps, probes, flap, timeouts, cold start, and in-cluster use. Startup logs are a bit more greppable for the token too.
Drop hardcoded localhost host so Try it out follows wherever you open the UI (docker/port-forward/ingress). Optional ?host=&scheme= override. PersistAuthorization so the Authorize token sticks in the browser.
Match utils vibe a bit with the donkey header. Raise delay cap (MAX_DELAY_SECONDS, default 120). Add GET/POST /proxy so north-south can trigger east-west calls with header passthrough for mesh testing.
|
|
||
| client := &http.Client{Timeout: time.Duration(timeout * float64(time.Second))} | ||
| start := time.Now() | ||
| resp, err := client.Do(outReq) |
Proxy is SSRF if public — moved under /a/ with bearer like /env. Do not auto-forward Authorization/Cookie east-west unless opted in. README spells out the JSON wrap (upstream status/headers/body) and which endpoints stay open for kube vs what must stay locked.
- rename module to github.com/donkeyx/cluster-utils-api - bump gin, prometheus, zap, swag, testify and related to current latest - proper HTTP metrics middleware (count, duration, in-flight) + Go/process collectors on a dedicated registry (OpenMetrics scrape) - pin swag CLI, make swagger/update targets; Dockerfile mod download cache
This branch was previously deployed
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.
Readme now says what this is for — drop into an env and poke probes / routing / headers / params (pair with cluster-utils).
What landed
/version,/status/:code,/delay/:seconds,/echo,/metrics/startupz— cold start + latch (sticky started until reset)/livez— liveness (restart on fail)/readyz— readiness (leave endpoints on fail)LIVE_MODE,READY_MODE,STARTUP_BOOT_DELAY,*_DELAY, …GET/PUT /a/control/probes(bearer)timeoutSeconds: 1Test plan
go test ./...