Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit217e46f

Browse files
committed
Reverting unncessary changes
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
1 parentd9497df commit217e46f

File tree

11 files changed

+45
-152
lines changed

11 files changed

+45
-152
lines changed

‎coderd/apidoc/docs.go‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/provisionerdserver/provisionerdserver.go‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,14 +2473,7 @@ type WorkspaceProvisionJob struct {
24732473
DryRunbool`json:"dry_run"`
24742474
IsPrebuildbool`json:"is_prebuild,omitempty"`
24752475
PrebuildClaimedByUser uuid.UUID`json:"prebuild_claimed_by,omitempty"`
2476-
// RunningWorkspaceAgentID is *only* used for prebuilds. We pass it down when we want to rebuild a prebuilt workspace
2477-
// but not generate a new agent token. The provisionerdserver will retrieve this token and push it down to
2478-
// the provisioner (and ultimately to the `coder_agent` resource in the Terraform provider) where it will be
2479-
// reused. Context: the agent token is often used in immutable attributes of workspace resource (e.g. VM/container)
2480-
// to initialize the agent, so if that value changes it will necessitate a replacement of that resource, thus
2481-
// obviating the whole point of the prebuild.
2482-
RunningWorkspaceAgentID uuid.UUID`json:"running_workspace_agent_id"`
2483-
LogLevelstring`json:"log_level,omitempty"`
2476+
LogLevelstring`json:"log_level,omitempty"`
24842477
}
24852478

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

‎coderd/workspaces.go‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@ import (
66
"encoding/json"
77
"errors"
88
"fmt"
9-
"github.com/coder/coder/v2/coderd/prebuilds"
109
"net/http"
1110
"slices"
1211
"strconv"
1312
"time"
1413

14+
"github.com/coder/coder/v2/coderd/prebuilds"
15+
1516
"github.com/dustin/go-humanize"
1617
"github.com/go-chi/chi/v5"
1718
"github.com/google/uuid"
1819
"golang.org/x/sync/errgroup"
1920
"golang.org/x/xerrors"
2021

2122
"cdr.dev/slog"
23+
2224
"github.com/coder/coder/v2/agent/proto"
2325
"github.com/coder/coder/v2/coderd/audit"
2426
"github.com/coder/coder/v2/coderd/database"
@@ -636,8 +638,6 @@ func createWorkspace(
636638
provisionerJob*database.ProvisionerJob
637639
workspaceBuild*database.WorkspaceBuild
638640
provisionerDaemons []database.GetEligibleProvisionerDaemonsByProvisionerJobIDsRow
639-
640-
runningWorkspaceAgentID uuid.UUID
641641
)
642642

643643
prebuilds:= (*api.PrebuildsClaimer.Load()).(prebuilds.Claimer)
@@ -685,16 +685,6 @@ func createWorkspace(
685685
// Prebuild found!
686686
workspaceID=claimedWorkspace.ID
687687
initiatorID=prebuilds.Initiator()
688-
agents,err:=db.GetWorkspaceAgentsInLatestBuildByWorkspaceID(ctx,claimedWorkspace.ID)
689-
iferr!=nil {
690-
// TODO: comment about best-effort, workspace can be restarted if this fails...
691-
api.Logger.Error(ctx,"failed to retrieve running agents of claimed prebuilt workspace",
692-
slog.F("workspace_id",claimedWorkspace.ID),slog.Error(err))
693-
}
694-
iflen(agents)>=1 {
695-
// TODO: handle multiple agents
696-
runningWorkspaceAgentID=agents[0].ID
697-
}
698688
}
699689

700690
// We have to refetch the workspace for the joined in fields.
@@ -710,8 +700,7 @@ func createWorkspace(
710700
Initiator(initiatorID).
711701
ActiveVersion().
712702
RichParameterValues(req.RichParameterValues).
713-
TemplateVersionPresetID(req.TemplateVersionPresetID).
714-
RunningWorkspaceAgentID(runningWorkspaceAgentID)
703+
TemplateVersionPresetID(req.TemplateVersionPresetID)
715704
ifreq.TemplateVersionID!=uuid.Nil {
716705
builder=builder.VersionID(req.TemplateVersionID)
717706
}

‎coderd/wsbuilder/wsbuilder.go‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ type Builder struct {
7777

7878
prebuildbool
7979
prebuildClaimedBy uuid.UUID
80-
runningWorkspaceAgentID uuid.UUID
8180

8281
verifyNoLegacyParametersOncebool
8382
}
@@ -186,13 +185,6 @@ func (b Builder) MarkPrebuildClaimedBy(userID uuid.UUID) Builder {
186185
returnb
187186
}
188187

189-
// RunningWorkspaceAgentID is only used for prebuilds; see the associated field in `provisionerdserver.WorkspaceProvisionJob`.
190-
func (bBuilder)RunningWorkspaceAgentID(id uuid.UUID)Builder {
191-
// nolint: revive
192-
b.runningWorkspaceAgentID=id
193-
returnb
194-
}
195-
196188
// SetLastWorkspaceBuildInTx prepopulates the Builder's cache with the last workspace build. This allows us
197189
// to avoid a repeated database query when the Builder's caller also needs the workspace build, e.g. auto-start &
198190
// auto-stop.
@@ -328,7 +320,6 @@ func (b *Builder) buildTx(authFunc func(action policy.Action, object rbac.Object
328320
LogLevel:b.logLevel,
329321
IsPrebuild:b.prebuild,
330322
PrebuildClaimedByUser:b.prebuildClaimedBy,
331-
RunningWorkspaceAgentID:b.runningWorkspaceAgentID,
332323
})
333324
iferr!=nil {
334325
returnnil,nil,nil,BuildError{

‎codersdk/deployment.go‎

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ const (
8181
FeatureControlSharedPortsFeatureName="control_shared_ports"
8282
FeatureCustomRolesFeatureName="custom_roles"
8383
FeatureMultipleOrganizationsFeatureName="multiple_organizations"
84-
FeatureWorkspacePrebuildsFeatureName="workspace_prebuilds"
8584
)
8685

8786
// FeatureNames must be kept in-sync with the Feature enum above.
@@ -104,7 +103,6 @@ var FeatureNames = []FeatureName{
104103
FeatureControlSharedPorts,
105104
FeatureCustomRoles,
106105
FeatureMultipleOrganizations,
107-
FeatureWorkspacePrebuilds,
108106
}
109107

110108
// Humanize returns the feature name in a human-readable format.
@@ -134,7 +132,6 @@ func (n FeatureName) AlwaysEnable() bool {
134132
FeatureHighAvailability:true,
135133
FeatureCustomRoles:true,
136134
FeatureMultipleOrganizations:true,
137-
FeatureWorkspacePrebuilds:true,
138135
}[n]
139136
}
140137

@@ -396,7 +393,6 @@ type DeploymentValues struct {
396393
TermsOfServiceURL serpent.String`json:"terms_of_service_url,omitempty" typescript:",notnull"`
397394
NotificationsNotificationsConfig`json:"notifications,omitempty" typescript:",notnull"`
398395
AdditionalCSPPolicy serpent.StringArray`json:"additional_csp_policy,omitempty" typescript:",notnull"`
399-
PrebuildsPrebuildsConfig`json:"workspace_prebuilds,omitempty" typescript:",notnull"`
400396
WorkspaceHostnameSuffix serpent.String`json:"workspace_hostname_suffix,omitempty" typescript:",notnull"`
401397

402398
Config serpent.YAMLConfigPath`json:"config,omitempty" typescript:",notnull"`
@@ -1038,11 +1034,6 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
10381034
Parent:&deploymentGroupNotifications,
10391035
YAML:"webhook",
10401036
}
1041-
deploymentGroupPrebuilds= serpent.Group{
1042-
Name:"Workspace Prebuilds",
1043-
YAML:"workspace_prebuilds",
1044-
Description:"Configure how workspace prebuilds behave.",
1045-
}
10461037
deploymentGroupInbox= serpent.Group{
10471038
Name:"Inbox",
10481039
Parent:&deploymentGroupNotifications,
@@ -3038,41 +3029,6 @@ Write out the current server config as YAML to stdout.`,
30383029
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration,"true"),
30393030
Hidden:true,// Hidden because most operators should not need to modify this.
30403031
},
3041-
{
3042-
Name:"Reconciliation Interval",
3043-
Description:"How often to reconcile workspace prebuilds state.",
3044-
Flag:"workspace-prebuilds-reconciliation-interval",
3045-
Env:"CODER_WORKSPACE_PREBUILDS_RECONCILIATION_INTERVAL",
3046-
Value:&c.Prebuilds.ReconciliationInterval,
3047-
Default: (time.Second*15).String(),
3048-
Group:&deploymentGroupPrebuilds,
3049-
YAML:"reconciliation_interval",
3050-
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration,"true"),
3051-
},
3052-
{
3053-
Name:"Reconciliation Backoff Interval",
3054-
Description:"Interval to increase reconciliation backoff by when unrecoverable errors occur.",
3055-
Flag:"workspace-prebuilds-reconciliation-backoff-interval",
3056-
Env:"CODER_WORKSPACE_PREBUILDS_RECONCILIATION_BACKOFF_INTERVAL",
3057-
Value:&c.Prebuilds.ReconciliationBackoffInterval,
3058-
Default: (time.Second*15).String(),
3059-
Group:&deploymentGroupPrebuilds,
3060-
YAML:"reconciliation_backoff_interval",
3061-
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration,"true"),
3062-
Hidden:true,
3063-
},
3064-
{
3065-
Name:"Reconciliation Backoff Lookback Period",
3066-
Description:"Interval to look back to determine number of failed builds, which influences backoff.",
3067-
Flag:"workspace-prebuilds-reconciliation-backoff-lookback-period",
3068-
Env:"CODER_WORKSPACE_PREBUILDS_RECONCILIATION_BACKOFF_LOOKBACK_PERIOD",
3069-
Value:&c.Prebuilds.ReconciliationBackoffLookback,
3070-
Default: (time.Hour).String(),// TODO: use https://pkg.go.dev/github.com/jackc/pgtype@v1.12.0#Interval
3071-
Group:&deploymentGroupPrebuilds,
3072-
YAML:"reconciliation_backoff_lookback_period",
3073-
Annotations: serpent.Annotations{}.Mark(annotationFormatDuration,"true"),
3074-
Hidden:true,
3075-
},
30763032
// Push notifications.
30773033
}
30783034

@@ -3298,7 +3254,6 @@ const (
32983254
ExperimentAutoFillParametersExperiment="auto-fill-parameters"// This should not be taken out of experiments until we have redesigned the feature.
32993255
ExperimentNotificationsExperiment="notifications"// Sends notifications via SMTP and webhooks following certain events.
33003256
ExperimentWorkspaceUsageExperiment="workspace-usage"// Enables the new workspace usage tracking.
3301-
ExperimentWorkspacePrebuildsExperiment="workspace-prebuilds"// Enables the new workspace prebuilds feature.
33023257
ExperimentWebPushExperiment="web-push"// Enables web push notifications through the browser.
33033258
ExperimentDynamicParametersExperiment="dynamic-parameters"// Enables dynamic parameters when creating a workspace.
33043259
)
@@ -3307,9 +3262,7 @@ const (
33073262
// users to opt-in to via --experimental='*'.
33083263
// Experiments that are not ready for consumption by all users should
33093264
// not be included here and will be essentially hidden.
3310-
varExperimentsAll=Experiments{
3311-
ExperimentWorkspacePrebuilds,
3312-
}
3265+
varExperimentsAll=Experiments{}
33133266

33143267
// Experiments is a list of experiments.
33153268
// Multiple experiments may be enabled at the same time.

‎docs/reference/api/schemas.md‎

Lines changed: 12 additions & 10 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎docs/reference/api/workspaces.md‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎enterprise/coderd/coderd.go‎

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import (
44
"context"
55
"crypto/ed25519"
66
"fmt"
7-
agplprebuilds"github.com/coder/coder/v2/coderd/prebuilds"
8-
"github.com/coder/coder/v2/enterprise/coderd/prebuilds"
9-
"github.com/coder/quartz"
107
"math"
118
"net/http"
129
"net/url"
@@ -631,8 +628,6 @@ type API struct {
631628

632629
licenseMetricsCollector*license.MetricsCollector
633630
tailnetService*tailnet.ClientService
634-
635-
PrebuildsReconciler agplprebuilds.ReconciliationOrchestrator
636631
}
637632

638633
// writeEntitlementWarningsHeader writes the entitlement warnings to the response header
@@ -663,14 +658,6 @@ func (api *API) Close() error {
663658
ifapi.Options.CheckInactiveUsersCancelFunc!=nil {
664659
api.Options.CheckInactiveUsersCancelFunc()
665660
}
666-
667-
ifapi.PrebuildsReconciler!=nil {
668-
ctx,giveUp:=context.WithTimeoutCause(context.Background(),time.Second*30,xerrors.New("gave up waiting for reconciler to stop"))
669-
defergiveUp()
670-
// TODO: determine root cause (requires changes up the stack, though).
671-
api.PrebuildsReconciler.Stop(ctx,xerrors.New("api closed"))
672-
}
673-
674661
returnapi.AGPL.Close()
675662
}
676663

@@ -873,20 +860,6 @@ func (api *API) updateEntitlements(ctx context.Context) error {
873860
api.AGPL.PortSharer.Store(&ps)
874861
}
875862

876-
ifinitial,changed,enabled:=featureChanged(codersdk.FeatureWorkspacePrebuilds);shouldUpdate(initial,changed,enabled)||api.PrebuildsReconciler==nil {
877-
reconciler,claimer:=api.setupPrebuilds(enabled)
878-
ifapi.PrebuildsReconciler!=nil {
879-
stopCtx,giveUp:=context.WithTimeoutCause(context.Background(),time.Second*30,xerrors.New("gave up waiting for reconciler to stop"))
880-
defergiveUp()
881-
api.PrebuildsReconciler.Stop(stopCtx,xerrors.New("entitlements change"))
882-
}
883-
884-
api.PrebuildsReconciler=reconciler
885-
goreconciler.RunLoop(context.Background())
886-
887-
api.AGPL.PrebuildsClaimer.Store(&claimer)
888-
}
889-
890863
// External token encryption is soft-enforced
891864
featureExternalTokenEncryption:=reloadedEntitlements.Features[codersdk.FeatureExternalTokenEncryption]
892865
featureExternalTokenEncryption.Enabled=len(api.ExternalTokenEncryption)>0
@@ -1155,19 +1128,3 @@ func (api *API) runEntitlementsLoop(ctx context.Context) {
11551128
func (api*API)Authorize(r*http.Request,action policy.Action,object rbac.Objecter)bool {
11561129
returnapi.AGPL.HTTPAuth.Authorize(r,action,object)
11571130
}
1158-
1159-
func (api*API)setupPrebuilds(entitledbool) (agplprebuilds.ReconciliationOrchestrator, agplprebuilds.Claimer) {
1160-
enabled:=api.AGPL.Experiments.Enabled(codersdk.ExperimentWorkspacePrebuilds)
1161-
if!enabled||!entitled {
1162-
api.Logger.Debug(context.Background(),"prebuilds not enabled",
1163-
slog.F("experiment_enabled",enabled),slog.F("entitled",entitled))
1164-
1165-
returnagplprebuilds.NewNoopReconciler(),agplprebuilds.DefaultClaimer
1166-
}
1167-
1168-
reconciler:=prebuilds.NewStoreReconciler(api.Database,api.Pubsub,api.DeploymentValues.Prebuilds,
1169-
api.Logger.Named("prebuilds"),quartz.NewReal())
1170-
1171-
returnreconciler,
1172-
prebuilds.EnterpriseClaimer{}
1173-
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp