项目作者: UnityTech

项目描述 :
NATS 0.9.4 + Kontrol
高级语言: Python
项目地址: git://github.com/UnityTech/ads-infra-nats.git
创建时间: 2017-06-07T14:45:55Z
项目社区:https://github.com/UnityTech/ads-infra-nats

开源协议:

下载


HAProxy+Kontrol pod

Overview

This project is a Docker image packaging
NATS 0.9.4 together with
Kontrol. It is meant
to be included in a Kubernetes
pod.

The container will run its own control-tier which will re-configure the routes anytime
brokers are added or removed. Please note we do not allow for custom configuration
settings at this point.

Lifecycle

The initial state will render the telegraf
configuration and add the statsd input. The local broker logfile will be written under
/data and rotated via logrotate. The state will then cycle thru one or more configuration
sequences with the broker configuration written as /data/gnatsd.conf. All other brokers
currently reporting via kontrol will be included in the routes. Please note the client
port is TCP 4242 and the internal cluster port is TCP 4244.

Any change detected by kontrol will trip the state-machine back to that configuration
state. The broker itself is restarted via supervisord.

Building the image

Pick a distro and build from the top-level directory. For instance:

  1. $ docker build -f alpine-3.5/Dockerfile .

Manifest

Simply use this pod in a deployment and assign it to an array with external access using a
node-port service to clamp onto the desired port. For instance:

  1. apiVersion: extensions/v1beta1
  2. kind: Deployment
  3. metadata:
  4. name: haproxy
  5. spec:
  6. replicas: 1
  7. template:
  8. metadata:
  9. labels:
  10. app: nats
  11. role: broker
  12. tier: data
  13. annotations:
  14. kontrol.unity3d.com/master: nats.default.svc
  15. kontrol.unity3d.com/opentsdb: kairosdb.us-east-1.applifier.info
  16. spec:
  17. nodeSelector:
  18. unity3d.com/array: data
  19. affinity:
  20. podAntiAffinity:
  21. requiredDuringSchedulingIgnoredDuringExecution:
  22. - labelSelector:
  23. matchExpressions:
  24. - key: app
  25. operator: In
  26. values:
  27. - nats
  28. topologyKey: "kubernetes.io/hostname"
  29. containers:
  30. - image: registry2.applifier.info:5005/ads-infra-nats-alpine-3.5
  31. name: nats
  32. imagePullPolicy: Always
  33. ports:
  34. - containerPort: 4242
  35. protocol: TCP
  36. - containerPort: 4244
  37. protocol: TCP
  38. - containerPort: 8000
  39. protocol: TCP
  40. env:
  41. - name: NAMESPACE
  42. valueFrom:
  43. fieldRef:
  44. fieldPath: metadata.namespace

Support

Contact olivierp@unity3d.com for more information about this project.