apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaUser
metadata:
  name: "service-account-{{ .ClusterName }}-{{ .ClusterProjectName }}-kafka-common"
  labels:
    strimzi.io/cluster: $kafka_cluster_namespace
spec:
  authorization:
    type: simple
    acls:
      - resource:
          type: topic
          name: "{{ .ClusterProjectName }}."
          patternType: prefix
        operations:
          - Read
          - Describe
          - DescribeConfigs
          - Write
      - resource:
          type: group
          name: "{{ .ClusterProjectName }}-"
          patternType: prefix
        operations:
          - Read
          - Write
          - Describe

{{- $clusterCatalog := . -}}
{{range index .QuestionsMap "$topicName"}}
---
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
  labels:
    strimzi.io/cluster: $kafka_cluster_namespace
  name: "{{replaceDotUnderToHypen .}}"
  namespace: $kafka_cluster_namespace
spec:
  partitions: $topic.partition
  replicas: 3
  topicName: "{{ $clusterCatalog.ClusterProjectName }}.{{.}}"
  config:
    cleanup.policy: compact
    retention.bytes: "$topic.retention"
    segment.bytes: "$topic.segment"
{{end}}