fix(adminrpc): expose HTTP port 9091 in k8s deployment and service
The adminrpc binary runs HTTP endpoints on port grpc_port+1 (9091), but k8s deployment only exposed port 9090 (gRPC). The /api/admin/* HTTP routes were unreachable from the admin dashboard frontend. - Add http container port 9091 to Deployment - Add http named port to k8s Service - Point liveness/readiness probes to HTTP port 9091 - Add http_port: 9091 to Helm values.yaml
This commit is contained in:
parent
f125fb0c02
commit
38da729860
@ -8,10 +8,10 @@
|
|||||||
* import { listWorkspaceSessions, kickUser } from "@/lib/admin-rpc";
|
* import { listWorkspaceSessions, kickUser } from "@/lib/admin-rpc";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ADMIN_RPC_URL } from "./env";
|
import {ADMIN_RPC_URL} from "./env";
|
||||||
|
|
||||||
// Default to k8s internal service address; override via ADMIN_RPC_URL env var
|
// Default to k8s internal service address; override via ADMIN_RPC_URL env var
|
||||||
const BASE_URL = ADMIN_RPC_URL || "http://adminrpc.admin.svc.cluster.local:9091";
|
const BASE_URL = ADMIN_RPC_URL || "http://adminrpc.gitdataai.svc.cluster.local:9091";
|
||||||
|
|
||||||
async function rpc<T>(path: string, options?: RequestInit): Promise<T> {
|
async function rpc<T>(path: string, options?: RequestInit): Promise<T> {
|
||||||
const url = `${BASE_URL}${path}`;
|
const url = `${BASE_URL}${path}`;
|
||||||
@ -84,7 +84,7 @@ export async function isUserOnline(userId: string): Promise<{ online: boolean }>
|
|||||||
export async function kickUser(userId: string): Promise<{ kicked_count: number }> {
|
export async function kickUser(userId: string): Promise<{ kicked_count: number }> {
|
||||||
return rpc<{ kicked_count: number }>("/api/admin/sessions/kick", {
|
return rpc<{ kicked_count: number }>("/api/admin/sessions/kick", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({ user_id: userId }),
|
body: JSON.stringify({user_id: userId}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ export async function kickUserFromWorkspace(
|
|||||||
): Promise<{ kicked_count: number }> {
|
): Promise<{ kicked_count: number }> {
|
||||||
return rpc<{ kicked_count: number }>("/api/admin/sessions/kick-workspace", {
|
return rpc<{ kicked_count: number }>("/api/admin/sessions/kick-workspace", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({ user_id: userId, workspace_id: workspaceId }),
|
body: JSON.stringify({user_id: userId, workspace_id: workspaceId}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,9 @@ spec:
|
|||||||
- name: grpc
|
- name: grpc
|
||||||
containerPort: {{ .Values.adminrpc.service.port }}
|
containerPort: {{ .Values.adminrpc.service.port }}
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
|
- name: http
|
||||||
|
containerPort: {{ .Values.adminrpc.service.http_port }}
|
||||||
|
protocol: TCP
|
||||||
args:
|
args:
|
||||||
- --bind
|
- --bind
|
||||||
- "0.0.0.0:{{ .Values.adminrpc.service.port }}"
|
- "0.0.0.0:{{ .Values.adminrpc.service.port }}"
|
||||||
@ -43,12 +46,12 @@ spec:
|
|||||||
name: {{ include "gitdata.fullname" . }}-config
|
name: {{ include "gitdata.fullname" . }}-config
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
tcpSocket:
|
tcpSocket:
|
||||||
port: {{ .Values.adminrpc.service.port }}
|
port: {{ .Values.adminrpc.service.http_port }}
|
||||||
initialDelaySeconds: 5
|
initialDelaySeconds: 5
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
tcpSocket:
|
tcpSocket:
|
||||||
port: {{ .Values.adminrpc.service.port }}
|
port: {{ .Values.adminrpc.service.http_port }}
|
||||||
initialDelaySeconds: 5
|
initialDelaySeconds: 5
|
||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
{{- if .Values.adminrpc.resources }}
|
{{- if .Values.adminrpc.resources }}
|
||||||
@ -83,6 +86,10 @@ spec:
|
|||||||
targetPort: grpc
|
targetPort: grpc
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
name: grpc
|
name: grpc
|
||||||
|
- port: {{ .Values.adminrpc.service.http_port }}
|
||||||
|
targetPort: http
|
||||||
|
protocol: TCP
|
||||||
|
name: http
|
||||||
selector:
|
selector:
|
||||||
app.kubernetes.io/name: {{ include "gitdata.fullname" . }}-adminrpc
|
app.kubernetes.io/name: {{ include "gitdata.fullname" . }}-adminrpc
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
|||||||
@ -401,6 +401,7 @@ adminrpc:
|
|||||||
|
|
||||||
service:
|
service:
|
||||||
port: 9090
|
port: 9090
|
||||||
|
http_port: 9091
|
||||||
|
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
tcpSocket:
|
tcpSocket:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user