[MULTICLOUD] Move multicloud k8s to use strimzi kafka user template

Move multicloud k8s to use strimzi kafka user template

Change-Id: Idc85dcfee7d6708cc9025244453a97caaf112fdc
Signed-off-by: david.mcweeney <david.mcweeney@est.tech>
Issue-ID: DMAAP-1856
diff --git a/kubernetes/multicloud/components/multicloud-k8s/resources/config/config.json b/kubernetes/multicloud/components/multicloud-k8s/resources/config/config.json
index 4a08322..54b2b0e 100644
--- a/kubernetes/multicloud/components/multicloud-k8s/resources/config/config.json
+++ b/kubernetes/multicloud/components/multicloud-k8s/resources/config/config.json
@@ -44,8 +44,10 @@
                     "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT",
                     "HELM"
                 ],
-                "consumerGroup": "{{ .Values.config.kafka.sdcTopic.consumerGroup }}",
-                "consumerId": "{{ .Values.config.kafka.sdcTopic.clientId }}",
+                {{- with (first .Values.kafkaUser.acls) }}
+                "consumerGroup": "{{ .name }}",
+                "consumerId": "{{ .name }}-k8s",
+                {{- end }}
                 "environmentName": "AUTO",
                 "keystorePath": "null",
                 "keystorePassword": "null",
diff --git a/kubernetes/multicloud/components/multicloud-k8s/templates/deployment.yaml b/kubernetes/multicloud/components/multicloud-k8s/templates/deployment.yaml
index 45494e1..117f6fa 100644
--- a/kubernetes/multicloud/components/multicloud-k8s/templates/deployment.yaml
+++ b/kubernetes/multicloud/components/multicloud-k8s/templates/deployment.yaml
@@ -87,12 +87,11 @@
         - mountPath: /data
           name: artifact-data
         env:
-        - name: SECURITY_PROTOCOL
-          value: {{ .Values.config.kafka.securityProtocol }}
-        - name: SASL_MECHANISM
-          value: {{ .Values.config.kafka.saslMechanism }}
         - name: SASL_JAAS_CONFIG
-          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "multicloud-k8s-sdc-kafka-secret" "key" "sasl.jaas.config") | indent 10 }}
+          valueFrom:
+            secretKeyRef:
+              name: {{ include "common.name" . }}-ku
+              key: sasl.jaas.config
       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
       volumes:
       - name: localtime
diff --git a/kubernetes/multicloud/components/multicloud-k8s/templates/kafkauser.yaml b/kubernetes/multicloud/components/multicloud-k8s/templates/kafkauser.yaml
new file mode 100644
index 0000000..324a068
--- /dev/null
+++ b/kubernetes/multicloud/components/multicloud-k8s/templates/kafkauser.yaml
@@ -0,0 +1,16 @@
+{{/*
+# Copyright © 2022-23 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.kafkauser" . }}
diff --git a/kubernetes/multicloud/components/multicloud-k8s/templates/multicloud-k8s-sdc-list-kafka-user.yaml b/kubernetes/multicloud/components/multicloud-k8s/templates/multicloud-k8s-sdc-list-kafka-user.yaml
deleted file mode 100644
index 7600fac..0000000
--- a/kubernetes/multicloud/components/multicloud-k8s/templates/multicloud-k8s-sdc-list-kafka-user.yaml
+++ /dev/null
@@ -1,36 +0,0 @@
-{{/*
-# 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.
-*/}}
-apiVersion: kafka.strimzi.io/v1beta2
-kind: KafkaUser
-metadata:
-  name: {{ include "common.release" . }}-{{ .Values.global.multicloudK8sKafkaUser }}
-  labels:
-    strimzi.io/cluster: {{ include "common.release" . }}-strimzi
-spec:
-  authentication:
-    type: {{ .Values.config.kafka.saslMechanism | lower }}
-  authorization:
-    type: {{ .Values.config.kafka.authType }}
-    acls:
-    - resource:
-        type: group
-        name: {{ .Values.config.kafka.sdcTopic.consumerGroup }}
-      operation: All
-    - resource:
-        type: topic
-        patternType: prefix
-        name: {{ .Values.config.kafka.sdcTopic.pattern }}
-      operation: All
diff --git a/kubernetes/multicloud/components/multicloud-k8s/values.yaml b/kubernetes/multicloud/components/multicloud-k8s/values.yaml
index cae151a..aea6915 100644
--- a/kubernetes/multicloud/components/multicloud-k8s/values.yaml
+++ b/kubernetes/multicloud/components/multicloud-k8s/values.yaml
@@ -19,19 +19,6 @@
   nodePortPrefixExt: 304
   persistence: {}
   artifactImage: onap/multicloud/framework-artifactbroker:1.9.0
-  multicloudK8sKafkaUser: mc-k8s-sdc-list-kafka-user
-
-#################################################################
-# Secrets metaconfig
-#################################################################
-secrets:
-  - uid: multicloud-k8s-sdc-kafka-secret
-    externalSecret: '{{ tpl (default "" .Values.config.jaasConfExternalSecret) . }}'
-    type: genericKV
-    envs:
-      - name: sasl.jaas.config
-        value: '{{ .Values.config.someConfig }}'
-        policy: generate
 
 #################################################################
 # Application configuration defaults.
@@ -40,16 +27,16 @@
 image: onap/multicloud/k8s:0.10.1
 pullPolicy: Always
 
-config:
-  someConfig: blah
-  kafka:
-    securityProtocol: SASL_PLAINTEXT
-    saslMechanism: SCRAM-SHA-512
-    authType: simple
-    sdcTopic:
-      pattern: SDC-DIST
-      consumerGroup: multicloud
-      clientId: multicloud-k8s
+# Strimzi KafkaUser config
+kafkaUser:
+  acls:
+    - name: multicloud
+      type: group
+      operations: [Read]
+    - name: SDC-DISTR
+      type: topic
+      patternType: prefix
+      operations: [Read, Write]
 
 # flag to enable debugging - application support required
 debugEnabled: false
diff --git a/kubernetes/multicloud/values.yaml b/kubernetes/multicloud/values.yaml
index 21e6a61..ee9efc9 100644
--- a/kubernetes/multicloud/values.yaml
+++ b/kubernetes/multicloud/values.yaml
@@ -23,7 +23,6 @@
     enabled: false
   persistence: {}
   centralizedLoggingEnabled: true
-  multicloudK8sKafkaUser: mc-k8s-sdc-list-kafka-user
 
 #################################################################
 # Application configuration defaults.
@@ -40,8 +39,6 @@
   logConfigMapNamePrefix: '{{ include "common.release" . }}-multicloud'
 multicloud-k8s:
   enabled: true
-  config:
-    jaasConfExternalSecret: '{{ include "common.release" . }}-{{ .Values.global.multicloudK8sKafkaUser }}'
 multicloud-pike:
   enabled: true
   logConfigMapNamePrefix: '{{ include "common.release" . }}-multicloud'