472097d7eb
This change implements SASL authentication in the Kafka chart. Kafka and Exporter credentials are defined in the endpoints section, while other credentials for producers and consumers can be defined in the jaas section. Additionally, a few server settings are provided to enable SASL auth, and a jvm_options key is introduced. Any options specified here will be set when starting Kafka, including the location of the jaas file in this case. Change-Id: I43469c5bb5734b62cf69be924fe9cf7078e82a9c
53 lines
1.9 KiB
Smarty
53 lines
1.9 KiB
Smarty
#!/bin/sh
|
|
{{/* Copyright 2019 The Openstack-Helm Authors.
|
|
|
|
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. */}}
|
|
|
|
{{- $envAll := . }}
|
|
|
|
{{- if .Values.monitoring.prometheus.enabled }}
|
|
{{- $credentials := .Values.endpoints.kafka_exporter.auth }}
|
|
/opt/kafka/bin/kafka-acls.sh \
|
|
--authorizer kafka.security.auth.SimpleAclAuthorizer \
|
|
--authorizer-properties zookeeper.connect=$KAFKA_ZOOKEEPER_CONNECT \
|
|
--add \
|
|
--allow-principal User:{{ $credentials.username }} \
|
|
--operation DESCRIBE \
|
|
--topic "*" \
|
|
--group "*" \
|
|
--cluster
|
|
{{ end }}
|
|
|
|
{{ $producers := .Values.conf.kafka.jaas.producers }}
|
|
{{- range $producer, $properties := $producers }}
|
|
/opt/kafka/bin/kafka-acls.sh \
|
|
--authorizer kafka.security.auth.SimpleAclAuthorizer \
|
|
--authorizer-properties zookeeper.connect=$KAFKA_ZOOKEEPER_CONNECT \
|
|
--add \
|
|
--allow-principal User:{{ $properties.username }} \
|
|
--producer \
|
|
--topic {{ $properties.topic | quote }}
|
|
{{- end }}
|
|
|
|
{{ $consumers := .Values.conf.kafka.jaas.consumers }}
|
|
{{- range $consumer, $properties := $consumers }}
|
|
/opt/kafka/bin/kafka-acls.sh \
|
|
--authorizer kafka.security.auth.SimpleAclAuthorizer \
|
|
--authorizer-properties zookeeper.connect=$KAFKA_ZOOKEEPER_CONNECT \
|
|
--add \
|
|
--allow-principal User:{{ $properties.username }} \
|
|
--consumer \
|
|
--topic {{ $properties.topic | quote }} \
|
|
--group {{ $properties.group | quote }}
|
|
{{- end }}
|