resolve

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2026 License: MIT Imports: 9 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompartmentID

func CompartmentID(ctx context.Context, kubeConfig string, env models.Environment) (string, error)

CompartmentID queries the cluster for any GPU node and returns its CompartmentID. Used to scope OCI ListInstancePools calls during pool enrichment.

func EnrichGpuPools added in v0.5.0

func EnrichGpuPools(ctx context.Context, pools []models.GpuPool, kubeConfig string, env models.Environment) string

EnrichGpuPools fills ActualSize and Status on every pool by resolving the compartment ID via the live cluster and then calling PopulateGpuPools. Returns a non-empty warning string if enrichment could not complete; pools are still safe to use (the loader's Status="..." placeholder remains, ActualSize stays at zero).

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

func GpuNode(ctx context.Context, ld loader.Loader, 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

func GpuPool(ctx context.Context, ld loader.Loader, 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL