Integrate Scalability Changes in SDC for Community Contribution 43/140043/1
authorKhantwal <anamika.khantwal@accenture.com>
Fri, 31 Jan 2025 06:03:50 +0000 (11:33 +0530)
committerKhantwal <anamika.khantwal@accenture.com>
Fri, 31 Jan 2025 06:03:50 +0000 (11:33 +0530)
- Add scalability changes to SDC components

Issue-ID: SDC-4712
Change-Id: I3bf59b7cde36ce19a884552fdb9cf0ce10f5c327
Signed-off-by: Anamika Khantwal <anamika.khantwal@accenture.com>
kubernetes/sdc/components/sdc-be/templates/autoscaling.yaml [new file with mode: 0644]
kubernetes/sdc/components/sdc-be/templates/deployment.yaml
kubernetes/sdc/components/sdc-be/values.yaml

diff --git a/kubernetes/sdc/components/sdc-be/templates/autoscaling.yaml b/kubernetes/sdc/components/sdc-be/templates/autoscaling.yaml
new file mode 100644 (file)
index 0000000..b7f2653
--- /dev/null
@@ -0,0 +1,32 @@
+{{- if .Values.autoscaling.enabled }}
+apiVersion: autoscaling/v2
+kind: HorizontalPodAutoscaler
+metadata:
+  name: {{ include "common.fullname" . }}
+  namespace: {{ include "common.namespace" . }}
+  labels: {{- include "common.labels" . | nindent 4 }}
+spec:
+  scaleTargetRef:
+    apiVersion: apps/v1
+    kind: Deployment
+    name: {{ include "common.fullname" . }}
+  minReplicas: {{ .Values.autoscaling.minReplicas }}
+  maxReplicas: {{ .Values.autoscaling.maxReplicas }}
+  metrics:
+    {{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
+    - type: Resource
+      resource:
+        name: cpu
+        target:
+          type: Utilization
+          averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
+    {{- end }}
+    {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
+    - type: Resource
+      resource:
+        name: memory
+        target:
+          type: Utilization
+          averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
+    {{- end }}
+{{- end }}
index f55f723..7854175 100644 (file)
@@ -20,7 +20,16 @@ kind: Deployment
 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
 spec:
   selector: {{- include "common.selectors" . | nindent 4 }}
+  {{- if not .Values.autoscaling.enabled }}
   replicas: {{ .Values.replicaCount }}
+  {{- end }}
+  revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
+  minReadySeconds: {{ .Values.minReadySeconds }}
+  strategy:
+    type: {{ .Values.updateStrategy.type }}
+    rollingUpdate:
+      maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
+      maxSurge: {{ .Values.updateStrategy.maxSurge }}
   template:
     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
     spec:
@@ -213,4 +222,3 @@ spec:
           name: {{ include "common.release" . }}-sdc-be-ready-probe-configmap
           defaultMode: 0755
       {{- include "common.imagePullSecrets" . | nindent 6 }}
-
index 7d41915..3f82c98 100644 (file)
@@ -296,4 +296,22 @@ be:
   caCert: ""
   truststorePath: ""
   truststorePassword: ""
+
+autoscaling:
+  enabled: true
+  minReplicas: 1
+  maxReplicas: 3
+  targetCPUUtilizationPercentage: 75
+
+# number of ReplicaSets that should be retained for the Deployment
+revisionHistoryLimit: 1
+
+# the minimum number of seconds that a newly created Pod should be ready
+minReadySeconds: 30
+updateStrategy:
+  type: RollingUpdate
+  # The number of pods that can be unavailable during the update process
+  maxUnavailable: 0
+  # The number of pods that can be created above the desired amount of pods during an update
+  maxSurge: 1
 #END