Code Monkey home page Code Monkey logo

kafka-env-config-provider's Introduction

kafka-env-config-provider

A config provider for Kafka, able to retrieve secrets from environment variables.

This is meant to be used in Kafka connectors configuration, to be able to get values that are defined in environment variables.

This is particularly useful when running in the cloud, since configuration for Docker images (or Kubernetes pods) is normally achieved through environment variables.

This config provider can also be used as a way to externalize secrets when using Kafka, as described here. A possible way to use this for secrets would be delegating the actual secrets management to something external (e.g., a Kubernetes operator that gets the secrets from AWS Secrets Management and stores it as Kubernetes secrets) and just pass the secrets to your application as environment variables.

Using a config provider ensures that secrets can be passed to your Kafka connectors without being neither exposed nor logged by the Kafka connect infrastructure.

Installation

In order to install this config provider on a Kafka connect instance:

  • build the kafka-env-config-provider jar using gradle:
    gradle build
  • include the jar under build/libs in the Kafka connect instance you are using in a separate specific directory (e.g., /usr/local/share/java/kafka-connect/plugins/kafka-env-config-provider) (if are using Docker, create an image that extends the Kafka connect standard one from Confluent, adding this jar)
  • in the Kafka connect worker configuration, add the directory where you placed the jar to the plugins path
    • if you are using the confluent-oss platform, edit the file etc/schema-registry/connect-avro-distributed.properties and add the jar directory to the plugin.path property as follows:
      plugin.path=share/java,/usr/local/share/java/kafka-connect/plugins/kafka-env-config-provider
      
    • if you are extending the confluentinc/cp-kafka-connect Docker image, set the environment variable CONNECT_PLUGIN_PATH value with the jar directory when running the container

Usage

In order to use this config provider in Kafka connect, you need to declare it in the worker configuration as follows:

  • in the confluent-oss platform, edit the file etc/schema-registry/connect-avro-distributed.properties adding the following properties:
    config.providers=env
    config.providers.env.class=org.ggt.kafka.config.provider.KafkaEnvConfigProvider
    
  • if you are extending the confluentinc/cp-kafka-connect Docker image, add the following environment variables when running the container:
    CONNECT_CONFIG_PROVIDERS=env
    CONNECT_CONFIG_PROVIDERS_ENV_CLASS=org.ggt.kafka.config.provider.KafkaEnvConfigProvider

You can then reference environment variables from Kafka connect connector configurations as follows:

${env:ENVIRONMENT_VARIABLE_NAME}

kafka-env-config-provider's People

Contributors

adityajalkhare avatar giogt avatar mubeta06 avatar ndajr avatar shaunmaris avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.