Documentation
¶
Overview ¶
Package resolve maps a user-facing name (and optional OCID bypass) into the full *models.GPUNode / *models.GPUPool struct that the OCI compute actions require. Used by both `toolkit get`-derived mutation subcommands (internal/cli) and the MCP server's mutating tools (internal/mcp), so the find-by-name + OCI-enrichment chain lives in one place.
Index ¶
- func CompartmentID(ctx context.Context, kubeConfig string, env models.Environment) (string, error)
- func EnrichGPUPools(ctx context.Context, pools []models.GPUPool, kubeConfig string, ...) error
- func GPUNode(ctx context.Context, ld loader.Composite, kubeConfig string, ...) (*models.GPUNode, error)
- func GPUPool(ctx context.Context, ld loader.Composite, repoPath, kubeConfig string, ...) (*models.GPUPool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompartmentID ¶
CompartmentID queries the cluster for any GPU node and returns its CompartmentID. Used to scope OCI ListInstancePools calls during pool enrichment. Successful lookups are cached per kubeContext for the life of the process.
func EnrichGPUPools ¶ added in v0.6.0
func EnrichGPUPools(ctx context.Context, pools []models.GPUPool, kubeConfig string, env models.Environment) error
EnrichGPUPools fills ActualSize and Status on every pool by resolving the compartment ID via the live cluster and then calling PopulateGPUPools.
Best-effort: a non-nil error means enrichment couldn't complete (compartment lookup or OCI populate failed), but the pools slice is still safe to use — the loader's Status="..." placeholder remains and ActualSize stays at zero. Callers should surface the error as a warning, not abort.
Used by `toolkit get gpupool` and MCP `list_gpu_pools` to match the TUI's enriched view. Mutation paths (resolve.GPUPool) keep their per-pool enrichment for the single-pool ID lookup they actually need.
func GPUNode ¶ added in v0.6.0
func GPUNode(ctx context.Context, ld loader.Composite, kubeConfig string, env models.Environment, name, ocid string) (*models.GPUNode, error)
GPUNode finds a *models.GPUNode for the OCI compute actions. With ocid set, no cluster call is made — a stub {Name, ID:ocid} is returned. With ocid empty, the loader is consulted and the named node is returned by walking every pool.
func GPUPool ¶ added in v0.6.0
func GPUPool(ctx context.Context, ld loader.Composite, repoPath, kubeConfig string, env models.Environment, name string) (*models.GPUPool, error)
GPUPool loads GPU pools from the Terraform repo, finds the named one, then enriches with the live OCI ID + ActualSize via PopulateGPUPools. Partial-load on the Terraform pass is tolerated as long as the named pool is among the rows that did load — that matches the behavior of `toolkit get gpupool`.
Types ¶
This section is empty.