File tree Expand file tree Collapse file tree 11 files changed +92
-96
lines changed Expand file tree Collapse file tree 11 files changed +92
-96
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- FROM rockylinux/rockylinux:8.5
2-
3- ENV container docker
4-
5- # 1. Adding Confluent repository
6- RUN rpm --import https://packages.confluent.io/rpm/7.1/archive.key
7- COPY confluent.repo /etc/yum.repos.d/confluent.repo
8- RUN yum clean all
9-
10- # 2. Install Confluent Kafka stack
11- RUN yum install -y java-1.8.0-openjdk
12- RUN yum install -y confluent-kafka
13-
14- # 3. Install JY YAML parser for shell
15- RUN yum install -y jq
1+ FROM confluentinc/cp-kafka:latest
2+ USER root
3+ RUN yum install -y jq vim vi
164RUN curl -L -o /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/`curl -s https://api.github.com/repos/mikefarah/yq/releases/latest | jq .tag_name | sed 's/"//g' `/yq_linux_amd64
17- RUN chmod 755 /usr/local/bin/yq
5+ RUN chmod +x /usr/local/bin/yq
6+ USER appuser
Original file line number Diff line number Diff line change 11#! /bin/bash
22eval $( minikube docker-env)
3- docker build -t sandbox-kafka-client .
3+ docker build -t quota-manager .
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -4,6 +4,4 @@ namespace: sandbox
44resources :
55- namespace.yaml
66- ../../base/cfk-components/confluent-rbac
7- - client
8- patchesStrategicMerge :
9- - confluent/kafka.yaml
7+
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ quota_definition=" /tmp/quota-definition/quotas.yaml"
4+
5+ for i in $( yq ' .platform.quotas | keys' < $quota_definition ) ; do
6+ principal=" ${i: 0} "
7+ if [[ " $principal " != " -" ]]; then
8+ producer_byte_rate=$( yq " .platform.quotas.$principal .producer_byte_rate" < $quota_definition )
9+ consumer_byte_rate=$( yq " .platform.quotas.$principal .consumer_byte_rate" < $quota_definition )
10+ request_percentage=$( yq " .platform.quotas.$principal .request_percentage" < $quota_definition )
11+ config_string=" "
12+ if [[ " $producer_byte_rate " != " null" ]]; then
13+ config_string=" $config_string producer_byte_rate=$producer_byte_rate ,"
14+ fi
15+ if [[ " $consumer_byte_rate " != " null" ]]; then
16+ config_string=" $config_string consumer_byte_rate=$consumer_byte_rate ,"
17+ fi
18+ if [[ " $request_percentage " != " null" ]]; then
19+ config_string=" $config_string request_percentage=$request_percentage ,"
20+ fi
21+ # Removes white space and the last trailing comma
22+ config=$( echo $config_string | tr -d " \t\n\r" | rev | cut -c 2- | rev)
23+ set -x
24+ echo $config
25+
26+ kafka-configs \
27+ --bootstrap-server kafka:9071 \
28+ --alter \
29+ --entity-type users \
30+ --entity-name $principal \
31+ --command-config /tmp/config-properties/kafka.properties \
32+ --add-config " $config "
33+ set +x
34+ fi
35+ done
36+
Original file line number Diff line number Diff line change 1+ bootstrap.servers =kafka:9071
2+ sasl.jaas.config =org.apache.kafka.common.security.plain.PlainLoginModule required username =kafka password =kafka-secret;
3+ sasl.mechanism =PLAIN
4+ security.protocol =SASL_SSL
5+ ssl.truststore.location =/mnt/sslcerts/truststore.jks
6+ ssl.truststore.password =mystorepassword
Original file line number Diff line number Diff line change 1+ ---
2+ platform :
3+ quotas :
4+ app-0 :
5+ producer_byte_rate : 1024
6+ consumer_byte_rate : 1024
7+ request_percentage : 50.0
8+ app-2 :
9+ producer_byte_rate : 2048
10+ consumer_byte_rate : 2048
11+ app-3 :
12+ request_percentage : 80.0
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11namespace : sandbox
22resources :
3- - demo-topic.yaml
4- - quota-manager.yaml
3+ - quota-manager.yaml
4+ configMapGenerator :
5+ - name : oso-quota-example
6+ files :
7+ - ./definition/quotas.yaml
8+ - name : config-properties
9+ files :
10+ - ./definition/kafka.properties
11+ - name : apply-quota-script
12+ files :
13+ - ./definition/apply-quotas-script.sh
14+ generatorOptions :
15+ disableNameSuffixHash : true
You can’t perform that action at this time.
0 commit comments