imageextract

package
v0.124.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package imageextract extracts container image references from Kubernetes manifests and Helm charts. This implementation is ported from github.com/replicatedhq/airgap/airgap-builder/pkg/builder/images.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extractor

type Extractor interface {
	ExtractFromDirectory(ctx context.Context, dir string, opts Options) (*Result, error)
	ExtractFromChart(ctx context.Context, chartPath string, opts Options) (*Result, error)
	ExtractFromManifests(ctx context.Context, manifests []byte, opts Options) (*Result, error)
}

Extractor defines the interface for extracting container image references.

func NewExtractor

func NewExtractor() Extractor

NewExtractor creates a new Extractor instance.

type ImageRef

type ImageRef struct {
	Raw        string   // Original reference string
	Registry   string   // Parsed registry
	Repository string   // Parsed repository
	Tag        string   // Parsed tag
	Digest     string   // Parsed digest (if present)
	Sources    []Source // Where this image was found
}

ImageRef represents a parsed container image reference.

type Options

type Options struct {
	HelmValues        map[string]interface{}
	HelmValuesFiles   []string
	Namespace         string
	IncludeDuplicates bool
	NoWarnings        bool
}

Options configures the extraction behavior.

type Result

type Result struct {
	Images   []ImageRef
	Warnings []Warning
	Errors   []error
}

Result contains the extracted image references, warnings, and errors.

type Source

type Source struct {
	File          string
	Kind          string
	Name          string
	Namespace     string
	Container     string
	ContainerType string // container, initContainer, ephemeralContainer
}

Source identifies where an image reference was found.

type Warning

type Warning struct {
	Image   string
	Type    WarningType
	Message string
	Source  *Source
}

Warning represents an issue detected with an image reference.

type WarningType

type WarningType string

WarningType categorizes different types of warnings.

const (
	WarningLatestTag     WarningType = "latest-tag"
	WarningNoTag         WarningType = "no-tag"
	WarningInsecure      WarningType = "insecure-registry"
	WarningUnqualified   WarningType = "unqualified-name"
	WarningInvalidSyntax WarningType = "invalid-syntax"
)

Jump to

Keyboard shortcuts

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