tasks

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 90 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ItemsPerPage           = 1000
	EventProcessingTimeout = 10 * time.Second
	AckTimeout             = 5 * time.Second
)
View Source
const (
	// DeviceConnectionPollingInterval is the interval at which the device connection status task runs (disconnection and reconnection).
	DeviceConnectionPollingInterval = 2 * time.Minute
	DeviceConnectionTaskName        = "device-connection"
)
View Source
const (
	// EventCleanupPollingInterval is the interval at which the event cleanup task runs.
	EventCleanupPollingInterval = 10 * time.Minute
	EventCleanupTaskName        = "event-cleanup"
)
View Source
const (
	// VulnerabilitySyncInterval is the default interval between Trustify sync runs.
	VulnerabilitySyncInterval = 15 * time.Minute
	VulnerabilitySyncTaskName = "vulnerability-sync"
)
View Source
const (
	// EncryptionMigrationConsumer is the checkpoint consumer name for migration progress.
	EncryptionMigrationConsumer = "encryption-migration"
)
View Source
const EventReasonEncryptionMigrationBatch domain.EventReason = "EncryptionMigrationBatch"

Internal worker reason for encryption migration batches. Not an API EventReason; messages are enqueued directly onto task-queue and are not persisted as Events.

View Source
const RepoTesterTaskName = "repository-tester"
View Source
const ResourceSyncTaskName = "resourcesync"

Variables

View Source
var (
	ErrUnknownConfigName      = errors.New("failed to find configuration item name")
	ErrUnknownApplicationType = errors.New("unknown application type")
)

Functions

func CloneGitRepo

func CloneGitRepo(ctx context.Context, repo *domain.Repository, revision *string, depth *int, cfg *config.Config) (billy.Filesystem, string, error)

func CloneGitRepoToIgnition added in v0.4.0

func CloneGitRepoToIgnition(ctx context.Context, repo *domain.Repository, revision string, path string, cfg *config.Config) (*config_latest_types.Config, string, error)

func ConvertFileSystemToIgnition

func ConvertFileSystemToIgnition(mfs billy.Filesystem, path string) (*config_latest_types.Config, error)

ConvertFileSystemToIgnition converts a filesystem to an ignition config The filesystem is expected to be a git repo, and the path is the root of the repo The function will recursively walk the filesystem and add all files to the ignition config In case user provides file path we will add file as "/file-name" In case user provides folder we will drop folder path add all files and subfolder with subfolder paths, like Example: ConvertFileSystemToIgnition(mfs, "/test-path) will go through all subfolder and files and build ignition paths like /etc/motd, /etc/config/file.yaml The function will return an error if the path does not exist or if there is an error reading the filesystem

func EmitInternalTaskFailedEvent added in v0.10.0

func EmitInternalTaskFailedEvent(ctx context.Context, orgID uuid.UUID, errorMessage string, originalEvent domain.Event, eventSvc event.Service)

func EncryptionMigrationCheckpointKey added in v1.3.0

func EncryptionMigrationCheckpointKey(kind string, orgID uuid.UUID) string

EncryptionMigrationCheckpointKey is the checkpoint key for one kind within one org.

func EnqueueEncryptionMigration added in v1.3.0

func EnqueueEncryptionMigration(ctx context.Context, publisher queues.QueueProducer, kind string, orgID uuid.UUID) error

EnqueueEncryptionMigration enqueues one batch job for the given kind and org.

func EnqueueEncryptionMigrationIfNeeded added in v1.3.0

func EnqueueEncryptionMigrationIfNeeded(ctx context.Context, publisher queues.QueueProducer, migrator *EncryptionMigrator, log logrus.FieldLogger) error

EnqueueEncryptionMigrationIfNeeded enqueues a batch for each incomplete kind/org. The incomplete kind/org list is materialized first (see IncompleteWork), then enqueued.

func GetAuth

func GetAuth(ctx context.Context, repository *domain.Repository, cfg *config.Config) (transport.AuthMethod, error)

Read repository's ssh/http config and create transport.AuthMethod. If no ssh/http config is defined a nil is returned.

func GitLsRemote added in v1.2.0

func GitLsRemote(ctx context.Context, repoURL string, refs []string, auth transport.AuthMethod) (map[string]string, error)

GitLsRemote resolves one or more git refs (branch name, tag name, or full ref path) to their commit SHAs without cloning the repository. A single remote.List call is made regardless of how many refs are requested. The returned map contains only the refs that were found. Error messages are sanitized to prevent credential leakage.

func LaunchConsumers

func LaunchConsumers(ctx context.Context,
	queuesProvider queues.Provider,
	fleetSvc fleetservice.Service,
	templateversionSvc templateversionservice.Service,
	deviceSvc deviceservice.Service,
	dependencyrefSvc dependencyrefservice.Service,
	repositorySvc repositoryservice.Service,
	catalogSvc catalogservice.Service,
	eventSvc eventservice.Service,
	k8sClient k8sclient.K8SClient,
	kvStore kvstore.KVStore,
	cfg *config.Config,
	numConsumers, threadsPerConsumer int,
	workerMetrics *worker.WorkerCollector,
	encryptionMigrator *EncryptionMigrator,
	queuePublisher queues.QueueProducer) error

func NeedsSyncToHash added in v0.6.0

func NeedsSyncToHash(rs *domain.ResourceSync, hash string) bool

NeedsSyncToHash returns true if the resource needs to be synced to the given hash.

func ReplaceParametersInString added in v1.2.0

func ReplaceParametersInString(s string, device *domain.Device) (string, error)

Types

type API

type API interface {
	Test()
}

type CVEEventEmitter added in v1.2.0

type CVEEventEmitter interface {
	CreateEvent(ctx context.Context, orgId uuid.UUID, event *domain.Event)
}

CVEEventEmitter creates CVE lifecycle events.

type CheckpointStore added in v1.2.0

type CheckpointStore interface {
	Set(ctx context.Context, consumer string, key string, value []byte) error
	Get(ctx context.Context, consumer string, key string) ([]byte, error)
	GetDatabaseTime(ctx context.Context) (time.Time, error)
}

CheckpointStore provides checkpoint read/write for snapshot tracking.

type ConfigRefFingerprint added in v1.2.0

type ConfigRefFingerprint struct {
	ConfigProviderName string
	Fingerprint        string
}

ConfigRefFingerprint holds the fingerprint captured for one config provider at render time.

type DependencySyncGit added in v1.2.0

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

func NewDependencySyncGit added in v1.2.0

func NewDependencySyncGit(log logrus.FieldLogger, dependencyrefSvc dependencyrefservice.Service, eventSvc eventservice.Service, syncstateSvc syncstateservice.Service,
	cfg *config.Config, metrics *periodic.DependencySyncCollector) *DependencySyncGit

func (*DependencySyncGit) Poll added in v1.2.0

func (d *DependencySyncGit) Poll(ctx context.Context, orgId uuid.UUID)

type DependencySyncHttp added in v1.2.0

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

func NewDependencySyncHttp added in v1.2.0

func NewDependencySyncHttp(log logrus.FieldLogger, dependencyrefSvc dependencyrefservice.Service, eventSvc eventservice.Service, syncstateSvc syncstateservice.Service,
	cfg *config.Config, metrics *periodic.DependencySyncCollector) *DependencySyncHttp

func (*DependencySyncHttp) Poll added in v1.2.0

func (d *DependencySyncHttp) Poll(ctx context.Context, orgId uuid.UUID)

type DependencySyncSecret added in v1.2.0

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

DependencySyncSecret manages a K8s Secret SharedInformer that detects changes to labeled secrets and emits DependencyChangeDetected events for affected fleets/devices.

func NewDependencySyncSecret added in v1.2.0

func NewDependencySyncSecret(log logrus.FieldLogger, dependencyrefSvc dependencyrefservice.Service, eventSvc eventservice.Service, syncstateSvc syncstateservice.Service, releaseNamespace string, metrics *periodic.DependencySyncCollector) *DependencySyncSecret

func (*DependencySyncSecret) IsInformerConnected added in v1.2.0

func (d *DependencySyncSecret) IsInformerConnected() bool

func (*DependencySyncSecret) Run added in v1.2.0

func (d *DependencySyncSecret) Run(ctx context.Context, clientset kubernetes.Interface)

Run starts the SharedInformerFactory watching labeled secrets and blocks until ctx is cancelled. Intended to be called as a goroutine.

type DeviceConnection added in v1.1.0

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

func NewDeviceConnection added in v1.1.0

func NewDeviceConnection(log logrus.FieldLogger, deviceSvc deviceservice.Service) *DeviceConnection

func (*DeviceConnection) Poll added in v1.1.0

func (t *DeviceConnection) Poll(ctx context.Context, orgID uuid.UUID)

Poll checks the status of devices and updates connection state (e.g. disconnection and reconnection) based on device liveness.

type DeviceRenderLogic

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

func NewDeviceRenderLogic

func NewDeviceRenderLogic(log logrus.FieldLogger, deviceSvc deviceservice.Service, repositorySvc repositoryservice.Service, catalogSvc catalogservice.Service, k8sClient k8sclient.K8SClient, kvStore kvstore.KVStore, cfg *config.Config, orgId uuid.UUID, event domain.Event) DeviceRenderLogic

func (*DeviceRenderLogic) RenderDevice

func (t *DeviceRenderLogic) RenderDevice(ctx context.Context) error

func (DeviceRenderLogic) WithVmConverter added in v1.3.0

func (t DeviceRenderLogic) WithVmConverter(fn VmConverterFn) DeviceRenderLogic

WithVmConverter returns a copy of DeviceRenderLogic using the given converter for VM application rendering. Intended for integration tests that extract the kubevirt-vm-to-pod binary into a temporary directory and supply its path via NewVmConverter.

type EncryptionMigratableRow added in v1.3.0

type EncryptionMigratableRow interface {
	OrgID() uuid.UUID
	Name() string
	Migrate(ctx context.Context, encrypt encryption.EncryptFunc) (changed bool, keyIDs []string, err error)
	Persist(ctx context.Context) error
}

EncryptionMigratableRow is one persisted resource to reprocess.

type EncryptionMigrationCheckpoint added in v1.3.0

type EncryptionMigrationCheckpoint struct {
	TargetActiveKeyID string `json:"targetActiveKeyId"`
	// RegistryHash is model.RegistryHash() for the encrypt-field registry used by this pass.
	// A mismatch (new protected fields between versions) forces a rescan.
	RegistryHash string `json:"registryHash,omitempty"`
	LastName     string `json:"lastName"`
	Complete     bool   `json:"complete"`
	// PassHadErrors is set when any row fails during the current scan pass.
	// Complete is only allowed after a full pass with no errors.
	PassHadErrors bool `json:"passHadErrors,omitempty"`
	// BackoffUntil delays the next scan after a pass that had errors.
	BackoffUntil *time.Time `json:"backoffUntil,omitempty"`
}

EncryptionMigrationCheckpoint tracks scanner progress for one kind within one org.

type EncryptionMigrationLocker added in v1.3.0

type EncryptionMigrationLocker interface {
	TryLock(ctx context.Context, key string) (unlock func() error, acquired bool, err error)
}

EncryptionMigrationLocker serializes migration of one kind/org across worker replicas. Successful TryLock must be released with the returned unlock function. The key is typically leaseKey(kind, orgID).

type EncryptionMigrationReport added in v1.3.0

type EncryptionMigrationReport struct {
	Kind        string
	OrgID       uuid.UUID
	Scanned     int
	Updated     int
	Unchanged   int
	Errors      int
	KeyIDsInUse []string
	ActiveKeyID string
	Complete    bool
	// RetryAfter asks the consumer to delay before re-enqueueing.
	RetryAfter time.Duration
}

EncryptionMigrationReport summarizes one batch for a kind within one org.

type EncryptionMigrationResource added in v1.3.0

type EncryptionMigrationResource interface {
	Kind() string
	NextPage(ctx context.Context, orgID uuid.UUID, afterName string, limit int) ([]EncryptionMigratableRow, error)
}

EncryptionMigrationResource pages and migrates one resource kind within an org.

type EncryptionMigrationWork added in v1.3.0

type EncryptionMigrationWork struct {
	Kind  string
	OrgID uuid.UUID
}

EncryptionMigrationWork identifies one per-org migration unit.

type EncryptionMigrator added in v1.3.0

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

EncryptionMigrator runs batched encryption migration for registered kinds.

func NewEncryptionMigrator added in v1.3.0

func NewEncryptionMigrator(lifecycleCtx context.Context, db *gorm.DB, manager *encryption.Manager, checkpoints CheckpointStore, locker EncryptionMigrationLocker, canarySvc canaryservice.Service, eventSvc eventservice.Service, log logrus.FieldLogger) *EncryptionMigrator

NewEncryptionMigrator builds a migrator with Repository, AuthProvider, and Device adapters. lifecycleCtx cancels delayed re-enqueue work on worker shutdown; nil uses context.Background(). Pass nil locker to disable cross-replica leasing (tests). Pass nil canarySvc to skip PrepareForRetirement after successful migration. Pass nil eventSvc to skip system-wide started/completed events.

func (*EncryptionMigrator) IncompleteWork added in v1.3.0

func (m *EncryptionMigrator) IncompleteWork(ctx context.Context) ([]EncryptionMigrationWork, error)

IncompleteWork returns kind/org pairs that still need migration for the active key.

func (*EncryptionMigrator) NeedsMigration added in v1.3.0

func (m *EncryptionMigrator) NeedsMigration(ctx context.Context) (bool, error)

NeedsMigration reports whether any kind/org still needs work for the active key.

func (*EncryptionMigrator) RegisterResource added in v1.3.0

func (m *EncryptionMigrator) RegisterResource(resource EncryptionMigrationResource)

RegisterResource adds or replaces a kind adapter (for tests or future kinds).

func (*EncryptionMigrator) RunBatch added in v1.3.0

RunBatch migrates one page for the given kind within one org.

func (*EncryptionMigrator) SetBatchSize added in v1.3.0

func (m *EncryptionMigrator) SetBatchSize(n int)

SetBatchSize overrides the default page size (tests / tuning).

func (*EncryptionMigrator) SetErrorBackoff added in v1.3.0

func (m *EncryptionMigrator) SetErrorBackoff(d time.Duration)

SetErrorBackoff overrides the delay before restarting a failed scan pass.

func (*EncryptionMigrator) SetOrganizations added in v1.3.0

func (m *EncryptionMigrator) SetOrganizations(orgs []uuid.UUID)

SetOrganizations overrides org discovery (tests).

func (*EncryptionMigrator) SetRegistryHashOverride added in v1.3.0

func (m *EncryptionMigrator) SetRegistryHashOverride(hash string)

SetRegistryHashOverride replaces model.RegistryHash() (tests).

type EventCleanup added in v0.7.0

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

func NewEventCleanup added in v0.7.0

func NewEventCleanup(log logrus.FieldLogger, eventSvc event.Service, retentionPeriod util.Duration) *EventCleanup

func (*EventCleanup) Poll added in v0.7.0

func (t *EventCleanup) Poll(ctx context.Context)

Poll checks deletes events older than the configured retention period

type FindingStoreUpsertLister added in v1.2.0

type FindingStoreUpsertLister interface {
	ListDeployedImageDigests(ctx context.Context) ([]string, error)
	// UpsertFindings inserts or updates vulnerability findings and returns the findings
	// that were actually inserted or had their severity/status changed.
	UpsertFindings(ctx context.Context, findings []model.VulnerabilityFinding) ([]model.ChangedFinding, error)
	// ComputeAllCVEActions computes all CVE event actions from changed findings and device image changes.
	ComputeAllCVEActions(ctx context.Context, changedFindings []model.ChangedFinding, lastSnapshot time.Time) ([]model.CVEEventAction, error)
	// BatchUpdateOpenEvents applies CVE event actions to device_open_cve_events using batch INSERT/UPDATE/DELETE.
	BatchUpdateOpenEvents(ctx context.Context, actions []model.CVEEventAction) ([]model.CVEEventAction, error)
}

FindingStoreUpsertLister is the subset of VulnerabilityFinding the sync task depends on for Trustify ingestion.

type FleetApplicationLifecycleLogic added in v1.3.0

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

FleetApplicationLifecycleLogic propagates a change to a fleet's application lifecycle default to every device currently owned by the fleet: it refreshes each device's local cache of that default and triggers a re-render for each one.

func NewFleetApplicationLifecycleLogic added in v1.3.0

func NewFleetApplicationLifecycleLogic(log logrus.FieldLogger, fleetSvc fleetservice.Service, deviceSvc deviceservice.Service, eventSvc eventservice.Service, orgId uuid.UUID, event domain.Event) FleetApplicationLifecycleLogic

func (FleetApplicationLifecycleLogic) SyncFleet added in v1.3.0

type FleetRolloutsLogic

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

func NewFleetRolloutsLogic

func NewFleetRolloutsLogic(log logrus.FieldLogger, fleetSvc fleetservice.Service, templateversionSvc templateversionservice.Service, deviceSvc deviceservice.Service, dependencyrefSvc dependencyrefservice.Service, orgId uuid.UUID, event domain.Event) FleetRolloutsLogic

func (FleetRolloutsLogic) RolloutDevice

func (f FleetRolloutsLogic) RolloutDevice(ctx context.Context) error

The device's owner was changed, roll out if necessary

func (FleetRolloutsLogic) RolloutFleet

func (f FleetRolloutsLogic) RolloutFleet(ctx context.Context) error

func (*FleetRolloutsLogic) SetItemsPerPage

func (f *FleetRolloutsLogic) SetItemsPerPage(items int)

type FleetSelectorMatchingLogic

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

func NewFleetSelectorMatchingLogic

func NewFleetSelectorMatchingLogic(log logrus.FieldLogger, deviceSvc deviceservice.Service, fleetSvc fleetservice.Service, orgId uuid.UUID, event domain.Event) FleetSelectorMatchingLogic

func (FleetSelectorMatchingLogic) DeviceLabelsUpdated added in v0.9.0

func (f FleetSelectorMatchingLogic) DeviceLabelsUpdated(ctx context.Context) error

func (FleetSelectorMatchingLogic) FleetSelectorUpdated added in v0.9.0

func (f FleetSelectorMatchingLogic) FleetSelectorUpdated(ctx context.Context) error

Iterate devices that match the fleet's selector and set owners/conditions as necessary

func (*FleetSelectorMatchingLogic) SetItemsPerPage

func (f *FleetSelectorMatchingLogic) SetItemsPerPage(items int32)

type FleetValidateLogic

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

func NewFleetValidateLogic

func NewFleetValidateLogic(log logrus.FieldLogger, fleetSvc fleetservice.Service, templateversionSvc templateversionservice.Service, deviceSvc deviceservice.Service, repositorySvc repositoryservice.Service, k8sClient k8sclient.K8SClient, orgId uuid.UUID, event domain.Event) FleetValidateLogic

func (*FleetValidateLogic) CreateNewTemplateVersionIfFleetValid

func (t *FleetValidateLogic) CreateNewTemplateVersionIfFleetValid(ctx context.Context) error

type FleetValidationResult added in v0.9.0

type FleetValidationResult struct {
	Fleet *domain.Fleet
	Error error
}

FleetValidationResult holds the result of fleet validation

type GenericResourceMap added in v0.9.0

type GenericResourceMap map[string]interface{}

func RemoveIgnoredFields added in v0.9.0

func RemoveIgnoredFields(resource GenericResourceMap, ignorePaths []string) GenericResourceMap

type GitRepoTester

type GitRepoTester struct {
}

func (*GitRepoTester) TestAccess

func (r *GitRepoTester) TestAccess(ctx context.Context, repository *domain.Repository) error

type HttpRepoTester added in v0.3.0

type HttpRepoTester struct {
}

func (*HttpRepoTester) TestAccess added in v0.3.0

func (r *HttpRepoTester) TestAccess(ctx context.Context, repository *domain.Repository) error

type OciRepoTester added in v1.1.0

type OciRepoTester struct {
}

func (*OciRepoTester) TestAccess added in v1.1.0

func (r *OciRepoTester) TestAccess(ctx context.Context, repository *domain.Repository) error

type PopulateDependencyRefsLogic added in v1.2.0

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

func NewPopulateDependencyRefsLogic added in v1.2.0

func NewPopulateDependencyRefsLogic(log logrus.FieldLogger, fleetSvc fleetservice.Service, deviceSvc deviceservice.Service, dependencyrefSvc dependencyrefservice.Service, orgId uuid.UUID) PopulateDependencyRefsLogic

func (PopulateDependencyRefsLogic) HandleDeletion added in v1.2.0

func (p PopulateDependencyRefsLogic) HandleDeletion(ctx context.Context, event domain.Event) error

HandleDeletion cleans up all dependency_refs for a deleted fleet or device.

func (PopulateDependencyRefsLogic) PopulateForDevice added in v1.2.0

func (p PopulateDependencyRefsLogic) PopulateForDevice(ctx context.Context, deviceName string) error

func (PopulateDependencyRefsLogic) PopulateForFleet added in v1.2.0

func (p PopulateDependencyRefsLogic) PopulateForFleet(ctx context.Context, fleetName string) error

type PostgresEncryptionMigrationLocker added in v1.3.0

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

PostgresEncryptionMigrationLocker uses session-scoped pg_try_advisory_lock.

func NewPostgresEncryptionMigrationLocker added in v1.3.0

func NewPostgresEncryptionMigrationLocker(db *gorm.DB) *PostgresEncryptionMigrationLocker

func (*PostgresEncryptionMigrationLocker) TryLock added in v1.3.0

func (l *PostgresEncryptionMigrationLocker) TryLock(ctx context.Context, key string) (func() error, bool, error)

type ProcessingStats added in v0.9.0

type ProcessingStats struct {
	TotalDevicesProcessed int
	TotalErrors           int
}

ProcessingStats holds the results of fleet selector processing

type QueueMaintenanceTask added in v0.10.0

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

QueueMaintenanceTask handles queue maintenance operations including: - Processing timed out messages - Retrying failed messages - Checkpoint advancement based on in-flight task completion tracking

func NewQueueMaintenanceTask added in v0.10.0

func NewQueueMaintenanceTask(log logrus.FieldLogger, checkpointSvc checkpointservice.Service, eventSvc eventservice.Service, organizationSvc organizationservice.Service, queuesProvider queues.Provider, workerClient worker_client.WorkerClient, workerMetrics *worker.WorkerCollector) *QueueMaintenanceTask

NewQueueMaintenanceTask creates a new queue maintenance task

func (*QueueMaintenanceTask) Execute added in v0.10.0

func (t *QueueMaintenanceTask) Execute(ctx context.Context) error

Execute runs the queue maintenance task (system-wide, no organization context needed)

type RenderItem added in v0.3.0

type RenderItem interface {
	MarshalJSON() ([]byte, error)
}

type RepoTester

type RepoTester struct {
	RepoTesterMapper RepoTesterMapping
	// contains filtered or unexported fields
}

func NewRepoTester

func NewRepoTester(log logrus.FieldLogger, repositorySvc repositoryservice.Service, repoTesterMapper RepoTesterMapping) *RepoTester

func (*RepoTester) SetAccessCondition

func (r *RepoTester) SetAccessCondition(ctx context.Context, orgId uuid.UUID, repository *domain.Repository, err error) error

func (*RepoTester) TestRepositories

func (r *RepoTester) TestRepositories(ctx context.Context, orgId uuid.UUID)

type RepoTesterMapping added in v1.1.0

type RepoTesterMapping func(repository *domain.Repository) TypeSpecificRepoTester

RepoTesterMapping maps a repository to its appropriate TypeSpecificRepoTester. Returns nil if the repository type is unsupported.

type RepositoryUpdateLogic

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

func NewRepositoryUpdateLogic

func NewRepositoryUpdateLogic(log logrus.FieldLogger, repositorySvc repositoryservice.Service, eventSvc eventservice.Service, orgId uuid.UUID, event domain.Event) RepositoryUpdateLogic

func (*RepositoryUpdateLogic) HandleRepositoryUpdate

func (t *RepositoryUpdateLogic) HandleRepositoryUpdate(ctx context.Context) error

type ResourceSync

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

func NewResourceSync

func NewResourceSync(repositorySvc repositoryservice.Service, fleetSvc fleetservice.Service, resourcesyncSvc resourcesyncservice.Service, catalogSvc catalogservice.Service, log logrus.FieldLogger, cfg *config.Config, ignoreResourceUpdates []string) *ResourceSync

func (*ResourceSync) GetRepositoryAndValidateAccess added in v0.9.0

func (r *ResourceSync) GetRepositoryAndValidateAccess(ctx context.Context, orgId uuid.UUID, rs *domain.ResourceSync) (*domain.Repository, error)

GetRepositoryAndValidateAccess gets the repository and validates it's accessible

func (*ResourceSync) ParseFleetsFromResources added in v0.9.0

func (r *ResourceSync) ParseFleetsFromResources(resources []GenericResourceMap, resourceName string) ([]*domain.Fleet, error)

ParseFleetsFromResources parses fleets from generic resources

func (*ResourceSync) Poll

func (r *ResourceSync) Poll(ctx context.Context, orgId uuid.UUID)

func (*ResourceSync) SyncCatalogItems added in v1.1.0

func (r *ResourceSync) SyncCatalogItems(ctx context.Context, log logrus.FieldLogger, orgId uuid.UUID, rs *domain.ResourceSync, items []*domain.CatalogItem, resourceName string) ([]string, error)

SyncCatalogItems creates/updates catalog items and returns the list of stale item keys to delete. Deletion is handled separately by the caller to ensure correct dependency ordering (CatalogItems must be deleted before Catalogs).

func (*ResourceSync) SyncCatalogs added in v1.1.0

func (r *ResourceSync) SyncCatalogs(ctx context.Context, log logrus.FieldLogger, orgId uuid.UUID, rs *domain.ResourceSync, catalogs []*domain.Catalog, resourceName string) ([]string, error)

SyncCatalogs creates/updates catalogs and returns the list of stale catalog names to delete. Deletion is handled separately by the caller to ensure correct dependency ordering (CatalogItems must be deleted before Catalogs).

func (*ResourceSync) SyncFleets added in v0.9.0

func (r *ResourceSync) SyncFleets(ctx context.Context, log logrus.FieldLogger, orgId uuid.UUID, rs *domain.ResourceSync, fleets []*domain.Fleet, resourceName string) error

SyncFleets syncs the fleets to the service

type TypeSpecificRepoTester

type TypeSpecificRepoTester interface {
	TestAccess(ctx context.Context, repository *domain.Repository) error
}

func DefaultRepoTesterMapping added in v1.1.0

func DefaultRepoTesterMapping(repository *domain.Repository) TypeSpecificRepoTester

DefaultRepoTesterMapping returns the appropriate TypeSpecificRepoTester based on the repository spec. Returns nil if the repository type is unsupported.

type VmConverterFn added in v1.3.0

type VmConverterFn func(ctx context.Context, vmYAML []byte) (files map[string]string, stderr string, err error)

VmConverterFn accepts KubeVirt VM YAML on stdin and returns a map of Quadlet unit filename → content, read from the TAR stream that vm-to-quadlet writes to stdout. Passed explicitly to renderVmApplication — no package-level variable is used so tests can inject stubs without sharing state.

func NewVmConverter added in v1.3.0

func NewVmConverter(binaryPath string, opts VmRenderOptions) VmConverterFn

NewVmConverter returns a VmConverterFn that invokes the vm-to-quadlet binary at binaryPath with the given render options. The binary reads VM YAML from stdin and writes a TAR archive of Quadlet unit files to stdout. binaryPath may be an absolute path or a bare binary name resolved via PATH. Exported so integration tests can point the converter at a binary extracted to a temporary directory.

type VmRenderOptions added in v1.3.0

type VmRenderOptions struct {
	LauncherImage    string
	PasstWorkarounds bool
}

VmRenderOptions controls vm-to-quadlet conversion for VmApplications.

func DefaultVmRenderOptions added in v1.3.0

func DefaultVmRenderOptions() VmRenderOptions

DefaultVmRenderOptions returns the default conversion options.

type VulnerabilitySync added in v1.2.0

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

VulnerabilitySync queries Trustify for CVE findings for each unique OS image digest currently deployed across all devices, and upserts the results into the vulnerability_findings table.

func NewVulnerabilitySync added in v1.2.0

func NewVulnerabilitySync(
	log logrus.FieldLogger,
	vulnClient trustifyv2.VulnerabilityClient,
	findingStore FindingStoreUpsertLister,
	checkpoint CheckpointStore,
	eventEmitter CVEEventEmitter,
) *VulnerabilitySync

func (*VulnerabilitySync) Poll added in v1.2.0

func (t *VulnerabilitySync) Poll(ctx context.Context)

Poll discovers all deployed image digests, fetches their CVE findings from Trustify, upserts the results, and emits CVE lifecycle events using a delta-based approach.

Jump to

Keyboard shortcuts

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