Movatterモバイル変換


[0]ホーム

URL:


provisionerdserver

package
v2.23.0Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License:AGPL-3.0Imports:50Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

View Source
const (// DefaultAcquireJobLongPollDur is the time the (deprecated) AcquireJob rpc waits to try to obtain a job before// canceling and returning an empty job.DefaultAcquireJobLongPollDur =time.Second * 5// DefaultHeartbeatInterval is the interval at which the provisioner daemon// will update its last seen at timestamp in the database.DefaultHeartbeatInterval =time.Minute// StaleInterval is the amount of time after the last heartbeat for which// the provisioner will be reported as 'stale'.StaleInterval = 90 *time.Second)

Variables

View Source
var ErrTagsContainNullByte =xerrors.New("tags cannot contain the null byte (0x00)")

Functions

funcInsertWorkspaceModuleadded inv2.18.0

func InsertWorkspaceModule(ctxcontext.Context, dbdatabase.Store, jobIDuuid.UUID, transitiondatabase.WorkspaceTransition, protoModule *sdkproto.Module, snapshot *telemetry.Snapshot)error

funcInsertWorkspacePresetAndParametersadded inv2.20.0

func InsertWorkspacePresetAndParameters(ctxcontext.Context, dbdatabase.Store, templateVersionIDuuid.UUID, protoPreset *sdkproto.Preset, ttime.Time)error

funcInsertWorkspacePresetsAndParametersadded inv2.20.0

func InsertWorkspacePresetsAndParameters(ctxcontext.Context, loggerslog.Logger, dbdatabase.Store, jobIDuuid.UUID, templateVersionIDuuid.UUID, protoPresets []*sdkproto.Preset, ttime.Time)error

funcInsertWorkspaceResource

func InsertWorkspaceResource(ctxcontext.Context, dbdatabase.Store, jobIDuuid.UUID, transitiondatabase.WorkspaceTransition, protoResource *sdkproto.Resource, snapshot *telemetry.Snapshot)error

funcNewServeradded inv2.1.5

func NewServer(lifecycleCtxcontext.Context,apiVersionstring,accessURL *url.URL,iduuid.UUID,organizationIDuuid.UUID,loggerslog.Logger,provisioners []database.ProvisionerType,tagsTags,dbdatabase.Store,pspubsub.Pubsub,acquirer *Acquirer,teltelemetry.Reporter,tracertrace.Tracer,quotaCommitter *atomic.Pointer[proto.QuotaCommitter],auditor *atomic.Pointer[audit.Auditor],templateScheduleStore *atomic.Pointer[schedule.TemplateScheduleStore],userQuietHoursScheduleStore *atomic.Pointer[schedule.UserQuietHoursScheduleStore],deploymentValues *codersdk.DeploymentValues,optionsOptions,enqueuernotifications.Enqueuer,prebuildsOrchestrator *atomic.Pointer[prebuilds.ReconciliationOrchestrator],) (proto.DRPCProvisionerDaemonServer,error)

Types

typeAcquireradded inv2.2.0

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

Acquirer is shared among multiple routines that need to calldatabase.Store.AcquireProvisionerJob. The callers that acquire jobs are called "acquirees". Thegoal is to minimize polling the database (i.e. lower our average query rate) and simplify theacquiree's logic by handling retrying the database if a job is not available at the time of thecall.

When multiple acquirees share a set of provisioner types and tags, we define them as part of thesame "domain". Only one acquiree from each domain may query the database at a time. If thedatabase returns no jobs for that acquiree, the entire domain waits until the Acquirer isnotified over the pubsub of a new job acceptable to the domain.

As a backup to pubsub notifications, each domain is allowed to query periodically once every 30s.This ensures jobs are not stuck permanently if the service that created them fails to publish(e.g. a crash).

funcNewAcquireradded inv2.2.0

func NewAcquirer(ctxcontext.Context, loggerslog.Logger, storeAcquirerStore, pspubsub.Pubsub,opts ...AcquirerOption,) *Acquirer

func (*Acquirer)AcquireJobadded inv2.2.0

func (a *Acquirer) AcquireJob(ctxcontext.Context, organizationuuid.UUID, workeruuid.UUID, pt []database.ProvisionerType, tagsTags,) (retJobdatabase.ProvisionerJob, retErrerror,)

AcquireJob acquires a job with one of the given provisioner types and compatibletags from the database. The call blocks until a job is acquired, the context isdone, or the database returns an error _other_ than that no jobs are available.If no jobs are available, this method handles retrying as appropriate.

typeAcquirerOptionadded inv2.2.0

type AcquirerOption func(*Acquirer)

funcTestingBackupPollDurationadded inv2.2.0

func TestingBackupPollDuration(durtime.Duration)AcquirerOption

typeAcquirerStoreadded inv2.2.0

type AcquirerStore interface {AcquireProvisionerJob(context.Context,database.AcquireProvisionerJobParams) (database.ProvisionerJob,error)}

AcquirerStore is the subset of database.Store that the Acquirer needs

typeOptionsadded inv2.1.5

type Options struct {OIDCConfigpromoauth.OAuth2ConfigExternalAuthConfigs []*externalauth.Config// Clock for testingClockquartz.Clock// AcquireJobLongPollDur is used in testsAcquireJobLongPollDurtime.Duration// HeartbeatInterval is the interval at which the provisioner daemon// will update its last seen at timestamp in the database.HeartbeatIntervaltime.Duration// HeartbeatFn is the function that will be called at the interval// specified by HeartbeatInterval.// The default function just calls UpdateProvisionerDaemonLastSeenAt.// This is mainly used for testing.HeartbeatFn func(context.Context)error}

typeTagsadded inv2.2.0

type Tags map[string]string

func (Tags)ToJSONadded inv2.2.0

func (tTags) ToJSON() (json.RawMessage,error)

func (Tags)Validadded inv2.2.0

func (tTags) Valid()error

typeTemplateVersionDryRunJob

type TemplateVersionDryRunJob struct {TemplateVersionIDuuid.UUID                          `json:"template_version_id"`WorkspaceNamestring                             `json:"workspace_name"`RichParameterValues []database.WorkspaceBuildParameter `json:"rich_parameter_values"`}

TemplateVersionDryRunJob is the payload for the "template_version_dry_run" job type.

typeTemplateVersionImportJob

type TemplateVersionImportJob struct {TemplateVersionIDuuid.UUID                `json:"template_version_id"`UserVariableValues []codersdk.VariableValue `json:"user_variable_values"`}

typeWorkspaceProvisionJob

type WorkspaceProvisionJob struct {WorkspaceBuildIDuuid.UUID                            `json:"workspace_build_id"`DryRunbool                                 `json:"dry_run"`LogLevelstring                               `json:"log_level,omitempty"`PrebuiltWorkspaceBuildStagesdkproto.PrebuiltWorkspaceBuildStage `json:"prebuilt_workspace_stage,omitempty"`}

WorkspaceProvisionJob is the payload for the "workspace_provision" job type.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp