Skip to content

[experimental] add ssh certificate authorities as feature flags #19208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/gitpod-protocol/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ export const WorkspaceFeatureFlags = {
workspace_class_limiting: undefined,
workspace_connection_limiting: undefined,
workspace_psi: undefined,
ssh_ca: undefined,
};
export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
export namespace NamedWorkspaceFeatureFlag {
Expand Down
11 changes: 11 additions & 0 deletions components/server/src/workspace/workspace-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,10 @@ export class WorkspaceStarter {
featureFlags.push("workspace_psi");
}

if (await this.shouldEnableSSHCA(user, workspace.organizationId)) {
featureFlags.push("ssh_ca");
}

const workspaceClass = await getWorkspaceClassForInstance(
ctx,
workspace,
Expand Down Expand Up @@ -995,6 +999,13 @@ export class WorkspaceStarter {
return this.entitlementService.limitNetworkConnections(userId, organizationId);
}

private async shouldEnableSSHCA(user: User, organizationId: string): Promise<boolean> {
return getExperimentsClientForBackend().getValueAsync("isSSHCertificateAuthoritiesEnabled", false, {
user: user,
teamId: organizationId,
});
}

private shouldEnablePSI(billingTier: BillingTier): boolean {
return billingTier === "paid";
}
Expand Down
3 changes: 3 additions & 0 deletions components/ws-manager-api/core.proto
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ enum WorkspaceFeatureFlag {

// WORKSPACE_PSI feature flag for enabling pressure stall information for workspaces
WORKSPACE_PSI = 11;

// SSH_CA feature flag for enabling SSH CA for workspaces
SSH_CA = 12;
}

// GitSpec configures the Git available within the workspace
Expand Down
166 changes: 85 additions & 81 deletions components/ws-manager-api/go/core.pb.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions components/ws-manager-api/typescript/src/core_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion components/ws-manager-api/typescript/src/core_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions components/ws-manager-mk2/service/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,15 @@ func (wsm *WorkspaceManagerServer) StartWorkspace(ctx context.Context, req *wsma
}
}

var sshGatewayCAPublicKey string
for _, feature := range req.Spec.FeatureFlags {
switch feature {
case wsmanapi.WorkspaceFeatureFlag_WORKSPACE_CONNECTION_LIMITING:
annotations[wsk8s.WorkspaceNetConnLimitAnnotation] = util.BooleanTrueString

case wsmanapi.WorkspaceFeatureFlag_WORKSPACE_PSI:
annotations[wsk8s.WorkspacePressureStallInfoAnnotation] = util.BooleanTrueString
case wsmanapi.WorkspaceFeatureFlag_SSH_CA:
sshGatewayCAPublicKey = wsm.Config.SSHGatewayCAPublicKey
}
}

Expand Down Expand Up @@ -281,7 +283,7 @@ func (wsm *WorkspaceManagerServer) StartWorkspace(ctx context.Context, req *wsma
Ports: ports,
SshPublicKeys: req.Spec.SshPublicKeys,
StorageQuota: int(storage.Value()),
SSHGatewayCAPublicKey: wsm.Config.SSHGatewayCAPublicKey,
SSHGatewayCAPublicKey: sshGatewayCAPublicKey,
},
}
controllerutil.AddFinalizer(&ws, workspacev1.GitpodFinalizerName)
Expand Down