Documentation ¶
Index ¶
- Constants
- type CommandRunner
- type ContainerCommandRunner
- func (r *ContainerCommandRunner) Build(dockerfile, tag string) error
- func (r *ContainerCommandRunner) GetToolName() string
- func (r *ContainerCommandRunner) Inspect(image string) ([]byte, error)
- func (r *ContainerCommandRunner) Pull(image string) error
- func (r *ContainerCommandRunner) Save(image, tarFile string) error
- type ContainerTool
- type DockerConfig
- type DockerImageData
- type DockerfileGenerator
- type GetImageDataOption
- type GetImageDataOptions
- type ImageLabelReader
- type ImageLayerReader
- type ImageReader
- type IndexDockerfileGenerator
- type LabelReader
- type PodmanImageData
Constants ¶
const ( DefaultDbLocation = "/database/index.db" DbLocationLabel = "operators.operatorframework.io.index.database.v1" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandRunner ¶
type CommandRunner interface { GetToolName() string Pull(image string) error Build(dockerfile, tag string) error Save(image, tarFile string) error Inspect(image string) ([]byte, error) }
CommandRunner defines methods to shell out to common container tools
func NewCommandRunner ¶
func NewCommandRunner(containerTool ContainerTool, logger *logrus.Entry) CommandRunner
NewCommandRunner takes the containerTool as an input string and returns a CommandRunner to run commands with that cli tool
type ContainerCommandRunner ¶
type ContainerCommandRunner struct {
// contains filtered or unexported fields
}
ContainerCommandRunner is configured to select a container cli tool and execute commands with that tooling.
func (*ContainerCommandRunner) Build ¶
func (r *ContainerCommandRunner) Build(dockerfile, tag string) error
Build takes a dockerfile and a tag and builds a container image
func (*ContainerCommandRunner) GetToolName ¶
func (r *ContainerCommandRunner) GetToolName() string
GetToolName returns the container tool this command runner is using
func (*ContainerCommandRunner) Inspect ¶
func (r *ContainerCommandRunner) Inspect(image string) ([]byte, error)
Inspect runs the 'inspect' command to get image metadata of a local container image and returns a byte array of the command's output
func (*ContainerCommandRunner) Pull ¶
func (r *ContainerCommandRunner) Pull(image string) error
Pull takes a container image path hosted on a container registry and runs the pull command to download it onto the local environment
func (*ContainerCommandRunner) Save ¶ added in v1.5.4
func (r *ContainerCommandRunner) Save(image, tarFile string) error
Save takes a local container image and runs the save commmand to convert the image into a specified tarball and push it to the local directory
type ContainerTool ¶
type ContainerTool int
const ( NoneTool ContainerTool = iota PodmanTool DockerTool )
func NewCommandContainerTool ¶
func NewCommandContainerTool(s string) (t ContainerTool)
NewCommandContainerTool returns a tool that can be used in `exec` statements.
func NewContainerTool ¶
func NewContainerTool(s string, defaultTool ContainerTool) (t ContainerTool)
func (ContainerTool) String ¶
func (t ContainerTool) String() (s string)
type DockerConfig ¶
type DockerImageData ¶
type DockerImageData struct {
Config DockerConfig `json:"Config"`
}
type DockerfileGenerator ¶
DockerfileGenerator defines functions to generate index dockerfiles
func NewDockerfileGenerator ¶
func NewDockerfileGenerator(logger *logrus.Entry) DockerfileGenerator
NewDockerfileGenerator is a constructor that returns a DockerfileGenerator
type GetImageDataOption ¶
type GetImageDataOption func(*GetImageDataOptions)
func WithWorkingDir ¶
func WithWorkingDir(workingDir string) GetImageDataOption
type GetImageDataOptions ¶
type GetImageDataOptions struct {
WorkingDir string
}
type ImageLabelReader ¶
type ImageLabelReader struct { Logger *logrus.Entry Cmd CommandRunner }
func (ImageLabelReader) GetLabelsFromImage ¶
func (r ImageLabelReader) GetLabelsFromImage(image string) (map[string]string, error)
GetLabelsFromImage takes a container image path as input, pulls that image to the local environment and then inspects it for labels
type ImageLayerReader ¶ added in v1.5.4
type ImageLayerReader struct { Cmd CommandRunner Logger *logrus.Entry }
func (ImageLayerReader) GetImageData ¶ added in v1.5.4
func (b ImageLayerReader) GetImageData(image, outputDir string, opts ...GetImageDataOption) error
type ImageReader ¶ added in v1.5.4
type ImageReader interface {
GetImageData(string, string, ...GetImageDataOption) error
}
func NewImageReader ¶ added in v1.5.4
func NewImageReader(containerTool ContainerTool, logger *logrus.Entry) ImageReader
type IndexDockerfileGenerator ¶
IndexDockerfileGenerator struct implementation of DockerfileGenerator interface
func (*IndexDockerfileGenerator) GenerateIndexDockerfile ¶
func (g *IndexDockerfileGenerator) GenerateIndexDockerfile(binarySourceImage, databasePath string) string
GenerateIndexDockerfile builds a string representation of a dockerfile to use when building an operator-registry index image
type LabelReader ¶
func NewLabelReader ¶
func NewLabelReader(containerTool ContainerTool, logger *logrus.Entry) LabelReader