Skip to content

Commit

Permalink
Merge pull request #54 from alercebroker/logstash/kafka-authentication
Browse files Browse the repository at this point in the history
feat: add option to use kafka authentication on logstash
  • Loading branch information
dirodriguezm authored Mar 10, 2023
2 parents b79c9f3 + 3729b5a commit f4f3a0c
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 8 deletions.
4 changes: 2 additions & 2 deletions charts/logstash/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.0
version: 0.3.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "8.6.1-amd64"
appVersion: "7.16.2"
34 changes: 33 additions & 1 deletion charts/logstash/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
kind: ConfigMap
apiVersion: v1
metadata:
name: {{ include "logstash.fullname" . }}
name: '{{ include "logstash.fullname" . }}-plaintext'
namespace: {{ .Values.namespace }}
data:
log-pipeline-es.conf: |-
Expand All @@ -16,6 +17,37 @@ data:
}
filter {
}
output {
opensearch {
hosts => ["${ES_HOST}"]
user => "${LOGSTASH_USER}"
password => "${LOGSTASH_PASSWORD}"
index => "pipeline-metrics-%{+YYYY-MM-dd}"
}
}
---
kind: ConfigMap
apiVersion: v1
metadata:
name: '{{ include "logstash.fullname" . }}-sasl'
namespace: {{ .Values.namespace }}
data:
log-pipeline-es.conf: |-
input {
kafka {
bootstrap_servers => "${CONSUMER_SERVER}"
topics => ["${METRICS_TOPIC}"]
codec => "json"
group_id => "logstash"
auto_offset_reset => "earliest"
security_protocol => "SASL_SSL"
sasl_mechanism => "SCRAM-SHA-512"
sasl_jaas_config => "org.apache.kafka.common.security.scram.ScramLoginModule required username='${KAFKA_USERNAME}' password='${KAFKA_PASSWORD}';"
}
}
filter {
}
output {
opensearch {
Expand Down
16 changes: 15 additions & 1 deletion charts/logstash/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,24 @@ spec:
value: {{ .Values.kafkaHost }}
- name: METRICS_TOPIC
value: {{ .Values.kafkaTopic }}
- name: KAFKA_USERNAME
valueFrom:
secretKeyRef:
name: kafka-auth
key: username
- name: KAFKA_PASSWORD
valueFrom:
secretKeyRef:
name: kafka-auth
key: password
volumes:
- name: log-pipeline-config
configMap:
name: {{ include "logstash.fullname" . }}
{{- if .Values.secrets.kafkaAuth.enabled }}
name: '{{ include "logstash.fullname" . }}-sasl'
{{- else }}
name: '{{ include "logstash.fullname" . }}-plaintext'
{{- end}}
items:
- key: log-pipeline-es.conf
path: log-pipeline-es.conf
Expand Down
14 changes: 12 additions & 2 deletions charts/logstash/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
---
apiVersion: v1
kind: Secret
metadata:
name: {{ include "logstash.fullname" . }}
namespace: {{ .Values.namespace }}
stringData:
username: {{ .Values.secrets.username }}
password: {{ .Values.secrets.password }}
username: {{ .Values.secrets.elasticsearch.username }}
password: {{ .Values.secrets.elasticsearch.password }}
---
apiVersion: v1
kind: Secret
metadata:
name: kafka-auth
namespace: {{ .Values.namespace }}
stringData:
username: {{ .Values.secrets.kafkaAuth.username }}
password: {{ .Values.secrets.kafkaAuth.password }}
9 changes: 7 additions & 2 deletions charts/logstash/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ kafkaHost: ""
kafkaTopic: "metrics"

secrets:
username: ""
password: ""
elasticsearch:
username: ""
password: ""
kafkaAuth:
enabled: false
username: ""
password: ""

resources: {}

Expand Down

0 comments on commit f4f3a0c

Please sign in to comment.