[MULTICLOUD] Move multicloud k8s to use strimzi kafka user template 38/133538/2
authordavid.mcweeney <david.mcweeney@est.tech>
Fri, 10 Feb 2023 12:35:20 +0000 (12:35 +0000)
committerFiachra Corcoran <fiachra.corcoran@est.tech>
Fri, 3 Mar 2023 16:18:36 +0000 (16:18 +0000)
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

kubernetes/multicloud/components/multicloud-k8s/resources/config/config.json
kubernetes/multicloud/components/multicloud-k8s/templates/deployment.yaml
kubernetes/multicloud/components/multicloud-k8s/templates/kafkauser.yaml [new file with mode: 0644]
kubernetes/multicloud/components/multicloud-k8s/templates/multicloud-k8s-sdc-list-kafka-user.yaml [deleted file]
kubernetes/multicloud/components/multicloud-k8s/values.yaml
kubernetes/multicloud/values.yaml

index 4a08322..54b2b0e 100644 (file)
                     "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",
index 45494e1..117f6fa 100644 (file)
@@ -87,12 +87,11 @@ spec:
         - 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 (file)
index 0000000..324a068
--- /dev/null
@@ -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 (file)
index 7600fac..0000000
+++ /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
index cae151a..aea6915 100644 (file)
@@ -19,19 +19,6 @@ global:
   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 @@ secrets:
 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
index 21e6a61..ee9efc9 100644 (file)
@@ -23,7 +23,6 @@ global:
     enabled: false
   persistence: {}
   centralizedLoggingEnabled: true
-  multicloudK8sKafkaUser: mc-k8s-sdc-list-kafka-user
 
 #################################################################
 # Application configuration defaults.
@@ -40,8 +39,6 @@ multicloud-fcaps:
   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'