Skip to content

Commit

Permalink
[ws-manager] Make IDE image API field composite
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusludmann committed Oct 25, 2021
1 parent 1398e92 commit afa6acd
Show file tree
Hide file tree
Showing 16 changed files with 1,084 additions and 420 deletions.
4 changes: 3 additions & 1 deletion components/ee/ws-scheduler/pkg/scaler/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ func (wspd *WorkspaceManagerPrescaleDriver) startGhostWorkspaces(ctx context.Con
Email: "[email protected]",
Username: "gitpod-ghost",
},
IdeImage: wspd.Config.IDEImage,
IdeImage: &api.StartWorkspaceSpec_IDEImage{
WebRef: wspd.Config.IDEImage,
},
Initializer: &csapi.WorkspaceInitializer{
Spec: &csapi.WorkspaceInitializer_Empty{
Empty: &csapi.EmptyInitializer{},
Expand Down
12 changes: 7 additions & 5 deletions components/image-builder-mk3/pkg/orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,13 @@ func (o *Orchestrator) Build(req *protocol.BuildRequest, resp protocol.ImageBuil
Owner: buildWorkspaceOwnerID,
},
Spec: &wsmanapi.StartWorkspaceSpec{
CheckoutLocation: ".",
Initializer: initializer,
Timeout: maxBuildRuntime.String(),
WorkspaceImage: o.Config.BuilderImage,
IdeImage: o.Config.BuilderImage,
CheckoutLocation: ".",
Initializer: initializer,
Timeout: maxBuildRuntime.String(),
WorkspaceImage: o.Config.BuilderImage,
IdeImage: &wsmanapi.StartWorkspaceSpec_IDEImage{
WebRef: o.Config.BuilderImage,
},
WorkspaceLocation: contextPath,
Envvars: []*wsmanapi.EnvironmentVariable{
{Name: "BOB_TARGET_REF", Value: wsrefstr},
Expand Down
4 changes: 3 additions & 1 deletion components/server/src/workspace/workspace-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,9 @@ export class WorkspaceStarter {
spec.setGit(this.createGitSpec(workspace, user));
spec.setPortsList(ports);
spec.setInitializer((await initializerPromise).initializer);
spec.setIdeImage(ideImage);
const startWorkspaceSpecIDEImage = new StartWorkspaceSpec.IDEImage();
startWorkspaceSpecIDEImage.setWebRef(ideImage);
spec.setIdeImage(startWorkspaceSpecIDEImage);
spec.setWorkspaceImage(instance.workspaceImage);
spec.setWorkspaceLocation(workspace.config.workspaceLocation || spec.getCheckoutLocation());
spec.setFeatureFlagsList(this.toWorkspaceFeatureFlags(featureFlags));
Expand Down
34 changes: 26 additions & 8 deletions components/ws-manager-api/core.proto
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,20 @@ message WorkspaceStatus {

// WorkspaceSpec is the specification of a workspace at runtime
message WorkspaceSpec {
// IDEImage configures the IDE images a workspace will use
message IDEImage {
// web_ref is a reference to an OCI image used for serving the web-based IDE
string web_ref = 1;
// desktop_ref is an optional reference to an OCI image used for serving desktop IDEs
string desktop_ref = 2;
}

// workspace_image is the name of the Docker image this workspace runs
string workspace_image = 1;

// ide_image is the name of the Docker image used as IDE
string ide_image = 2;
// deprecated_ide_image is a field present for backwards compatibility and the same
// as IDEImage.web_ref. If both fields are present, IDEImage.web_ref takes precedence.
string deprecated_ide_image = 2;

// headless marks this workspace a headless one - headless workspaces are not intended for users but for automation
bool headless = 3;
Expand All @@ -291,8 +300,8 @@ message WorkspaceSpec {
// The intervals in which a heartbeat must be received for the workspace not to time out
string timeout = 7;

// desktop_ide_image is the name of the Docker image used as desktop IDE
string desktop_ide_image = 8;
// ide_image is the name of the Docker image used as IDE
IDEImage ide_image = 8;
}

// PortSpec describes a networking port exposed on a workspace
Expand Down Expand Up @@ -443,11 +452,20 @@ message WorkspaceAuthentication {

// StartWorkspaceSpec specifies the configuration of a workspace for a workspace start
message StartWorkspaceSpec {
// IDEImage configures the IDE images a workspace will use
message IDEImage {
// web_ref is a reference to an OCI image used for serving the web-based IDE
string web_ref = 1;
// desktop_ref is an optional reference to an OCI image used for serving desktop IDEs
string desktop_ref = 2;
}

// workspace_image is the Docker image name of the workspace container
string workspace_image = 1;

// ide_image is the Docker image name of the IDE image
string ide_image = 2;
// deprecated_ide_image is a field present for backwards compatibility and the same
// as IDEImage.web_ref. If both fields are present, IDEImage.web_ref takes precedence.
string deprecated_ide_image = 2;

// feature_flags provide a means for starting variants of workspaces (e.g. a privileged one)
repeated WorkspaceFeatureFlag feature_flags = 3;
Expand Down Expand Up @@ -476,8 +494,8 @@ message StartWorkspaceSpec {
// admission controlls who can access the workspace and its ports.
AdmissionLevel admission = 11;

// desktop_ide_image is the Docker image name of the desktop IDE image
string desktop_ide_image = 12;
// ide_image is the Docker image name of the IDE image
IDEImage ide_image = 12;
}

// WorkspaceFeatureFlag enable non-standard behaviour in workspaces
Expand Down
Loading

0 comments on commit afa6acd

Please sign in to comment.