Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/damiannolan/eventing-init
A K8s Init Container as a wait mechanism for Kafka availability and Topic configuration
https://github.com/damiannolan/eventing-init
Last synced: 2 days ago
JSON representation
A K8s Init Container as a wait mechanism for Kafka availability and Topic configuration
- Host: GitHub
- URL: https://github.com/damiannolan/eventing-init
- Owner: damiannolan
- License: mit
- Created: 2019-07-28T12:58:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-05T11:42:57.000Z (over 5 years ago)
- Last Synced: 2023-03-05T20:20:49.060Z (over 1 year ago)
- Language: Go
- Size: 889 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eventing-init
A [Kubernetes Init Container](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/) as a wait mechanism for Kafka availability and topic configuration.
This project serves as a means to block service startup until Kafka eventing and topic dependencies have been fulfilled.
## Usage
The following example assumes the use of [Helm](https://helm.sh/) (A Package manager for Kubernetes), however this is not a requirement and appropriate K8s manifests can be constructed without the use of Helm's templating functionality.
1. A ConfigMap should be provided with the required Kafka Topics.
For Example:```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: service-x-topics-config
data:
topics.yml: |
topics:
{{- range .Values.kafka.topics }}
- {{ . | quote }}
{{- end }}
```2. Topic entries should be supplied through `values.yaml`
For Example:```yaml
...
kafka:
topics:
- notification-events
- request-events
```3. An `initContainers` entry should be added to the service Deployment PodSpec with a `volumeMounts` entry specifying the associated ConfigMap. Environment variables can be provided in the Container spec, if omitted the default configuration fallbacks are used for Kafka host, port and version.
For Example:
```yaml
spec:
initContainers:
- name: eventing-init
image: damiannolan/eventing-init:0.1.0
imagePullPolicy: Always
volumeMounts:
- name: topics-config
mountPath: /etc/config
...
volumes:
- name: topics-config
configMap:
name: sevice-x-topics-config
```### TODO's
- Cleanup config pkg - possibly use [viper](https://github.com/spf13/viper)
- Add more configurability (Create topics if not exists option)
- Use [logrus](https://github.com/sirupsen/logrus) for logging
- Use [testify](https://github.com/stretchr/testify) for assertions