Discover Packages
github.com/tech-sketch/mqtt-kube-operator
command
module
Version:
v0.0.0-...-24eff3e
Opens a new window with list of versions in this module.
Published: Sep 30, 2018
License: Apache-2.0
Opens a new window with license information.
Imports: 17
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
mqtt-kube-operator
Deploy a resource to remote Kubernetes using MQTT
Description
When this container is deployed a Kubernetes cluster, the container subscribes two MQTT topics.
When a json string is received from subscribed topic, this container create / update / delete a Resource to its own Kubernetes.
Limitations
This program can operate only 4 resources below:
resource
apiVersion
Deployment
apps/v1
Service
v1
ConfigMap
v1
Secret
v1
This program can operate only default
namespace.
Environment Variables
This REST API accept Environment Variables like below:
Environment Variable
Summary
LOG_LEVEL
log level
MQTT_USE_TLS
set false
when connecting local MQTT Broker without TLS
MQTT_TLS_CA_PATH
path to cafile used to connect MQTT Broker
MQTT_USERNAME
username used to connect MQTT Broker
MQTT_PASSWORD
password used to connect MQTT Broker
MQTT_HOST
hostname of MQTT Broker
MQTT_PORT
port of MQTT Broker
DEVICE_TYPE
device type which is registered to iotagent-ul of FIWARE
DEVICE_ID
device id which is registered to iotagent-ul of FIWARE
REPORT_INTERVAL_SEC
report interval seconds (default 1 second)
USE_DEPLOYMENT_STATE_REPORTER
set true when using deploymentStateReporter (default false)
USE_POD_STATE_REPORTER
set true when using podStateReporter (default false)
REPORT_TARGET_LABEL_KEY
the target label to gather resource status
KUBE_CONF_PATH
if set, run this program locally using kubectl's configuration
Run this program locally
set environment variables
$ export KUBE_CONF_PATH=$HOME/.kube/config
$ export MQTT_TLS_CA_PATH=/path/to/ca.crt
$ export MQTT_USERNAME=mqtt_user
$ export MQTT_PASSWORD=the_password_of_mqtt_user
$ export MQTT_HOST=mqtt.example.com
$ export MQTT_PORT=8883
$ export DEVICE_TYPE=deployer
$ export DEVICE_ID=delopyer_01
$ export REPORT_INTERVAL_SEC=1
$ export USE_DEPLOYMENT_STATE_REPORTER=true
$ export REPORT_TARGET_LABEL_KEY=report
get dependencies (at the first time only)
$ make deps
run program
$ make run
Build container from source code
build program and build container image
$ make VERSION=0.2.0
push container to DockerHub
$ docker login
$ make push VERSION=0.2.0
License
Apache License 2.0
Copyright
Copyright (c) 2018 TIS Inc.
Expand ▾
Collapse ▴
Documentation
¶
Package main : entry point of mqtt-kube-operator.
license: Apache license 2.0
copyright: Nobuyuki Matsui <nobuyuki.matsui@gmail.com>
Source Files
¶
Directories
¶
Package handlers : handle MQTT message and deploy object to kubernetes.
Package handlers : handle MQTT message and deploy object to kubernetes.
Package reporters : report state of kubernetes using MQTT.
Package reporters : report state of kubernetes using MQTT.
Click to show internal directories.
Click to hide internal directories.