Documentation
¶
Index ¶
- Constants
- func ComputeDigest(data []byte) (string, error)
- func CreateImageFactsCollector(namespace string, options CollectionOptions) (*troubleshootv1beta2.Collect, error)
- func ExtractDigestFromManifestResponse(headers map[string][]string) string
- func ExtractRepositoryHost(repository string) string
- func FormatSize(bytes int64) string
- func GetImageShortName(facts ImageFacts) string
- func GetRegistryType(registryURL string) string
- func IsOfficialImage(registry, repository string) bool
- func IsValidImageName(imageName string) bool
- func NormalizeRegistryURL(registryURL string) string
- func ParseSize(sizeStr string) (int64, error)
- func ProcessImageFactsCollectionResult(ctx context.Context, namespace string, client kubernetes.Interface, ...) ([]byte, error)
- func ValidateCredentials(creds RegistryCredentials) error
- type CollectionOptions
- type CollectionResult
- type ConfigDetails
- type DefaultImageCollector
- func (c *DefaultImageCollector) CollectImageFacts(ctx context.Context, imageRef ImageReference) (*ImageFacts, error)
- func (c *DefaultImageCollector) CollectMultipleImageFacts(ctx context.Context, imageRefs []ImageReference) ([]ImageFacts, error)
- func (c *DefaultImageCollector) SetCredentials(registry string, credentials RegistryCredentials) error
- type DefaultRegistryClient
- func (c *DefaultRegistryClient) GetBlob(ctx context.Context, imageRef ImageReference, digest string) (io.ReadCloser, error)
- func (c *DefaultRegistryClient) GetManifest(ctx context.Context, imageRef ImageReference) (Manifest, error)
- func (c *DefaultRegistryClient) Ping(ctx context.Context) error
- func (c *DefaultRegistryClient) SetCredentials(credentials RegistryCredentials) error
- type Descriptor
- type DigestResolver
- func (dr *DigestResolver) NormalizeImageReference(imageRef ImageReference) ImageReference
- func (dr *DigestResolver) ResolveBulkTagsToDigests(ctx context.Context, imageRefs []ImageReference) ([]ImageReference, error)
- func (dr *DigestResolver) ResolveTagToDigest(ctx context.Context, imageRef ImageReference) (string, error)
- func (dr *DigestResolver) ValidateDigest(digest string) error
- type FactsBuilder
- func (fb *FactsBuilder) BuildFactsFromImageReferences(ctx context.Context, imageRefs []ImageReference, source string) ([]ImageFacts, error)
- func (fb *FactsBuilder) BuildFactsFromImageStrings(ctx context.Context, imageStrs []string, source string) ([]ImageFacts, error)
- func (fb *FactsBuilder) DeduplicateImageFacts(imageFacts []ImageFacts) []ImageFacts
- func (fb *FactsBuilder) DeserializeFactsFromJSON(data []byte) (*FactsBundle, error)
- func (fb *FactsBuilder) ExtractUniqueImages(imageFacts []ImageFacts) []string
- func (fb *FactsBuilder) FilterImageFactsByRegistry(imageFacts []ImageFacts, allowedRegistries []string) []ImageFacts
- func (fb *FactsBuilder) GetFailedCollections(imageFacts []ImageFacts) []ImageFacts
- func (fb *FactsBuilder) GetImageFactsSummary(imageFacts []ImageFacts) FactsSummary
- func (fb *FactsBuilder) GetImagesByRegistry(imageFacts []ImageFacts) map[string][]ImageFacts
- func (fb *FactsBuilder) GetLargestImages(imageFacts []ImageFacts, count int) []ImageFacts
- func (fb *FactsBuilder) GetSuccessfulCollections(imageFacts []ImageFacts) []ImageFacts
- func (fb *FactsBuilder) SerializeFactsToJSON(imageFacts []ImageFacts, namespace string) ([]byte, error)
- func (fb *FactsBuilder) SortImageFactsByName(imageFacts []ImageFacts)
- func (fb *FactsBuilder) SortImageFactsBySize(imageFacts []ImageFacts)
- func (fb *FactsBuilder) ValidateImageFacts(facts ImageFacts) error
- type FactsBundle
- type FactsSummary
- type History
- type ImageCollector
- type ImageConfig
- type ImageConfigBlob
- type ImageFacts
- type ImageReference
- type KubernetesImageExtractor
- type LayerInfo
- type Manifest
- type ManifestDescriptor
- type ManifestList
- func (m *ManifestList) GetConfig() Descriptor
- func (m *ManifestList) GetLayers() []Descriptor
- func (m *ManifestList) GetManifestForPlatform(targetPlatform Platform) (*ManifestDescriptor, error)
- func (m *ManifestList) GetMediaType() string
- func (m *ManifestList) GetPlatform() *Platform
- func (m *ManifestList) GetSchemaVersion() int
- func (m *ManifestList) Marshal() ([]byte, error)
- type NamespaceImageCollector
- type Platform
- type RegistryClient
- type RegistryClientFactory
- type RegistryCredentials
- type RootFS
- type V1Manifest
- type V2Manifest
Constants ¶
const ( // Docker manifest media types DockerManifestSchema1 = "application/vnd.docker.distribution.manifest.v1+json" DockerManifestSchema2 = "application/vnd.docker.distribution.manifest.v2+json" DockerManifestListSchema2 = "application/vnd.docker.distribution.manifest.list.v2+json" // OCI manifest media types OCIManifestSchema1 = "application/vnd.oci.image.manifest.v1+json" OCIImageIndex = "application/vnd.oci.image.index.v1+json" OCIImageConfig = "application/vnd.oci.image.config.v1+json" OCIImageLayerTarGzip = "application/vnd.oci.image.layer.v1.tar+gzip" OCIImageLayerTar = "application/vnd.oci.image.layer.v1.tar" // Docker layer media types DockerImageLayerTarGzip = "application/vnd.docker.image.rootfs.diff.tar.gzip" DockerImageConfig = "application/vnd.docker.container.image.v1+json" DockerImageLayer = "application/vnd.docker.image.rootfs.diff.tar" )
Known media types for Docker and OCI manifests
const ( DefaultTimeout = 30 * time.Second DefaultMaxConcurrency = 5 DefaultCacheDuration = 1 * time.Hour DefaultRegistry = "docker.io" DefaultTag = "latest" )
Default values
Variables ¶
This section is empty.
Functions ¶
func ComputeDigest ¶
ComputeDigest computes the SHA256 digest of data
func CreateImageFactsCollector ¶
func CreateImageFactsCollector(namespace string, options CollectionOptions) (*troubleshootv1beta2.Collect, error)
CreateImageFactsCollector creates a troubleshoot collector for image facts
func ExtractDigestFromManifestResponse ¶
ExtractDigestFromManifestResponse extracts digest from HTTP response headers
func ExtractRepositoryHost ¶
ExtractRepositoryHost extracts the hostname from a repository string
func FormatSize ¶
FormatSize formats a size in bytes to a human-readable format
func GetImageShortName ¶
func GetImageShortName(facts ImageFacts) string
GetImageShortName returns a shortened version of the image name for display
func GetRegistryType ¶
GetRegistryType determines the type of registry based on its URL
func IsOfficialImage ¶
IsOfficialImage checks if an image is an official Docker Hub image
func IsValidImageName ¶
IsValidImageName validates an image name format
func NormalizeRegistryURL ¶
NormalizeRegistryURL normalizes a registry URL
func ProcessImageFactsCollectionResult ¶
func ProcessImageFactsCollectionResult(ctx context.Context, namespace string, client kubernetes.Interface, options CollectionOptions) ([]byte, error)
ProcessImageFactsCollectionResult processes the result of image facts collection
func ValidateCredentials ¶
func ValidateCredentials(creds RegistryCredentials) error
ValidateCredentials validates registry credentials
Types ¶
type CollectionOptions ¶
type CollectionOptions struct {
// Registry authentication
Credentials map[string]RegistryCredentials `json:"credentials,omitempty"`
// Collection behavior
IncludeLayers bool `json:"includeLayers"`
IncludeConfig bool `json:"includeConfig"`
Timeout time.Duration `json:"timeout"`
MaxConcurrency int `json:"maxConcurrency"`
// Error handling
ContinueOnError bool `json:"continueOnError"`
SkipTLSVerify bool `json:"skipTLSVerify"`
// Caching
EnableCache bool `json:"enableCache"`
CacheDuration time.Duration `json:"cacheDuration"`
}
CollectionOptions configures image collection behavior
func GetDefaultCollectionOptions ¶
func GetDefaultCollectionOptions() CollectionOptions
GetDefaultCollectionOptions returns default collection options
type CollectionResult ¶
type CollectionResult struct {
ImageFacts []ImageFacts `json:"imageFacts"`
Errors []error `json:"errors,omitempty"`
Duration time.Duration `json:"duration"`
Cached int `json:"cached"` // number of cached results used
}
CollectionResult contains the results of image fact collection
type ConfigDetails ¶
type ConfigDetails struct {
User string `json:"User,omitempty"`
ExposedPorts map[string]struct{} `json:"ExposedPorts,omitempty"`
Env []string `json:"Env,omitempty"`
Entrypoint []string `json:"Entrypoint,omitempty"`
Cmd []string `json:"Cmd,omitempty"`
Volumes map[string]struct{} `json:"Volumes,omitempty"`
WorkingDir string `json:"WorkingDir,omitempty"`
Labels map[string]string `json:"Labels,omitempty"`
}
ConfigDetails contains the runtime configuration
type DefaultImageCollector ¶
type DefaultImageCollector struct {
// contains filtered or unexported fields
}
DefaultImageCollector implements the ImageCollector interface
func NewImageCollector ¶
func NewImageCollector(options CollectionOptions) *DefaultImageCollector
NewImageCollector creates a new image collector
func (*DefaultImageCollector) CollectImageFacts ¶
func (c *DefaultImageCollector) CollectImageFacts(ctx context.Context, imageRef ImageReference) (*ImageFacts, error)
CollectImageFacts collects metadata for a single image
func (*DefaultImageCollector) CollectMultipleImageFacts ¶
func (c *DefaultImageCollector) CollectMultipleImageFacts(ctx context.Context, imageRefs []ImageReference) ([]ImageFacts, error)
CollectMultipleImageFacts collects metadata for multiple images concurrently
func (*DefaultImageCollector) SetCredentials ¶
func (c *DefaultImageCollector) SetCredentials(registry string, credentials RegistryCredentials) error
SetCredentials configures registry authentication
type DefaultRegistryClient ¶
type DefaultRegistryClient struct {
// contains filtered or unexported fields
}
DefaultRegistryClient implements the RegistryClient interface
func NewRegistryClient ¶
func NewRegistryClient(registry string, credentials RegistryCredentials, options CollectionOptions) (*DefaultRegistryClient, error)
NewRegistryClient creates a new registry client for the specified registry
func (*DefaultRegistryClient) GetBlob ¶
func (c *DefaultRegistryClient) GetBlob(ctx context.Context, imageRef ImageReference, digest string) (io.ReadCloser, error)
GetBlob retrieves a blob by digest
func (*DefaultRegistryClient) GetManifest ¶
func (c *DefaultRegistryClient) GetManifest(ctx context.Context, imageRef ImageReference) (Manifest, error)
GetManifest retrieves the image manifest
func (*DefaultRegistryClient) Ping ¶
func (c *DefaultRegistryClient) Ping(ctx context.Context) error
Ping tests connectivity to the registry
func (*DefaultRegistryClient) SetCredentials ¶
func (c *DefaultRegistryClient) SetCredentials(credentials RegistryCredentials) error
SetCredentials configures authentication for the registry
type Descriptor ¶
type Descriptor struct {
MediaType string `json:"mediaType"`
Size int64 `json:"size"`
Digest string `json:"digest"`
URLs []string `json:"urls,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
Platform *Platform `json:"platform,omitempty"`
}
Descriptor represents a content descriptor
type DigestResolver ¶
type DigestResolver struct {
// contains filtered or unexported fields
}
DigestResolver handles conversion of image tags to digests
func NewDigestResolver ¶
func NewDigestResolver(options CollectionOptions) *DigestResolver
NewDigestResolver creates a new digest resolver
func (*DigestResolver) NormalizeImageReference ¶
func (dr *DigestResolver) NormalizeImageReference(imageRef ImageReference) ImageReference
NormalizeImageReference normalizes an image reference to include defaults
func (*DigestResolver) ResolveBulkTagsToDigests ¶
func (dr *DigestResolver) ResolveBulkTagsToDigests(ctx context.Context, imageRefs []ImageReference) ([]ImageReference, error)
ResolveBulkTagsToDigests resolves multiple tags to digests concurrently
func (*DigestResolver) ResolveTagToDigest ¶
func (dr *DigestResolver) ResolveTagToDigest(ctx context.Context, imageRef ImageReference) (string, error)
ResolveTagToDigest converts an image tag to its digest
func (*DigestResolver) ValidateDigest ¶
func (dr *DigestResolver) ValidateDigest(digest string) error
ValidateDigest validates that a digest string is properly formatted
type FactsBuilder ¶
type FactsBuilder struct {
// contains filtered or unexported fields
}
FactsBuilder creates and manages image facts
func NewFactsBuilder ¶
func NewFactsBuilder(options CollectionOptions) *FactsBuilder
NewFactsBuilder creates a new facts builder
func (*FactsBuilder) BuildFactsFromImageReferences ¶
func (fb *FactsBuilder) BuildFactsFromImageReferences(ctx context.Context, imageRefs []ImageReference, source string) ([]ImageFacts, error)
BuildFactsFromImageReferences builds image facts from a list of image references
func (*FactsBuilder) BuildFactsFromImageStrings ¶
func (fb *FactsBuilder) BuildFactsFromImageStrings(ctx context.Context, imageStrs []string, source string) ([]ImageFacts, error)
BuildFactsFromImageStrings builds image facts from string representations
func (*FactsBuilder) DeduplicateImageFacts ¶
func (fb *FactsBuilder) DeduplicateImageFacts(imageFacts []ImageFacts) []ImageFacts
DeduplicateImageFacts removes duplicate image facts based on digest
func (*FactsBuilder) DeserializeFactsFromJSON ¶
func (fb *FactsBuilder) DeserializeFactsFromJSON(data []byte) (*FactsBundle, error)
DeserializeFactsFromJSON deserializes image facts from JSON
func (*FactsBuilder) ExtractUniqueImages ¶
func (fb *FactsBuilder) ExtractUniqueImages(imageFacts []ImageFacts) []string
ExtractUniqueImages extracts unique images from image facts
func (*FactsBuilder) FilterImageFactsByRegistry ¶
func (fb *FactsBuilder) FilterImageFactsByRegistry(imageFacts []ImageFacts, allowedRegistries []string) []ImageFacts
FilterImageFactsByRegistry filters image facts to only include specific registries
func (*FactsBuilder) GetFailedCollections ¶
func (fb *FactsBuilder) GetFailedCollections(imageFacts []ImageFacts) []ImageFacts
GetFailedCollections returns image facts with collection errors
func (*FactsBuilder) GetImageFactsSummary ¶
func (fb *FactsBuilder) GetImageFactsSummary(imageFacts []ImageFacts) FactsSummary
GetImageFactsSummary generates a summary of image facts
func (*FactsBuilder) GetImagesByRegistry ¶
func (fb *FactsBuilder) GetImagesByRegistry(imageFacts []ImageFacts) map[string][]ImageFacts
GetImagesByRegistry groups images by registry
func (*FactsBuilder) GetLargestImages ¶
func (fb *FactsBuilder) GetLargestImages(imageFacts []ImageFacts, count int) []ImageFacts
GetLargestImages returns the N largest images by size
func (*FactsBuilder) GetSuccessfulCollections ¶
func (fb *FactsBuilder) GetSuccessfulCollections(imageFacts []ImageFacts) []ImageFacts
GetSuccessfulCollections returns image facts without collection errors
func (*FactsBuilder) SerializeFactsToJSON ¶
func (fb *FactsBuilder) SerializeFactsToJSON(imageFacts []ImageFacts, namespace string) ([]byte, error)
SerializeFactsToJSON serializes image facts to JSON
func (*FactsBuilder) SortImageFactsByName ¶
func (fb *FactsBuilder) SortImageFactsByName(imageFacts []ImageFacts)
SortImageFactsByName sorts image facts by repository name
func (*FactsBuilder) SortImageFactsBySize ¶
func (fb *FactsBuilder) SortImageFactsBySize(imageFacts []ImageFacts)
SortImageFactsBySize sorts image facts by size (largest first)
func (*FactsBuilder) ValidateImageFacts ¶
func (fb *FactsBuilder) ValidateImageFacts(facts ImageFacts) error
ValidateImageFacts validates that image facts are complete and consistent
type FactsBundle ¶
type FactsBundle struct {
Version string `json:"version"`
GeneratedAt time.Time `json:"generatedAt"`
Namespace string `json:"namespace,omitempty"`
ImageFacts []ImageFacts `json:"imageFacts"`
Summary FactsSummary `json:"summary"`
}
FactsBundle represents the facts.json output format
func CreateFactsBundle ¶
func CreateFactsBundle(namespace string, imageFacts []ImageFacts) *FactsBundle
CreateFactsBundle creates a facts bundle for serialization
type FactsSummary ¶
type FactsSummary struct {
TotalImages int `json:"totalImages"`
UniqueRegistries int `json:"uniqueRegistries"`
UniqueRepositories int `json:"uniqueRepositories"`
TotalSize int64 `json:"totalSize"`
CollectionErrors int `json:"collectionErrors"`
}
FactsSummary provides high-level statistics about collected image facts
type History ¶
type History struct {
Created time.Time `json:"created"`
CreatedBy string `json:"created_by,omitempty"`
Author string `json:"author,omitempty"`
Comment string `json:"comment,omitempty"`
EmptyLayer bool `json:"empty_layer,omitempty"`
}
History contains information about image layer history
type ImageCollector ¶
type ImageCollector interface {
// CollectImageFacts collects metadata for a single image
CollectImageFacts(ctx context.Context, imageRef ImageReference) (*ImageFacts, error)
// CollectMultipleImageFacts collects metadata for multiple images concurrently
CollectMultipleImageFacts(ctx context.Context, imageRefs []ImageReference) ([]ImageFacts, error)
// SetCredentials configures registry authentication
SetCredentials(registry string, credentials RegistryCredentials) error
}
ImageCollector defines the interface for collecting image metadata
type ImageConfig ¶
type ImageConfig struct {
User string `json:"user,omitempty"`
ExposedPorts map[string]struct{} `json:"exposedPorts,omitempty"`
Env []string `json:"env,omitempty"`
Entrypoint []string `json:"entrypoint,omitempty"`
Cmd []string `json:"cmd,omitempty"`
Volumes map[string]struct{} `json:"volumes,omitempty"`
WorkingDir string `json:"workingDir,omitempty"`
}
ImageConfig contains image configuration details
func ConvertToImageConfig ¶
func ConvertToImageConfig(config ConfigDetails) ImageConfig
ConvertToImageConfig converts configuration details to our ImageConfig type
type ImageConfigBlob ¶
type ImageConfigBlob struct {
Architecture string `json:"architecture"`
OS string `json:"os"`
OSVersion string `json:"os.version,omitempty"`
OSFeatures []string `json:"os.features,omitempty"`
Variant string `json:"variant,omitempty"`
Config ConfigDetails `json:"config"`
RootFS RootFS `json:"rootfs"`
History []History `json:"history"`
Created time.Time `json:"created"`
Author string `json:"author,omitempty"`
}
ImageConfigBlob represents the image configuration blob
func ParseImageConfig ¶
func ParseImageConfig(data []byte) (*ImageConfigBlob, error)
ParseImageConfig parses an image configuration blob
type ImageFacts ¶
type ImageFacts struct {
// Basic image identification
Repository string `json:"repository"`
Tag string `json:"tag"`
Digest string `json:"digest"`
Registry string `json:"registry"`
// Image metadata
Size int64 `json:"size"`
Created time.Time `json:"created"`
Labels map[string]string `json:"labels"`
Platform Platform `json:"platform"`
// Manifest information
MediaType string `json:"mediaType"`
SchemaVersion int `json:"schemaVersion"`
// Layer information
Layers []LayerInfo `json:"layers,omitempty"`
// Configuration
Config ImageConfig `json:"config,omitempty"`
// Collection metadata
CollectedAt time.Time `json:"collectedAt"`
Source string `json:"source"` // pod/deployment/etc that referenced this image
Error string `json:"error,omitempty"` // any collection errors
}
ImageFacts contains comprehensive metadata about a container image
type ImageReference ¶
type ImageReference struct {
Registry string `json:"registry"`
Repository string `json:"repository"`
Tag string `json:"tag"`
Digest string `json:"digest,omitempty"`
}
ImageReference represents a reference to a container image
func ExtractImageReferencesFromPodSpec ¶
func ExtractImageReferencesFromPodSpec(podSpec interface{}) ([]ImageReference, error)
ExtractImageReferencesFromPodSpec extracts image references from Kubernetes pod specifications
func ParseImageReference ¶
func ParseImageReference(imageStr string) (ImageReference, error)
ParseImageReference parses a full image reference string into components
func (ImageReference) String ¶
func (ir ImageReference) String() string
String returns the full image reference string
type KubernetesImageExtractor ¶
type KubernetesImageExtractor struct {
// contains filtered or unexported fields
}
KubernetesImageExtractor extracts image references from Kubernetes resources
func NewKubernetesImageExtractor ¶
func NewKubernetesImageExtractor(client kubernetes.Interface) *KubernetesImageExtractor
NewKubernetesImageExtractor creates a new image extractor
func (*KubernetesImageExtractor) ExtractImagesFromNamespace ¶
func (ke *KubernetesImageExtractor) ExtractImagesFromNamespace(ctx context.Context, namespace string) ([]ImageReference, error)
ExtractImagesFromNamespace extracts all image references from a namespace
type LayerInfo ¶
type LayerInfo struct {
Digest string `json:"digest"`
Size int64 `json:"size"`
MediaType string `json:"mediaType"`
}
LayerInfo contains information about an image layer
func ConvertToLayerInfo ¶
func ConvertToLayerInfo(layers []Descriptor) []LayerInfo
ConvertToLayerInfo converts descriptors to layer info
type Manifest ¶
type Manifest interface {
// GetMediaType returns the manifest media type
GetMediaType() string
// GetSchemaVersion returns the manifest schema version
GetSchemaVersion() int
// GetConfig returns the config descriptor
GetConfig() Descriptor
// GetLayers returns the layer descriptors
GetLayers() []Descriptor
// GetPlatform returns the platform information
GetPlatform() *Platform
// Marshal serializes the manifest to JSON
Marshal() ([]byte, error)
}
Manifest represents a container image manifest
type ManifestDescriptor ¶
type ManifestDescriptor struct {
Descriptor
Platform *Platform `json:"platform,omitempty"`
}
ManifestDescriptor represents a manifest in a manifest list
type ManifestList ¶
type ManifestList struct {
SchemaVersion int `json:"schemaVersion"`
MediaType string `json:"mediaType"`
Manifests []ManifestDescriptor `json:"manifests"`
}
ManifestList represents a Docker manifest list or OCI image index
func (*ManifestList) GetConfig ¶
func (m *ManifestList) GetConfig() Descriptor
GetConfig returns the config descriptor (not applicable for manifest lists)
func (*ManifestList) GetLayers ¶
func (m *ManifestList) GetLayers() []Descriptor
GetLayers returns the layer descriptors (not applicable for manifest lists)
func (*ManifestList) GetManifestForPlatform ¶
func (m *ManifestList) GetManifestForPlatform(targetPlatform Platform) (*ManifestDescriptor, error)
GetManifestForPlatform returns the best manifest for the given platform
func (*ManifestList) GetMediaType ¶
func (m *ManifestList) GetMediaType() string
GetMediaType returns the manifest media type
func (*ManifestList) GetPlatform ¶
func (m *ManifestList) GetPlatform() *Platform
GetPlatform returns platform information (not applicable for manifest lists)
func (*ManifestList) GetSchemaVersion ¶
func (m *ManifestList) GetSchemaVersion() int
GetSchemaVersion returns the manifest schema version
func (*ManifestList) Marshal ¶
func (m *ManifestList) Marshal() ([]byte, error)
Marshal serializes the manifest to JSON
type NamespaceImageCollector ¶
type NamespaceImageCollector struct {
// contains filtered or unexported fields
}
NamespaceImageCollector collects image facts for an entire namespace
func NewNamespaceImageCollector ¶
func NewNamespaceImageCollector(client kubernetes.Interface, options CollectionOptions) *NamespaceImageCollector
NewNamespaceImageCollector creates a new namespace-level image collector
func (*NamespaceImageCollector) CollectNamespaceImageFacts ¶
func (nc *NamespaceImageCollector) CollectNamespaceImageFacts(ctx context.Context, namespace string) (*FactsBundle, error)
CollectNamespaceImageFacts collects image facts for all images in a namespace
type Platform ¶
type Platform struct {
Architecture string `json:"architecture"`
OS string `json:"os"`
Variant string `json:"variant,omitempty"`
OSVersion string `json:"osVersion,omitempty"`
OSFeatures []string `json:"osFeatures,omitempty"`
}
Platform represents the target platform for the image
func ConvertToPlatform ¶
ConvertToPlatform converts various platform representations to our Platform type
func GetDefaultPlatform ¶
func GetDefaultPlatform() Platform
GetDefaultPlatform returns the default platform for image selection
func NormalizePlatform ¶
NormalizePlatform normalizes platform information
type RegistryClient ¶
type RegistryClient interface {
// GetManifest retrieves the image manifest
GetManifest(ctx context.Context, imageRef ImageReference) (Manifest, error)
// GetBlob retrieves a blob by digest
GetBlob(ctx context.Context, imageRef ImageReference, digest string) (io.ReadCloser, error)
// SetCredentials configures authentication for the registry
SetCredentials(credentials RegistryCredentials) error
// Ping tests connectivity to the registry
Ping(ctx context.Context) error
}
RegistryClient defines the interface for interacting with container registries
type RegistryClientFactory ¶
type RegistryClientFactory struct {
// contains filtered or unexported fields
}
RegistryClientFactory creates registry clients for different registry types
func NewRegistryClientFactory ¶
func NewRegistryClientFactory(options CollectionOptions) *RegistryClientFactory
NewRegistryClientFactory creates a new registry client factory
func (*RegistryClientFactory) CreateClient ¶
func (f *RegistryClientFactory) CreateClient(registry string, credentials RegistryCredentials) (RegistryClient, error)
CreateClient creates a registry client for the specified registry
func (*RegistryClientFactory) GetSupportedRegistries ¶
func (f *RegistryClientFactory) GetSupportedRegistries() []string
GetSupportedRegistries returns a list of well-known registry patterns
type RegistryCredentials ¶
type RegistryCredentials struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
Token string `json:"token,omitempty"`
// For cloud provider authentication
IdentityToken string `json:"identityToken,omitempty"`
RegistryToken string `json:"registryToken,omitempty"`
// TLS configuration
Insecure bool `json:"insecure,omitempty"`
CACert string `json:"caCert,omitempty"`
}
RegistryCredentials contains authentication information for a registry
type V1Manifest ¶
type V1Manifest struct {
SchemaVersion int `json:"schemaVersion"`
Name string `json:"name"`
Tag string `json:"tag"`
Architecture string `json:"architecture"`
FsLayers []struct {
BlobSum string `json:"blobSum"`
} `json:"fsLayers"`
History []struct {
V1Compatibility string `json:"v1Compatibility"`
} `json:"history"`
}
V1Manifest represents a Docker v1 manifest (legacy)
func (*V1Manifest) GetConfig ¶
func (m *V1Manifest) GetConfig() Descriptor
GetConfig returns the config descriptor (convert from v1 format)
func (*V1Manifest) GetLayers ¶
func (m *V1Manifest) GetLayers() []Descriptor
GetLayers returns the layer descriptors (convert from v1 format)
func (*V1Manifest) GetMediaType ¶
func (m *V1Manifest) GetMediaType() string
GetMediaType returns the manifest media type
func (*V1Manifest) GetPlatform ¶
func (m *V1Manifest) GetPlatform() *Platform
GetPlatform returns platform information
func (*V1Manifest) GetSchemaVersion ¶
func (m *V1Manifest) GetSchemaVersion() int
GetSchemaVersion returns the manifest schema version
func (*V1Manifest) Marshal ¶
func (m *V1Manifest) Marshal() ([]byte, error)
Marshal serializes the manifest to JSON
type V2Manifest ¶
type V2Manifest struct {
SchemaVersion int `json:"schemaVersion"`
MediaType string `json:"mediaType"`
Config Descriptor `json:"config"`
Layers []Descriptor `json:"layers"`
}
V2Manifest represents a Docker v2 or OCI manifest
func (*V2Manifest) GetConfig ¶
func (m *V2Manifest) GetConfig() Descriptor
GetConfig returns the config descriptor
func (*V2Manifest) GetLayers ¶
func (m *V2Manifest) GetLayers() []Descriptor
GetLayers returns the layer descriptors
func (*V2Manifest) GetMediaType ¶
func (m *V2Manifest) GetMediaType() string
GetMediaType returns the manifest media type
func (*V2Manifest) GetPlatform ¶
func (m *V2Manifest) GetPlatform() *Platform
GetPlatform returns platform information (not available in v2 manifests directly)
func (*V2Manifest) GetSchemaVersion ¶
func (m *V2Manifest) GetSchemaVersion() int
GetSchemaVersion returns the manifest schema version
func (*V2Manifest) Marshal ¶
func (m *V2Manifest) Marshal() ([]byte, error)
Marshal serializes the manifest to JSON