From 8dd178fd707705bacafcea48f79f7ed9218c4da2 Mon Sep 17 00:00:00 2001 From: "halil.cakal" Date: Wed, 5 Nov 2025 15:26:45 +0000 Subject: [PATCH] added second dmi-stub to cps-charts - cps-charts should support two dmi-stub instances, each uses its own pod. Since each pod should return its own Servlet URI (dmi-stub address) - the services for dmi-stub instances should be defined seperately since a fixed dmi-stub address is required. (otherwise adress would be dynamic on each deployment) - env. variable DMI_STUB_SERVER_PORT is used to override ther server port for second dmi-stub (ports should be different on pod levels) - for the latest architecture please visit the solution page: https://lf-onap.atlassian.net/wiki/spaces/DW/pages/347537434/CPS-2933+Kubernetes+container+management+system+for+CPS+and+NCMP - updated Uri address for dmi stub services Issue-ID: CPS-2934 Change-Id: I1c6bda107ed362278dea7c26fa842a286de76009 Signed-off-by: halil.cakal --- ...-deployment.yaml => dmi-stub-deployment-1.yaml} | 6 ++-- cps-charts/templates/dmi-stub-deployment-2.yaml | 36 ++++++++++++++++++++++ cps-charts/templates/dmi-stub-service-1.yaml | 20 ++++++++++++ cps-charts/templates/dmi-stub-service-2.yaml | 20 ++++++++++++ cps-charts/templates/dmi-stub-service.yaml | 20 ------------ cps-charts/values.yaml | 31 ++++++++++++++----- k6-tests/ncmp/config/endurance.json | 2 +- k6-tests/ncmp/config/kpi.json | 2 +- 8 files changed, 104 insertions(+), 33 deletions(-) rename cps-charts/templates/{dmi-stub-deployment.yaml => dmi-stub-deployment-1.yaml} (80%) create mode 100644 cps-charts/templates/dmi-stub-deployment-2.yaml create mode 100644 cps-charts/templates/dmi-stub-service-1.yaml create mode 100644 cps-charts/templates/dmi-stub-service-2.yaml delete mode 100644 cps-charts/templates/dmi-stub-service.yaml diff --git a/cps-charts/templates/dmi-stub-deployment.yaml b/cps-charts/templates/dmi-stub-deployment-1.yaml similarity index 80% rename from cps-charts/templates/dmi-stub-deployment.yaml rename to cps-charts/templates/dmi-stub-deployment-1.yaml index dd56bfa14e..e4593c2a04 100644 --- a/cps-charts/templates/dmi-stub-deployment.yaml +++ b/cps-charts/templates/dmi-stub-deployment-1.yaml @@ -1,7 +1,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "cps-and-ncmp.fullname" . }}-dmi-stub + name: {{ include "cps-and-ncmp.fullname" . }}-dmi-stub-1 labels: app: {{ include "cps-and-ncmp.name" . }} component: dmi-stub @@ -22,7 +22,7 @@ spec: image: "{{ .Values.dmiStub.image.repository }}:{{ .Values.dmiStub.image.tag }}" imagePullPolicy: {{ .Values.dmiStub.image.pullPolicy }} ports: - - containerPort: {{ .Values.dmiStub.containerPort }} + - containerPort: {{ .Values.dmiStub.deployment1.containerPort }} env: {{- range $key, $value := .Values.dmiStub.env }} - name: {{ $key }} @@ -31,4 +31,4 @@ spec: resources: {{- toYaml .Values.dmiStub.resources | nindent 12 }} livenessProbe: - {{- toYaml .Values.dmiStub.livenessProbe | nindent 12 }} + {{- toYaml .Values.dmiStub.livenessProbe.deployment1 | nindent 12 }} diff --git a/cps-charts/templates/dmi-stub-deployment-2.yaml b/cps-charts/templates/dmi-stub-deployment-2.yaml new file mode 100644 index 0000000000..4ad307b9fa --- /dev/null +++ b/cps-charts/templates/dmi-stub-deployment-2.yaml @@ -0,0 +1,36 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "cps-and-ncmp.fullname" . }}-dmi-stub-2 + labels: + app: {{ include "cps-and-ncmp.name" . }} + component: dmi-stub +spec: + replicas: {{ .Values.dmiStub.replicaCount }} + selector: + matchLabels: + app: {{ include "cps-and-ncmp.name" . }} + component: dmi-stub + template: + metadata: + labels: + app: {{ include "cps-and-ncmp.name" . }} + component: dmi-stub + spec: + containers: + - name: dmi-stub + image: "{{ .Values.dmiStub.image.repository }}:{{ .Values.dmiStub.image.tag }}" + imagePullPolicy: {{ .Values.dmiStub.image.pullPolicy }} + ports: + - containerPort: {{ .Values.dmiStub.deployment2.containerPort }} + env: + - name: DMI_STUB_SERVER_PORT + value: "{{ .Values.dmiStub.deployment2.containerPort }}" + {{- range $key, $value := .Values.dmiStub.env }} + - name: {{ $key }} + value: "{{ $value }}" + {{- end }} + resources: + {{- toYaml .Values.dmiStub.resources | nindent 12 }} + livenessProbe: + {{- toYaml .Values.dmiStub.livenessProbe.deployment2 | nindent 12 }} diff --git a/cps-charts/templates/dmi-stub-service-1.yaml b/cps-charts/templates/dmi-stub-service-1.yaml new file mode 100644 index 0000000000..f498a95a4d --- /dev/null +++ b/cps-charts/templates/dmi-stub-service-1.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "cps-and-ncmp.fullname" . }}-dmi-stub-1 + labels: + app: {{ include "cps-and-ncmp.name" . }} + component: dmi-stub +spec: + type: {{ .Values.dmiStub.service1.type }} + ports: + - port: {{ .Values.dmiStub.service1.port }} + targetPort: {{ .Values.dmiStub.deployment1.containerPort }} + protocol: TCP + name: http + {{- if and (eq .Values.dmiStub.service1.type "NodePort") .Values.dmiStub.service1.nodePort }} + nodePort: {{ .Values.dmiStub.service1.nodePort }} + {{- end }} + selector: + app: {{ include "cps-and-ncmp.name" . }} + component: dmi-stub diff --git a/cps-charts/templates/dmi-stub-service-2.yaml b/cps-charts/templates/dmi-stub-service-2.yaml new file mode 100644 index 0000000000..5cf8667f34 --- /dev/null +++ b/cps-charts/templates/dmi-stub-service-2.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "cps-and-ncmp.fullname" . }}-dmi-stub-2 + labels: + app: {{ include "cps-and-ncmp.name" . }} + component: dmi-stub +spec: + type: {{ .Values.dmiStub.service2.type }} + ports: + - port: {{ .Values.dmiStub.service2.port }} + targetPort: {{ .Values.dmiStub.deployment2.containerPort }} + protocol: TCP + name: http + {{- if and (eq .Values.dmiStub.service2.type "NodePort") .Values.dmiStub.service2.nodePort }} + nodePort: {{ .Values.dmiStub.service2.nodePort }} + {{- end }} + selector: + app: {{ include "cps-and-ncmp.name" . }} + component: dmi-stub diff --git a/cps-charts/templates/dmi-stub-service.yaml b/cps-charts/templates/dmi-stub-service.yaml deleted file mode 100644 index 79f727d96e..0000000000 --- a/cps-charts/templates/dmi-stub-service.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "cps-and-ncmp.fullname" . }}-dmi-stub - labels: - app: {{ include "cps-and-ncmp.name" . }} - component: dmi-stub -spec: - type: {{ .Values.dmiStub.service.type }} - ports: - - port: {{ .Values.dmiStub.service.port }} - targetPort: {{ .Values.dmiStub.containerPort }} - protocol: TCP - name: http - {{- if and (eq .Values.dmiStub.service.type "NodePort") .Values.dmiStub.service.nodePort }} - nodePort: {{ .Values.dmiStub.service.nodePort }} - {{- end }} - selector: - app: {{ include "cps-and-ncmp.name" . }} - component: dmi-stub diff --git a/cps-charts/values.yaml b/cps-charts/values.yaml index 72f040d0ed..4c0557463f 100644 --- a/cps-charts/values.yaml +++ b/cps-charts/values.yaml @@ -127,11 +127,18 @@ dmiStub: tag: "1.8.0-SNAPSHOT" pullPolicy: IfNotPresent replicaCount: 1 - service: + deployment1: + containerPort: 8092 + deployment2: + containerPort: 8093 + service1: type: NodePort port: 8092 nodePort: 30092 - containerPort: 8092 + service2: + type: NodePort + port: 8093 + nodePort: 31092 env: KAFKA_BOOTSTRAP_SERVER: "cps-ncmp-kafka.default.svc.cluster.local:9092" NCMP_CONSUMER_GROUP_ID: "ncmp-group" @@ -149,9 +156,17 @@ dmiStub: cpu: "1000m" memory: "2Gi" livenessProbe: - httpGet: - path: /actuator/health/readiness - port: 8092 - initialDelaySeconds: 30 - periodSeconds: 10 - failureThreshold: 3 + deployment1: + httpGet: + path: /actuator/health/readiness + port: 8092 + initialDelaySeconds: 30 + periodSeconds: 10 + failureThreshold: 3 + deployment2: + httpGet: + path: /actuator/health/readiness + port: 8093 + initialDelaySeconds: 30 + periodSeconds: 10 + failureThreshold: 3 diff --git a/k6-tests/ncmp/config/endurance.json b/k6-tests/ncmp/config/endurance.json index e216ed065c..afe8f6a336 100644 --- a/k6-tests/ncmp/config/endurance.json +++ b/k6-tests/ncmp/config/endurance.json @@ -7,7 +7,7 @@ }, "k8sHosts": { "ncmpBaseUrl": "http://localhost:30080", - "dmiStubUrl": "http://cps-ncmp-dmi-stub:8092", + "dmiStubUrl": "http://cps-ncmp-dmi-stub-1:8092", "kafkaBootstrapServer": "localhost:30093" }, "scenarios": { diff --git a/k6-tests/ncmp/config/kpi.json b/k6-tests/ncmp/config/kpi.json index 666f70a355..7cade346f1 100644 --- a/k6-tests/ncmp/config/kpi.json +++ b/k6-tests/ncmp/config/kpi.json @@ -7,7 +7,7 @@ }, "k8sHosts": { "ncmpBaseUrl": "http://localhost:30080", - "dmiStubUrl": "http://cps-ncmp-dmi-stub:8092", + "dmiStubUrl": "http://cps-ncmp-dmi-stub-1:8092", "kafkaBootstrapServer": "localhost:30093" }, "scenarios": { -- 2.16.6