Skip to content
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

[ws-manager-bridge] Remove HasUserLevel admission constraint #11383

Merged
merged 1 commit into from
Jul 14, 2022
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
2 changes: 0 additions & 2 deletions components/gitpod-protocol/src/workspace-cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ export type WorkspaceManagerConnectionInfo = Pick<WorkspaceCluster, "name" | "ur
export type AdmissionConstraint =
| AdmissionConstraintFeaturePreview
| AdmissionConstraintHasPermission
| AdmissionConstraintHasUserLevel
| AdmissionConstraintHasMoreResources
| AdmissionConstraintHasClass;
export type AdmissionConstraintFeaturePreview = { type: "has-feature-preview" };
export type AdmissionConstraintHasPermission = { type: "has-permission"; permission: PermissionName };
export type AdmissionConstraintHasUserLevel = { type: "has-user-level"; level: string };
export type AdmissionConstraintHasMoreResources = { type: "has-more-resources" };
export type AdmissionConstraintHasClass = { type: "has-class"; id: string; displayName: string };

Expand Down
2 changes: 1 addition & 1 deletion components/ws-manager-bridge-api/cluster-service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ message AdmissionConstraint {
oneof constraint {
FeaturePreview has_feature_preview = 1;
HasPermission has_permission = 2;
string has_user_level = 3;
// deprecated anr removed: has_user_level = 3;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo is fixed later in the PR stack

bool has_more_resources = 4;
}
}
Expand Down
15 changes: 0 additions & 15 deletions components/ws-manager-bridge/src/cluster-service-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
AdmissionConstraint,
AdmissionConstraintHasPermission,
WorkspaceClusterWoTLS,
AdmissionConstraintHasUserLevel,
AdmissionConstraintHasMoreResources,
} from "@gitpod/gitpod-protocol/lib/workspace-cluster";
import {
Expand Down Expand Up @@ -233,10 +232,6 @@ export class ClusterService implements IClusterServiceServer {
return false;
}
break;
case "has-user-level":
if (v.level === (c as AdmissionConstraintHasUserLevel).level) {
return false;
}
case "has-more-resources":
return false;
}
Expand Down Expand Up @@ -348,9 +343,6 @@ function convertToGRPC(ws: WorkspaceClusterWoTLS): ClusterStatus {
perm.setPermission(c.permission);
constraint.setHasPermission(perm);
break;
case "has-user-level":
constraint.setHasUserLevel(c.level);
break;
case "has-more-resources":
constraint.setHasMoreResources(true);
break;
Expand Down Expand Up @@ -378,13 +370,6 @@ function mapAdmissionConstraint(c: GRPCAdmissionConstraint | undefined): Admissi

return <AdmissionConstraintHasPermission>{ type: "has-permission", permission };
}
if (c.hasHasUserLevel()) {
const level = c.getHasUserLevel();
if (!level) {
return;
}
return <AdmissionConstraintHasUserLevel>{ type: "has-user-level", level };
}
if (c.hasHasMoreResources()) {
return <AdmissionConstraintHasMoreResources>{ type: "has-more-resources" };
}
Expand Down
13 changes: 1 addition & 12 deletions dev/gpctl/cmd/clusters-update.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ var clustersUpdateMaxScoreCmd = &cobra.Command{
}

var clustersUpdateAdmissionConstraintCmd = &cobra.Command{
Use: "admission-constraint add|remove has-feature-preview|has-permission=<permission>|has-user-level=<level>|has-more-resources",
Use: "admission-constraint add|remove has-feature-preview|has-permission=<permission>|has-more-resources",
Short: "Updates a cluster's admission constraints",
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
Expand Down Expand Up @@ -126,17 +126,6 @@ var clustersUpdateAdmissionConstraintCmd = &cobra.Command{
},
},
}
} else if strings.HasPrefix(args[1], "has-user-level=") {
request.Property = &api.UpdateRequest_AdmissionConstraint{
AdmissionConstraint: &api.ModifyAdmissionConstraint{
Add: add,
Constraint: &api.AdmissionConstraint{
Constraint: &api.AdmissionConstraint_HasUserLevel{
HasUserLevel: strings.TrimPrefix(args[1], "has-user-level="),
},
},
},
}
} else if strings.HasPrefix(args[1], "has-more-resources") {
request.Property = &api.UpdateRequest_AdmissionConstraint{
AdmissionConstraint: &api.ModifyAdmissionConstraint{
Expand Down