Documentation
¶
Overview ¶
Package container implements `olares-cli cluster container ...` — per-container drill-down inside a Pod.
"container" is a virtual noun in this CLI: a container is always scoped to a Pod, and every fetch goes through the same `/api/v1/namespaces/<ns>/pods/<name>` endpoint that `cluster pod get` uses. We re-project the response into per- container views (one row per spec.containers[*]; one section per container's env block) so users don't have to JSONPath their way into the pod object to answer "what env vars does the X container of pod Y have?".
No new HTTP surface is added here — it's all rendering on top of pod.Get. That means container verbs inherit the same server-side scoping (a 404 from pod.Get propagates as-is) and the same auth recovery story as `cluster pod ...`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContainerCommand ¶
NewContainerCommand assembles `olares-cli cluster container`. Today's verbs are the read-only Phase 1c slice (list / env) plus Phase 2's `container logs`, which routes per-container via /api/v1/namespaces/<ns>/pods/<name>/log?container=<c> (same endpoint the SPA uses for its container log viewer).
func NewEnvCommand ¶
NewEnvCommand: `olares-cli cluster container env <ns/pod | pod> [-n NS] [--container NAME] [-o table|json]`.
Renders explicit env vars from spec.containers[*].env. Source-of- truth is the same pod object `cluster pod get` returns; we just project containers[*].env into a flat table (or per-container sections when --container is omitted).
IMPORTANT: this verb does NOT resolve valueFrom references. A var declared as `valueFrom: { secretKeyRef: { name: 'foo', key: 'k' } }` shows up with VALUE blank and FROM = "secretKey foo/k", so users can see WHERE the value would come from at pod-startup time without leaking the secret material itself. Resolving the ref requires extra GETs against ConfigMap / Secret and a per-call scope decision; that lives behind a future `--resolve` flag.
Also intentionally NOT covered: envFrom (the implicit configMapRef / secretRef sets that import every key from a CM / Secret). Add when a verb actually needs the implicit set.
func NewListCommand ¶
NewListCommand: `olares-cli cluster container list <ns/pod | name> [-n NS] [-o table|json]`.
Renders one row per spec.containers[*] in the target pod. Re-uses `pod.Get` so the HTTP surface and error-handling story stay identical to `cluster pod get`.
func NewLogsCommand ¶
NewLogsCommand: `olares-cli cluster container logs <ns/pod/container | ns/pod | pod> [-n NS] [-c NAME] ...`.
Thin alias over `cluster pod logs` — the only practical difference is the positional grammar. Container is mandatory here (it's the noun the verb is named after), so we accept a 3-segment positional `<ns>/<pod>/<container>` in addition to the 2-segment "<ns/pod>" + --container variant `cluster pod logs` already accepts.
Same wire endpoint, same polling --follow, same option semantics — every flag delegates straight through to pod.RunLogs so behavior stays bit-exact between the two entry points.
Types ¶
This section is empty.