Git Product home page Git Product logo

kubecloudconfigserver's Introduction

license Go Report Card Go Reference Docker Pulls gateboard

kubecloudconfigserver

Simple centralized cloud configuration server for Kubernetes in Go.

This configuration server exposes fast cached access to a slow backend.

Features

  • The server is meant to run as multiple replicas service in a Kubernetes cluster.

  • groupcache is used as fast distributed cache. If multiple clients request a new configuration file, only a single replica fetches it from the backend and then makes the file available for all pending requests.

  • The pod replicas automatically find each other by querying Kubernetes API for pods with a shared label app=<app-name>. For example, if a deployment is used to create the replicas, the shared label would be app=<deployment-name>.

  • The server handles refresh notification events from the AMQP queue config-event-queue below. Whenever a refresh notification is received for an application, cache entries with that application configuration file are cleared, forcing their refresh from the backend.

exchangeName: springCloudBus
exchangeType: topic
queue:        config-event-queue
  • The env var TTL can be used to enforce a TTL on cache entries. Example: TTL=300s. Default value is TTL=0, meaning no expiration set for cache entries.

Build

git clone https://github.com/udhos/kubecloudconfigserver

cd kubecloudconfigserver

go mod tidy

go test -race ./...

export CGO_ENABLED=0

go install ./...

Run

HTTP backend

Proxying to an HTTP server:

export BACKEND=http://configserver:9000

kubeconfigserver

Directory backend

Reading from filesystem rooted at directory samples:

export BACKEND=dir:samples
export BACKEND_OPTIONS=flatten ;# flatten request path into a flat dir

kubeconfigserver

Test

Query server:

curl localhost:8080/deploy.yml

Query groupcache directly:

curl localhost:5000/_groupcache/<group>/<key>

curl localhost:5000/_groupcache/configfiles/deploy.yml

Docker

Docker hub:

https://hub.docker.com/r/udhos/kubecloudconfigserver

Pull from docker hub:

docker pull udhos/kubecloudconfigserver:0.0.0

Build recipe:

./docker/build.sh

kubecloudconfigserver's People

Contributors

udhos avatar

Watchers

 avatar  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.