Skip to content

Commit c199213

Browse files
feat(nx-cloud): add frontend hpa, deployment probes values
1 parent c11fd80 commit c199213

File tree

8 files changed

+545
-29
lines changed

8 files changed

+545
-29
lines changed

charts/nx-cloud/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ Below is a summary table of configurable values from values.yaml.
8484
| fileServer.deployment.volumeMounts | list | [] | Additional volume mounts. |
8585
| fileServer.deployment.extraContainers | list | [] | Extra sidecars for file server only. |
8686
| fileServer.deployment.initContainers | list | [] | Init containers for file server. |
87+
| fileServer.deployment.livenessProbe | object | httpGet on /file/uptime-check:5000 | Liveness probe configuration for file server container. |
88+
| fileServer.deployment.startupProbe | object | httpGet on /file/uptime-check:5000 | Startup probe configuration for file server container. |
89+
| fileServer.deployment.readinessProbe | object | httpGet on /file/uptime-check:5000 | Readiness probe configuration for file server container. |
8790
| fileServer.pvc.name | string | nx-cloud-file-server | PVC name for file server storage. |
8891
| fileServer.pvc.annotations | object | {} | PVC annotations. |
8992
| fileServer.pvc.labels | object | {} | PVC labels. |
@@ -157,11 +160,23 @@ Below is a summary table of configurable values from values.yaml.
157160
| frontend.deployment.volumeMounts | list | [] | Additional volume mounts. |
158161
| frontend.deployment.extraContainers | list | [] | Extra sidecars for frontend only. |
159162
| frontend.deployment.initContainers | list | [] | Init containers for frontend. |
163+
| frontend.deployment.startupProbe | object | httpGet on /healthz:4202 | Startup probe configuration for frontend container. |
164+
| frontend.deployment.livenessProbe | object | httpGet on /healthz:4202 | Liveness probe configuration for frontend container. |
165+
| frontend.deployment.readinessProbe | object | httpGet on /readyz:4202 | Readiness probe configuration for frontend container. |
160166
| frontend.serviceAccount.create | bool | true | Whether to create a ServiceAccount for frontend. |
161167
| frontend.serviceAccount.name | string | nx-cloud-frontend | ServiceAccount name for frontend. |
162168
| frontend.serviceAccount.annotations | object | {} | ServiceAccount annotations for frontend. |
163169
| frontend.serviceAccount.labels | object | {} | ServiceAccount labels for frontend. |
164170
| frontend.serviceAccount.automount | bool | false | Automount service account token for frontend pods. |
171+
| frontend.hpa.enabled | bool | false | Enable Horizontal Pod Autoscaler for frontend. |
172+
| frontend.hpa.annotations | object | {} | HPA annotations for frontend. |
173+
| frontend.hpa.labels | object | {} | HPA labels for frontend. |
174+
| frontend.hpa.minReplicas | int | 1 | Minimum number of frontend replicas for HPA. |
175+
| frontend.hpa.maxReplicas | int | 10 | Maximum number of frontend replicas for HPA. |
176+
| frontend.hpa.targetCPUUtilizationPercentage | int | 80 | Target CPU utilization percentage for scaling. |
177+
| frontend.hpa.targetMemoryUtilizationPercentage | string | "" | Target memory utilization percentage (empty to disable). |
178+
| frontend.hpa.behavior | object | {} | HPA scaling behavior configuration (scaleUp/scaleDown policies). |
179+
| frontend.hpa.customMetrics | list | [] | Custom metrics for HPA scaling decisions. |
165180
| api.verboseLogging | bool | false | Enable verbose logging for API. |
166181
| api.logLevel | string | "INFO" | Log level for API. |
167182
| api.valkey.clientProvider | string | "redisson" | Valkey client provider implementation. |
@@ -205,6 +220,9 @@ Below is a summary table of configurable values from values.yaml.
205220
| api.deployment.volumeMounts | list | [] | Additional volume mounts. |
206221
| api.deployment.extraContainers | list | [] | Extra sidecars for API only. |
207222
| api.deployment.initContainers | list | [] | Init containers for API. |
223+
| api.deployment.startupProbe | object | httpGet on /nx-cloud/uptime-check:4203 | Startup probe configuration for API container. |
224+
| api.deployment.livenessProbe | object | httpGet on /nx-cloud/uptime-check:4203 | Liveness probe configuration for API container. |
225+
| api.deployment.readinessProbe | object | httpGet on /nx-cloud/uptime-check:4203 | Readiness probe configuration for API container. |
208226
| api.serviceAccount.create | bool | true | Whether to create a ServiceAccount for API. |
209227
| api.serviceAccount.name | string | nx-cloud-nx-api | ServiceAccount name for API. |
210228
| api.serviceAccount.annotations | object | {} | ServiceAccount annotations for API. |

charts/nx-cloud/ci/hpa-values.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
global:
2+
imageRegistry: "docker.io"
3+
nxCloudAppURL: "https://nx.test"
4+
mongodbConnectionString:
5+
secretName: nx-cloud-credentials
6+
secretKey: NX_CLOUD_MONGO_SERVER_ENDPOINT
7+
8+
extraObjects:
9+
appSecrets:
10+
apiVersion: v1
11+
kind: Secret
12+
metadata:
13+
name: nx-cloud-credentials
14+
type: Opaque
15+
stringData:
16+
VALKEY_PASSWORD: password
17+
NX_CLOUD_MONGO_SERVER_ENDPOINT: mongodb://mongo-mongodb-0.mongo-mongodb-headless.mongodb.svc.cluster.local:27017
18+
ADMIN_PASSWORD: password
19+
20+
backendNotFoundService:
21+
apiVersion: v1
22+
kind: Service
23+
metadata:
24+
name: backend-not-found
25+
labels:
26+
app: backend-not-found
27+
app.kubernetes.io/name: nx-cloud
28+
app.kubernetes.io/instance: nx-cloud
29+
spec:
30+
selector:
31+
app: backend-not-found
32+
type: ClusterIP
33+
ports:
34+
- name: http
35+
port: 80
36+
targetPort: 80
37+
38+
aggregator:
39+
cronjob:
40+
env:
41+
NX_CLOUD_SKIP_SLOW_AGGREGATOR_QUERIES: 'true'
42+
NX_CLOUD_LOG_OUTPUT_FORMAT: 'json'
43+
envValueFrom:
44+
ADMIN_PASSWORD:
45+
secretKeyRef:
46+
name: nx-cloud-credentials
47+
key: ADMIN_PASSWORD
48+
resources: null
49+
50+
frontend:
51+
deployment:
52+
env:
53+
NX_API_INTERNAL_BASE_URL: 'http://nx-cloud-nx-api-service'
54+
resources: null
55+
hpa:
56+
enabled: true
57+
minReplicas: 2
58+
maxReplicas: 5
59+
targetCPUUtilizationPercentage: 50
60+
61+
api:
62+
image:
63+
digest: sha256:034e529bbf353fe6ac2fffe551fa0edc5165f1dc1eba26cae86d104b75d896c1
64+
valkey:
65+
clientProvider: "redisson"
66+
useSentinel: true
67+
sentinelMasterName: "nxcloud"
68+
sentinelPort: 26379
69+
primaryAddress: valkey-node-0.valkey-headless.valkey.svc.cluster.local
70+
replicaAddresses: "valkey-node-1.valkey-headless.valkey.svc.cluster.local,valkey-node-2.valkey-headless.valkey.svc.cluster.local"
71+
port: 6379
72+
username: "default"
73+
passwordSecret:
74+
name: nx-cloud-credentials
75+
key: VALKEY_PASSWORD
76+
deployment:
77+
env:
78+
FILE_SERVER_INTERNAL_BASE_URL: http://nx-cloud-file-server-service
79+
FILE_SERVER_INTERNAL_PORT: "5000"
80+
resources: null

charts/nx-cloud/templates/api/deployment.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,18 @@ spec:
8383
{{- end }}
8484
ports:
8585
- containerPort: 4203
86+
{{- with .Values.api.deployment.startupProbe }}
8687
startupProbe:
87-
httpGet:
88-
path: /nx-cloud/uptime-check
89-
port: 4203
90-
initialDelaySeconds: 10
91-
failureThreshold: 5
92-
periodSeconds: 10
88+
{{- toYaml . | nindent 12 }}
89+
{{- end }}
90+
{{- with .Values.api.deployment.livenessProbe }}
9391
livenessProbe:
94-
httpGet:
95-
path: /nx-cloud/uptime-check
96-
port: 4203
97-
initialDelaySeconds: 30
92+
{{- toYaml . | nindent 12 }}
93+
{{- end }}
94+
{{- with .Values.api.deployment.readinessProbe }}
95+
readinessProbe:
96+
{{- toYaml . | nindent 12 }}
97+
{{- end }}
9898
env:
9999
- name: NX_CLOUD_MODE
100100
value: {{ .Values.global.nxCloudMode | default "private-enterprise" | quote }}

charts/nx-cloud/templates/file-server/deployment.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,18 @@ spec:
8888
{{- end }}
8989
ports:
9090
- containerPort: {{ .Values.fileServer.deployment.port }}
91+
{{- with .Values.fileServer.deployment.livenessProbe }}
9192
livenessProbe:
92-
httpGet:
93-
path: /file/uptime-check
94-
port: {{ .Values.fileServer.deployment.port }}
95-
initialDelaySeconds: 10
93+
{{- toYaml . | nindent 12 }}
94+
{{- end }}
95+
{{- with .Values.fileServer.deployment.startupProbe }}
9696
startupProbe:
97-
httpGet:
98-
path: /file/uptime-check
99-
port: {{ .Values.fileServer.deployment.port }}
100-
failureThreshold: 10
101-
periodSeconds: 5
97+
{{- toYaml . | nindent 12 }}
98+
{{- end }}
99+
{{- with .Values.fileServer.deployment.readinessProbe }}
100+
readinessProbe:
101+
{{- toYaml . | nindent 12 }}
102+
{{- end }}
102103
{{- if .Values.fileServer.deployment.securityContext }}
103104
securityContext:
104105
{{- omit .Values.fileServer.deployment.securityContext "fsGroup" "fsGroupChangePolicy" | toYaml | nindent 12 }}

charts/nx-cloud/templates/frontend/deployment.yaml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ metadata:
1010
{{- toYaml . | nindent 4 }}
1111
{{- end }}
1212
spec:
13+
{{- if not .Values.frontend.hpa.enabled }}
1314
replicas: {{ .Values.frontend.deployment.replicas | default 1}}
15+
{{- end }}
1416
selector:
1517
matchLabels:
1618
app: nx-cloud-frontend
@@ -61,18 +63,18 @@ spec:
6163
{{- if .Values.frontend.deployment.resources }}
6264
resources: {{- toYaml .Values.frontend.deployment.resources | nindent 12 }}
6365
{{- end }}
66+
{{- with .Values.frontend.deployment.startupProbe }}
67+
startupProbe:
68+
{{- toYaml . | nindent 12 }}
69+
{{- end }}
70+
{{- with .Values.frontend.deployment.livenessProbe }}
6471
livenessProbe:
65-
httpGet:
66-
path: /healthz
67-
port: 4202
68-
initialDelaySeconds: 15
69-
periodSeconds: 20
72+
{{- toYaml . | nindent 12 }}
73+
{{- end }}
74+
{{- with .Values.frontend.deployment.readinessProbe }}
7075
readinessProbe:
71-
httpGet:
72-
path: /readyz
73-
port: 4202
74-
initialDelaySeconds: 5
75-
periodSeconds: 10
76+
{{- toYaml . | nindent 12 }}
77+
{{- end }}
7678
ports:
7779
- containerPort: 4202
7880
env:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{{- if .Values.frontend.hpa.enabled }}
2+
apiVersion: autoscaling/v2
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: nx-cloud-frontend
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "nxCloud.mergedLabels" (dict "resourceLabels" .Values.frontend.hpa.labels "context" .) | nindent 4 }}
9+
{{- with .Values.frontend.hpa.annotations }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
spec:
14+
scaleTargetRef:
15+
apiVersion: apps/v1
16+
kind: Deployment
17+
name: nx-cloud-frontend
18+
minReplicas: {{ .Values.frontend.hpa.minReplicas }}
19+
maxReplicas: {{ .Values.frontend.hpa.maxReplicas }}
20+
{{- with .Values.frontend.hpa.behavior }}
21+
behavior:
22+
{{- toYaml . | nindent 4 }}
23+
{{- end }}
24+
metrics:
25+
{{- if .Values.frontend.hpa.targetCPUUtilizationPercentage }}
26+
- type: Resource
27+
resource:
28+
name: cpu
29+
target:
30+
type: Utilization
31+
averageUtilization: {{ .Values.frontend.hpa.targetCPUUtilizationPercentage }}
32+
{{- end }}
33+
{{- if .Values.frontend.hpa.targetMemoryUtilizationPercentage }}
34+
- type: Resource
35+
resource:
36+
name: memory
37+
target:
38+
type: Utilization
39+
averageUtilization: {{ .Values.frontend.hpa.targetMemoryUtilizationPercentage }}
40+
{{- end }}
41+
{{- with .Values.frontend.hpa.customMetrics }}
42+
{{- toYaml . | nindent 2 }}
43+
{{- end }}
44+
{{- end }}

0 commit comments

Comments
 (0)