[CPS] Parameterize topics in application
- parameterize the topics for both cps-ncmp and ncmp-dmi-plugin code
- Also copy the globally defined topics to the more specific place.
- In the next patch will remove the global topics and users info.
Issue-ID: CPS-1612
Change-Id: Ibf38dd96857ed50a101279a11ded915f86be3d65
Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
diff --git a/kubernetes/cps/components/cps-core/resources/config/application-helm.yml b/kubernetes/cps/components/cps-core/resources/config/application-helm.yml
index fd3068e..842395f 100644
--- a/kubernetes/cps/components/cps-core/resources/config/application-helm.yml
+++ b/kubernetes/cps/components/cps-core/resources/config/application-helm.yml
@@ -62,6 +62,11 @@
spring.kafka.properties.sasl.mechanism: {{ .Values.kafkaUser.authenticationType | upper }}
spring.kafka.properties.sasl.jaas.config: ${SASL_JAAS_CONFIG}
+# Kafka Topics
+{{- if .Values.topics.config }}
+{{ toYaml .Values.topics.config | nindent 2 }}
+{{- end }}
+
{{- if .Values.config.additional }}
{{ toYaml .Values.config.additional | nindent 2 }}
{{- end }}
diff --git a/kubernetes/cps/components/cps-core/values.yaml b/kubernetes/cps/components/cps-core/values.yaml
index e5c062c..96d53f5 100644
--- a/kubernetes/cps/components/cps-core/values.yaml
+++ b/kubernetes/cps/components/cps-core/values.yaml
@@ -192,7 +192,18 @@
notification.async.executor.wait-for-tasks-to-complete-on-shutdown: true
notification.async.executor.thread-name-prefix: Async-
-# Strimzi KafkaUser config
+# Strimzi KafkaUser and Topic config
+kafkaTopic:
+ - name: &dmiCmEventsTopic dmi-cm-events
+ retentionMs: 7200000
+ segmentBytes: 1073741824
+ - name: &ncmpAsyncM2MTopic ncmp-async-m2m
+ retentionMs: 7200000
+ segmentBytes: 1073741824
+ - name: &cmAvcSubscriptionTopic cm-avc-subscription
+ retentionMs: 7200000
+ segmentBytes: 1073741824
+
kafkaUser:
authenticationType: scram-sha-512
acls:
@@ -202,16 +213,22 @@
- name: *dataUpdatedTopic
type: topic
operations: [Write]
- - name: dmi-cm-events
+ - name: *dmiCmEventsTopic
type: topic
operations: [Read]
- - name: ncmp-async-m2m
+ - name: *ncmpAsyncM2MTopic
type: topic
operations: [Read]
- - name: cm-avc-subscription
+ - name: *cmAvcSubscriptionTopic
type: topic
operations: [Read]
+topics:
+ config:
+ app.ncmp.async-m2m.topic: *ncmpAsyncM2MTopic
+ app.ncmp.avc.subscription-topic: *cmAvcSubscriptionTopic
+ app.dmi.cm-events.topic: *dmiCmEventsTopic
+
logging:
level: INFO
path: /tmp
diff --git a/kubernetes/cps/components/ncmp-dmi-plugin/resources/config/application-helm.yml b/kubernetes/cps/components/ncmp-dmi-plugin/resources/config/application-helm.yml
index 7d764bf..428a553 100644
--- a/kubernetes/cps/components/ncmp-dmi-plugin/resources/config/application-helm.yml
+++ b/kubernetes/cps/components/ncmp-dmi-plugin/resources/config/application-helm.yml
@@ -57,6 +57,11 @@
spring.kafka.properties.sasl.mechanism: {{ .Values.kafkaUser.authenticationType | upper }}
spring.kafka.properties.sasl.jaas.config: ${SASL_JAAS_CONFIG}
+# Kafka Topics
+{{- if .Values.topics.config }}
+{{ toYaml .Values.topics.config | nindent 2 }}
+{{- end }}
+
{{- if .Values.config.additional }}
{{ toYaml .Values.config.additional | nindent 2 }}
{{- end }}
diff --git a/kubernetes/cps/components/ncmp-dmi-plugin/values.yaml b/kubernetes/cps/components/ncmp-dmi-plugin/values.yaml
index 59a6490..fcc4808 100644
--- a/kubernetes/cps/components/ncmp-dmi-plugin/values.yaml
+++ b/kubernetes/cps/components/ncmp-dmi-plugin/values.yaml
@@ -178,19 +178,36 @@
maxUnavailable: 0
maxSurge: 1
-# Strimzi KafkaUser config
+# Strimzi KafkaUser and Topic config
+kafkaTopic:
+ - name: &ncmpDmiCmAvcSubscriptionNcmpDmiPluginTopic ncmp-dmi-cm-avc-subscription-ncmp-dmi-plugin
+ retentionMs: 7200000
+ segmentBytes: 1073741824
+ - name: &dmiNcmpCmAvcSubscriptionTopic dmi-ncmp-cm-avc-subscription
+ retentionMs: 7200000
+ segmentBytes: 1073741824
+ - name: &ncmpAsyncM2MTopic ncmp-async-m2m
+ retentionMs: 7200000
+ segmentBytes: 1073741824
+
kafkaUser:
authenticationType: scram-sha-512
acls:
- name: ncmp-dmi-plugin-group
type: group
operations: [Read]
- - name: ncmp-dmi-cm-avc-subscription-ncmp-dmi-plugin
+ - name: *ncmpDmiCmAvcSubscriptionNcmpDmiPluginTopic
type: topic
operations: [Read]
- - name: dmi-ncmp-cm-avc-subscription
+ - name: *dmiNcmpCmAvcSubscriptionTopic
type: topic
operations: [Write]
- - name: ncmp-async-m2m
+ - name: *ncmpAsyncM2MTopic
type: topic
operations: [Write]
+
+topics:
+ config:
+ app.ncmp.async.topic: *ncmpAsyncM2MTopic
+ app.dmi.avc.subscription-topic: *ncmpDmiCmAvcSubscriptionNcmpDmiPluginTopic
+ app.dmi.avc.subscription-response-topic: *dmiNcmpCmAvcSubscriptionTopic