Skip to content

Commit dbeeafa

Browse files
csweichelroboquat
authored andcommitted
[workspace cluster] Remove admission preferences
1 parent ecf598a commit dbeeafa

13 files changed

+228
-1182
lines changed

components/gitpod-db/src/typeorm/entity/db-workspace-cluster.ts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import { PrimaryColumn, Column, Entity, Index } from "typeorm";
8-
import { AdmissionConstraint, AdmissionPreference, TLSConfig, WorkspaceCluster, WorkspaceClusterState } from "@gitpod/gitpod-protocol/lib/workspace-cluster";
8+
import { AdmissionConstraint, TLSConfig, WorkspaceCluster, WorkspaceClusterState } from "@gitpod/gitpod-protocol/lib/workspace-cluster";
99
import { ValueTransformer } from "typeorm/decorator/options/ValueTransformer";
1010

1111
@Entity()
@@ -79,27 +79,4 @@ export class DBWorkspaceCluster implements WorkspaceCluster {
7979
})()
8080
})
8181
admissionConstraints?: AdmissionConstraint[];
82-
83-
@Column({
84-
type: "simple-json",
85-
transformer: (() => {
86-
const defaultValue: AdmissionPreference[] = [];
87-
const jsonifiedDefault = JSON.stringify(defaultValue);
88-
return <ValueTransformer> {
89-
to(value: any): any {
90-
if (!value) {
91-
return jsonifiedDefault;
92-
}
93-
return JSON.stringify(value);
94-
},
95-
from(value: any): any {
96-
if (!value) {
97-
return undefined;
98-
}
99-
return JSON.parse(value);
100-
}
101-
};
102-
})()
103-
})
104-
admissionPreferences?: AdmissionPreference[];
10582
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
* Licensed under the GNU Affero General Public License (AGPL).
4+
* See License-AGPL.txt in the project root for license information.
5+
*/
6+
7+
import {MigrationInterface, QueryRunner} from "typeorm";
8+
import { columnExists, tableExists } from "./helper/helper";
9+
10+
export class RemoveAdmissionPreferences1643724196672 implements MigrationInterface {
11+
12+
public async up(queryRunner: QueryRunner): Promise<void> {
13+
if (await tableExists(queryRunner, "d_b_workspace_cluster")) {
14+
if (!(await columnExists(queryRunner, "d_b_workspace_cluster", "admissionPreferences"))) {
15+
await queryRunner.query("ALTER TABLE d_b_workspace_cluster DROP COLUMN admissionPreferences");
16+
}
17+
}
18+
}
19+
20+
public async down(queryRunner: QueryRunner): Promise<void> {
21+
}
22+
23+
}

components/gitpod-db/src/typeorm/workspace-cluster-db-impl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import { WorkspaceCluster, WorkspaceClusterFilter, WorkspaceClusterWoTLS } from
4949
state: "available",
5050
govern: false,
5151
admissionConstraints: [],
52-
admissionPreferences: [],
5352
};
5453

5554
const repo = await this.getRepo();

components/gitpod-protocol/src/workspace-cluster.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ export interface WorkspaceCluster {
3535

3636
// An optional set of constraints that limit who can start workspaces on the cluster
3737
admissionConstraints?: AdmissionConstraint[];
38-
39-
// An optional set of admission preferences that guide cluster selection
40-
admissionPreferences?: AdmissionPreference[];
4138
}
4239

4340
export type WorkspaceClusterState = "available" | "cordoned" | "draining";

components/ws-manager-bridge-api/cluster-service.proto

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ message RegisterRequest {
2121
TlsConfig tls = 3;
2222
RegistrationHints hints = 4;
2323
repeated AdmissionConstraint admission_constraints = 5;
24-
repeated AdmissionPreference admission_preference = 6;
24+
25+
// DEPRECATED
26+
// repeated AdmissionPreference admission_preference = 6;
27+
reserved 6;
2528
}
2629

2730
message RegisterResponse {}
@@ -51,12 +54,6 @@ message AdmissionConstraint {
5154
}
5255
}
5356

54-
message AdmissionPreference {
55-
oneof preference {
56-
string user_level = 1;
57-
}
58-
}
59-
6057
enum Preferability {
6158
None = 0;
6259
Prefer = 1;
@@ -71,8 +68,11 @@ message ClusterStatus {
7168
int32 max_score = 5;
7269
bool governed = 6;
7370
repeated AdmissionConstraint admission_constraint = 7;
74-
repeated AdmissionPreference admission_preference = 9;
7571
bool static = 8;
72+
73+
// DEPRECATED
74+
// repeated AdmissionPreference admission_preference = 9;
75+
reserved 9;
7676
}
7777

7878
enum ClusterState {
@@ -89,7 +89,9 @@ message UpdateRequest {
8989
int32 max_score = 3;
9090
bool cordoned = 4;
9191
ModifyAdmissionConstraint admission_constraint = 5;
92-
ModifyAdmissionPreference admission_preference = 6;
92+
93+
// DEPRECATED
94+
// ModifyAdmissionPreference admission_preference = 6;
9395
}
9496
}
9597

@@ -98,11 +100,6 @@ message ModifyAdmissionConstraint {
98100
AdmissionConstraint constraint = 2;
99101
}
100102

101-
message ModifyAdmissionPreference {
102-
bool add = 1;
103-
AdmissionPreference preference = 2;
104-
}
105-
106103
message UpdateResponse {}
107104

108105
message DeregisterRequest {

0 commit comments

Comments
 (0)