Documentation
¶
Index ¶
- Constants
- Variables
- func CloneGitRepo(ctx context.Context, repo *domain.Repository, revision *string, depth *int, ...) (billy.Filesystem, string, error)
- func CloneGitRepoToIgnition(ctx context.Context, repo *domain.Repository, revision string, path string, ...) (*config_latest_types.Config, string, error)
- func ConvertFileSystemToIgnition(mfs billy.Filesystem, path string) (*config_latest_types.Config, error)
- func DesiredSpecFromTemplate(device *domain.Device, tv *domain.TemplateVersion) (*domain.DeviceSpec, error)
- func EmitInternalTaskFailedEvent(ctx context.Context, orgID uuid.UUID, errorMessage string, ...)
- func EncryptionMigrationCheckpointKey(kind string, orgID uuid.UUID) string
- func EnqueueEncryptionMigration(ctx context.Context, publisher queues.QueueProducer, kind string, ...) error
- func EnqueueEncryptionMigrationIfNeeded(ctx context.Context, publisher queues.QueueProducer, ...) error
- func FormatIECBytes(n int64) string
- func GitLsRemote(ctx context.Context, repoURL string, refs []string, options *git.ListOptions) (map[string]string, error)
- func ImageRepositoryFromRef(imageRef string) (string, error)
- func LaunchConsumers(ctx context.Context, queuesProvider queues.Provider, d TaskConsumer, ...) error
- func NeedsSyncToHash(rs *domain.ResourceSync, hash string) bool
- func ReplaceParametersInString(s string, device *domain.Device) (string, error)
- type API
- type CVEEventEmitter
- type CheckpointStore
- type ConfigRefFingerprint
- type DeltaPrepareDeadline
- type DependencySyncGit
- type DependencySyncHttp
- type DependencySyncSecret
- type DeviceConnection
- type DeviceLabelReconciliationLogic
- type DeviceRenderLogic
- func (t *DeviceRenderLogic) RenderDevice(ctx context.Context, orgId uuid.UUID, event domain.Event) error
- func (t *DeviceRenderLogic) RenderHelmImageRefs(ctx context.Context, orgID uuid.UUID, device *domain.Device, ...) ([]string, error)
- func (t *DeviceRenderLogic) RenderSpec(ctx context.Context, orgId uuid.UUID, spec *domain.DeviceSpec) (RenderedSpec, error)
- func (t *DeviceRenderLogic) RenderSpecForDevice(ctx context.Context, orgId uuid.UUID, device *domain.Device, ...) (RenderedSpec, error)
- func (t *DeviceRenderLogic) WithHelmImageRenderer(renderer helmImageRenderer) *DeviceRenderLogic
- func (t *DeviceRenderLogic) WithVmConverter(fn VmConverterFn) *DeviceRenderLogic
- type EncryptionMigratableRow
- type EncryptionMigrationCheckpoint
- type EncryptionMigrationLocker
- type EncryptionMigrationReport
- type EncryptionMigrationResource
- type EncryptionMigrationWork
- type EncryptionMigrator
- func (m *EncryptionMigrator) IncompleteWork(ctx context.Context) ([]EncryptionMigrationWork, error)
- func (m *EncryptionMigrator) NeedsMigration(ctx context.Context) (bool, error)
- func (m *EncryptionMigrator) RegisterResource(resource EncryptionMigrationResource)
- func (m *EncryptionMigrator) RunBatch(ctx context.Context, kind string, orgID uuid.UUID) (EncryptionMigrationReport, error)
- func (m *EncryptionMigrator) SetBatchSize(n int)
- func (m *EncryptionMigrator) SetErrorBackoff(d time.Duration)
- func (m *EncryptionMigrator) SetOrganizations(orgs []uuid.UUID)
- func (m *EncryptionMigrator) SetRegistryHashOverride(hash string)
- type EventCleanup
- type FindingStoreUpsertLister
- type FleetApplicationLifecycleLogic
- type FleetRolloutsLogic
- type FleetSelectorMatchingLogic
- type FleetValidateLogic
- type FleetValidationResult
- type GenericResourceMap
- type GitRepoTester
- type HttpRepoTester
- type LabelMappingScanConfig
- type LabelMappingScanTask
- type OciRepoTester
- type PopulateDependencyRefsLogic
- type PostgresEncryptionMigrationLocker
- type ProcessingStats
- type QueueMaintenanceTask
- type RenderItem
- type RenderedSpec
- type RepoTester
- type RepoTesterMapping
- type RepositoryUpdateLogic
- type ResourceSync
- func (r *ResourceSync) GetRepositoryAndValidateAccess(ctx context.Context, orgId uuid.UUID, rs *domain.ResourceSync) (*domain.Repository, error)
- func (r *ResourceSync) ParseFleetsFromResources(resources []GenericResourceMap, resourceName string) ([]*domain.Fleet, error)
- func (r *ResourceSync) Poll(ctx context.Context, orgId uuid.UUID)
- func (r *ResourceSync) SyncCatalogItems(ctx context.Context, log logrus.FieldLogger, orgId uuid.UUID, ...) ([]string, error)
- func (r *ResourceSync) SyncCatalogs(ctx context.Context, log logrus.FieldLogger, orgId uuid.UUID, ...) ([]string, error)
- func (r *ResourceSync) SyncFleets(ctx context.Context, log logrus.FieldLogger, orgId uuid.UUID, ...) error
- type TaskConsumer
- type TypeSpecificRepoTester
- type VmConverterFn
- type VmRenderOptions
- type VulnerabilitySync
Constants ¶
const ( ItemsPerPage = 1000 EventProcessingTimeout = 10 * time.Second AckTimeout = 5 * time.Second // EnrollmentHookNotifyProcessingTimeout is the time budget and queue-lease // allowance for enrollment hook webhook delivery. It matches // webhookdelivery.DefaultDeadline so delivery is not canceled or reclaimed // by the shared EventProcessingTimeout. EnrollmentHookNotifyProcessingTimeout = 10 * time.Minute )
const ( // DeviceConnectionPollingInterval is the interval at which the device connection status task runs (disconnection and reconnection). DeviceConnectionPollingInterval = 2 * time.Minute DeviceConnectionTaskName = "device-connection" )
const ( // EventCleanupPollingInterval is the interval at which the event cleanup task runs. EventCleanupPollingInterval = 10 * time.Minute EventCleanupTaskName = "event-cleanup" )
const ( // VulnerabilitySyncInterval is the default interval between vulnerability sync runs. VulnerabilitySyncInterval = 15 * time.Minute VulnerabilitySyncTaskName = "vulnerability-sync" )
const DeltaPrepareDeadlinePollingInterval = time.Minute
const (
// EncryptionMigrationConsumer is the checkpoint consumer name for migration progress.
EncryptionMigrationConsumer = "encryption-migration"
)
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.
const RepoTesterTaskName = "repository-tester"
const ResourceSyncTaskName = "resourcesync"
Variables ¶
var ( ErrUnknownConfigName = errors.New("failed to find configuration item name") ErrUnknownApplicationType = errors.New("unknown application type") )
Functions ¶
func CloneGitRepo ¶
func CloneGitRepoToIgnition ¶ added in v0.4.0
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 DesiredSpecFromTemplate ¶ added in v1.4.0
func DesiredSpecFromTemplate(device *domain.Device, tv *domain.TemplateVersion) (*domain.DeviceSpec, error)
func EmitInternalTaskFailedEvent ¶ added in v0.10.0
func EncryptionMigrationCheckpointKey ¶ added in v1.3.0
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 FormatIECBytes ¶ added in v1.4.0
func GitLsRemote ¶ added in v1.2.0
func GitLsRemote(ctx context.Context, repoURL string, refs []string, options *git.ListOptions) (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. The caller's context controls the deadline. ListOptions.Timeout applies to Remote.List, whereas this function uses Remote.ListContext.
func ImageRepositoryFromRef ¶ added in v1.4.0
func LaunchConsumers ¶
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.
Types ¶
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
ConfigRefFingerprint holds the fingerprint captured for one config provider at render time.
type DeltaPrepareDeadline ¶ added in v1.4.0
type DeltaPrepareDeadline struct {
// contains filtered or unexported fields
}
func NewDeltaPrepareDeadline ¶ added in v1.4.0
func NewDeltaPrepareDeadline(log logrus.FieldLogger, deltaStore prepareDeadlineStore, prepareSvc deltaprepare.Service, fleetSvc fleetservice.Service, deviceSvc deviceservice.Service, tvSvc templateversionservice.Service, eventSvc eventservice.Service) *DeltaPrepareDeadline
func (*DeltaPrepareDeadline) Poll ¶ added in v1.4.0
func (t *DeltaPrepareDeadline) Poll(ctx context.Context)
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
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
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
type DeviceLabelReconciliationLogic ¶ added in v1.4.0
type DeviceLabelReconciliationLogic struct {
// contains filtered or unexported fields
}
DeviceLabelReconciliationLogic reconciles one device using current persisted state.
func NewDeviceLabelReconciliationLogic ¶ added in v1.4.0
func NewDeviceLabelReconciliationLogic(log logrus.FieldLogger, service labelsyncmappingservice.Service, orgID uuid.UUID, event domain.Event) (DeviceLabelReconciliationLogic, error)
NewDeviceLabelReconciliationLogic builds worker logic from an event's resource identity.
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) *DeviceRenderLogic
func NewDeviceRenderLogicWithDeltaStore ¶ added in v1.4.0
func NewDeviceRenderLogicWithDeltaStore(log logrus.FieldLogger, deviceSvc deviceservice.Service, repositorySvc repositoryservice.Service, catalogSvc catalogservice.Service, k8sClient k8sclient.K8SClient, kvStore kvstore.KVStore, deltaStore delta.Store, cfg *config.Config) (*DeviceRenderLogic, error)
NewDeviceRenderLogicWithDeltaStore creates device-render logic with the dependencies required to look up OS delta hints. NewDeviceRenderLogic is also used for spec-only rendering, which does not need a delta store.
func (*DeviceRenderLogic) RenderDevice ¶
func (t *DeviceRenderLogic) RenderDevice(ctx context.Context, orgId uuid.UUID, event domain.Event) error
RenderDevice processes one device event. orgId and event are call-scoped so the renderer's startup-owned dependencies can be reused across events.
func (*DeviceRenderLogic) RenderHelmImageRefs ¶ added in v1.4.0
func (t *DeviceRenderLogic) RenderHelmImageRefs( ctx context.Context, orgID uuid.UUID, device *domain.Device, app v1beta1.HelmApplication, renderedConfig []byte, ) ([]string, error)
RenderHelmImageRefs renders a target Helm application using the resolved config files that will be delivered to the device and returns its workload image references. The same method is used during delta preparation and when attaching delta hints to a rendered device spec.
func (*DeviceRenderLogic) RenderSpec ¶ added in v1.4.0
func (t *DeviceRenderLogic) RenderSpec(ctx context.Context, orgId uuid.UUID, spec *domain.DeviceSpec) (RenderedSpec, error)
RenderSpec resolves a spec for orgId without device-event state.
func (*DeviceRenderLogic) RenderSpecForDevice ¶ added in v1.4.0
func (t *DeviceRenderLogic) RenderSpecForDevice(ctx context.Context, orgId uuid.UUID, device *domain.Device, spec *domain.DeviceSpec) (RenderedSpec, error)
RenderSpecForDevice resolves a spec using the VM render options selected for the device's reported OS, matching the options used by RenderDevice.
func (*DeviceRenderLogic) WithHelmImageRenderer ¶ added in v1.4.0
func (t *DeviceRenderLogic) WithHelmImageRenderer(renderer helmImageRenderer) *DeviceRenderLogic
WithHelmImageRenderer returns a copy configured with a renderer implementation. This keeps Helm command execution injectable in unit tests.
func (*DeviceRenderLogic) WithVmConverter ¶ added in v1.3.0
func (t *DeviceRenderLogic) WithVmConverter(fn VmConverterFn) *DeviceRenderLogic
WithVmConverter returns a copy of DeviceRenderLogic configured with 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
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
func (m *EncryptionMigrator) RunBatch(ctx context.Context, kind string, orgID uuid.UUID) (EncryptionMigrationReport, error)
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 {
ListDeployedImageRefs(ctx context.Context) ([]vulnerability.ImageRef, 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.Service the sync task depends on for finding ingestion. Implemented by the owning service.
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
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 {
WorkerClient worker_client.WorkerClient
// contains filtered or unexported fields
}
func NewFleetValidateLogic ¶
func NewFleetValidateLogic(log logrus.FieldLogger, fleetSvc fleetservice.Service, templateversionSvc templateversionservice.Service, _ 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
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 LabelMappingScanConfig ¶ added in v1.4.0
LabelMappingScanConfig bounds the amount of device work performed by one poll.
type LabelMappingScanTask ¶ added in v1.4.0
type LabelMappingScanTask struct {
// contains filtered or unexported fields
}
LabelMappingScanTask runs a resumable device-label mapping scan for one org.
func NewLabelMappingScanTask ¶ added in v1.4.0
func NewLabelMappingScanTask( reconciler labelsyncmappingservice.Service, deviceSvc deviceservice.Service, checkpoints checkpointservice.Service, config LabelMappingScanConfig, log logrus.FieldLogger, ) (*LabelMappingScanTask, 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
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
type ProcessingStats ¶ added in v0.9.0
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, deltaGenerationTimeout time.Duration, completionTimeout time.Duration, queuesProvider queues.Provider, workerClient worker_client.WorkerClient, workerMetrics *worker.WorkerCollector) *QueueMaintenanceTask
NewQueueMaintenanceTask creates a new queue maintenance task
type RenderItem ¶ added in v0.3.0
type RenderedSpec ¶ added in v1.4.0
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) 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 TaskConsumer ¶ added in v1.4.0
type TaskConsumer struct {
FleetSvc fleetservice.Service
TemplateversionSvc templateversionservice.Service
DeviceSvc deviceservice.Service
DependencyrefSvc dependencyrefservice.Service
RepositorySvc repositoryservice.Service
CatalogSvc catalogservice.Service
EventSvc eventservice.Service
EnrollmentRequestSvc enrollmentrequestservice.Service
NotifySecretsStore enrollmenthooknotifysecrets.Store
K8sClient k8sclient.K8SClient
KVStore kvstore.KVStore
Cfg *config.Config
WorkerMetrics *worker.WorkerCollector
EncryptionMigrator *EncryptionMigrator
QueuePublisher queues.QueueProducer
WorkerClient worker_client.WorkerClient
DeviceRenderer *DeviceRenderLogic
LabelSyncMappingSvc labelsyncmappingservice.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
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 scans each unique OS image digest currently deployed across all devices for CVE findings and upserts the results into the vulnerability_findings table.
func NewVulnerabilitySync ¶ added in v1.2.0
func NewVulnerabilitySync( log logrus.FieldLogger, scanner vulnerability.Scanner, findingStore FindingStoreUpsertLister, checkpoint CheckpointStore, eventEmitter CVEEventEmitter, source config.VulnerabilityBackend, ) *VulnerabilitySync
func (*VulnerabilitySync) Poll ¶ added in v1.2.0
func (t *VulnerabilitySync) Poll(ctx context.Context)
Poll discovers all deployed image digests, scans them for CVE findings, upserts the results, and emits CVE lifecycle events using a delta-based approach.
Source Files
¶
- common.go
- consumer.go
- delta_prepare_deadline.go
- dependency_sync_git.go
- dependency_sync_http.go
- dependency_sync_secret.go
- dependency_sync_status.go
- desired_spec.go
- device_connection.go
- device_label_reconciliation.go
- device_render.go
- device_render_vm.go
- encryption_migration.go
- encryption_migration_enqueue.go
- encryption_migration_events.go
- encryption_migration_lock.go
- encryption_migration_resources.go
- enrollment_hook_notify.go
- event_cleanup.go
- fleet_application_lifecycle.go
- fleet_rollout.go
- fleet_selector.go
- fleet_validate.go
- git_helpers.go
- http_helpers.go
- labelsyncmapping_scan.go
- os_delta_hint.go
- populate_dependency_refs.go
- queue_maintenance.go
- render_errors.go
- repo_update.go
- repotester.go
- resourcesync.go
- vulnerability_sync.go