ocimirror

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractUniqueOCIRefs

func ExtractUniqueOCIRefs(manifests string) []string

ExtractUniqueOCIRefs extracts and deduplicates all OCI image references from YAML manifests.

func SplitOCIRef

func SplitOCIRef(imageRef string) (registry, repository, tagOrDigest string)

SplitOCIRef breaks an OCI reference into registry, repository, and tag/digest.

Types

type ImageMirror

type ImageMirror struct {
	// contains filtered or unexported fields
}

ImageMirror handles image replacement and OCI artifact replication for configured registry mirrors.

func NewImageMirror

func NewImageMirror(ctx context.Context, k8sClient client.Client, config *RegistryMirrorConfig, namespace string) (*ImageMirror, error)

NewImageMirror creates an ImageMirror with credentials from the configured Secret.

func NewImageMirrorForTest

func NewImageMirrorForTest(config *RegistryMirrorConfig, auth authn.Authenticator, fetcher func(ref string, opts ...crane.Option) ([]byte, error)) *ImageMirror

NewImageMirrorForTest creates an ImageMirror for testing with explicit auth and manifest fetcher.

func (*ImageMirror) BuildImageTransformations

func (m *ImageMirror) BuildImageTransformations(manifestSets ...string) []ImageTransform

BuildImageTransformations extracts image refs from the given rendered manifest sets and returns the upstream-to-mirror rewrites for them, skipping refs that already point at a mirror and deduplicating across sets.

func (*ImageMirror) EnsureChartReplicated

func (m *ImageMirror) EnsureChartReplicated(ctx context.Context, ociRef string) (replicatedRef string, manifest []byte, err error)

EnsureChartReplicated warms the pull-through cache for a chart on a mirror domain.

func (*ImageMirror) EnsureImageReplicated

func (m *ImageMirror) EnsureImageReplicated(ctx context.Context, ociRef string) (replicatedRef string, manifest []byte, err error)

EnsureImageReplicated warms the pull-through cache for a container image, including upstream refs.

func (*ImageMirror) ReplicateOCIArtifacts

func (m *ImageMirror) ReplicateOCIArtifacts(ctx context.Context, alreadyReplicated []string, manifestSets ...string) ([]string, error)

ReplicateOCIArtifacts triggers replication for OCI artifacts found in the given manifest sets, skipping already-replicated refs and deduplicating across sets.

type ImageTransform

type ImageTransform struct {
	Original string
	Mirrored string
}

ImageTransform represents an upstream-to-mirror image reference rewrite.

type RegistryMirror

type RegistryMirror struct {
	BaseDomain string `yaml:"baseDomain"`
	SubPath    string `yaml:"subPath"`
}

RegistryMirror represents a single registry mirror configuration.

type RegistryMirrorConfig

type RegistryMirrorConfig struct {
	PrimaryMirror   string                    `yaml:"primaryMirror"`
	RegistryMirrors map[string]RegistryMirror `yaml:"registryMirrors"`
	SecretName      string                    `yaml:"secretName,omitempty"`
}

RegistryMirrorConfig represents the registry mirror configuration structure.

func GetRegistryMirrorConfig

func GetRegistryMirrorConfig(ctx context.Context, k8sClient client.Reader, orgName string) (*RegistryMirrorConfig, error)

GetRegistryMirrorConfig retrieves and parses the registry mirror configuration from the Organization's ConfigMap. Registry mirrors redirect image pulls from original registries to mirror registries.

func (*RegistryMirrorConfig) ResolveOCIRef

func (c *RegistryMirrorConfig) ResolveOCIRef(imageRef string) *ResolvedOCIRef

ResolveOCIRef looks up the mirror configuration for an OCI reference.

type ResolvedOCIRef

type ResolvedOCIRef struct {
	Registry    string
	Mirror      RegistryMirror
	Repository  string
	TagOrDigest string
}

ResolvedOCIRef holds the result of resolving an OCI reference against a mirror configuration.

Jump to

Keyboard shortcuts

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