Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
30b888a
Creates a pod for expermentation with kubectl and kafkacat
solsson Jul 6, 2017
4bdfb2b
Produces and reads events
solsson Jul 6, 2017
ccdd8be
wip
solsson Jul 7, 2017
5ee97a2
Quite interesting way to test a command from yaml - see it in logs
solsson Jul 7, 2017
4da60f8
Produces proper json. Let's see when curl gives up and the container …
solsson Jul 7, 2017
efacc18
Testing compression but solsson/kafka:0.11.0.0 throws ...
solsson Jul 7, 2017
b6575a5
Works with my current kafka image, and the test consumer still sees JSON
solsson Jul 7, 2017
a30f22e
Latest build suppors snappy compression
solsson Jul 27, 2017
f626a77
Adds RBAC policy for curl, default service account
solsson Aug 5, 2017
4f13cf5
Moves the example comsumer to the test namespace
solsson Aug 5, 2017
8935cf5
Not a proper test yet, but the PR documents how to use it to see events
solsson Aug 5, 2017
8d0d993
Use an image with new kafkacat and curl versions
solsson Oct 26, 2017
b9e7b8a
Makes things a bit less obscure if for example RBAC fails
solsson Oct 26, 2017
e4c5179
Argh, curl will pretty print the json ...
solsson Oct 26, 2017
d628275
bash -e is important, in combination with curl -f, so ...
solsson Oct 26, 2017
fc5a836
kafkacat's debug output solves the silence, but ...
solsson Oct 26, 2017
071f973
Manifests updated to 1.8 and v3.0.0 pre-merge
solsson Oct 27, 2017
1de4d2c
An actual assertion
solsson Oct 27, 2017
8eb4a4d
Needs to be tweaked depending on the churn
solsson Oct 27, 2017
8ee3beb
Fixes JSON syntax, topic is jq:able now
solsson Oct 27, 2017
97f03a4
Aligns RBAC with addons->folders for v3.0.0
solsson Oct 27, 2017
d4a3bc6
Fix retention from 0.8 days to 8 days
atamon Oct 30, 2017
c8a1ba8
Merge pull request #86 from Yolean/atamon-patch-1
solsson Oct 30, 2017
3fca1e7
Fixes manifest. I must have had a local edit last time.
solsson Oct 30, 2017
907467c
Uses kafkacat build as in tests and logs-streaming
solsson Nov 9, 2017
a861237
Modernize based on
solsson Dec 18, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions events-kube/events-kube-kafka.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: events-kube-kafka
namespace: kafka
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
# prefer duplicate events over missed
maxUnavailable: 0
maxSurge: 1
selector:
matchLabels:
app: events
from: kube
to: kafka
template:
metadata:
labels:
app: events
from: kube
to: kafka
spec:
containers:
- name: kafkacat-curl
image: solsson/kafkacat-curl@sha256:b5484379301937129e67550331782a0f7ac030a4b913a254d084faea4bcf44a2
env:
- name: BOOTSTRAP
value: bootstrap.kafka:9092
- name: TOPIC
value: ops.kube-events-all.stream.json.001
command:
- /bin/bash
- -ec
- >
curl
-f
-s
--cacert /run/secrets/kubernetes.io/serviceaccount/ca.crt
--header "Authorization: Bearer $(cat /run/secrets/kubernetes.io/serviceaccount/token)"
https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT/api/v1/watch/events
|
kafkacat
-b $BOOTSTRAP
-t $TOPIC
-P
-z snappy
-v
-d broker,topic
30 changes: 30 additions & 0 deletions events-kube/rbac/cluster-events-watcher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# If events-kube-kafka-* goes crashlooping you probably need this
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: events-watcher
labels:
origin: github.com_Yolean_kubernetes-kafka
rules:
- apiGroups:
- ""
resources:
- events
verbs:
- watch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: kafka-events-watcher
labels:
origin: github.com_Yolean_kubernetes-kafka
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: events-watcher
subjects:
- kind: ServiceAccount
name: default
namespace: kafka
89 changes: 89 additions & 0 deletions events-kube/test/events-topic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
kind: ConfigMap
metadata:
name: events-topic
namespace: test-kafka
apiVersion: v1
data:

setup.sh: |-
touch /tmp/testlog

tail -f /tmp/testlog

test.sh: |-
exec >> /tmp/testlog
exec 2>&1

PREVIOUS=$(sha1sum /tmp/event 2>/dev/null || echo "")
kafkacat -b $BOOTSTRAP -t $TOPIC -C -o -1 -c 1 | tee /tmp/event
CURRENT=$(sha1sum /tmp/event)
[ "$PREVIOUS" == "$CURRENT" ] && echo "{\"test-result\": \"No new event in $TOPIC\"}" && exit 1

exit 0

quit-on-nonzero-exit.sh: |-
exec >> /tmp/testlog
exec 2>&1

exit 0

---
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: events-topic
namespace: test-kafka
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
test-target: events-topic
test-type: readiness
template:
metadata:
labels:
test-target: events-topic
test-type: readiness
# for example:
# readonly - can be used in production
# isolated - read/write but in a manner that does not affect other services
# load - unsuitable for production because it uses significant resources
# chaos - unsuitable for production because it injects failure modes
#test-use:
spec:
containers:
- name: testcase
image: solsson/kafkacat@sha256:2c539e4f58960ab7872976ebc664dd92de18cf27e7cbbeb296d654a2351f6ca4
env:
- name: BOOTSTRAP
value: bootstrap.kafka:9092
- name: TOPIC
value: ops.kube-events-all.stream.json.001
command:
- /bin/bash
- -e
- /test/setup.sh
readinessProbe:
exec:
command:
- /bin/bash
- -e
- /test/test.sh
initialDelaySeconds: 10
periodSeconds: 60
livenessProbe:
exec:
command:
- /bin/bash
- -e
- /test/quit-on-nonzero-exit.sh
volumeMounts:
- name: config
mountPath: /test
volumes:
- name: config
configMap:
name: events-topic