Documentation ¶
Overview ¶
An Imager runs kubectl and communicates with the server to image a given container. Multiple imagers may be run at once.
Index ¶
- Constants
- func SimpleImagePods(ctx context.Context, config ImagerConfig, pods []string) []error
- func WaitForServerStart(rd *bufio.Reader) (containerName string, err error)
- type ClientApi
- func (c *ClientApi) GenerateDiff(meta *fsdiff.DirMeta) (err error)
- func (c *ClientApi) GetTargetRoots() ([]string, error)
- func (c *ClientApi) RpcCall(method string, args, reply any) error
- func (c *ClientApi) SetConfig(config *tkserver.ServerConfig) (err error)
- func (c *ClientApi) TarProgress() (float64, error)
- func (c *ClientApi) TarStart() error
- type ImageCache
- type ImageRequest
- type Imager
- type ImagerConfig
- type ProcIO
Constants ¶
const CONTAINER_NAME_PREFIX = "Defaulting debug container name to "
Variables ¶
This section is empty.
Functions ¶
func SimpleImagePods ¶
func SimpleImagePods(ctx context.Context, config ImagerConfig, pods []string) []error
Simple function to image one or more pods at once. The caller must fill in all fields of 'config' other than 'Pod'. Returns an array of errors returned by the imagers.
Types ¶
type ClientApi ¶
func NewClientApi ¶
func NewClientApi(ctx context.Context, conn io.ReadWriteCloser) *ClientApi
func (*ClientApi) GetTargetRoots ¶
Attemts to determine a path to access the root of the target container from the debug container.
func (*ClientApi) SetConfig ¶
func (c *ClientApi) SetConfig(config *tkserver.ServerConfig) (err error)
func (*ClientApi) TarProgress ¶
type ImageCache ¶
type ImageCache struct {
// contains filtered or unexported fields
}
Caches DirMeta objects for base images (tar files). This way in a batch-processing scenario we're not re-reading the same tar file mulitple times.
func (*ImageCache) Request ¶
func (ic *ImageCache) Request(fpath string) *ImageRequest
type ImageRequest ¶
func (*ImageRequest) Value ¶
func (ir *ImageRequest) Value() *fsdiff.DirMeta
type Imager ¶
type Imager struct {
// contains filtered or unexported fields
}
func NewImager ¶
func NewImager(parent context.Context, config ImagerConfig) *Imager
Returns a new imager created with the given configuration.
func (*Imager) CloseUpdates ¶
func (m *Imager) CloseUpdates()
Close the update channel so the imager does not block.
func (*Imager) DownloadFile ¶
Download a file
func (*Imager) GetOutputName ¶
Returns the tar file that will be created
func (*Imager) GetProgress ¶
Returns the progress amount on the current task, if applicable, or -1 if the current task has no progress indicator.
type ImagerConfig ¶
type ImagerConfig struct { // Command that runs 'kubectl' KubectlCmd []string // Pod name to image Pod string // Container on the pod Container string // Debug image name and version (default: "taki-collector") DebugImage string // List of paths to ignore Ignored []string // Image cache instance MetaCache *ImageCache // Base image path BaseImage string }
func (ImagerConfig) Defaults ¶
func (c ImagerConfig) Defaults() ImagerConfig
Returns a copy of the config with default values set if they weren't already.
type ProcIO ¶
type ProcIO struct { *bufio.ReadWriter // contains filtered or unexported fields }
Takes an exec.Cmd and wraps the Stdin and Stdout/Stderr in buffered readers/writers. Stdout and Stderr are combined into one stream.