Skip to content

stack pods: use exec_pods from the server for the EXEC column #189

Open

Description

@omattsson

Problem

Since #188, stack pods works out on the client which pod stack exec picks for each container. The client data has two gaps:

  • The pod list has no deletion state. A pod that is shutting down, but still Running and Ready, can get the hint. The server skips that pod.
  • container_states mixes init containers with normal containers. An init container with the name of an exec container can get the hint. The server picks only from the normal containers.

Proposal

k8s-stack-manager sends exec_pods for each chart with exec hints (omattsson/k8s-stack-manager#767, PR omattsson/k8s-stack-manager#768). It maps each name in exec_containers to the pod that the exec route picks for -c <name>.

  • Add ExecPods map[string]string (exec_pods,omitempty) to types.ChartStatus.
  • In execColumn (cli/cmd/stack_inspect.go): when exec_pods is present, put each valid container name on the row of the pod that exec_pods names. Keep the * on the default container.
  • Without exec_pods (older server), keep the current client rule.
  • A container whose pod is not in the listed pods goes on the line under the table, as now.
  • JSON and YAML output carry exec_pods as received.
  • Update the help text and docs/commands.md: the known limits apply only to older servers.

Tests

  • Table-driven cases with exec_pods: a terminating pod sorted first, an init container with the same name, a pod name not in the list, and an invalid container name in the map.
  • The fallback without exec_pods stays as it is.

Dependency

omattsson/k8s-stack-manager#768 must be merged and released first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions