Documentation
¶
Overview ¶
Package kubectlexec is an example sandbox implementation that runs each exec-hook invocation inside a sidecar container in an existing Kubernetes pod via `kubectl exec -i -- <cmd>`. The pattern fits deployments where PromptKit runs in-cluster with a long-lived hooks sidecar that has the hook runtime (Python, Node, etc.) and scripts baked in.
This is reference/example code — not imported by PromptKit core. Register via sdk.WithSandboxFactory or sandbox.RegisterFactory, or construct one directly and set it on ExecHookConfig.Sandbox.
Configuration:
mode: kubectl_exec pod: my-agent-pod # required namespace: default # optional; maps to -n container: hooks # optional; maps to -c kubeconfig: /etc/kube.yaml # optional; maps to --kubeconfig context: prod # optional; maps to --context extra_args: [--request-timeout=5s]
Index ¶
Constants ¶
const ModeName = "kubectl_exec"
ModeName is the identifier under which this backend registers with sandbox.RegisterFactory.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Pod is the target pod. Required.
Pod string
// Namespace maps to `-n <value>`. Empty means don't pass the flag
// (kubectl falls back to the current-context default).
Namespace string
// Container maps to `-c <value>`. Empty means don't pass the flag.
Container string
// Kubeconfig maps to `--kubeconfig=<value>`.
Kubeconfig string
// Context maps to `--context=<value>`.
Context string
// ExtraArgs are extra `kubectl exec` flags inserted after the
// standard ones and before the `--` command separator.
ExtraArgs []string
// KubectlPath overrides the `kubectl` binary name. Empty uses
// `kubectl` resolved from PATH.
KubectlPath string
}
Config configures the kubectl-exec backend.
type Sandbox ¶
type Sandbox struct {
// contains filtered or unexported fields
}
Sandbox runs exec-hook commands via `kubectl exec` in an existing pod.