mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-17 05:31:16 +08:00
* feat(server): add Prometheus metrics infrastructure and gRPC/HTTP request metrics Add metrics exposition via a dedicated server port (--metrics-port, default disabled) following the same optional-listener pattern as the health port. The metrics crate facade records counters and histograms in the MultiplexedService hot path, and a PrometheusHandle renders them at GET /metrics on the dedicated port. Metrics added: - openshell_server_grpc_requests_total (counter: method, code) - openshell_server_grpc_request_duration_seconds (histogram: method, code) - openshell_server_http_requests_total (counter: path, status) - openshell_server_http_request_duration_seconds (histogram: path, status) * feat(helm): add metrics port to openshell-server helm chart Expose the Prometheus metrics endpoint in the helm chart by adding service.metricsPort (default 9090) to values, the --metrics-port arg and container port to the statefulset, and a metrics service port. Set metricsPort to 0 to disable.
184 lines
7.1 KiB
YAML
184 lines
7.1 KiB
YAML
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ include "openshell.fullname" . }}
|
|
labels:
|
|
{{- include "openshell.labels" . | nindent 4 }}
|
|
spec:
|
|
serviceName: {{ include "openshell.fullname" . }}
|
|
replicas: {{ .Values.replicaCount }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "openshell.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
{{- with .Values.podAnnotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "openshell.labels" . | nindent 8 }}
|
|
{{- with .Values.podLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
terminationGracePeriodSeconds: {{ .Values.podLifecycle.terminationGracePeriodSeconds }}
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
serviceAccountName: {{ include "openshell.serviceAccountName" . }}
|
|
{{- if .Values.server.hostGatewayIP }}
|
|
hostAliases:
|
|
- ip: {{ .Values.server.hostGatewayIP | quote }}
|
|
hostnames:
|
|
- host.docker.internal
|
|
- host.openshell.internal
|
|
{{- end }}
|
|
securityContext:
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
|
containers:
|
|
- name: {{ .Chart.Name }}
|
|
securityContext:
|
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
args:
|
|
- --port
|
|
- {{ .Values.service.port | quote }}
|
|
- --health-port
|
|
- {{ .Values.service.healthPort | quote }}
|
|
{{- if .Values.service.metricsPort }}
|
|
- --metrics-port
|
|
- {{ .Values.service.metricsPort | quote }}
|
|
{{- end }}
|
|
- --log-level
|
|
- {{ .Values.server.logLevel }}
|
|
- --db-url
|
|
- {{ .Values.server.dbUrl | quote }}
|
|
env:
|
|
- name: OPENSHELL_SANDBOX_NAMESPACE
|
|
value: {{ .Values.server.sandboxNamespace | quote }}
|
|
- name: OPENSHELL_SANDBOX_IMAGE
|
|
value: {{ .Values.server.sandboxImage | quote }}
|
|
{{- if .Values.server.sandboxImagePullPolicy }}
|
|
- name: OPENSHELL_SANDBOX_IMAGE_PULL_POLICY
|
|
value: {{ .Values.server.sandboxImagePullPolicy | quote }}
|
|
{{- end }}
|
|
- name: OPENSHELL_GRPC_ENDPOINT
|
|
value: {{ if .Values.server.disableTls }}{{ .Values.server.grpcEndpoint | replace "https://" "http://" | quote }}{{ else }}{{ .Values.server.grpcEndpoint | quote }}{{ end }}
|
|
{{- if .Values.server.sshGatewayHost }}
|
|
- name: OPENSHELL_SSH_GATEWAY_HOST
|
|
value: {{ .Values.server.sshGatewayHost | quote }}
|
|
{{- end }}
|
|
{{- if .Values.server.sshGatewayPort }}
|
|
- name: OPENSHELL_SSH_GATEWAY_PORT
|
|
value: {{ .Values.server.sshGatewayPort | quote }}
|
|
{{- end }}
|
|
{{- if .Values.server.hostGatewayIP }}
|
|
- name: OPENSHELL_HOST_GATEWAY_IP
|
|
value: {{ .Values.server.hostGatewayIP | quote }}
|
|
{{- end }}
|
|
- name: OPENSHELL_SSH_HANDSHAKE_SECRET
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.server.sshHandshakeSecretName | quote }}
|
|
key: secret
|
|
{{- if .Values.server.disableTls }}
|
|
- name: OPENSHELL_DISABLE_TLS
|
|
value: "true"
|
|
{{- else }}
|
|
- name: OPENSHELL_TLS_CERT
|
|
value: /etc/openshell-tls/server/tls.crt
|
|
- name: OPENSHELL_TLS_KEY
|
|
value: /etc/openshell-tls/server/tls.key
|
|
- name: OPENSHELL_TLS_CLIENT_CA
|
|
value: /etc/openshell-tls/client-ca/ca.crt
|
|
- name: OPENSHELL_CLIENT_TLS_SECRET_NAME
|
|
value: {{ .Values.server.tls.clientTlsSecretName | quote }}
|
|
{{- if .Values.server.disableGatewayAuth }}
|
|
- name: OPENSHELL_DISABLE_GATEWAY_AUTH
|
|
value: "true"
|
|
{{- end }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: openshell-data
|
|
mountPath: /var/openshell
|
|
{{- if not .Values.server.disableTls }}
|
|
- name: tls-cert
|
|
mountPath: /etc/openshell-tls/server
|
|
readOnly: true
|
|
- name: tls-client-ca
|
|
mountPath: /etc/openshell-tls/client-ca
|
|
readOnly: true
|
|
{{- end }}
|
|
ports:
|
|
- name: grpc
|
|
containerPort: {{ .Values.service.port }}
|
|
protocol: TCP
|
|
- name: health
|
|
containerPort: {{ .Values.service.healthPort }}
|
|
protocol: TCP
|
|
{{- if .Values.service.metricsPort }}
|
|
- name: metrics
|
|
containerPort: {{ .Values.service.metricsPort }}
|
|
protocol: TCP
|
|
{{- end }}
|
|
startupProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: health
|
|
periodSeconds: {{ .Values.probes.startup.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.probes.startup.timeoutSeconds }}
|
|
failureThreshold: {{ .Values.probes.startup.failureThreshold }}
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: health
|
|
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.probes.liveness.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.probes.liveness.timeoutSeconds }}
|
|
failureThreshold: {{ .Values.probes.liveness.failureThreshold }}
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /readyz
|
|
port: health
|
|
initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.probes.readiness.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }}
|
|
failureThreshold: {{ .Values.probes.readiness.failureThreshold }}
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
volumes:
|
|
{{- if not .Values.server.disableTls }}
|
|
- name: tls-cert
|
|
secret:
|
|
secretName: {{ .Values.server.tls.certSecretName }}
|
|
- name: tls-client-ca
|
|
secret:
|
|
secretName: {{ .Values.server.tls.clientCaSecretName }}
|
|
{{- end }}
|
|
{{- with .Values.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: openshell-data
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
resources:
|
|
requests:
|
|
storage: 1Gi
|