Skip to content

Instantly share code, notes, and snippets.

@slinkydeveloper
Last active March 17, 2021 07:47
Show Gist options
  • Save slinkydeveloper/59ab25d63fe8b14c298bbc1d9839fb62 to your computer and use it in GitHub Desktop.
Save slinkydeveloper/59ab25d63fe8b14c298bbc1d9839fb62 to your computer and use it in GitHub Desktop.
Reproduce eventing-kafka upgrade to 0.22
apiVersion: v1
kind: Namespace
metadata:
name: sacura
apiVersion: messaging.knative.dev/v1alpha1
kind: KafkaChannel
metadata:
name: testchannel
namespace: sacura
spec:
numPartitions: 10
replicationFactor: 1
apiVersion: v1
kind: ConfigMap
metadata:
name: config-sacura
namespace: sacura
data:
sacura.yaml: |
sender:
target: http://testchannel-kn-channel.sacura.svc.cluster.local/
frequency: 200
workers: 15
keepAlive: true
receiver:
port: 8080
timeout: 5m
duration: 10m
timeout: 5m
apiVersion: batch/v1
kind: Job
metadata:
name: sacura
namespace: sacura
labels:
app: sacura
spec:
backoffLimit: 0
completions: 1
parallelism: 1
template:
metadata:
labels:
app: sacura
spec:
securityContext:
runAsNonRoot: true
containers:
- name: sacura
image: ko://github.com/pierdipi/sacura/cmd/sacura
args:
- "--config"
- "/etc/sacura/sacura.yaml"
securityContext:
privileged: false
readOnlyRootFilesystem: true
runAsNonRoot: true
allowPrivilegeEscalation: false
volumeMounts:
- mountPath: /etc/sacura
name: config
resources:
limits:
cpu: 2000m
memory: 4Gi
ports:
- containerPort: 8080
protocol: TCP
name: receiver
volumes:
- name: config
configMap:
name: config-sacura
restartPolicy: Never
apiVersion: messaging.knative.dev/v1
kind: Subscription
metadata:
name: sub
namespace: sacura
spec:
channel:
apiVersion: messaging.knative.dev/v1alpha1
kind: KafkaChannel
name: testchannel
subscriber:
ref:
apiVersion: v1
kind: Service
name: sacura
namespace: sacura
apiVersion: v1
kind: Service
metadata:
name: sacura
namespace: sacura
spec:
selector:
app: sacura
ports:
- port: 80
protocol: TCP
targetPort: receiver
name: http

In order to reproduce:

./00-installer-kind.sh && ./02-kn-eventing.sh && ./03-strimzi.sh && ./04-kn-kafka.sh

NOTE: it seems like the last version of strimzi has a setup issue, I manually modified the 03-strimzi.sh script to setup the 0.21.0 version, you might need to do the same.

  • Make sure you checkout on your local machine this branch of eventing https://github.com/slinkydeveloper/eventing/tree/kafkachannel_hack and this branch of eventing-kafka https://github.com/slinkydeveloper/eventing-kafka/tree/post_install_script
  • Copy all the yamls in this gist somewhere in a directory
  • Use ko apply to install them. This will setup a KafkaChannel with a sub and will start sending events continuosly to the channel. From now on you have 10 mins to complete the rest of the procedure.
  • Install eventing from source using ko apply -f config
  • Install eventing-kafka from source new CRD with kubectl apply -f config/channel/resources
  • Install consolidated channel from source new version using ko apply -f config/channel/consolidated (make sure you don't overwrite the config kafka CM, for simplicity just remove it from the config dir)
  • Run post install with ko apply -f config/post-install
  • Check subs and channel status, and then wait for sacura to end and check the report. You should see a bunch of status code 0 errors, maybe some 404, but nothing else.
  • Add a new sub to the channel previously created and add a new channel and a sub associated to make sure everything works properly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment