Documentation
¶
Index ¶
- Constants
- func GetCanceledStreamKey(orgID uuid.UUID, imageExportName string) string
- func GetImageBuildCanceledStreamKey(orgID uuid.UUID, imageBuildName string) string
- func LaunchConsumers(ctx context.Context, queuesProvider queues.Provider, ...) error
- func StartStatusUpdater(ctx context.Context, cancelBuild func(), ...) (*statusUpdater, func())
- type Consumer
- func (c *Consumer) CheckAndMarkTimeoutsForOrg(ctx context.Context, orgID uuid.UUID, timeoutDuration time.Duration, ...) (int, error)
- func (c *Consumer) Consume(ctx context.Context, payload []byte, entryID string, ...) error
- func (c *Consumer) HandleImageBuildUpdate(ctx context.Context, eventWithOrgId worker_client.EventWithOrgId, ...) error
- func (c *Consumer) RunRequeueOnStartup(ctx context.Context)
- type ContainerfileResult
- type EnrollmentCredentialGenerator
Constants ¶
const ( // AckTimeout is the timeout for acknowledging messages AckTimeout = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func GetCanceledStreamKey ¶
GetCanceledStreamKey returns the Redis stream key used for signaling cancellation completion
func GetImageBuildCanceledStreamKey ¶
GetImageBuildCanceledStreamKey returns the Redis stream key used for signaling cancellation completion This is exported so the API service can use the same key format
func LaunchConsumers ¶
func LaunchConsumers( ctx context.Context, queuesProvider queues.Provider, store imagebuilderstore.Store, mainStore store.Store, kvStore kvstore.KVStore, serviceHandler *service.ServiceHandler, imageBuilderService imagebuilderapi.Service, cfg *config.Config, log logrus.FieldLogger, ) error
LaunchConsumers starts the specified number of queue consumers for imagebuild jobs
func StartStatusUpdater ¶
func StartStatusUpdater( ctx context.Context, cancelBuild func(), imageBuildService imagebuilderapi.ImageBuildService, orgID uuid.UUID, imageBuildName string, kvStore kvstore.KVStore, cfg *config.Config, log logrus.FieldLogger, ) (*statusUpdater, func())
StartStatusUpdater starts a goroutine that is the single writer for ImageBuild status updates. It receives condition updates via a channel and periodically updates LastSeen. It also listens for cancellation signals via Redis Stream and calls cancelBuild when received. Returns the updater and a cleanup function. Exported for testing purposes.
Types ¶
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer handles incoming jobs from the queue and routes them to appropriate handlers
func NewConsumer ¶
func NewConsumer( store imagebuilderstore.Store, mainStore store.Store, kvStore kvstore.KVStore, serviceHandler *service.ServiceHandler, imageBuilderService imagebuilderapi.Service, queueProducer queues.QueueProducer, cfg *config.Config, log logrus.FieldLogger, ) *Consumer
NewConsumer creates a new Consumer instance with the provided dependencies
func (*Consumer) CheckAndMarkTimeoutsForOrg ¶
func (c *Consumer) CheckAndMarkTimeoutsForOrg(ctx context.Context, orgID uuid.UUID, timeoutDuration time.Duration, log logrus.FieldLogger) (int, error)
CheckAndMarkTimeoutsForOrg checks for timed-out image builds and exports in a specific organization This method is public to allow testing with mocked services Returns the number of resources moved to fail
func (*Consumer) Consume ¶
func (c *Consumer) Consume(ctx context.Context, payload []byte, entryID string, consumer queues.QueueConsumer, log logrus.FieldLogger) error
Consume handles incoming events from the queue and routes them to appropriate handlers
func (*Consumer) HandleImageBuildUpdate ¶
func (c *Consumer) HandleImageBuildUpdate(ctx context.Context, eventWithOrgId worker_client.EventWithOrgId, log logrus.FieldLogger) error
HandleImageBuildUpdate handles ImageBuild ResourceUpdated events If the ImageBuild is completed, it requeues related ImageExports that haven't started yet This method is public to allow testing with mocked services
func (*Consumer) RunRequeueOnStartup ¶
RunRequeueOnStartup runs the requeue task once on startup This method is public to allow testing with mocked services
type ContainerfileResult ¶
type ContainerfileResult struct {
// Containerfile is the generated Containerfile content (static template)
Containerfile string
// BuildArgs contains the arguments to pass to podman build via --build-arg
BuildArgs containerfileBuildArgs
// AgentConfig contains the full agent config.yaml content (for early binding)
// This includes: client-certificate-data, client-key-data, certificate-authority-data, server URL
AgentConfig []byte
// Publickey contains the SSH public key content (for user configuration)
Publickey []byte
}
ContainerfileResult contains the generated Containerfile and any associated files
func GenerateContainerfile ¶
func GenerateContainerfile( ctx context.Context, mainStore store.Store, credentialGenerator EnrollmentCredentialGenerator, orgID uuid.UUID, imageBuild *api.ImageBuild, log logrus.FieldLogger, ) (*ContainerfileResult, error)
GenerateContainerfile generates a Containerfile from an ImageBuild spec This function is exported for testing purposes
type EnrollmentCredentialGenerator ¶
type EnrollmentCredentialGenerator interface {
GenerateEnrollmentCredential(ctx context.Context, orgId uuid.UUID, baseName string, ownerKind string, ownerName string) (*crypto.EnrollmentCredential, v1beta1.Status)
}
EnrollmentCredentialGenerator is an interface for generating enrollment credentials This allows for easier testing by mocking the service handler