Documentation
¶
Index ¶
- Constants
- func BuildLocalImageName(name, version string) string
- func BuildMCPServerRegistryName(author, name string) string
- func BuildRegistryImageName(registryURL, name, version string) string
- func DeploymentID(namespace, name string) string
- func DeploymentResourceName(targetName, runtimeID string) string
- func DeploymentStatus(dep *v1alpha1.Deployment) string
- func FormatVersionForDisplay(version string) string
- func GetImageNameFromManifest(loader manifest.ManifestLoader) (string, error)
- func HideRegistryFlags(cmds ...*cobra.Command)
- func ResolveVersion(flagVersion, manifestVersion string) string
- func ValidateProjectDir(projectDir string) error
- func WaitForDeployment(ctx context.Context, resolve ResolveDeploymentFunc, opts WaitOptions) error
- type DeploymentRecord
- type ResolveDeploymentFunc
- type WaitOptions
Constants ¶
const DefaultAgentGatewayPort = "21212"
const DefaultUserName = "user"
const ( // DefaultWaitTimeout is the default for the `arctl wait --timeout` flag. // WaitForDeployment itself does not substitute this for a zero Timeout; // see WaitOptions.Timeout for the helper's zero/negative semantics. DefaultWaitTimeout = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func BuildLocalImageName ¶
BuildLocalImageName constructs a local Docker image name from a project name and version. Returns format: "kebab-case-name:version"
func BuildRegistryImageName ¶
BuildRegistryImageName constructs a full Docker registry image reference. Returns format: "registry-url/kebab-case-name:version"
func DeploymentID ¶ added in v0.4.0
DeploymentID is the display identity used by imperative deployment commands.
func DeploymentResourceName ¶ added in v0.4.0
DeploymentResourceName returns the generated metadata.name used by imperative deployment create flows for a (target, runtime) pair.
func DeploymentStatus ¶ added in v0.4.0
func DeploymentStatus(dep *v1alpha1.Deployment) string
DeploymentStatus derives the old CLI phase strings from v1alpha1 conditions.
func FormatVersionForDisplay ¶ added in v0.2.1
FormatVersionForDisplay adds a leading "v" only for valid semver values. Non-semver labels are returned unchanged.
func GetImageNameFromManifest ¶
func GetImageNameFromManifest(loader manifest.ManifestLoader) (string, error)
GetImageNameFromManifest loads the project manifest and constructs a Docker image name in the format "kebab-case-name:version".
func HideRegistryFlags ¶ added in v0.4.0
HideRegistryFlags marks the inherited registry-url and registry-token flags as hidden so they do not appear in the --help output of commands that do not interact with the registry. Multiple commands can be passed at once.
func ResolveVersion ¶
ResolveVersion returns the version to use based on priority: flag > manifest > "latest".
func ValidateProjectDir ¶
ValidateProjectDir checks if the provided project directory exists and is a directory.
func WaitForDeployment ¶ added in v0.4.0
func WaitForDeployment(ctx context.Context, resolve ResolveDeploymentFunc, opts WaitOptions) error
WaitForDeployment polls until the deployment reaches the requested state, reaches a different terminal state, or the timeout is exceeded.
With TargetStatus set, the wait succeeds on dep.Status == TargetStatus and fails on any other terminal state (deployed / failed / undeployed). With TargetDeleted, the wait succeeds on a not-found error and keeps polling otherwise. Context cancellation unwraps to ctx.Err() (the returned error wraps it via fmt.Errorf "%w").
Types ¶
type DeploymentRecord ¶ added in v0.4.0
type DeploymentRecord struct {
Namespace string `json:"namespace,omitempty"`
Name string `json:"name"`
ID string `json:"id"`
TargetName string `json:"serverName"`
TargetTag string `json:"targetTag,omitempty"`
ResourceType string `json:"resourceType"`
RuntimeID string `json:"runtimeId,omitempty"`
Status string `json:"status"`
Origin string `json:"origin"`
Env map[string]string `json:"env,omitempty"`
RuntimeConfig map[string]any `json:"runtimeConfig,omitempty"`
RuntimeMetadata map[string]any `json:"runtimeMetadata,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"deployedAt,omitempty"`
UpdatedAt time.Time `json:"updatedAt,omitempty"`
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
// Conditions is the raw v1alpha1.Status.Conditions list as reported by
// reconcilers. Surfaced alongside the derived Status phase so YAML/JSON
// consumers can see fine-grained state without losing the compact view.
Conditions []v1alpha1.Condition `json:"conditions,omitempty"`
// Details is the opaque adapter-owned status map (see v1alpha1.Status.Details).
Details json.RawMessage `json:"details,omitempty"`
}
DeploymentRecord is the CLI-friendly projection of a v1alpha1 Deployment.
func DeploymentRecordFromObject ¶ added in v0.4.0
func DeploymentRecordFromObject(dep *v1alpha1.Deployment) *DeploymentRecord
DeploymentRecordFromObject projects a v1alpha1 Deployment into the CLI view.
func FindDeploymentByIDPrefix ¶ added in v0.4.0
func FindDeploymentByIDPrefix(ctx context.Context, c *client.Client, prefix string) (*DeploymentRecord, error)
FindDeploymentByIDPrefix resolves a deployment identity by exact or prefix match.
func ListDeployments ¶ added in v0.4.0
ListDeployments returns managed Deployment rows visible from the default namespace.
type ResolveDeploymentFunc ¶ added in v0.4.0
type ResolveDeploymentFunc func(ctx context.Context) (*DeploymentRecord, error)
ResolveDeploymentFunc fetches the current deployment record. Implementations must return a not-found error (database.ErrNotFound, client.ErrNotFound, or any error wrapping either) when the deployment no longer exists.
type WaitOptions ¶ added in v0.4.0
type WaitOptions struct {
// TargetStatus is the deployment status the wait succeeds on
// (e.g. "deployed", "failed"). Ignored when TargetDeleted is true.
// Defaults to "deployed" when TargetDeleted is false and TargetStatus
// is empty.
TargetStatus string
// TargetDeleted, when true, waits for the deployment to disappear
// (the resolver returns a not-found error). Mutually exclusive
// with TargetStatus.
TargetDeleted bool
// Timeout caps the total wait. See type doc for the three regimes.
Timeout time.Duration
// PollInterval is the delay between poll attempts. Zero or negative
// values use defaultPollInterval (2s).
PollInterval time.Duration
// Progress is called once after each non-terminal poll with the
// observed status and elapsed time.
Progress func(status string, elapsed time.Duration)
}
WaitOptions configures WaitForDeployment.
Timeout regimes:
- > 0: wait at most this long.
- == 0: poll once and return.
- < 0: wait forever.