[SDC] Add strimzi kafka setup on sdc-be 28/129928/5
authorefiacor <fiachra.corcoran@est.tech>
Tue, 12 Jul 2022 12:19:53 +0000 (13:19 +0100)
committerFiachra Corcoran <fiachra.corcoran@est.tech>
Tue, 22 Nov 2022 14:11:42 +0000 (14:11 +0000)
Add SDC KafkaTopics and KafkaUser

Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Change-Id: I78542539567d2e3b67376b154ad069df3d1dad55
Issue-ID: DMAAP-1744

13 files changed:
kubernetes/sdc/components/sdc-be/templates/configmap.yaml
kubernetes/sdc/components/sdc-be/templates/deployment.yaml
kubernetes/sdc/components/sdc-be/templates/sdc-be-kafka-user.yaml [new file with mode: 0644]
kubernetes/sdc/components/sdc-be/templates/sdc-distro-topics.yaml [new file with mode: 0644]
kubernetes/sdc/components/sdc-be/templates/secret.yaml [new file with mode: 0644]
kubernetes/sdc/components/sdc-be/values.yaml
kubernetes/sdc/components/sdc-cs/values.yaml
kubernetes/sdc/components/sdc-fe/values.yaml
kubernetes/sdc/components/sdc-onboarding-be/values.yaml
kubernetes/sdc/resources/config/environments/AUTO.json
kubernetes/sdc/values.yaml
kubernetes/strimzi/templates/strimzi-kafka.yaml
kubernetes/strimzi/values.yaml

index aa632f3..332cd74 100644 (file)
@@ -27,3 +27,5 @@ metadata:
     heritage: {{ .Release.Service }}
 data:
 {{ tpl (.Files.Glob "resources/config/logging/*").AsConfig . | indent 2 }}
+
+
index 24f169a..16fc57a 100644 (file)
@@ -31,8 +31,10 @@ spec:
         args:
         - --container-name
         - "sdc-onboarding-be"
+        {{- if not .Values.global.kafka.useKafka }}
         - --container-name
         - "message-router"
+        {{- end }}
         env:
         - name: NAMESPACE
           valueFrom:
@@ -159,6 +161,12 @@ spec:
             valueFrom:
               fieldRef:
                 fieldPath: status.podIP
+          {{- if .Values.global.kafka.useKafka }}
+          - name: SASL_JAAS_CONFIG
+            {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdc-be-kafka-secret" "key" "sasl.jaas.config") | indent 12 }}
+          - name: USE_KAFKA
+            value: {{ .Values.global.kafka.useKafka | quote }}
+          {{- end }}
           volumeMounts:
           - name: sdc-environments
             mountPath: /app/jetty/chef-solo/environments/
diff --git a/kubernetes/sdc/components/sdc-be/templates/sdc-be-kafka-user.yaml b/kubernetes/sdc/components/sdc-be/templates/sdc-be-kafka-user.yaml
new file mode 100644 (file)
index 0000000..6cd7f93
--- /dev/null
@@ -0,0 +1,39 @@
+{{/*
+# Copyright © 2022 Nordix Foundation
+#
+# 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.global.kafka.useKafka }}
+apiVersion: kafka.strimzi.io/v1beta2
+kind: KafkaUser
+metadata:
+  name: {{ include "common.release" . }}-{{ .Values.global.kafka.sdcBeKafkaUser }}
+  labels:
+    strimzi.io/cluster: {{ include "common.release" . }}-strimzi
+spec:
+  authentication:
+    type: {{ .Values.config.kafka.saslMech }}
+  authorization:
+    type: {{ .Values.config.kafka.authType }}
+    acls:
+    - resource:
+        type: group
+        name: {{ .Values.config.kafka.topicConsumer.groupId }}-{{ .Values.env.name }}
+      operation: Read
+    - resource:
+        type: topic
+        patternType: prefix
+        name: {{ .Values.config.kafka.topicConsumer.pattern }}
+      operation: All
+{{- end }}
diff --git a/kubernetes/sdc/components/sdc-be/templates/sdc-distro-topics.yaml b/kubernetes/sdc/components/sdc-be/templates/sdc-distro-topics.yaml
new file mode 100644 (file)
index 0000000..9a6f757
--- /dev/null
@@ -0,0 +1,40 @@
+{{/*
+# Copyright © 2022 Nordix Foundation
+#
+# 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.global.kafka.useKafka }}
+apiVersion: kafka.strimzi.io/v1beta2
+kind: KafkaTopic
+metadata:
+  name: sdc-distro-notif-topic
+  labels:
+    strimzi.io/cluster: {{ include "common.release" . }}-strimzi
+spec:
+  topicName: {{ .Values.global.kafka.topics.sdcDistNotifTopic }}-{{ .Values.env.name }}
+  config:
+    retention.ms: {{ .Values.config.kafka.topicRetentionMs }}
+    segment.bytes: {{ .Values.config.kafka.topicSegmentBytes }}
+---
+apiVersion: kafka.strimzi.io/v1beta2
+kind: KafkaTopic
+metadata:
+  name: sdc-distro-status-topic
+  labels:
+    strimzi.io/cluster: {{ include "common.release" . }}-strimzi
+spec:
+  topicName: {{ .Values.global.kafka.topics.sdcDistStatusTopic }}-{{ .Values.env.name }}
+  config:
+    retention.ms: {{ .Values.config.kafka.topicRetentionMs }}
+    segment.bytes: {{ .Values.config.kafka.topicSegmentBytes }}
+{{- end }}
\ No newline at end of file
diff --git a/kubernetes/sdc/components/sdc-be/templates/secret.yaml b/kubernetes/sdc/components/sdc-be/templates/secret.yaml
new file mode 100644 (file)
index 0000000..bb5091f
--- /dev/null
@@ -0,0 +1,17 @@
+{{/*
+# Copyright © 2022 Nordix Foundation
+#
+# 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.
+*/}}
+
+{{ include "common.secretFast" . }}
index 9f21635..faf46e5 100644 (file)
@@ -1,5 +1,6 @@
 # Copyright © 2017 Amdocs, Bell Canada
 # Modifications Copyright © 2018 AT&T, ZTE
+# Modifications Copyright © 2022 Nordix Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -30,13 +31,20 @@ global:
     replicaCount: 3
     clusterName: cassandra
     dataCenter: Pod
+  # Strimzi kafka config
+  kafka:
+    useKafka: overridden-from-parent-values-yaml
+    sdcBeKafkaUser: overridden-from-parent-values-yaml
+    topics:
+      sdcDistNotifTopic: overridden-from-parent-values-yaml
+      sdcDistStatusTopic: overridden-from-parent-values-yaml
 
 #################################################################
 # Application configuration defaults.
 #################################################################
 # application image
-image: onap/sdc-backend-all-plugins:1.11.9
-backendInitImage: onap/sdc-backend-init:1.11.9
+image: onap/sdc-backend-all-plugins:1.12.0
+backendInitImage: onap/sdc-backend-init:1.12.0
 
 pullPolicy: Always
 
@@ -70,9 +78,29 @@ certInitializer:
 #################################################################
 # SDC Config part
 #################################################################
+
+secrets:
+  - uid: sdc-be-kafka-secret
+    externalSecret: '{{ tpl (default "" .Values.config.jaasConfExternalSecret) . }}'
+    type: genericKV
+    envs:
+      - name: sasl.jaas.config
+        value: '{{ .Values.config.someConfig }}'
+        policy: generate
+
 config:
   javaOptions: "-Xmx1536m -Xms1536m"
   cassandraSslEnabled: "false"
+  # Strimzi kafka config
+  kafka:
+    saslMech: scram-sha-512
+    securityProtocol: SASL_PLAINTEXT
+    authType: simple
+    topicRetentionMs: 7200000
+    topicSegmentBytes: 1073741824
+    topicConsumer:
+      pattern: SDC-DIST
+      groupId: sdc
 
 # default number of instances
 replicaCount: 1
index 46208a2..b3dfbfa 100644 (file)
@@ -51,8 +51,8 @@ cassandra:
 
 # application image
 repository: nexus3.onap.org:10001
-image: onap/sdc-cassandra:1.11.9
-cassandraInitImage: onap/sdc-cassandra-init:1.11.9
+image: onap/sdc-cassandra:1.12.0
+cassandraInitImage: onap/sdc-cassandra-init:1.12.0
 pullPolicy: Always
 
 config:
index 76c9e13..abac356 100644 (file)
@@ -47,7 +47,7 @@ certInitializer:
 # Application configuration defaults.
 #################################################################
 # application image
-image: onap/sdc-frontend:1.11.9
+image: onap/sdc-frontend:1.12.0
 pullPolicy: Always
 
 config:
index 45cbcd6..1db5af9 100644 (file)
@@ -59,8 +59,8 @@ certInitializer:
 # Application configuration defaults.
 #################################################################
 # application image
-image: onap/sdc-onboard-backend:1.11.9
-onboardingInitImage: onap/sdc-onboard-cassandra-init:1.11.9
+image: onap/sdc-onboard-backend:1.12.0
+onboardingInitImage: onap/sdc-onboard-cassandra-init:1.12.0
 pullPolicy: Always
 
 # flag to enable debugging - application support required
index c953559..aee666f 100755 (executable)
                 "message-router.{{include "common.namespace" .}}"
             ]
         },
+        "Kafka": {
+             "bootstrap": "{{ include "common.release" . }}-{{ .Values.global.kafka.kafkaBootstrap }}"
+        },
+        "DistributionTopics": {
+             "notificationTopicName": "{{ .Values.global.kafka.topics.sdcDistNotifTopic }}",
+             "statusTopicName": "{{ .Values.global.kafka.topics.sdcDistStatusTopic }}"
+        },
         "Nodes": {
             "CS": [
                 "{{.Values.global.sdc_cassandra.serviceName}}.{{include "common.namespace" .}}"
index e764306..60a361e 100644 (file)
@@ -1,5 +1,6 @@
 # Copyright © 2017 Amdocs, Bell Canada
 # Modifications Copyright © 2018 AT&T, ZTE
+# Modifications Copyright © 2021 Nordix Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -41,9 +42,19 @@ global:
    clusterName: cassandra
    dataCenter: Pod
   centralizedLoggingEnabled: true
+  # Kafka config
+  kafka:
+    useKafka: true
+    sdcBeKafkaUser: sdc-be-kafka-user
+    kafkaBootstrap: strimzi-kafka-bootstrap:9092
+    topics:
+      sdcDistNotifTopic: SDC-DISTR-NOTIF-TOPIC
+      sdcDistStatusTopic: SDC-DISTR-STATUS-TOPIC
 
 sdc-be:
   logConfigMapNamePrefix: '{{ include "common.release" . }}-sdc'
+  config:
+    jaasConfExternalSecret: '{{ include "common.release" . }}-{{ .Values.global.kafka.sdcBeKafkaUser }}'
 sdc-fe:
   logConfigMapNamePrefix: '{{ include "common.release" . }}-sdc'
 sdc-onboarding-be:
index c7dc2af..03ee56a 100644 (file)
@@ -70,6 +70,7 @@ spec:
       min.insync.replicas: {{ .Values.replicaCount }}
       offsets.topic.replication.factor: {{ .Values.replicaCount }}
       transaction.state.log.replication.factor: {{ .Values.replicaCount }}
+      num.partitions: {{ .Values.numPartitions }}
       transaction.state.log.min.isr: {{ .Values.replicaCount }}
       log.message.format.version: {{ .Values.version }}
       inter.broker.protocol.version: {{ .Values.version }}
index dcfa913..99ccde5 100644 (file)
@@ -24,6 +24,7 @@ global:
 # Application configuration defaults.
 #################################################################
 replicaCount: 3
+numPartitions: 10
 kafkaInternalPort: 9092
 saslMechanism: scram-sha-512
 version: 3.2.3