controller

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartPodWatcher

func StartPodWatcher(ctx context.Context, cfg Config, builder *Builder) error

Types

type Artifact

type Artifact struct {
	ID                  int64  `json:"id"`
	SourceImageRef      string `json:"sourceImageRef"`
	ImageDigestRef      string `json:"imageDigestRef"`
	ImageManifestDigest string `json:"imageManifestDigest"`
	ImageConfigDigest   string `json:"imageConfigDigest"`
	Platform            string `json:"platform"`
	AccelerationKey     string `json:"accelerationKey"`
	IndexDigest         string `json:"indexDigest"`
	IndexMediaType      string `json:"indexMediaType"`
	IndexSize           int64  `json:"indexSize"`
	Status              string `json:"status"`
	Error               string `json:"error"`
}

type BuildAcceleration

type BuildAcceleration struct {
	Profile              string
	PrefetchPathPatterns []string
}

func (BuildAcceleration) IndexAnnotations

func (a BuildAcceleration) IndexAnnotations() map[string]string

func (BuildAcceleration) Key

func (a BuildAcceleration) Key() string

func (BuildAcceleration) MinLayerSize

func (a BuildAcceleration) MinLayerSize(base int64) int64

func (BuildAcceleration) PrefetchMaxSpans

func (a BuildAcceleration) PrefetchMaxSpans() int

func (BuildAcceleration) PrefetchPaths

func (a BuildAcceleration) PrefetchPaths() []string

func (BuildAcceleration) PrefetchProfile

func (a BuildAcceleration) PrefetchProfile() string

func (BuildAcceleration) SkipFileVerification

func (a BuildAcceleration) SkipFileVerification() bool

func (BuildAcceleration) WithImageConfig

func (a BuildAcceleration) WithImageConfig(config ocispec.ImageConfig) BuildAcceleration

type BuildTask

type BuildTask struct {
	SourceImageRef string
	Platform       string
	Reason         string
	PolicyNames    []string
	RegistryAuths  []RegistryAuth
	Acceleration   BuildAcceleration
}

type Builder

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

func NewBuilder

func NewBuilder(cfg Config, store *Store, recorders ...PolicyStatusRecorder) *Builder

func (*Builder) Build

func (b *Builder) Build(ctx context.Context, task BuildTask) error

func (*Builder) Enqueue

func (b *Builder) Enqueue(task BuildTask) bool

func (*Builder) SetPolicyStatusRecorder

func (b *Builder) SetPolicyStatusRecorder(recorder PolicyStatusRecorder)

func (*Builder) Start

func (b *Builder) Start(ctx context.Context)

type Config

type Config struct {
	ListenAddr        string
	DBPath            string
	Kubeconfig        string
	WatchKubernetes   bool
	WatchNamespace    string
	Platform          string
	MaxConcurrency    int
	QueueSize         int
	BuildTimeout      time.Duration
	ContainerdAddress string
	ContainerdNS      string
	HermesRoot        string
	SpanSize          int64
	MinLayerSize      int64
	Optimizations     []string
	PullImage         bool
}

type HermesPolicyManager

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

func NewHermesPolicyManager

func NewHermesPolicyManager(cfg *rest.Config) (*HermesPolicyManager, error)

func (*HermesPolicyManager) MatchImage

func (m *HermesPolicyManager) MatchImage(image, defaultPlatform string) []PolicyBuildTarget

func (*HermesPolicyManager) RecordBuild

func (m *HermesPolicyManager) RecordBuild(ctx context.Context, policyNames []string, imageDigestRef, platform string, phase hermesv1.HermesImagePhase, buildErr error)

func (*HermesPolicyManager) SetOnChange

func (m *HermesPolicyManager) SetOnChange(fn func())

func (*HermesPolicyManager) Start

func (m *HermesPolicyManager) Start(ctx context.Context) error

type HermesPolicyStore

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

func NewHermesPolicyStore

func NewHermesPolicyStore() *HermesPolicyStore

func (*HermesPolicyStore) Delete

func (s *HermesPolicyStore) Delete(name string)

func (*HermesPolicyStore) MatchImage

func (s *HermesPolicyStore) MatchImage(image, defaultPlatform string) []PolicyBuildTarget

func (*HermesPolicyStore) Upsert

func (s *HermesPolicyStore) Upsert(policy *hermesv1.HermesPolicy)

type LayerArtifact

type LayerArtifact struct {
	LayerDigest string
	ZtocDigest  string
	ZtocSize    int64
}

type PolicyBuildTarget

type PolicyBuildTarget struct {
	Platform     string
	PolicyNames  []string
	Acceleration BuildAcceleration
}

type PolicyStatusRecorder

type PolicyStatusRecorder interface {
	RecordBuild(ctx context.Context, policyNames []string, imageDigestRef, platform string, phase hermesv1.HermesImagePhase, buildErr error)
}

type RegistryAuth

type RegistryAuth struct {
	Host     string
	Username string
	Secret   string
}

type ResolveResponse

type ResolveResponse struct {
	Image     string             `json:"image"`
	Platform  string             `json:"platform"`
	SOCIIndex ocispec.Descriptor `json:"sociIndex"`
	Ztocs     []ZtocResponse     `json:"ztocs"`
}

type Server

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

func NewServer

func NewServer(cfg Config, store *Store) *Server

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(ctx context.Context) error

type Store

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

func OpenStore

func OpenStore(path string) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) GetBlob

func (s *Store) GetBlob(ctx context.Context, dgst string) (mediaType string, size int64, content []byte, err error)

func (*Store) HasReady

func (s *Store) HasReady(ctx context.Context, imageDigestRef, platform, accelerationKey string) (bool, error)

func (*Store) ListRecent

func (s *Store) ListRecent(ctx context.Context, limit int) ([]Artifact, error)

func (*Store) MarkBuilding

func (s *Store) MarkBuilding(ctx context.Context, task BuildTask, imageDigestRef, manifestDigest string, cfg Config, accelerationKey string) (bool, error)

func (*Store) MarkFailed

func (s *Store) MarkFailed(ctx context.Context, sourceImageRef, imageDigestRef, platform, accelerationKey string, buildErr error) error

func (*Store) PutReady

func (s *Store) PutReady(ctx context.Context, artifact Artifact, indexDesc ocispec.Descriptor, indexBytes []byte, ztocs []ocispec.Descriptor, ztocBytes map[string][]byte, layers []LayerArtifact, cfg Config, accelerationKey string) error

func (*Store) Resolve

func (s *Store) Resolve(ctx context.Context, imageDigestRef, platform, accelerationKey string) (*ResolveResponse, error)

type StringSet

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

func NewStringSet

func NewStringSet() *StringSet

func (*StringSet) Add

func (s *StringSet) Add(v string) bool

func (*StringSet) Delete

func (s *StringSet) Delete(v string)

type ZtocResponse

type ZtocResponse struct {
	LayerDigest string `json:"layerDigest"`
	ZtocDigest  string `json:"ztocDigest"`
	Size        int64  `json:"size"`
}

Jump to

Keyboard shortcuts

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