Integrate Scalability Changes in SDC 44/140044/6
authorKhantwal <anamika.khantwal@accenture.com>
Fri, 31 Jan 2025 06:20:47 +0000 (11:50 +0530)
committerKhantwal <anamika.khantwal@accenture.com>
Fri, 7 Feb 2025 05:39:47 +0000 (11:09 +0530)
- Add scalability changes to SDC components

Issue-ID: SDC-4712
Change-Id: I9c5f81ce979d3c923981f8b00eeec25f69d9d103
Signed-off-by: Anamika Khantwal <anamika.khantwal@accenture.com>
20 files changed:
kubernetes/sdc/Chart.yaml
kubernetes/sdc/components/sdc-be/Chart.yaml
kubernetes/sdc/components/sdc-fe/Chart.yaml
kubernetes/sdc/components/sdc-fe/resources/config/readyProbe/combined-liveness.sh [new file with mode: 0644]
kubernetes/sdc/components/sdc-fe/templates/autoscaling.yaml [new file with mode: 0644]
kubernetes/sdc/components/sdc-fe/templates/configmap.yaml
kubernetes/sdc/components/sdc-fe/values.yaml
kubernetes/sdc/components/sdc-onboarding-be/Chart.yaml
kubernetes/sdc/components/sdc-onboarding-be/templates/autoscaling.yaml [new file with mode: 0644]
kubernetes/sdc/components/sdc-onboarding-be/templates/deployment.yaml
kubernetes/sdc/components/sdc-onboarding-be/templates/servicemonitor.yaml [new file with mode: 0644]
kubernetes/sdc/components/sdc-onboarding-be/values.yaml
kubernetes/sdc/components/sdc-wfd-be/Chart.yaml
kubernetes/sdc/components/sdc-wfd-be/templates/autoscaling.yaml [new file with mode: 0644]
kubernetes/sdc/components/sdc-wfd-be/templates/deployment.yaml
kubernetes/sdc/components/sdc-wfd-be/values.yaml
kubernetes/sdc/components/sdc-wfd-fe/Chart.yaml
kubernetes/sdc/components/sdc-wfd-fe/templates/autoscaling.yaml [new file with mode: 0644]
kubernetes/sdc/components/sdc-wfd-fe/templates/deployment.yaml
kubernetes/sdc/components/sdc-wfd-fe/values.yaml

index e455d79..54b71b4 100644 (file)
@@ -18,7 +18,7 @@
 apiVersion: v2
 description: Service Design and Creation Umbrella Helm charts
 name: sdc
-version: 13.0.3
+version: 13.0.4
 
 dependencies:
   - name: common
index a17a9d3..bb385a0 100644 (file)
@@ -18,7 +18,7 @@
 apiVersion: v2
 description: ONAP Service Design and Creation Backend API
 name: sdc-be
-version: 13.0.2
+version: 13.0.3
 
 dependencies:
   - name: common
index 83197f3..3f8ae42 100644 (file)
@@ -18,7 +18,7 @@
 apiVersion: v2
 description: ONAP Service Design and Creation Front End
 name: sdc-fe
-version: 13.0.2
+version: 13.0.3
 
 dependencies:
   - name: repositoryGenerator
diff --git a/kubernetes/sdc/components/sdc-fe/resources/config/readyProbe/combined-liveness.sh b/kubernetes/sdc/components/sdc-fe/resources/config/readyProbe/combined-liveness.sh
new file mode 100644 (file)
index 0000000..28ad30a
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# Variables
+
+INTERNAL_PORT=8181
+HEALTHCHECK_URL="http://localhost:8181/sdc1/rest/healthCheck"
+
+# 1. TCP Socket Check for Internal Port
+
+nc -z localhost $INTERNAL_PORT
+TCP_STATUS=$?
+
+if [ $TCP_STATUS -ne 0 ]; then
+    echo "TCP check failed: Internal port $INTERNAL_PORT is not open."
+    exit 1
+fi
+
+# 2. Cassandra Health Check from API Response using jq
+
+CASSANDRA_STATUS=$(curl -s $HEALTHCHECK_URL | jq -r '.componentsInfo[] | select(.healthCheckComponent == "CASSANDRA") | .healthCheckStatus')
+
+if [ "$CASSANDRA_STATUS" != "UP" ]; then
+    echo "Cassandra API check failed: HealthCheck status is $CASSANDRA_STATUS, not UP."
+    exit 1
+fi
+
+echo "Liveness check passed: Internal port $INTERNAL_PORT is open, and Cassandra is healthy."
+exit 0
diff --git a/kubernetes/sdc/components/sdc-fe/templates/autoscaling.yaml b/kubernetes/sdc/components/sdc-fe/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 948a3fe..1d4243e 100644 (file)
@@ -40,3 +40,12 @@ metadata:
     heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/config/plugins/*").AsConfig . | indent 2 }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "common.fullname" . }}-readiness-liveness-probe
+  namespace: {{ include "common.namespace" . }}
+  labels: {{- include "common.labels" . | nindent 4 }}
+data:
+{{ tpl (.Files.Glob "resources/config/readyProbe/*").AsConfig . | indent 2 }}
index 0079f83..72c048c 100644 (file)
@@ -57,7 +57,7 @@ affinity: {}
 liveness:
   initialDelaySeconds: 1
   periodSeconds: 10
-  timeoutSeconds: 15
+  timeoutSeconds: 30
   successThreshold: 1
   failureThreshold: 3
   # necessary to disable liveness probe when setting breakpoints
@@ -67,7 +67,7 @@ liveness:
 readiness:
   initialDelaySeconds: 1
   periodSeconds: 10
-  timeoutSeconds: 15
+  timeoutSeconds: 30
   successThreshold: 1
   failureThreshold: 3
 
@@ -146,3 +146,21 @@ serviceAccount:
 log:
   path: /var/log/onap
 logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
+
+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
index afcbef2..a41f386 100644 (file)
@@ -18,7 +18,7 @@
 apiVersion: v2
 description: ONAP Service Design and Creation Onboarding API
 name: sdc-onboarding-be
-version: 13.0.2
+version: 13.0.3
 
 dependencies:
   - name: repositoryGenerator
diff --git a/kubernetes/sdc/components/sdc-onboarding-be/templates/autoscaling.yaml b/kubernetes/sdc/components/sdc-onboarding-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 47ae2bb..7448697 100644 (file)
@@ -21,7 +21,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:
diff --git a/kubernetes/sdc/components/sdc-onboarding-be/templates/servicemonitor.yaml b/kubernetes/sdc/components/sdc-onboarding-be/templates/servicemonitor.yaml
new file mode 100644 (file)
index 0000000..937f5ef
--- /dev/null
@@ -0,0 +1,19 @@
+{{/*
+# Copyright © 2024 Deutsche Telekom AG
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/}}
+
+{{- if .Values.metrics.serviceMonitor.enabled }}
+{{  include "common.serviceMonitor" . }}
+{{- end }}
index a928e10..07e3bea 100644 (file)
@@ -210,3 +210,28 @@ permittedAncestors: ""
 JETTY_BASE: "/app/jetty"
 http_option: http_option
 
+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
+
+metrics:
+  serviceMonitor:
+    enabled: true
+    targetPort: 8081
+    path: /onboarding-api/v1.0/actuator/prometheus
+    basicAuth:
+      enabled: false
index 8a1a8b3..ea2d0f2 100644 (file)
@@ -17,7 +17,7 @@
 apiVersion: v2
 description: ONAP Service Design and Creation Workflow Designer backend
 name: sdc-wfd-be
-version: 13.0.0
+version: 13.0.1
 
 dependencies:
   - name: repositoryGenerator
diff --git a/kubernetes/sdc/components/sdc-wfd-be/templates/autoscaling.yaml b/kubernetes/sdc/components/sdc-wfd-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 59ebb02..cbbfe21 100644 (file)
@@ -21,7 +21,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:
index cc85176..4d39ce0 100644 (file)
@@ -153,3 +153,21 @@ serviceAccount:
 wait_for_job_container:
   containers:
     - '{{ include "common.name" . }}-job'
+
+autoscaling:
+  enabled: false
+  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
index 79ff34a..6aeee84 100644 (file)
@@ -17,7 +17,7 @@
 apiVersion: v2
 description: ONAP Service Design and Creation Workflow Designer frontend
 name: sdc-wfd-fe
-version: 13.0.0
+version: 13.0.1
 
 dependencies:
   - name: repositoryGenerator
diff --git a/kubernetes/sdc/components/sdc-wfd-fe/templates/autoscaling.yaml b/kubernetes/sdc/components/sdc-wfd-fe/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 ad031da..fcf1398 100644 (file)
@@ -19,7 +19,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:
index e33cf48..e82e1d9 100644 (file)
@@ -138,3 +138,21 @@ serviceAccount:
 log:
   path: /var/log/onap
 logConfigMapNamePrefix: '{{ include "common.fullname" . }}'
+
+autoscaling:
+  enabled: false
+  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