First version of ThingsBoard IoT Platform - an Aether edge app
Change-Id: Ia94164fb6ec9b1f2a31668b0e419f05e72eac27c
diff --git a/apps/thingsboard-iot-platform/Chart.yaml b/apps/thingsboard-iot-platform/Chart.yaml
new file mode 100644
index 0000000..0f49a35
--- /dev/null
+++ b/apps/thingsboard-iot-platform/Chart.yaml
@@ -0,0 +1,12 @@
+---
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+apiVersion: v1
+description: Thingsboard IoT Platform
+name: thingsboard-iot-platform
+icon: https://guide.opencord.org/logos/cord.svg
+
+version: 0.1.0
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/_helpers.tpl b/apps/thingsboard-iot-platform/templates/_helpers.tpl
new file mode 100644
index 0000000..8591fda
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/_helpers.tpl
@@ -0,0 +1,88 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+{{/*
+Renders a set of standardised labels
+*/}}
+{{- define "thingsboard-iot-platform.metadata_labels" -}}
+{{- $application := index . 0 -}}
+{{- $context := index . 1 -}}
+release: {{ $context.Release.Name }}
+app: {{ $application }}
+{{- end -}}
+
+{{/*
+Render the given template.
+*/}}
+{{- define "thingsboard-iot-platform.template" -}}
+{{- $name := index . 0 -}}
+{{- $context := index . 1 -}}
+{{- $last := base $context.Template.Name }}
+{{- $wtf := $context.Template.Name | replace $last $name -}}
+{{ include $wtf $context }}
+{{- end -}}
+
+{{/*
+Render ServiceAccount, Role, and RoleBinding required for kubernetes-entrypoint.
+*/}}
+{{- define "thingsboard-iot-platform.service_account" -}}
+{{- $context := index . 1 -}}
+{{- $saName := index . 0 -}}
+{{- $saNamespace := $context.Release.Namespace }}
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "thingsboard-iot-platform.metadata_labels" | indent 4 }}
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: RoleBinding
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "thingsboard-iot-platform.metadata_labels" | indent 4 }}
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: {{ $saName }}
+subjects:
+ - kind: ServiceAccount
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+---
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: Role
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "thingsboard-iot-platform.metadata_labels" | indent 4 }}
+rules:
+ - apiGroups:
+ - ""
+ - extensions
+ - batch
+ - apps
+ verbs:
+ - get
+ - list
+ - patch
+ resources:
+ - statefulsets
+ - daemonsets
+ - jobs
+ - pods
+ - services
+ - endpoints
+ - configmaps
+{{- end -}}
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/configmap-postgres.yaml b/apps/thingsboard-iot-platform/templates/configmap-postgres.yaml
new file mode 100644
index 0000000..f3d605c
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/configmap-postgres.yaml
@@ -0,0 +1,86 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: postgres-conf
+ labels:
+ name: postgres-conf
+data:
+ config: |
+ listen_addresses = '*'
+ huge_pages = off
+
+
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: tb-node-db-config
+ labels:
+ name: tb-node-db-config
+data:
+ DATABASE_TS_TYPE: sql
+ SPRING_JPA_DATABASE_PLATFORM: org.hibernate.dialect.PostgreSQLDialect
+ SPRING_DRIVER_CLASS_NAME: org.postgresql.Driver
+ SPRING_DATASOURCE_URL: jdbc:postgresql://tb-database:5432/thingsboard
+ SPRING_DATASOURCE_USERNAME: postgres
+ SPRING_DATASOURCE_PASSWORD: postgres
+
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: tb-node-config
+ labels:
+ name: tb-node-config
+data:
+ conf: |
+ export JAVA_OPTS="$JAVA_OPTS -Dplatform=deb -Dinstall.data_dir=/usr/share/thingsboard/data"
+ export JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/thingsboard/${TB_SERVICE_ID}/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/thingsboard/${TB_SERVICE_ID}/heapdump.bin -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
+ export JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10"
+ export JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark"
+ export JAVA_OPTS="$JAVA_OPTS -XX:CMSWaitDuration=10000 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSParallelInitialMarkEnabled"
+ export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ExitOnOutOfMemoryError"
+ export LOG_FILENAME=thingsboard.out
+ export LOADER_PATH=/usr/share/thingsboard/conf,/usr/share/thingsboard/extensions
+ logback: |
+ <!DOCTYPE configuration>
+ <configuration scan="true" scanPeriod="10 seconds">
+
+ <appender name="fileLogAppender"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>/var/log/thingsboard/${TB_SERVICE_ID}/thingsboard.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>/var/log/thingsboard/${TB_SERVICE_ID}/thingsboard.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ <maxFileSize>100MB</maxFileSize>
+ <maxHistory>30</maxHistory>
+ <totalSizeCap>3GB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.thingsboard.server" level="INFO" />
+ <logger name="com.google.common.util.concurrent.AggregateFuture" level="OFF" />
+
+ <root level="INFO">
+ <appender-ref ref="fileLogAppender"/>
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+ </configuration>
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/configmap-tb-coap-transport.yaml b/apps/thingsboard-iot-platform/templates/configmap-tb-coap-transport.yaml
new file mode 100644
index 0000000..00f7d61
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/configmap-tb-coap-transport.yaml
@@ -0,0 +1,57 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: tb-coap-transport-config
+ labels:
+ name: tb-coap-transport-config
+data:
+ conf: |
+ export JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/tb-coap-transport/${TB_SERVICE_ID}/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/tb-coap-transport/${TB_SERVICE_ID}/heapdump.bin -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
+ export JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10"
+ export JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark"
+ export JAVA_OPTS="$JAVA_OPTS -XX:CMSWaitDuration=10000 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSParallelInitialMarkEnabled"
+ export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ExitOnOutOfMemoryError"
+ export LOG_FILENAME=tb-coap-transport.out
+ export LOADER_PATH=/usr/share/tb-coap-transport/conf
+ logback: |
+ <!DOCTYPE configuration>
+ <configuration scan="true" scanPeriod="10 seconds">
+
+ <appender name="fileLogAppender"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>/var/log/tb-coap-transport/${TB_SERVICE_ID}/tb-coap-transport.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>/var/log/tb-coap-transport/${TB_SERVICE_ID}/tb-coap-transport.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ <maxFileSize>100MB</maxFileSize>
+ <maxHistory>30</maxHistory>
+ <totalSizeCap>3GB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.thingsboard.server" level="INFO" />
+
+ <root level="INFO">
+ <appender-ref ref="fileLogAppender"/>
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+ </configuration>
diff --git a/apps/thingsboard-iot-platform/templates/configmap-tb-http-transport.yaml b/apps/thingsboard-iot-platform/templates/configmap-tb-http-transport.yaml
new file mode 100644
index 0000000..cf1f38b
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/configmap-tb-http-transport.yaml
@@ -0,0 +1,57 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: tb-http-transport-config
+ labels:
+ name: tb-http-transport-config
+data:
+ conf: |
+ export JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/tb-http-transport/${TB_SERVICE_ID}/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/tb-http-transport/${TB_SERVICE_ID}/heapdump.bin -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
+ export JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10"
+ export JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark"
+ export JAVA_OPTS="$JAVA_OPTS -XX:CMSWaitDuration=10000 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSParallelInitialMarkEnabled"
+ export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ExitOnOutOfMemoryError"
+ export LOG_FILENAME=tb-http-transport.out
+ export LOADER_PATH=/usr/share/tb-http-transport/conf
+ logback: |
+ <!DOCTYPE configuration>
+ <configuration scan="true" scanPeriod="10 seconds">
+
+ <appender name="fileLogAppender"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>/var/log/tb-http-transport/${TB_SERVICE_ID}/tb-http-transport.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>/var/log/tb-http-transport/${TB_SERVICE_ID}/tb-http-transport.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ <maxFileSize>100MB</maxFileSize>
+ <maxHistory>30</maxHistory>
+ <totalSizeCap>3GB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.thingsboard.server" level="INFO" />
+
+ <root level="INFO">
+ <appender-ref ref="fileLogAppender"/>
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+ </configuration>
diff --git a/apps/thingsboard-iot-platform/templates/configmap-tb-mqtt-transport.yaml b/apps/thingsboard-iot-platform/templates/configmap-tb-mqtt-transport.yaml
new file mode 100644
index 0000000..52fce34
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/configmap-tb-mqtt-transport.yaml
@@ -0,0 +1,57 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: tb-mqtt-transport-config
+ labels:
+ name: tb-mqtt-transport-config
+data:
+ conf: |
+ export JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/tb-mqtt-transport/${TB_SERVICE_ID}/gc.log -XX:+IgnoreUnrecognizedVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/tb-mqtt-transport/${TB_SERVICE_ID}/heapdump.bin -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
+ export JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10"
+ export JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M -XX:-UseBiasedLocking -XX:+UseTLAB -XX:+ResizeTLAB -XX:+PerfDisableSharedMem -XX:+UseCondCardMark"
+ export JAVA_OPTS="$JAVA_OPTS -XX:CMSWaitDuration=10000 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+CMSParallelInitialMarkEnabled"
+ export JAVA_OPTS="$JAVA_OPTS -XX:+CMSEdenChunksRecordAlways -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ExitOnOutOfMemoryError"
+ export LOG_FILENAME=tb-mqtt-transport.out
+ export LOADER_PATH=/usr/share/tb-mqtt-transport/conf
+ logback: |
+ <!DOCTYPE configuration>
+ <configuration scan="true" scanPeriod="10 seconds">
+
+ <appender name="fileLogAppender"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>/var/log/tb-mqtt-transport/${TB_SERVICE_ID}/tb-mqtt-transport.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>/var/log/tb-mqtt-transport/${TB_SERVICE_ID}/tb-mqtt-transport.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ <maxFileSize>100MB</maxFileSize>
+ <maxHistory>30</maxHistory>
+ <totalSizeCap>3GB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{ISO8601} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.thingsboard.server" level="INFO" />
+
+ <root level="INFO">
+ <appender-ref ref="fileLogAppender"/>
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+ </configuration>
diff --git a/apps/thingsboard-iot-platform/templates/configmap-tb-node-cache.yaml b/apps/thingsboard-iot-platform/templates/configmap-tb-node-cache.yaml
new file mode 100644
index 0000000..d9b6c50
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/configmap-tb-node-cache.yaml
@@ -0,0 +1,18 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: tb-node-cache-config
+ labels:
+ name: tb-node-cache-config
+data:
+ CACHE_TYPE: redis
+ REDIS_HOST: tb-redis
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/deployment-kafka.yaml b/apps/thingsboard-iot-platform/templates/deployment-kafka.yaml
new file mode 100644
index 0000000..43bc9d9
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/deployment-kafka.yaml
@@ -0,0 +1,88 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: tb-kafka
+spec:
+ selector:
+ matchLabels:
+ app: tb-kafka
+ template:
+ metadata:
+ labels:
+ app: tb-kafka
+ spec:
+ serviceAccountName: thingsboard
+ initContainers:
+ - name: kafka-dep-check
+ image: {{ .Values.images.tags.depCheck }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ env:
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.name
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.namespace
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
+ - name: COMMAND
+ value: "echo done"
+ - name: DEPENDENCY_POD_JSON
+ value: '[{"labels": {"app": "zookeeper"}, "requireSameNode": false}]'
+ command:
+ - kubernetes-entrypoint
+ volumeMounts:
+ []
+ containers:
+ - name: server
+ imagePullPolicy: {{ .Values.images.pullPolicy}}
+ image: {{ .Values.images.tags.kafka }}
+ ports:
+ - containerPort: {{ .Values.config.kafka.ports.outPort }}
+ readinessProbe:
+ periodSeconds: 20
+ tcpSocket:
+ port: {{ .Values.config.kafka.ports.outPort }}
+ livenessProbe:
+ initialDelaySeconds: 25
+ periodSeconds: 5
+ tcpSocket:
+ port: {{ .Values.config.kafka.ports.outPort }}
+ env:
+ - name: KAFKA_ZOOKEEPER_CONNECT
+ value: "zookeeper:{{ .Values.config.zookeeper.port }}"
+ - name: KAFKA_LISTENERS
+ value: "INSIDE://:{{ .Values.config.kafka.ports.inPort }},OUTSIDE://:{{ .Values.config.kafka.ports.outPort }}"
+ - name: KAFKA_ADVERTISED_LISTENERS
+ value: "INSIDE://:{{ .Values.config.kafka.ports.inPort }},OUTSIDE://tb-kafka:{{ .Values.config.kafka.ports.outPort }}"
+ - name: KAFKA_LISTENER_SECURITY_PROTOCOL_MAP
+ value: "INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT"
+ - name: KAFKA_INTER_BROKER_LISTENER_NAME
+ value: "INSIDE"
+ - name: KAFKA_CREATE_TOPICS
+ value: "js_eval.requests:100:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb_transport.api.requests:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600,tb_rule_engine:30:1:delete --config=retention.ms=60000 --config=segment.bytes=26214400 --config=retention.bytes=104857600"
+ - name: KAFKA_AUTO_CREATE_TOPICS_ENABLE
+ value: "false"
+ - name: KAFKA_LOG_RETENTION_BYTES
+ value: "1073741824"
+ - name: KAFKA_LOG_SEGMENT_BYTES
+ value: "268435456"
+ - name: KAFKA_LOG_RETENTION_MS
+ value: "300000"
+ - name: KAFKA_LOG_CLEANUP_POLICY
+ value: "delete"
+ restartPolicy: Always
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/deployment-postgres.yaml b/apps/thingsboard-iot-platform/templates/deployment-postgres.yaml
new file mode 100644
index 0000000..bd71b2c
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/deployment-postgres.yaml
@@ -0,0 +1,76 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+{{ tuple "thingsboard" . | include "thingsboard-iot-platform.service_account" }}
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: postgres
+ labels:
+ app: postgres
+spec:
+ selector:
+ matchLabels:
+ app: postgres
+ template:
+ metadata:
+ labels:
+ app: postgres
+ spec:
+ serviceAccountName: thingsboard
+ volumes:
+ - name: postgres-conf
+ configMap:
+ name: postgres-conf
+ items:
+ - key: config
+ path: config/postgresql.conf.sample
+ containers:
+ - name: postgres
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ image: {{ .Values.images.tags.postgres }}
+ ports:
+ - containerPort: {{ .Values.config.postgres.port }}
+ name: postgres
+ env:
+ - name: POSTGRES_DB
+ value: "thingsboard"
+ - name: POSTGRES_PASSWORD
+ value: "postgres"
+ - name: PGDATA
+ value: /var/lib/postgresql/data/pgdata
+ volumeMounts:
+ - mountPath: /usr/share/postgresql/postgresql.conf.sample
+ subPath: config/postgresql.conf.sample
+ name: postgres-conf
+# volumeMounts:
+# - mountPath: /var/lib/postgresql/data
+# name: postgres-data
+ livenessProbe:
+ exec:
+ command:
+ - pg_isready
+ - -h
+ - localhost
+ - -U
+ - postgres
+ initialDelaySeconds: 60
+ timeoutSeconds: 30
+ readinessProbe:
+ exec:
+ command:
+ - pg_isready
+ - -h
+ - localhost
+ - -U
+ - postgres
+ initialDelaySeconds: 5
+ timeoutSeconds: 1
+ restartPolicy: Always
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/deployment-redis.yaml b/apps/thingsboard-iot-platform/templates/deployment-redis.yaml
new file mode 100644
index 0000000..8473316
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/deployment-redis.yaml
@@ -0,0 +1,74 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: tb-redis
+spec:
+ selector:
+ matchLabels:
+ app: tb-redis
+ template:
+ metadata:
+ labels:
+ app: tb-redis
+ spec:
+ serviceAccountName: thingsboard
+ initContainers:
+ - name: redis-dep-check
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ image: {{ .Values.images.tags.depCheck }}
+ securityContext:
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: false
+ runAsUser: 0
+ env:
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.name
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.namespace
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
+ - name: COMMAND
+ value: "echo done"
+ - name: DEPENDENCY_JOBS
+ value: job-tb-db-setup
+ command:
+ - kubernetes-entrypoint
+ volumeMounts:
+ []
+ containers:
+ - name: server
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ image: {{ .Values.images.tags.redis }}
+ ports:
+ - containerPort: {{ .Values.config.redis.port }}
+ readinessProbe:
+ periodSeconds: 5
+ tcpSocket:
+ port: {{ .Values.config.redis.port }}
+ livenessProbe:
+ periodSeconds: 5
+ tcpSocket:
+ port: {{ .Values.config.redis.port }}
+ volumeMounts:
+ - mountPath: /data
+ name: redis-data
+ volumes:
+ - name: redis-data
+ emptyDir: {}
+ restartPolicy: Always
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/deployment-tb-coap-transport.yaml b/apps/thingsboard-iot-platform/templates/deployment-tb-coap-transport.yaml
new file mode 100644
index 0000000..2142102
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/deployment-tb-coap-transport.yaml
@@ -0,0 +1,86 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: tb-coap-transport
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: tb-coap-transport
+ template:
+ metadata:
+ labels:
+ app: tb-coap-transport
+ spec:
+ serviceAccountName: thingsboard
+ volumes:
+ - name: tb-coap-transport-config
+ configMap:
+ name: tb-coap-transport-config
+ items:
+ - key: conf
+ path: tb-coap-transport.conf
+ - key: logback
+ path: logback.xml
+ initContainers:
+ - name: tb-coap-transport-dep-check
+ image: {{ .Values.images.tags.depCheck }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ env:
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.name
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.namespace
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
+ - name: COMMAND
+ value: "echo done"
+ - name: DEPENDENCY_POD_JSON
+ value: '[{"labels": {"app": "tb-kafka"}, "requireSameNode": false}]'
+ command:
+ - kubernetes-entrypoint
+ volumeMounts:
+ []
+ containers:
+ - name: server
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ image: {{ .Values.images.tags.coapTransport }}
+ ports:
+ - containerPort: {{ .Values.config.transports.coap.port }}
+ name: coap
+ protocol: UDP
+ env:
+ - name: TB_SERVICE_ID
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.name
+ - name: TB_QUEUE_TYPE
+ value: "kafka"
+ - name: COAP_BIND_ADDRESS
+ value: {{ .Values.config.transports.coap.bindAddr | quote }}
+ - name: COAP_BIND_PORT
+ value: {{ .Values.config.transports.coap.port | quote }}
+ - name: COAP_TIMEOUT
+ value: {{ .Values.config.transports.coap.timeout | quote }}
+ - name: TB_KAFKA_SERVERS
+ value: "tb-kafka:{{ .Values.config.kafka.ports.outPort }}"
+ volumeMounts:
+ - mountPath: /config
+ name: tb-coap-transport-config
+ restartPolicy: Always
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/deployment-tb-http-transport.yaml b/apps/thingsboard-iot-platform/templates/deployment-tb-http-transport.yaml
new file mode 100644
index 0000000..bb7b5d4
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/deployment-tb-http-transport.yaml
@@ -0,0 +1,94 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: tb-http-transport
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: tb-http-transport
+ template:
+ metadata:
+ labels:
+ app: tb-http-transport
+ spec:
+ serviceAccountName: thingsboard
+ volumes:
+ - name: tb-http-transport-config
+ configMap:
+ name: tb-http-transport-config
+ items:
+ - key: conf
+ path: tb-http-transport.conf
+ - key: logback
+ path: logback.xml
+ initContainers:
+ - name: tb-http-transport-dep-check
+ image: {{ .Values.images.tags.depCheck }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ env:
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.name
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.namespace
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
+ - name: COMMAND
+ value: "echo done"
+ - name: DEPENDENCY_POD_JSON
+ value: '[{"labels": {"app": "tb-kafka"}, "requireSameNode": false}]'
+ command:
+ - kubernetes-entrypoint
+ volumeMounts:
+ []
+ containers:
+ - name: server
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ image: {{ .Values.images.tags.httpTransport }}
+ ports:
+ - containerPort: {{ .Values.config.transports.http.port }}
+ name: http
+ env:
+ - name: TB_SERVICE_ID
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.name
+ - name: TB_QUEUE_TYPE
+ value: "kafka"
+ - name: HTTP_BIND_ADDRESS
+ value: {{ .Values.config.transports.http.bindAddr | quote }}
+ - name: HTTP_BIND_PORT
+ value: {{ .Values.config.transports.http.port | quote }}
+ - name: HTTP_REQUEST_TIMEOUT
+ value: {{ .Values.config.transports.http.timeout | quote }}
+ - name: TB_KAFKA_SERVERS
+ value: "tb-kafka:{{ .Values.config.kafka.ports.outPort }}"
+ volumeMounts:
+ - mountPath: /config
+ name: tb-http-transport-config
+ readinessProbe:
+ periodSeconds: 20
+ tcpSocket:
+ port: {{ .Values.config.transports.http.port }}
+ livenessProbe:
+ initialDelaySeconds: 120
+ periodSeconds: 20
+ tcpSocket:
+ port: {{ .Values.config.transports.http.port }}
+ restartPolicy: Always
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/deployment-tb-js-executor.yaml b/apps/thingsboard-iot-platform/templates/deployment-tb-js-executor.yaml
new file mode 100644
index 0000000..d79e0fa
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/deployment-tb-js-executor.yaml
@@ -0,0 +1,70 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: tb-js-executor
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: tb-js-executor
+ template:
+ metadata:
+ labels:
+ app: tb-js-executor
+ spec:
+ serviceAccountName: thingsboard
+ initContainers:
+ - name: js-executor-dep-check
+ image: {{ .Values.images.tags.depCheck }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ env:
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.name
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.namespace
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
+ - name: COMMAND
+ value: "echo done"
+ - name: DEPENDENCY_POD_JSON
+ value: '[{"labels": {"app": "tb-kafka"}, "requireSameNode": false}]'
+ command:
+ - kubernetes-entrypoint
+ volumeMounts:
+ []
+ containers:
+ - name: server
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ image: {{ .Values.images.tags.jsExecutor }}
+ env:
+ - name: REMOTE_JS_EVAL_REQUEST_TOPIC
+ value: "js_eval.requests"
+ - name: TB_KAFKA_SERVERS
+ value: "tb-kafka:{{ .Values.config.kafka.ports.outPort}}"
+ - name: LOGGER_LEVEL
+ value: "info"
+ - name: LOG_FOLDER
+ value: "logs"
+ - name: LOGGER_FILENAME
+ value: "tb-js-executor-%DATE%.log"
+ - name: DOCKER_MODE
+ value: "true"
+ - name: SCRIPT_BODY_TRACE_FREQUENCY
+ value: "1000"
+ restartPolicy: Always
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/deployment-tb-mqtt-transport.yaml b/apps/thingsboard-iot-platform/templates/deployment-tb-mqtt-transport.yaml
new file mode 100644
index 0000000..c4954d0
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/deployment-tb-mqtt-transport.yaml
@@ -0,0 +1,94 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: tb-mqtt-transport
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: tb-mqtt-transport
+ template:
+ metadata:
+ labels:
+ app: tb-mqtt-transport
+ spec:
+ serviceAccountName: thingsboard
+ volumes:
+ - name: tb-mqtt-transport-config
+ configMap:
+ name: tb-mqtt-transport-config
+ items:
+ - key: conf
+ path: tb-mqtt-transport.conf
+ - key: logback
+ path: logback.xml
+ initContainers:
+ - name: tb-mqtt-transport-dep-check
+ image: {{ .Values.images.tags.depCheck }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ env:
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.name
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.namespace
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
+ - name: COMMAND
+ value: "echo done"
+ - name: DEPENDENCY_POD_JSON
+ value: '[{"labels": {"app": "tb-kafka"}, "requireSameNode": false}]'
+ command:
+ - kubernetes-entrypoint
+ volumeMounts:
+ []
+ containers:
+ - name: server
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ image: {{ .Values.images.tags.mqttTransport }}
+ ports:
+ - containerPort: {{ .Values.config.transports.mqtt.port }}
+ name: mqtt
+ env:
+ - name: TB_SERVICE_ID
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.name
+ - name: TB_QUEUE_TYPE
+ value: "kafka"
+ - name: MQTT_BIND_ADDRESS
+ value: {{ .Values.config.transports.mqtt.bindAddr | quote}}
+ - name: MQTT_BIND_PORT
+ value: {{ .Values.config.transports.mqtt.port | quote}}
+ - name: MQTT_TIMEOUT
+ value: {{ .Values.config.transports.mqtt.timeout | quote}}
+ - name: TB_KAFKA_SERVERS
+ value: "tb-kafka:{{ .Values.config.kafka.ports.outPort }}"
+ volumeMounts:
+ - mountPath: /config
+ name: tb-mqtt-transport-config
+ readinessProbe:
+ periodSeconds: 20
+ tcpSocket:
+ port: {{ .Values.config.transports.mqtt.port }}
+ livenessProbe:
+ initialDelaySeconds: 120
+ periodSeconds: 20
+ tcpSocket:
+ port: {{ .Values.config.transports.mqtt.port }}
+ restartPolicy: Always
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/deployment-tb-node.yaml b/apps/thingsboard-iot-platform/templates/deployment-tb-node.yaml
new file mode 100644
index 0000000..19086e4
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/deployment-tb-node.yaml
@@ -0,0 +1,104 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: tb-node
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: tb-node
+ template:
+ metadata:
+ labels:
+ app: tb-node
+ spec:
+ serviceAccountName: thingsboard
+ volumes:
+ - name: tb-node-config
+ configMap:
+ name: tb-node-config
+ items:
+ - key: conf
+ path: thingsboard.conf
+ - key: logback
+ path: logback.xml
+ initContainers:
+ - name: tb-node-dep-check
+ image: {{ .Values.images.tags.depCheck }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ env:
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.name
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.namespace
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
+ - name: COMMAND
+ value: "echo done"
+ - name: DEPENDENCY_POD_JSON
+ value: '[{"labels": {"app": "tb-kafka"}, "requireSameNode": false}]'
+ command:
+ - kubernetes-entrypoint
+ volumeMounts:
+ []
+ containers:
+ - name: node-server
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ image: {{ .Values.images.tags.tbNode }}
+ ports:
+ - containerPort: {{ .Values.config.tbNode.ports.http }}
+ name: http
+ - containerPort: {{ .Values.config.tbNode.ports.rpc }}
+ name: rpc
+ env:
+ - name: TB_SERVICE_ID
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.name
+ - name: TB_SERVICE_TYPE
+ value: {{ .Values.config.tbNode.serviceType | quote }}
+ - name: TB_QUEUE_TYPE
+ value: "kafka"
+ - name: ZOOKEEPER_ENABLED
+ value: {{ .Values.config.zookeeper.enabled | quote }}
+ - name: ZOOKEEPER_URL
+ value: "zookeeper:{{ .Values.config.zookeeper.port }}"
+ - name: TB_KAFKA_SERVERS
+ value: "tb-kafka:{{ .Values.config.kafka.ports.outPort }}"
+ - name: JS_EVALUATOR
+ value: {{ .Values.config.tbNode.jsEvaluator | quote }}
+ - name: TRANSPORT_TYPE
+ value: {{ .Values.config.tbNode.transportType | quote }}
+ - name: HTTP_LOG_CONTROLLER_ERROR_STACK_TRACE
+ value: {{ .Values.config.tbNode.httpLogCtrlErrStackTrace | quote }}
+ envFrom:
+ - configMapRef:
+ name: tb-node-db-config
+ - configMapRef:
+ name: tb-node-cache-config
+ volumeMounts:
+ - mountPath: /config
+ name: tb-node-config
+ livenessProbe:
+ httpGet:
+ path: /login
+ port: http
+ initialDelaySeconds: 300
+ timeoutSeconds: 10
+ restartPolicy: Always
diff --git a/apps/thingsboard-iot-platform/templates/deployment-web-ui.yaml b/apps/thingsboard-iot-platform/templates/deployment-web-ui.yaml
new file mode 100644
index 0000000..fa03ade
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/deployment-web-ui.yaml
@@ -0,0 +1,79 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: tb-web-ui
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: tb-web-ui
+ template:
+ metadata:
+ labels:
+ app: tb-web-ui
+ spec:
+ serviceAccountName: thingsboard
+ initContainers:
+ - name: tb-web-ui-dep-check
+ image: {{ .Values.images.tags.depCheck }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ env:
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.name
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.namespace
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
+ - name: COMMAND
+ value: "echo done"
+ - name: DEPENDENCY_POD_JSON
+ value: '[{"labels": {"app": "tb-kafka"}, "requireSameNode": false}]'
+ command:
+ - kubernetes-entrypoint
+ volumeMounts:
+ []
+ containers:
+ - name: server
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ image: {{.Values.images.tags.webUi }}
+ ports:
+ - containerPort: {{ .Values.config.webUi.port }}
+ name: http
+ env:
+ - name: HTTP_BIND_ADDRESS
+ value: {{ .Values.config.webUi.bindAddr | quote }}
+ - name: HTTP_BIND_PORT
+ value: {{ .Values.config.webUi.port | quote }}
+ - name: TB_ENABLE_PROXY
+ value: {{ .Values.config.webUi.proxy.enabled | quote }}
+ - name: LOGGER_LEVEL
+ value: {{ .Values.config.webUi.logger.level | quote}}
+ - name: LOG_FOLDER
+ value: {{ .Values.config.webUi.logger.dir | quote }}
+ - name: LOGGER_FILENAME
+ value: {{ .Values.config.webUi.logger.fileName }}
+ - name: DOCKER_MODE
+ value: "true"
+ livenessProbe:
+ httpGet:
+ path: /index.html
+ port: http
+ initialDelaySeconds: 120
+ timeoutSeconds: 10
+ restartPolicy: Always
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/deployment-zookeeper.yaml b/apps/thingsboard-iot-platform/templates/deployment-zookeeper.yaml
new file mode 100644
index 0000000..8d6e603
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/deployment-zookeeper.yaml
@@ -0,0 +1,74 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: zookeeper
+spec:
+ selector:
+ matchLabels:
+ app: zookeeper
+ template:
+ metadata:
+ labels:
+ app: zookeeper
+ spec:
+ serviceAccountName: thingsboard
+ initContainers:
+ - name: zookeeper-dep-check
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ image: {{ .Values.images.tags.depCheck }}
+ securityContext:
+ allowPrivilegeEscalation: false
+ readOnlyRootFilesystem: false
+ runAsUser: 0
+ env:
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.name
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.namespace
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
+ - name: COMMAND
+ value: "echo done"
+ - name: DEPENDENCY_JOBS
+ value: job-tb-db-setup
+ command:
+ - kubernetes-entrypoint
+ volumeMounts:
+ []
+ containers:
+ - name: server
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ image: {{ .Values.images.tags.zookeeper }}
+ ports:
+ - containerPort: {{ .Values.config.zookeeper.port }}
+ readinessProbe:
+ periodSeconds: 5
+ tcpSocket:
+ port: {{ .Values.config.zookeeper.port }}
+ livenessProbe:
+ initialDelaySeconds: 15
+ periodSeconds: 5
+ tcpSocket:
+ port: {{ .Values.config.zookeeper.port }}
+ env:
+ - name: ZOO_MY_ID
+ value: "1"
+ - name: ZOO_SERVERS
+ value: "server.1=0.0.0.0:2888:3888;0.0.0.0:2181"
+ restartPolicy: Always
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/ingress-tb-services.yaml b/apps/thingsboard-iot-platform/templates/ingress-tb-services.yaml
new file mode 100644
index 0000000..2d885bf
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/ingress-tb-services.yaml
@@ -0,0 +1,63 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: networking.k8s.io/v1beta1
+kind: Ingress
+metadata:
+ name: tb-ingress
+ annotations:
+ nginx.ingress.kubernetes.io/use-regex: "true"
+ nginx.ingress.kubernetes.io/ssl-redirect: "false"
+ nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
+ nginx.ingress.kubernetes.io/default-backend: "default-http-backend:33800"
+spec:
+ rules:
+ - http:
+ paths:
+ - path: /api/v1/.*
+ backend:
+ serviceName: tb-http-transport
+ servicePort: {{ .Values.config.transports.http.port }}
+ - path: /api/.*
+ backend:
+ serviceName: tb-node
+ servicePort: {{ .Values.config.tbNode.ports.http }}
+ - path: /swagger.*
+ backend:
+ serviceName: tb-node
+ servicePort: {{ .Values.config.tbNode.ports.http }}
+ - path: /webjars.*
+ backend:
+ serviceName: tb-node
+ servicePort: {{ .Values.config.tbNode.ports.http }}
+ - path: /v2/.*
+ backend:
+ serviceName: tb-node
+ servicePort: {{ .Values.config.tbNode.ports.http }}
+ - path: /static/rulenode/.*
+ backend:
+ serviceName: tb-node
+ servicePort: {{ .Values.config.tbNode.ports.http }}
+ - path: /oauth2/.*
+ backend:
+ serviceName: tb-node
+ servicePort: {{ .Values.config.tbNode.ports.http }}
+ - path: /login/oauth2/.*
+ backend:
+ serviceName: tb-node
+ servicePort: {{ .Values.config.tbNode.ports.http }}
+ - path: /
+ backend:
+ serviceName: tb-web-ui
+ servicePort: {{ .Values.config.webUi.port }}
+ - path: /.*
+ backend:
+ serviceName: tb-web-ui
+ servicePort: {{ .Values.config.webUi.port }}
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/job-tbdb-setup.yaml b/apps/thingsboard-iot-platform/templates/job-tbdb-setup.yaml
new file mode 100644
index 0000000..71e6a2a
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/job-tbdb-setup.yaml
@@ -0,0 +1,66 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: job-tb-db-setup
+spec:
+ template:
+ metadata:
+ name: job-tb-db-setup
+ spec:
+ restartPolicy: OnFailure
+ serviceAccountName: thingsboard
+ initContainers:
+ - name: job-tb-db-setup-dep-check
+ image: {{ .Values.images.tags.depCheck }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ env:
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.name
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.namespace
+ - name: PATH
+ value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
+ - name: COMMAND
+ value: "echo done"
+ - name: DEPENDENCY_POD_JSON
+ value: '[{"labels": {"app": "postgres"}, "requireSameNode": false}]'
+ command:
+ - kubernetes-entrypoint
+ volumeMounts:
+ []
+ containers:
+ - name: job-tb-db-setup
+ image: {{ .Values.images.tags.tbDbSetup }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ envFrom:
+ - configMapRef:
+ name: tb-node-db-config
+ volumeMounts:
+ - mountPath: /config
+ name: tb-node-config
+ command: ['sh', '-c', 'export INSTALL_TB=true; export LOAD_DEMO=true; start-tb-node.sh;']
+ volumes:
+ - name: tb-node-config
+ configMap:
+ name: tb-node-config
+ items:
+ - key: conf
+ path: thingsboard.conf
+ - key: logback
+ path: logback.xml
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/service-kafka.yaml b/apps/thingsboard-iot-platform/templates/service-kafka.yaml
new file mode 100644
index 0000000..9f3f2d7
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/service-kafka.yaml
@@ -0,0 +1,20 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: tb-kafka
+spec:
+ type: ClusterIP
+ selector:
+ app: tb-kafka
+ ports:
+ - name: tb-kafka-port
+ port: {{ .Values.config.kafka.ports.outPort }}
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/service-postgres.yaml b/apps/thingsboard-iot-platform/templates/service-postgres.yaml
new file mode 100644
index 0000000..fc28b30
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/service-postgres.yaml
@@ -0,0 +1,21 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: tb-database
+spec:
+ type: ClusterIP
+ selector:
+ app: postgres
+ ports:
+ - port: {{ .Values.config.postgres.port }}
+ name: postgres
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/service-redis.yaml b/apps/thingsboard-iot-platform/templates/service-redis.yaml
new file mode 100644
index 0000000..c9ed516
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/service-redis.yaml
@@ -0,0 +1,20 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: tb-redis
+spec:
+ type: ClusterIP
+ selector:
+ app: tb-redis
+ ports:
+ - name: tb-redis-port
+ port: {{ .Values.config.redis.port }}
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/service-tb-coap-transport.yaml b/apps/thingsboard-iot-platform/templates/service-tb-coap-transport.yaml
new file mode 100644
index 0000000..8938f25
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/service-tb-coap-transport.yaml
@@ -0,0 +1,39 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: tb-coap-transport
+spec:
+ type: ClusterIP
+ selector:
+ app: tb-coap-transport
+ ports:
+ - port: {{ .Values.config.transports.coap.port }}
+ name: coap
+ protocol: UDP
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: tb-coap-transport-external
+spec:
+ type: NodePort
+ selector:
+ app: tb-coap-transport
+ ports:
+{{- if .Values.config.transports.coap.nodePort.enabled }}
+ - port: {{ .Values.config.transports.coap.port }}
+ name: coap
+ protocol: UDP
+ nodePort: {{ .Values.config.transports.coap.nodePort.port }}
+{{- end }}
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/service-tb-http-transport.yaml b/apps/thingsboard-iot-platform/templates/service-tb-http-transport.yaml
new file mode 100644
index 0000000..fcc3f6a
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/service-tb-http-transport.yaml
@@ -0,0 +1,38 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: tb-http-transport
+spec:
+ type: ClusterIP
+ selector:
+ app: tb-http-transport
+ ports:
+ - port: {{ .Values.config.transports.http.port }}
+ name: http
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: tb-http-transport-external
+spec:
+ type: NodePort
+ selector:
+ app: tb-http-transport
+ ports:
+ {{- if .Values.config.transports.http.nodePort.enabled }}
+ - port: {{ .Values.config.transports.http.port }}
+ name: http
+ protocol: TCP
+ nodePort: {{ .Values.config.transports.http.nodePort.port }}
+ {{- end }}
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/service-tb-mqtt-transport.yaml b/apps/thingsboard-iot-platform/templates/service-tb-mqtt-transport.yaml
new file mode 100644
index 0000000..37725cc
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/service-tb-mqtt-transport.yaml
@@ -0,0 +1,38 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: tb-mqtt-transport
+spec:
+ type: ClusterIP
+ selector:
+ app: tb-mqtt-transport
+ ports:
+ - port: {{ .Values.config.transports.mqtt.port }}
+ name: mqtt
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: tb-mqtt-transport-external
+spec:
+ type: NodePort
+ selector:
+ app: tb-mqtt-transport
+ ports:
+{{- if .Values.config.transports.mqtt.nodePort.enabled }}
+ - port: {{ .Values.config.transports.mqtt.port }}
+ name: mqtt
+ protocol: TCP
+ nodePort: {{ .Values.config.transports.mqtt.nodePort.port }}
+{{- end }}
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/service-tb-node.yaml b/apps/thingsboard-iot-platform/templates/service-tb-node.yaml
new file mode 100644
index 0000000..ff8bc34
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/service-tb-node.yaml
@@ -0,0 +1,46 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: tb-node
+spec:
+ type: ClusterIP
+ selector:
+ app: tb-node
+ ports:
+ - port: {{ .Values.config.tbNode.ports.http }}
+ name: http
+ - port: {{ .Values.config.tbNode.ports.rpc }}
+ name: rpc
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: tb-node-external
+spec:
+ type: NodePort
+ selector:
+ app: tb-node
+ ports:
+{{- if .Values.config.tbNode.nodePort.http.enabled }}
+ - port: {{ .Values.config.tbNode.ports.http }}
+ name: http
+ protocol: TCP
+ nodePort: {{ .Values.config.tbNode.nodePort.http.port }}
+{{- end }}
+ {{- if .Values.config.tbNode.nodePort.rpc.enabled }}
+ - port: {{ .Values.config.tbNode.ports.rpc }}
+ name: http
+ protocol: TCP
+ nodePort: {{ .Values.config.tbNode.nodePort.rpc.port }}
+ {{- end }}
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/service-web-ui.yaml b/apps/thingsboard-iot-platform/templates/service-web-ui.yaml
new file mode 100644
index 0000000..1837a75
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/service-web-ui.yaml
@@ -0,0 +1,38 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: tb-web-ui
+spec:
+ type: ClusterIP
+ selector:
+ app: tb-web-ui
+ ports:
+ - port: {{ .Values.config.webUi.port }}
+ name: http
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: tb-web-ui-external
+spec:
+ type: NodePort
+ selector:
+ app: tb-web-ui
+ ports:
+ {{- if .Values.config.webUi.nodePort.enabled }}
+ - port: {{ .Values.config.webUi.port }}
+ name: http
+ protocol: TCP
+ nodePort: {{ .Values.config.webUi.nodePort.port }}
+ {{- end }}
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/templates/service-zookeeper.yaml b/apps/thingsboard-iot-platform/templates/service-zookeeper.yaml
new file mode 100644
index 0000000..39ca534
--- /dev/null
+++ b/apps/thingsboard-iot-platform/templates/service-zookeeper.yaml
@@ -0,0 +1,21 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: zookeeper
+spec:
+ type: ClusterIP
+ selector:
+ app: zookeeper
+ ports:
+ - name: zk-port
+ port: {{ .Values.config.zookeeper.port }}
\ No newline at end of file
diff --git a/apps/thingsboard-iot-platform/values.yaml b/apps/thingsboard-iot-platform/values.yaml
new file mode 100644
index 0000000..a09bae1
--- /dev/null
+++ b/apps/thingsboard-iot-platform/values.yaml
@@ -0,0 +1,85 @@
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+images:
+ tags:
+ depCheck: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
+ nginxController: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.10.2
+ nginxControllerBase: docker.io/alpine:3.6
+ nginxBackendService: gcr.io/google_containers/defaultbackend:1.4
+ postgres: docker.io/postgres:12
+ tbDbSetup: docker.io/thingsboard/tb-node:latest
+ zookeeper: docker.io/zookeeper:3.5
+ kafka: docker.io/wurstmeister/kafka:2.12-2.2.1
+ redis: docker.io/redis:4.0
+ jsExecutor: docker.io/thingsboard/tb-js-executor:latest
+ mqttTransport: docker.io/thingsboard/tb-mqtt-transport:latest
+ httpTransport: docker.io/thingsboard/tb-http-transport:latest
+ coapTransport: docker.io/thingsboard/tb-coap-transport:latest
+ webUi: docker.io/thingsboard/tb-web-ui:latest
+ tbNode: docker.io/thingsboard/tb-node:latest
+ pullPolicy: IfNotPresent
+
+config:
+ postgres:
+ port: 5432
+ zookeeper:
+ enabled: true
+ port: 2181
+ kafka:
+ ports:
+ outPort: 9092
+ inPort: 9093
+ redis:
+ port: 6379
+ transports:
+ mqtt:
+ port: 1883
+ nodePort:
+ enabled: true
+ port: 33801
+ bindAddr: 0.0.0.0
+ timeout: 10000
+ http:
+ port: 8080
+ nodePort:
+ enabled: true
+ port: 33802
+ bindAddr: 0.0.0.0
+ timeout: 60000
+ coap:
+ port: 5683
+ nodePort:
+ enabled: true
+ port: 30803
+ bindAddr: 0.0.0.0
+ timeout: 10000
+ webUi:
+ port: 8080
+ nodePort:
+ enabled: true
+ port: 33805
+ bindAddr: 0.0.0.0
+ proxy:
+ enabled: false
+ logger:
+ level: info
+ dir: logs
+ fileName: "tb-web-ui-%DATE%.log"
+ tbNode:
+ ports:
+ http: 8080
+ rpc: 9001
+ nodePort:
+ http:
+ enabled: true
+ port: 33806
+ rpc:
+ enabled: false
+ port: 33807
+ serviceType: monolith
+ jsEvaluator: remote
+ transportType: remote
+ httpLogCtrlErrStackTrace: false
\ No newline at end of file