Skip to content

Commit

Permalink
kafka-proxy chart (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
bueti authored Feb 7, 2022
1 parent d4cc959 commit 99d239d
Show file tree
Hide file tree
Showing 19 changed files with 320 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/helm-docs.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -euo pipefail

HELM_DOCS_VERSION="1.5.0"
HELM_DOCS_VERSION="1.6.0"

# install helm-docs
curl --silent --show-error --fail --location --output /tmp/helm-docs.tar.gz https://github.com/norwoodj/helm-docs/releases/download/v"${HELM_DOCS_VERSION}"/helm-docs_"${HELM_DOCS_VERSION}"_Linux_x86_64.tar.gz
Expand Down
4 changes: 2 additions & 2 deletions charts/bunnycdn-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: bunnycdn-exporter
version: 1.1.0
version: 1.1.1
appVersion: 0.2.3
description: Prometheus exporter for BunnyCDN
home: https://bunny.net/
Expand All @@ -14,7 +14,7 @@ keywords:
- bunnycdn
annotations:
artifacthub.io/changes: |
- Change default image to ricardoag/bunnycdn_exporter which includes metric bugfixes, updated dependencies and doesn't run as root user.
- Update Helm Docs to v1.6.0
artifacthub.io/images: |
- name: bunnycdn_exporter
image: ricardoag/bunnycdn_exporter:v0.2.3
4 changes: 2 additions & 2 deletions charts/bunnycdn-exporter/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# bunnycdn-exporter

![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![AppVersion: 0.2.3](https://img.shields.io/badge/AppVersion-0.2.3-informational?style=flat-square)
![Version: 1.1.1](https://img.shields.io/badge/Version-1.1.1-informational?style=flat-square) ![AppVersion: 0.2.3](https://img.shields.io/badge/AppVersion-0.2.3-informational?style=flat-square)

Prometheus exporter for BunnyCDN

Expand Down Expand Up @@ -30,4 +30,4 @@ Prometheus exporter for BunnyCDN
| scrape | string | `"true"` | Scraping enabled? |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
Autogenerated from chart metadata using [helm-docs v1.6.0](https://github.com/norwoodj/helm-docs/releases/v1.6.0)
4 changes: 2 additions & 2 deletions charts/imaginary/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "1.2.4"
description: Deploy imaginary to process pictures on the fly
name: imaginary
version: 0.1.6
version: 0.1.7
home: https://github.com/h2non/imaginary
sources:
- https://github.com/ricardo-ch/helm-charts/tree/main/charts/imaginary
Expand All @@ -15,7 +15,7 @@ keywords:
- h2non
annotations:
artifacthub.io/changes: |
- Add env-vars to deployment
- Update Helm Docs to v1.6.0
artifacthub.io/images: |
- name: imaginary
image: h2non/imaginary:1.2.4
4 changes: 2 additions & 2 deletions charts/imaginary/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Imaginary

![Version: 0.1.6](https://img.shields.io/badge/Version-0.1.6-informational?style=flat-square) ![AppVersion: 1.2.4](https://img.shields.io/badge/AppVersion-1.2.4-informational?style=flat-square) ![Release Status](https://github.com/ricardo-ch/helm-charts/workflows/Release%20Charts/badge.svg) [![License](https://img.shields.io/github/license/ricardo-ch/helm-charts)](https://github.com/ricardo-ch/helm-charts/blob/main/LICENSE)
![Version: 0.1.7](https://img.shields.io/badge/Version-0.1.7-informational?style=flat-square) ![AppVersion: 1.2.4](https://img.shields.io/badge/AppVersion-1.2.4-informational?style=flat-square) ![Release Status](https://github.com/ricardo-ch/helm-charts/workflows/Release%20Charts/badge.svg) [![License](https://img.shields.io/github/license/ricardo-ch/helm-charts)](https://github.com/ricardo-ch/helm-charts/blob/main/LICENSE)

This chart installs [Imaginary](https://github.com/h2non/imaginary).

Expand Down Expand Up @@ -58,4 +58,4 @@ Simply add this Chart repository to Helm:
* <https://github.com/h2non/imaginary>

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
Autogenerated from chart metadata using [helm-docs v1.6.0](https://github.com/norwoodj/helm-docs/releases/v1.6.0)
20 changes: 20 additions & 0 deletions charts/kafka-proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v2
name: kafka-proxy
version: 0.0.1
appVersion: 0.3.0
description: Deploying the grepplabs kafka-proxy as a StatefulSet
home: https://github.com/grepplabs/kafka-proxy
sources:
- https://github.com/grepplabs/kafka-proxy
- https://github.com/ricardo-ch/helm-charts/tree/main/charts/kafka-proxy
maintainers:
- name: ricardo-ch
email: [email protected]
keywords:
- kafka-proxy
annotations:
artifacthub.io/changes: |
- Initial release
artifacthub.io/images: |
- name: kafka-proxy
image: grepplabs/kafka-proxy:v0.3.0
43 changes: 43 additions & 0 deletions charts/kafka-proxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# PromLens

![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![AppVersion: 0.3.0](https://img.shields.io/badge/AppVersion-0.3.0-informational?style=flat-square) ![Release Status](https://github.com/ricardo-ch/helm-charts/workflows/Release%20Charts/badge.svg) [![License](https://img.shields.io/github/license/ricardo-ch/helm-charts)](https://github.com/ricardo-ch/helm-charts/blob/main/LICENSE)

This chart installs [kafka-proxy](https://github.com/grepplabs/kafka-proxy).

The Kafka Proxy is based on idea of Cloud SQL Proxy. It allows a service to connect to Kafka brokers without having to deal with SASL/PLAIN authentication and SSL certificates.

## Helm Chart

### How To Install

Simply add this Chart repository to Helm:

```sh
➜ helm repo add ricardo https://ricardo-ch.github.io/helm-charts/
"ricardo" has been added to your repositories
```

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Node affinity configuration |
| config.kafkaClient | object | `{"brokers":["kafka-0:9092","kafka-1:9092"],"jaas":"org.apache.kafka.common.security.plain.PlainLoginModule required username=\"username\" password=\"password\";"}` | Kafka client configuration |
| image | string | `"grepplabs/kafka-proxy"` | Kafka-proxy Container Image |
| nodeSelector | object | `{}` | A node selector label |
| podAnnotations | object | `{"prometheus.io/port":"9399","prometheus.io/scrape":"true"}` | Set a pod annotations |
| podAnnotations."prometheus.io/port" | string | `"9399"` | Set a Prometheus scrape port |
| podAnnotations."prometheus.io/scrape" | string | `"true"` | Set a flag to mark pod for scrapping |
| pullPolicy | string | `"IfNotPresent"` | Kubernetes PullPolicy |
| replicaCount | int | `1` | Number of replicas |
| resources | object | `{}` | Set kubernetes specific resource limits |
| tolerations | list | `[]` | A toleration |
| version | string | `"v0.3.0"` | Kafka-proxy Container Image Version |

## Source Code

* <https://github.com/grepplabs/kafka-proxy>
* <https://github.com/ricardo-ch/helm-charts/tree/main/charts/kafka-proxy>

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.6.0](https://github.com/norwoodj/helm-docs/releases/v1.6.0)
26 changes: 26 additions & 0 deletions charts/kafka-proxy/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# PromLens

{{ template "chart.deprecationWarning" . }}

{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}![Release Status](https://github.com/ricardo-ch/helm-charts/workflows/Release%20Charts/badge.svg) [![License](https://img.shields.io/github/license/ricardo-ch/helm-charts)](https://github.com/ricardo-ch/helm-charts/blob/main/LICENSE)

This chart installs [kafka-proxy](https://github.com/grepplabs/kafka-proxy).

The Kafka Proxy is based on idea of Cloud SQL Proxy. It allows a service to connect to Kafka brokers without having to deal with SASL/PLAIN authentication and SSL certificates.

## Helm Chart

### How To Install

Simply add this Chart repository to Helm:

```sh
➜ helm repo add ricardo https://ricardo-ch.github.io/helm-charts/
"ricardo" has been added to your repositories
```

{{ template "chart.valuesSection" . }}

{{ template "chart.sourcesSection" . }}

{{ template "helm-docs.versionFooter" . }}
32 changes: 32 additions & 0 deletions charts/kafka-proxy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "kafka-proxy.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "kafka-proxy.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "kafka-proxy.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
12 changes: 12 additions & 0 deletions charts/kafka-proxy/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "kafka-proxy.fullname" . }}-config
labels:
app.kubernetes.io/name: {{ include "kafka-proxy.name" . }}
helm.sh/chart: {{ include "kafka-proxy.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
type: Opaque
data:
jaas.config: {{ .Values.config.kafkaClient.jaas | b64enc | quote }}
25 changes: 25 additions & 0 deletions charts/kafka-proxy/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "kafka-proxy.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "kafka-proxy.name" . }}
helm.sh/chart: {{ include "kafka-proxy.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
type: NodePort
ports:
{{- range $index, $broker := .Values.config.kafkaClient.brokers }}
- name: kafka-{{ add $index}}
nodePort: {{ add 32400 $index }}
port: {{ add 32400 $index }}
targetPort: {{ add 32400 $index }}
{{- end }}
- name: metrics
nodePort: 32480
port: 9080
targetPort: 9080
selector:
app.kubernetes.io/name: {{ include "kafka-proxy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
97 changes: 97 additions & 0 deletions charts/kafka-proxy/templates/statefulset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "kafka-proxy.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "kafka-proxy.name" . }}
helm.sh/chart: {{ include "kafka-proxy.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
release: production
spec:
selector:
matchLabels:
app.kubernetes.io/name: {{ include "kafka-proxy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
replicas: {{ .Values.replicaCount }}
serviceName: {{ include "kafka-proxy.name" . }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "kafka-proxy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
annotations:
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: {{ include "kafka-proxy.name" . }}
image: "{{ .Values.image }}:{{ .Values.version }}"
args:
- 'server'
- '--log-format=json'
{{- range $index, $broker := .Values.config.kafkaClient.brokers }}
- '--bootstrap-server-mapping={{ $broker }},0.0.0.0:{{ add 32400 $index}}{{ if ne $index 0}},$(MY_POD_IP):{{ add 32400 $index }}{{ end }}'
{{- end }}
- '--tls-enable'
- '--sasl-enable'
- '--sasl-plugin-mechanism=PLAIN'
- '--sasl-jaas-config-file=/var/run/secret/jaas.config'
- '--proxy-request-buffer-size=32768'
- '--proxy-response-buffer-size=32768'
- '--proxy-listener-read-buffer-size=32768'
- '--proxy-listener-write-buffer-size=131072'
- '--kafka-connection-read-buffer-size=131072'
- '--kafka-connection-write-buffer-size=32768'
env:
- name: MY_POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
volumeMounts:
- name: "proxy-config"
mountPath: "/var/run/secret"
ports:
- name: metrics
containerPort: 9080
{{- range $index, $broker := .Values.config.brokers }}
- name: kafka-{{ add $index }}
containerPort: {{ add 32400 $index }}
{{- end }}
livenessProbe:
httpGet:
path: /health
port: 9080
initialDelaySeconds: 5
periodSeconds: 3
readinessProbe:
httpGet:
path: /health
port: 9080
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
successThreshold: 2
failureThreshold: 5
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
restartPolicy: Always
volumes:
- name: proxy-config
secret:
secretName: {{ include "kafka-proxy.fullname" . }}-config
44 changes: 44 additions & 0 deletions charts/kafka-proxy/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -- Number of replicas
replicaCount: 1
# -- Kafka-proxy Container Image
image: "grepplabs/kafka-proxy"
# -- Kafka-proxy Container Image Version
version: "v0.3.0"
# -- Kubernetes PullPolicy
pullPolicy: IfNotPresent

# -- Set kubernetes specific resource limits
resources: {}
# requests:
# memory: 128Mi
# cpu: 1000m
# limits:
# cpu: 2000m
# memory: 256Mi

# -- Set a pod annotations
podAnnotations:
# -- Set a Prometheus scrape port
prometheus.io/port: "9399"
# -- Set a flag to mark pod for scrapping
prometheus.io/scrape: "true"

# -- A toleration
tolerations: []
# - key: "test"
# operator: "Exists"
# effect: "NoSchedule"

# -- A node selector label
nodeSelector: {}

# -- Node affinity configuration
affinity: {}

config:
# -- Kafka client configuration
kafkaClient:
jaas: org.apache.kafka.common.security.plain.PlainLoginModule required username="username" password="password";
brokers:
- kafka-0:9092
- kafka-1:9092
4 changes: 2 additions & 2 deletions charts/metrics-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: metrics-exporter
version: 1.0.1
version: 1.0.2
appVersion: "0.5"
description: This Chart installs and configures agnostic metrics exporter for
sql servers
Expand All @@ -14,7 +14,7 @@ keywords:
- sql_server
annotations:
artifacthub.io/changes: |
- Spelling corrections
- Update Helm Docs to v1.6.0
artifacthub.io/images: |
- name: free/sql_exporter
image: githubfree/sql_exporter:0.5
Loading

0 comments on commit 99d239d

Please sign in to comment.