From 2cfe8eccdc07cbc2db6b9a9cd802785bda89107e Mon Sep 17 00:00:00 2001 From: maslow Date: Sun, 22 Jan 2023 15:34:36 +0800 Subject: [PATCH] chore(deploy): change mongo charts from replicaset to statefulset (#669) --- .../build/charts/mongodb/templates/hpa.yaml | 28 ------------------- .../{deployment.yaml => statefulset.yaml} | 6 ++-- deploy/build/charts/mongodb/values.yaml | 9 +----- runtimes/nodejs/src/config.ts | 18 ------------ runtimes/nodejs/src/support/cloud-sdk.ts | 2 +- 5 files changed, 4 insertions(+), 59 deletions(-) delete mode 100644 deploy/build/charts/mongodb/templates/hpa.yaml rename deploy/build/charts/mongodb/templates/{deployment.yaml => statefulset.yaml} (97%) diff --git a/deploy/build/charts/mongodb/templates/hpa.yaml b/deploy/build/charts/mongodb/templates/hpa.yaml deleted file mode 100644 index 6fa0d82725..0000000000 --- a/deploy/build/charts/mongodb/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "mongodb.fullname" . }} - labels: - {{- include "mongodb.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "mongodb.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/deploy/build/charts/mongodb/templates/deployment.yaml b/deploy/build/charts/mongodb/templates/statefulset.yaml similarity index 97% rename from deploy/build/charts/mongodb/templates/deployment.yaml rename to deploy/build/charts/mongodb/templates/statefulset.yaml index aa6d329e30..4acc1b5e71 100644 --- a/deploy/build/charts/mongodb/templates/deployment.yaml +++ b/deploy/build/charts/mongodb/templates/statefulset.yaml @@ -1,16 +1,14 @@ apiVersion: apps/v1 -kind: Deployment +kind: StatefulSet metadata: name: {{ include "mongodb.fullname" . }} labels: {{- include "mongodb.labels" . | nindent 4 }} spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} selector: matchLabels: {{- include "mongodb.selectorLabels" . | nindent 6 }} + serviceName: {{ .Values.service.name }} template: metadata: {{- with .Values.podAnnotations }} diff --git a/deploy/build/charts/mongodb/values.yaml b/deploy/build/charts/mongodb/values.yaml index bba6e99162..59ccb6dc02 100644 --- a/deploy/build/charts/mongodb/values.yaml +++ b/deploy/build/charts/mongodb/values.yaml @@ -20,7 +20,7 @@ image: repository: mongo pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: "5.0" + tag: 5.0.14 imagePullSecrets: [] nameOverride: "" @@ -85,13 +85,6 @@ resources: # cpu: 100m # memory: 128Mi -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - nodeSelector: {} tolerations: [] diff --git a/runtimes/nodejs/src/config.ts b/runtimes/nodejs/src/config.ts index 47aabab203..1bc79aacde 100644 --- a/runtimes/nodejs/src/config.ts +++ b/runtimes/nodejs/src/config.ts @@ -31,14 +31,6 @@ export default class Config { return secret_salt; } - /** - * the `temp path` - */ - static get TMP_PATH(): string { - const tmp_path = process.env["TMP_PATH"] ?? path.join(process.cwd(), "tmp"); - return tmp_path; - } - /** * the logger level : 'fatal', 'error', 'warning', 'info', 'debug', 'trace' */ @@ -61,16 +53,6 @@ export default class Config { return (process.env.PORT ?? 8000) as number; } - /** - * enable cloud function logging, default is `always` - * - `always` means that all cloud functions' execution will be logged - * - `debug` means that only logging for debug invokes - * - `never` no logging any case - */ - static get ENABLE_CLOUD_FUNCTION_LOG(): "always" | "debug" | "never" { - return (process.env.ENABLE_CLOUD_FUNCTION_LOG as any) ?? "always"; - } - /** * in production deploy or not */ diff --git a/runtimes/nodejs/src/support/cloud-sdk.ts b/runtimes/nodejs/src/support/cloud-sdk.ts index 37b61bd376..133e292221 100644 --- a/runtimes/nodejs/src/support/cloud-sdk.ts +++ b/runtimes/nodejs/src/support/cloud-sdk.ts @@ -36,7 +36,7 @@ function createCloudSdk() { OSS_INTERNAL_ENDPOINT: process.env.OSS_INTERNAL_ENDPOINT, OSS_EXTERNAL_ENDPOINT: process.env.OSS_EXTERNAL_ENDPOINT, NPM_INSTALL_FLAGS: process.env.NPM_INSTALL_FLAGS || '', - RUNTIME_IMAGE: process.env.RUNTIME_IMAGE, + RUNTIME_IMAGE: Config.RUNTIME_IMAGE, }, }