Skip to content
Open
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
13 changes: 1 addition & 12 deletions bin/k8s/templates/base/gateway/gateway-routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,9 @@ spec:
- path:
type: PathPrefix
value: /api/executions/result/export
backendRefs:
- group: gateway.envoyproxy.io
kind: Backend
name: texera-dynamic-backend
- matches:
- path:
type: PathPrefix
value: /pve
filters:
- type: URLRewrite
urlRewrite:
path:
type: ReplacePrefixMatch
replacePrefixMatch: /api/pve
value: /api/pve
backendRefs:
- group: gateway.envoyproxy.io
kind: Backend
Expand Down
7 changes: 7 additions & 0 deletions bin/single-node/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ http {
proxy_send_timeout 1d;
}

location /api/pve/ {
proxy_pass http://workflow-runtime-coordinator-service:8085;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}

# nginx prefix locations match by longest prefix
location /api/ {
proxy_pass http://dashboard-service:8080;
proxy_set_header Host $host;
Expand Down
13 changes: 5 additions & 8 deletions frontend/proxy.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,15 @@
"secure": false,
"changeOrigin": true
},
"/api": {
"target": "http://localhost:8080",
"/api/pve": {
"target": "http://localhost:8085",
"secure": false,
"changeOrigin": false
},
"/pve": {
"target": "http://localhost:8085",
"/api": {
"target": "http://localhost:8080",
"secure": false,
"changeOrigin": false,
"pathRewrite": {
"^/pve": "/api/pve"
}
"changeOrigin": false
},
"/wsapi": {
"target": "http://localhost:8085",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class ComputingUnitSelectionComponent implements OnInit {
// variables for creating a virtual environment
pves: PveDraft[] = [];
systemPackages: { name: string; version: string }[] = [];
// True while a /pve/system response is in flight. The server resolves
// True while an /api/pve/system response is in flight. The server resolves
// the full pinned set with a `pip freeze` against a throwaway venv,
// which can take 30–60s on the first request after a server restart.
systemPackagesLoading = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import { TestBed } from "@angular/core/testing";
import { AppSettings } from "../../../common/app-setting";
import { HttpClientTestingModule, HttpTestingController } from "@angular/common/http/testing";
import { UserPveRecord, WorkflowPveService } from "./virtual-environment.service";
import { commonTestProviders } from "../../../common/testing/test-utils";
Expand Down Expand Up @@ -45,7 +46,7 @@ describe("WorkflowPveService", () => {
expect(resp.veid).toBe(42);
});

const req = httpTestingController.expectOne("/pve/db");
const req = httpTestingController.expectOne(`${AppSettings.getApiEndpoint()}/pve/db`);
Comment thread
Yicong-Huang marked this conversation as resolved.
expect(req.request.method).toBe("POST");
expect(req.request.body).toEqual({ name: "env-a", packages });
req.flush({ veid: 42 });
Expand All @@ -57,7 +58,7 @@ describe("WorkflowPveService", () => {
expect(resp.veid).toBe(7);
});

const req = httpTestingController.expectOne("/pve/db/7");
const req = httpTestingController.expectOne(`${AppSettings.getApiEndpoint()}/pve/db/7`);
expect(req.request.method).toBe("PUT");
expect(req.request.body).toEqual({ name: "env-b", packages });
req.flush({ veid: 7 });
Expand All @@ -69,15 +70,15 @@ describe("WorkflowPveService", () => {
expect(resp).toEqual(records);
});

const req = httpTestingController.expectOne("/pve/db");
const req = httpTestingController.expectOne(`${AppSettings.getApiEndpoint()}/pve/db`);
expect(req.request.method).toBe("GET");
req.flush(records);
});

it("deleteUserPve() DELETEs /pve/db/{veid}", () => {
service.deleteUserPve(9).subscribe();

const req = httpTestingController.expectOne("/pve/db/9");
const req = httpTestingController.expectOne(`${AppSettings.getApiEndpoint()}/pve/db/9`);
expect(req.request.method).toBe("DELETE");
req.flush(null);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Observable } from "rxjs";
import { map } from "rxjs/operators";
import { HttpClient, HttpParams } from "@angular/common/http";
import { AuthService } from "../../../common/service/user/auth.service";
import { AppSettings } from "../../../common/app-setting";

export interface PackageResponse {
system: string[];
Expand All @@ -42,19 +43,19 @@ export class WorkflowPveService {
constructor(private http: HttpClient) {}

savePve(name: string, packages: Record<string, string>): Observable<{ veid: number }> {
return this.http.post<{ veid: number }>("/pve/db", { name, packages });
return this.http.post<{ veid: number }>(`${AppSettings.getApiEndpoint()}/pve/db`, { name, packages });
}

updateUserPve(veid: number, name: string, packages: Record<string, string>): Observable<{ veid: number }> {
return this.http.put<{ veid: number }>(`/pve/db/${veid}`, { name, packages });
return this.http.put<{ veid: number }>(`${AppSettings.getApiEndpoint()}/pve/db/${veid}`, { name, packages });
}

listUserPves(): Observable<UserPveRecord[]> {
return this.http.get<UserPveRecord[]>("/pve/db");
return this.http.get<UserPveRecord[]>(`${AppSettings.getApiEndpoint()}/pve/db`);
}

deleteUserPve(veid: number): Observable<void> {
return this.http.delete<void>(`/pve/db/${veid}`);
return this.http.delete<void>(`${AppSettings.getApiEndpoint()}/pve/db/${veid}`);
}

getAccessToken(): string | null {
Expand All @@ -73,27 +74,27 @@ export class WorkflowPveService {

getSystemPackages(cuid: number): Observable<PackageResponse> {
const params = this.buildBaseParams().set("cuid", cuid.toString());
return this.http.get<PackageResponse>("/pve/system", { params });
return this.http.get<PackageResponse>(`${AppSettings.getApiEndpoint()}/pve/system`, { params });
}

fetchPVEs(cuid: number): Observable<PvePackageResponse[]> {
const params = this.buildBaseParams().set("cuid", cuid.toString());
return this.http.get<PvePackageResponse[]>("/pve/pves", { params });
return this.http.get<PvePackageResponse[]>(`${AppSettings.getApiEndpoint()}/pve/pves`, { params });
}

getUserPackages(cuid: number, pveName: string): Observable<string[]> {
return this.fetchPVEs(cuid).pipe(map(pves => pves.find(pve => pve.pveName === pveName)?.userPackages ?? []));
}

deleteEnvironments(cuid: number) {
return this.http.delete(`/pve/pves/${cuid}`);
return this.http.delete(`${AppSettings.getApiEndpoint()}/pve/pves/${cuid}`);
Comment thread
Yicong-Huang marked this conversation as resolved.
}

deletePackage(cuid: number, pveName: string, packageName: string) {
const params = this.buildBaseParams();

return this.http.delete<string[]>(
`/pve/${cuid}/${encodeURIComponent(pveName)}/packages/${encodeURIComponent(packageName)}`,
`${AppSettings.getApiEndpoint()}/pve/${cuid}/${encodeURIComponent(pveName)}/packages/${encodeURIComponent(packageName)}`,
{ params }
);
}
Expand Down
Loading