Discover Packages
github.com/crossplane-contrib/provider-kafka
module
Version:
v0.5.0
Opens a new window with list of versions in this module.
Published: Feb 12, 2024
License: Apache-2.0
Opens a new window with license information.
README
README
¶
provider-kafka
provider-kafka
is a Crossplane Provider that is used to
manage Kafka resources.
Usage
Create a provider secret containing a json like the following, see expected
schema here :
{
"brokers":[
"kafka-dev-0.kafka-dev-headless:9092"
],
"sasl":{
"mechanism":"PLAIN",
"username":"user",
"password":"<your-password>"
}
}
Create a k8s secret containing above config:
kubectl -n crossplane-system create secret generic kafka-creds --from-file=credentials=kc.json
Create a ProviderConfig
, see this as an example.
Create a managed resource see, see this for an example creating a Kafka topic
.
Development
Setting up a Development Kafka Cluster
The following instructions will setup a development environment where you will have a locally running Kafka
installation (SASL-Plain enabled). To change the configuration of your instance further, please see available helm
parameters here .
(Optional) Create a local kind cluster unless you want to develop against an existing
k8s cluster.
Install the Kafka helm chart :
helm repo add bitnami https://charts.bitnami.com/bitnami
kubectl create ns kafka-cluster
helm upgrade --install kafka-dev -n kafka-cluster bitnami/kafka \
--version 20.0.5 \
--set auth.clientProtocol=sasl \
--set deleteTopicEnable=true \
--set authorizerClassName="kafka.security.authorizer.AclAuthorizer" \
--wait
Username is "user", obtain password using the following
kubectl -n kafka-cluster exec kafka-dev-0 -- cat /opt/bitnami/kafka/config/kafka_jaas.conf
Create the Kubernetes secret by adding a JSON filed called kc.json with the following contents
{
"brokers": [
"kafka-dev-0.kafka-dev-headless:9092"
],
"sasl": {
"mechanism": "PLAIN",
"username": "user",
"password": "<password-you-obtained-in-step-2>"
}
}
Once this file is created, apply it by running the following command
kubectl -n kafka-cluster create secret generic kafka-creds --from-file=credentials=kc.json
Install kubefwd .
Run kubefwd
for kafka-cluster
namespace which will make internal k8s services locally accessible:
sudo kubefwd svc -n kafka-cluster
To run tests, export the KAFKA_PASSWORD environment variable using the password from step 2
export KAFKA_PASSWORD="<password-you-obtained-in-step-2>"
(optional) Install the kafka cli .
(optional) Configure the kafka cli to talk against local Kafka installation:
Create a config file for the client with the following content at ~/.kcl/config.toml
:
seed_brokers = ["kafka-dev-0.kafka-dev-headless:9092"]
timeout_ms = 10000
[sasl]
method = "plain"
user = "user"
pass = "<password-you-obtained-in-step-2>"
Verify that cli could talk to the Kafka cluster:
export KCL_CONFIG_DIR=~/.kcl
kcl metadata --all
Building and Running the provider locally
Run against a Kubernetes cluster:
make run
Build, push, and install:
make all
Build image:
make image
Push image:
make push
Build binary:
make build
Expand ▾
Collapse ▴
Directories
¶
Package apis contains Kubernetes API for the Template provider.
Package apis contains Kubernetes API for the Template provider.
acl
Package acl contains group Sample API versions
Package acl contains group Sample API versions
acl/v1alpha1
Package v1alpha1 contains the v1alpha1 group Sample resources of the Template provider.
Package v1alpha1 contains the v1alpha1 group Sample resources of the Template provider.
topic
Package topic contains group Sample API versions
Package topic contains group Sample API versions
topic/v1alpha1
Package v1alpha1 contains the v1alpha1 group Sample resources of the Template provider.
Package v1alpha1 contains the v1alpha1 group Sample resources of the Template provider.
v1alpha1
Package v1alpha1 contains the core resources of the Template provider.
Package v1alpha1 contains the core resources of the Template provider.
cmd
internal
Click to show internal directories.
Click to hide internal directories.