Skip to content

Commit 6ecc991

Browse files
authored
[experimental] add ssh certificate authorities as feature flags (#19208)
1 parent 77ff741 commit 6ecc991

File tree

7 files changed

+107
-84
lines changed

7 files changed

+107
-84
lines changed

components/gitpod-protocol/src/protocol.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ export const WorkspaceFeatureFlags = {
249249
workspace_class_limiting: undefined,
250250
workspace_connection_limiting: undefined,
251251
workspace_psi: undefined,
252+
ssh_ca: undefined,
252253
};
253254
export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
254255
export namespace NamedWorkspaceFeatureFlag {

components/server/src/workspace/workspace-starter.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,10 @@ export class WorkspaceStarter {
936936
featureFlags.push("workspace_psi");
937937
}
938938

939+
if (await this.shouldEnableSSHCA(user, workspace.organizationId)) {
940+
featureFlags.push("ssh_ca");
941+
}
942+
939943
const workspaceClass = await getWorkspaceClassForInstance(
940944
ctx,
941945
workspace,
@@ -995,6 +999,13 @@ export class WorkspaceStarter {
995999
return this.entitlementService.limitNetworkConnections(userId, organizationId);
9961000
}
9971001

1002+
private async shouldEnableSSHCA(user: User, organizationId: string): Promise<boolean> {
1003+
return getExperimentsClientForBackend().getValueAsync("isSSHCertificateAuthoritiesEnabled", false, {
1004+
user: user,
1005+
teamId: organizationId,
1006+
});
1007+
}
1008+
9981009
private shouldEnablePSI(billingTier: BillingTier): boolean {
9991010
return billingTier === "paid";
10001011
}

components/ws-manager-api/core.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,9 @@ enum WorkspaceFeatureFlag {
657657

658658
// WORKSPACE_PSI feature flag for enabling pressure stall information for workspaces
659659
WORKSPACE_PSI = 11;
660+
661+
// SSH_CA feature flag for enabling SSH CA for workspaces
662+
SSH_CA = 12;
660663
}
661664

662665
// GitSpec configures the Git available within the workspace

components/ws-manager-api/go/core.pb.go

Lines changed: 85 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ws-manager-api/typescript/src/core_pb.d.ts

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ws-manager-api/typescript/src/core_pb.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ws-manager-mk2/service/manager.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,15 @@ func (wsm *WorkspaceManagerServer) StartWorkspace(ctx context.Context, req *wsma
213213
}
214214
}
215215

216+
var sshGatewayCAPublicKey string
216217
for _, feature := range req.Spec.FeatureFlags {
217218
switch feature {
218219
case wsmanapi.WorkspaceFeatureFlag_WORKSPACE_CONNECTION_LIMITING:
219220
annotations[wsk8s.WorkspaceNetConnLimitAnnotation] = util.BooleanTrueString
220-
221221
case wsmanapi.WorkspaceFeatureFlag_WORKSPACE_PSI:
222222
annotations[wsk8s.WorkspacePressureStallInfoAnnotation] = util.BooleanTrueString
223+
case wsmanapi.WorkspaceFeatureFlag_SSH_CA:
224+
sshGatewayCAPublicKey = wsm.Config.SSHGatewayCAPublicKey
223225
}
224226
}
225227

@@ -281,7 +283,7 @@ func (wsm *WorkspaceManagerServer) StartWorkspace(ctx context.Context, req *wsma
281283
Ports: ports,
282284
SshPublicKeys: req.Spec.SshPublicKeys,
283285
StorageQuota: int(storage.Value()),
284-
SSHGatewayCAPublicKey: wsm.Config.SSHGatewayCAPublicKey,
286+
SSHGatewayCAPublicKey: sshGatewayCAPublicKey,
285287
},
286288
}
287289
controllerutil.AddFinalizer(&ws, workspacev1.GitpodFinalizerName)

0 commit comments

Comments
 (0)