Skip to content

Commit

Permalink
[#4167] Kafka certificate authentication (#4168)
Browse files Browse the repository at this point in the history
  • Loading branch information
ljupcovangelski committed May 6, 2024
1 parent 2f052cd commit 2efde81
Show file tree
Hide file tree
Showing 23 changed files with 270 additions and 7 deletions.
Expand Up @@ -51,6 +51,11 @@ spec:
initialDelaySeconds: 120
periodSeconds: 10
failureThreshold: 3
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.backend.resources | indent 10 }}
initContainers:
Expand All @@ -68,3 +73,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
10 changes: 10 additions & 0 deletions backend/components/contacts/helm/templates/deployment.yaml
Expand Up @@ -45,6 +45,11 @@ spec:
initialDelaySeconds: 120
periodSeconds: 10
failureThreshold: 3
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.resources | indent 10 }}
initContainers:
Expand All @@ -62,3 +67,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
20 changes: 20 additions & 0 deletions backend/components/facebook/helm/templates/deployments.yaml
Expand Up @@ -59,6 +59,11 @@ spec:
- name: Health-Check
value: health-check
initialDelaySeconds: 120
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.connector.resources | indent 12 }}
initContainers:
Expand All @@ -76,6 +81,11 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -124,6 +134,11 @@ spec:
initialDelaySeconds: 120
periodSeconds: 10
failureThreshold: 3
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.eventsRouter.resources | indent 10 }}
initContainers:
Expand All @@ -141,3 +156,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
20 changes: 20 additions & 0 deletions backend/components/google/helm/templates/deployments.yaml
Expand Up @@ -54,6 +54,11 @@ spec:
- name: Health-Check
value: health-check
initialDelaySeconds: 120
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.connector.resources | indent 12 }}
initContainers:
Expand All @@ -71,6 +76,11 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
---
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -122,6 +132,11 @@ spec:
initialDelaySeconds: 120
periodSeconds: 10
failureThreshold: 3
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.eventsRouter.resources | indent 10 }}
initContainers:
Expand All @@ -139,3 +154,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
10 changes: 10 additions & 0 deletions backend/components/media-resolver/helm/templates/deployment.yaml
Expand Up @@ -45,6 +45,11 @@ spec:
initialDelaySeconds: 120
periodSeconds: 10
failureThreshold: 3
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.resources | indent 12 }}
initContainers:
Expand All @@ -62,3 +67,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
10 changes: 10 additions & 0 deletions backend/components/sources-api/helm/templates/deployment.yaml
Expand Up @@ -50,6 +50,11 @@ spec:
initialDelaySeconds: 120
periodSeconds: 10
failureThreshold: 3
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.resources | indent 10 }}
initContainers:
Expand All @@ -67,3 +72,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
10 changes: 10 additions & 0 deletions backend/components/streams/helm/templates/deployment.yaml
Expand Up @@ -48,6 +48,11 @@ spec:
initialDelaySeconds: 120
periodSeconds: 10
failureThreshold: 3
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.resources | indent 10 }}
initContainers:
Expand All @@ -67,3 +72,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
10 changes: 10 additions & 0 deletions backend/components/twilio/helm/templates/deployments.yaml
Expand Up @@ -54,6 +54,11 @@ spec:
- name: Health-Check
value: health-check
initialDelaySeconds: 120
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.connector.resources | indent 12 }}
initContainers:
Expand Down Expand Up @@ -141,3 +146,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
10 changes: 10 additions & 0 deletions backend/components/viber/helm/templates/deployments.yaml
Expand Up @@ -49,6 +49,11 @@ spec:
- name: Health-Check
value: health-check
initialDelaySeconds: 120
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.connector.resources | indent 12 }}
initContainers:
Expand All @@ -66,3 +71,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
10 changes: 10 additions & 0 deletions backend/components/webhook/helm/templates/deployments.yaml
Expand Up @@ -55,6 +55,11 @@ spec:
- name: Health-Check
value: health-check
initialDelaySeconds: 120
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.consumer.resources | indent 10 }}
initContainers:
Expand Down Expand Up @@ -157,3 +162,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
10 changes: 10 additions & 0 deletions backend/components/whatsapp/helm/templates/deployments.yaml
Expand Up @@ -113,6 +113,11 @@ spec:
initialDelaySeconds: 120
periodSeconds: 10
failureThreshold: 3
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.eventsRouter.resources | indent 10 }}
initContainers:
Expand All @@ -130,3 +135,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
33 changes: 33 additions & 0 deletions docs/docs/getting-started/installation/helm.md
Expand Up @@ -290,6 +290,39 @@ Run the following command to create the `Airy` platform without the bundled inst
helm install airy airy/airy --timeout 10m --set prerequisites.kafka.enabled=false --values ./airy.yaml
```

#### Confluent

To connect to a Kafka instance in Confluent cloud, settings the `config.kafka.brokers` and `config.kafka.aurhJaas` is enough, prior to deploying the Helm chart.

#### Aiven

Aiven cloud uses a keystore and truststore certificates that need to be loaded on the workloads that are connecting to Kafka. Get the necessary certificates and connection files from Aiven using the `avn` CLI and place them in a separate directory.

```
avn service user-kafka-java-creds {KAFKA_INSTANCE} --username {USERNAME} -d ./aiven/ --password {PASSWORD}
```

Create a Kubernetes ConfigMap that contains the contents of the created directory:

```
kubectl create configmap kafka-config-certs --from-file aiven/
```

Set the connection appropriate parameters in your `airy.yaml` file:

```yaml
config:
kafka:
brokers: "the-aiven-kafka-broker-url"
keyTrustSecret: "the-key-trust-secret"
```

Then install Airy with the following command:

```sh
helm install airy airy/airy --timeout 10m --set prerequisites.kafka.enabled=false --set global.kafkaCertAuth=true --values ./airy.yaml
```

### Kafka partitions per topic

Currently all the default topics in the Airy instance are created with 10 partitions. To create these topics with a different number of partitions, add the following to your `airy.yaml` file before running `helm install` (before the initial creation of the topics):
Expand Down
Expand Up @@ -60,6 +60,11 @@ spec:
initialDelaySeconds: 120
periodSeconds: 10
failureThreshold: 3
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.components.api.admin.resources | indent 10 }}
initContainers:
Expand All @@ -77,3 +82,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
Expand Up @@ -45,6 +45,11 @@ spec:
initialDelaySeconds: 120
periodSeconds: 10
failureThreshold: 3
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.components.api.communication.resources | indent 10 }}
initContainers:
Expand All @@ -62,3 +67,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts
{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}
Expand Up @@ -81,6 +81,11 @@ spec:
initialDelaySeconds: 60
periodSeconds: 10
failureThreshold: 3
{{ if .Values.global.kafkaCertAuth }}
volumeMounts:
- name: kafka-config-certs
mountPath: /opt/kafka/certs
{{ end }}
resources:
{{ toYaml .Values.components.api.components.installer.resources | indent 10 }}
initContainers:
Expand All @@ -102,4 +107,8 @@ spec:
- name: provisioning-scripts
configMap:
name: provisioning-scripts

{{ if .Values.global.kafkaCertAuth }}
- name: kafka-config-certs
configMap:
name: kafka-config-certs
{{ end }}

0 comments on commit 2efde81

Please sign in to comment.