adopt

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package adopt classifies containers on a Docker host that nothing here manages and previews what adopting them would involve. It never changes the host.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Candidate

type Candidate struct {
	ID                string      `json:"id"`
	Name              string      `json:"name"`
	Kind              Kind        `json:"kind"`
	ComposeWorkingDir string      `json:"compose_working_dir,omitempty"`
	ComposeFiles      string      `json:"compose_files,omitempty"`
	Containers        []Container `json:"containers"`
	WouldCreate       []Resource  `json:"would_create"`
	CannotCarry       []Note      `json:"cannot_carry"`
	Risks             []Note      `json:"risks"`
	Unknowns          []Note      `json:"unknowns"`
}

Candidate is one adoptable unit: a compose project or a standalone container.

type Container

type Container struct {
	ID             string    `json:"id"`
	Name           string    `json:"name"`
	Image          string    `json:"image"`
	State          string    `json:"state"`
	Kind           Kind      `json:"kind"`
	Engine         string    `json:"engine,omitempty"`
	Ports          []Port    `json:"ports"`
	Mounts         []Mount   `json:"mounts"`
	Networks       []string  `json:"networks"`
	NetworkMode    string    `json:"network_mode,omitempty"`
	RestartPolicy  string    `json:"restart_policy"`
	ComposeProject string    `json:"compose_project,omitempty"`
	ComposeService string    `json:"compose_service,omitempty"`
	Env            []EnvName `json:"env"`
}

Container is one unmanaged container with its classification.

type EnvName

type EnvName struct {
	Name   string `json:"name"`
	Secret bool   `json:"secret"`
}

EnvName is an environment variable name, never its value.

type Kind

type Kind string

Kind is what a discovered workload looks like.

const (
	KindApp      Kind = "app"
	KindDatabase Kind = "database"
	KindCompose  Kind = "compose_project"
	KindUnknown  Kind = "unknown"
)

The kinds a workload is classified into.

type Mount

type Mount struct {
	Type     string `json:"type"`
	Name     string `json:"name,omitempty"`
	Source   string `json:"source,omitempty"`
	Target   string `json:"target"`
	ReadOnly bool   `json:"read_only"`
}

Mount is one volume or bind mount.

type Note

type Note struct {
	Code    string `json:"code"`
	Subject string `json:"subject,omitempty"`
	Message string `json:"message"`
}

Note is one coded finding; Subject names the port, path or volume it is about.

type Port

type Port struct {
	ContainerPort int    `json:"container_port"`
	Protocol      string `json:"protocol"`
	HostIP        string `json:"host_ip,omitempty"`
	HostPort      int    `json:"host_port,omitempty"`
}

Port is a container port; host_port 0 means exposed but not published.

type Report

type Report struct {
	Candidates []Candidate `json:"candidates"`
	// Managed counts containers left out because this or another instance manages them.
	Managed int `json:"managed_excluded"`
}

Report is the whole read-only discovery result.

func Build

func Build(hosts []docker.HostContainer) Report

Build classifies the host's containers and previews each adoption. Managed ones are only counted.

type Resource

type Resource struct {
	Type   string `json:"type"`
	Name   string `json:"name"`
	Image  string `json:"image,omitempty"`
	Engine string `json:"engine,omitempty"`
}

Resource is something adoption would create.

Jump to

Keyboard shortcuts

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