microservices: deploy k8s stack
This commit is contained in:
parent
2fccdd0283
commit
74e758dd0c
124
ansible/roles/microservices/files/car.yaml
Normal file
124
ansible/roles/microservices/files/car.yaml
Normal file
@ -0,0 +1,124 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: camera
|
||||
spec:
|
||||
containers:
|
||||
- name: camera
|
||||
image: docker.io/cyrilix/robocar-camera
|
||||
args:
|
||||
- "-mqtt-pub-frequency=20"
|
||||
- "-video-device=0"
|
||||
- "-video-width=$(CAMERA_WIDTH)"
|
||||
- "-video-height=$(CAMERA_HEIGHT)"
|
||||
volumeMounts:
|
||||
- name: camera
|
||||
mountPath: "/dev/video0"
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 44 # Set 44/video group to access to video device
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: robocar
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: robocar
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-camera
|
||||
- name: MQTT_TOPIC
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_CAMERA
|
||||
name: robocar
|
||||
- name: CAMERA_HEIGHT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: CAMERA_HEIGHT
|
||||
name: robocar
|
||||
- name: CAMERA_WIDTH
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: CAMERA_WIDTH
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
#network_mode: host
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: pca9685
|
||||
spec:
|
||||
containers:
|
||||
- name: pca9685
|
||||
image: docker.io/cyrilix/robocar-pca9685:v0.2.0
|
||||
args:
|
||||
- "-mqtt-retain=false"
|
||||
- "-throttle-channel=1"
|
||||
- "-steering-channel=0"
|
||||
- "-throttle-zero-pwm=378"
|
||||
- "-throttle-min-pwm=250"
|
||||
- "-throttle-max-pwm=500"
|
||||
- "-steering-left-pwm=490"
|
||||
- "-steering-right-pwm=265"
|
||||
- "-update-pwm-frequency=10"
|
||||
- "-debug=false"
|
||||
volumeMounts:
|
||||
- mountPath: /dev/i2c-1
|
||||
name: i2c
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 998 # Set 998/i2c group to access to i2c device
|
||||
#network_mode: host
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: robocar
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: robocar
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-pca9685
|
||||
- name: MQTT_TOPIC_THROTTLE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_THROTTLE
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_STEERING
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
volumes:
|
||||
- name: i2c
|
||||
hostPath:
|
||||
path: /dev/i2c-1
|
||||
type: CharDevice
|
||||
|
350
ansible/roles/microservices/files/robocar.yaml
Normal file
350
ansible/roles/microservices/files/robocar.yaml
Normal file
@ -0,0 +1,350 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: arduino
|
||||
spec:
|
||||
containers:
|
||||
- name: arduino
|
||||
image: docker.io/cyrilix/robocar-arduino:v0.2.0
|
||||
args:
|
||||
- "-device=/dev/ttyAMA1"
|
||||
- "-baud=115200"
|
||||
- "-mqtt-retain=false"
|
||||
- "-debug=false"
|
||||
volumeMounts:
|
||||
- mountPath: "/dev/ttyAMA1"
|
||||
name: serial
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 20 # Set 20/dialout group to access to serial device
|
||||
# network_mode: host
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: robocar
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: robocar
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-arduino
|
||||
- name: MQTT_TOPIC_THROTTLE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_THROTTLE
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_STEERING
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_DRIVE_MODE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_DRIVE_MODE
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_SWITCH_RECORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_SWITCH_RECORD
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
volumes:
|
||||
- name: serial
|
||||
hostPath:
|
||||
path: /dev/ttyAMA1
|
||||
type: CharDevice
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: led
|
||||
spec:
|
||||
containers:
|
||||
- name: led
|
||||
image: docker.io/cyrilix/robocar-led:v0.2.0
|
||||
args:
|
||||
- "-mqtt-retain=false"
|
||||
volumeMounts:
|
||||
- name: gpiomem
|
||||
mountPath: "/dev/gpiomem"
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 997 # Set 997/gpio group to access to serial device
|
||||
|
||||
#network_mode: host
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: robocar
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: robocar
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-led
|
||||
- name: MQTT_TOPIC_DRIVE_MODE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_DRIVE_MODE
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_RECORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_SWITCH_RECORD
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
volumes:
|
||||
- name: gpiomem
|
||||
hostPath:
|
||||
path: /dev/gpiomem
|
||||
type: CharDevice
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: tflite-steering
|
||||
spec:
|
||||
containers:
|
||||
- name: tflite-steering
|
||||
image: docker.io/cyrilix/robocar-tflite-steering:v0.1.0
|
||||
args:
|
||||
- "--tf-model-path=/model/model.tflite"
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 1234
|
||||
#network_mode: host
|
||||
volumeMounts:
|
||||
- name: models
|
||||
mountPath: /model
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: robocar
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: robocar
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-tflite-steering
|
||||
- name: MQTT_TOPIC_CAMERA
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_CAMERA
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_TF_STEERING
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
volumes:
|
||||
- name: models
|
||||
hostPath:
|
||||
path: /home/pi/models/steering
|
||||
type: DirectoryOrCreate
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: throttle
|
||||
spec:
|
||||
containers:
|
||||
- name: throttle
|
||||
image: docker.io/cyrilix/robocar-throttle:v0.2.0
|
||||
args:
|
||||
- "-mqtt-retain=false"
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 1234
|
||||
#network_mode: host
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: robocar
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: robocar
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-throttle
|
||||
- name: MQTT_TOPIC_THROTTLE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_THROTTLE
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_RC_THROTTLE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_THROTTLE
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_DRIVE_MODE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_DRIVE_MODE
|
||||
name: robocar
|
||||
- name: THROTTLE_MIN
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: THROTTLE_MIN
|
||||
name: robocar
|
||||
- name: THROTTLE_MAX
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: THROTTLE_MAX
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
|
||||
#---
|
||||
#apiVersion: v1
|
||||
#kind: Pod
|
||||
#metadata:
|
||||
# name: road
|
||||
#spec:
|
||||
# containers:
|
||||
# - name: road
|
||||
# image: docker.io/cyrilix/robocar-road:0.0.1
|
||||
# args:
|
||||
# - "-horizon=20"
|
||||
# - "-mqtt-retain=false"
|
||||
# securityContext:
|
||||
# runAsUser: 1234
|
||||
# runAsGroup: 1234
|
||||
# #network_mode: host
|
||||
# env:
|
||||
# - name: MQTT_BROKER
|
||||
# valueFrom:
|
||||
# configMapKeyRef:
|
||||
# key: MQTT_BROKER
|
||||
# name: robocar
|
||||
# - name: MQTT_USERNAME
|
||||
# valueFrom:
|
||||
# configMapKeyRef:
|
||||
# key: MQTT_USERNAME
|
||||
# name: robocar
|
||||
# - name: MQTT_PASSWORD
|
||||
# valueFrom:
|
||||
# configMapKeyRef:
|
||||
# key: MQTT_PASSWORD
|
||||
# name: robocar
|
||||
# - name: MQTT_CLIENT_ID
|
||||
# value: rc-road
|
||||
# - name: MQTT_TOPIC_CAMERA
|
||||
# valueFrom:
|
||||
# configMapKeyRef:
|
||||
# key: MQTT_TOPIC_CAMERA
|
||||
# name: robocar
|
||||
# - name: MQTT_TOPIC_ROAD
|
||||
# valueFrom:
|
||||
# configMapKeyRef:
|
||||
# key: MQTT_TOPIC_ROAD
|
||||
# name: robocar
|
||||
# - name: MQTT_QOS
|
||||
# value: "0"
|
||||
# - name: TZ
|
||||
# value: "Europe/Paris"
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: record
|
||||
spec:
|
||||
containers:
|
||||
- name: record
|
||||
image: docker.io/cyrilix/robocar-record:v0.2.0
|
||||
args:
|
||||
- "-mqtt-retain=true"
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 1234
|
||||
#network_mode: host
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: robocar
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: robocar
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-record
|
||||
- name: MQTT_TOPIC_CAMERA
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_CAMERA
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_STEERING
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_SWITCH_RECORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_SWITCH_RECORD
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_RECORDS
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RECORDS
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
161
ansible/roles/microservices/files/robocar/car/deployments.yaml
Normal file
161
ansible/roles/microservices/files/robocar/car/deployments.yaml
Normal file
@ -0,0 +1,161 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: camera
|
||||
annotations:
|
||||
reloader.stakater.com/auto: "true"
|
||||
spec:
|
||||
revisionHistoryLimit: 0
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
component: camera
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: camera
|
||||
spec:
|
||||
containers:
|
||||
- name: camera
|
||||
image: docker.io/cyrilix/robocar-camera
|
||||
args:
|
||||
- "-mqtt-pub-frequency=$(MQTT_CAMERA_PUB_FREQUENCY)"
|
||||
- "-video-device=0"
|
||||
- "-video-width=$(CAMERA_WIDTH)"
|
||||
- "-video-height=$(CAMERA_HEIGHT)"
|
||||
- "-debug=false"
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 44 # Set 44/video group to access to video device
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- name: camera-device
|
||||
mountPath: /dev/video0
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-camera
|
||||
- name: MQTT_TOPIC
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_CAMERA
|
||||
name: robocar
|
||||
- name: CAMERA_WIDTH
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: CAMERA_WIDTH
|
||||
name: robocar-camera
|
||||
- name: CAMERA_HEIGHT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: CAMERA_HEIGHT
|
||||
name: robocar-camera
|
||||
- name: MQTT_CAMERA_PUB_FREQUENCY
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_CAMERA_PUB_FREQUENCY
|
||||
name: robocar-camera
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
volumes:
|
||||
- name: camera-device
|
||||
hostPath:
|
||||
path: "/dev/video0"
|
||||
type: CharDevice
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: pca9685
|
||||
annotations:
|
||||
reloader.stakater.com/auto: "true"
|
||||
spec:
|
||||
revisionHistoryLimit: 0
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
component: pca9685
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: pca9685
|
||||
spec:
|
||||
containers:
|
||||
- name: pca9685
|
||||
image: cyrilix/robocar-pca9685:v0.3.0
|
||||
args:
|
||||
- "-mqtt-retain=false"
|
||||
- "-throttle-channel=1"
|
||||
- "-steering-channel=0"
|
||||
- "-throttle-zero-pwm=378"
|
||||
- "-throttle-min-pwm=250"
|
||||
- "-throttle-max-pwm=500"
|
||||
- "-steering-left-pwm=490"
|
||||
- "-steering-right-pwm=265"
|
||||
- "-update-pwm-frequency=10"
|
||||
- "-debug=false"
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 998 # Set 998/i2c group to access to i2c device
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- mountPath: /dev/i2c-1
|
||||
name: i2c
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-pca9685
|
||||
- name: MQTT_TOPIC_THROTTLE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_THROTTLE
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_STEERING
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
volumes:
|
||||
- name: i2c
|
||||
hostPath:
|
||||
path: /dev/i2c-1
|
||||
type: CharDevice
|
@ -0,0 +1,16 @@
|
||||
---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
namespace: robocar
|
||||
|
||||
resources:
|
||||
- ../common
|
||||
- deployments.yaml
|
||||
|
||||
images:
|
||||
- name: docker.io/cyrilix/robocar-camera
|
||||
newTag: v0.2.0
|
||||
|
||||
- name: docker.io/cyrilix/robocar-pca9685
|
||||
newTag: v0.3.0
|
@ -0,0 +1,83 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: robocar
|
||||
data:
|
||||
# Broker configuration
|
||||
MQTT_BROKER_HOST: localhost
|
||||
MQTT_BROKER: "tcp://192.168.2.221:1883"
|
||||
|
||||
# Camera
|
||||
MQTT_TOPIC_CAMERA: car/satanas/part/camera
|
||||
|
||||
|
||||
# Radio command
|
||||
MQTT_TOPIC_RC_THROTTLE: car/satanas/part/rc/throttle
|
||||
MQTT_TOPIC_RC_STEERING: car/satanas/part/rc/steering
|
||||
MQTT_TOPIC_RC_SWITCH_RECORD: car/satanas/part/rc/switch_record
|
||||
MQTT_TOPIC_RC_DRIVE_MODE: car/satanas/part/rc/drive_mode
|
||||
|
||||
|
||||
MQTT_TOPIC_TF_STEERING: car/satanas/part/tflite/steering
|
||||
|
||||
# Values to apply
|
||||
MQTT_TOPIC_THROTTLE: car/satanas/part/throttle
|
||||
MQTT_TOPIC_STEERING: car/satanas/part/steering
|
||||
|
||||
# Road detection
|
||||
MQTT_TOPIC_ROAD: car/satanas/part/road
|
||||
|
||||
# Records topic
|
||||
MQTT_TOPIC_RECORDS: car/satanas/part/records
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: robocar-throttle
|
||||
data:
|
||||
############
|
||||
# Throttle #
|
||||
############
|
||||
THROTTLE_MIN: "0.3"
|
||||
THROTTLE_MAX: "0.4"
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: robocar-camera
|
||||
data:
|
||||
##########
|
||||
# Camera #
|
||||
##########
|
||||
2CAMERA_WIDTH: "160"
|
||||
2CAMERA_HEIGHT: "128"
|
||||
|
||||
CAMERA_WIDTH: "160"
|
||||
CAMERA_HEIGHT: "120"
|
||||
|
||||
MQTT_CAMERA_PUB_FREQUENCY: "30"
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: robocar-models
|
||||
data:
|
||||
# model to use for steering
|
||||
MODEL_STEERING3: model_edgetpu.tflite
|
||||
MODEL_STEERING: model_160x120h20_edgetpu.tflite
|
||||
MODEL_STEERING2: model-sim-bigimg_edgetpu.tflite
|
||||
|
||||
MODEL_IMAGE_WIDTH: "160"
|
||||
MODEL_IMAGE_HEIGHT: "120"
|
||||
HORIZON: "20"
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: robocar-road
|
||||
data:
|
||||
HORIZON: "20"
|
@ -0,0 +1,616 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: arduino
|
||||
annotations:
|
||||
reloader.stakater.com/auto: "true"
|
||||
spec:
|
||||
revisionHistoryLimit: 0
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
component: arduino
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: arduino
|
||||
spec:
|
||||
containers:
|
||||
- name: arduino
|
||||
image: docker.io/cyrilix/robocar-arduino
|
||||
args:
|
||||
- "-device=/dev/ttyAMA1"
|
||||
- "-baud=115200"
|
||||
- "-mqtt-retain=false"
|
||||
- "-debug=true"
|
||||
volumeMounts:
|
||||
- mountPath: "/dev/ttyAMA1"
|
||||
name: serial
|
||||
securityContext:
|
||||
privileged: true
|
||||
runAsUser: 1234
|
||||
runAsGroup: 20 # Set 20/dialout group to access to serial device
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-arduino
|
||||
- name: MQTT_TOPIC_THROTTLE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_THROTTLE
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_STEERING
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_DRIVE_MODE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_DRIVE_MODE
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_SWITCH_RECORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_SWITCH_RECORD
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
volumes:
|
||||
- name: serial
|
||||
hostPath:
|
||||
path: /dev/ttyAMA1
|
||||
type: CharDevice
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: led
|
||||
annotations:
|
||||
reloader.stakater.com/auto: "true"
|
||||
spec:
|
||||
revisionHistoryLimit: 0
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
component: led
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: led
|
||||
spec:
|
||||
containers:
|
||||
- name: led
|
||||
image: docker.io/cyrilix/robocar-led
|
||||
args:
|
||||
- "-mqtt-retain=false"
|
||||
- "-log=info"
|
||||
volumeMounts:
|
||||
- name: gpiomem
|
||||
mountPath: "/dev/gpiomem"
|
||||
- name: gpiochip0
|
||||
mountPath: "/dev/gpiochip0"
|
||||
- name: gpiochip1
|
||||
mountPath: "/dev/gpiochip1"
|
||||
securityContext:
|
||||
privileged: true
|
||||
runAsUser: 1234
|
||||
runAsGroup: 997 # Set 997/gpio group to access to serial device
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-led
|
||||
- name: MQTT_TOPIC_DRIVE_MODE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_DRIVE_MODE
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_RECORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_SWITCH_RECORD
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
volumes:
|
||||
- name: gpiomem
|
||||
hostPath:
|
||||
path: /dev/gpiomem
|
||||
type: CharDevice
|
||||
- name: gpiochip0
|
||||
hostPath:
|
||||
path: /dev/gpiochip0
|
||||
type: CharDevice
|
||||
- name: gpiochip1
|
||||
hostPath:
|
||||
path: /dev/gpiochip1
|
||||
type: CharDevice
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: tflite-steering
|
||||
annotations:
|
||||
reloader.stakater.com/auto: "true"
|
||||
spec:
|
||||
revisionHistoryLimit: 0
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
component: tflite-steering
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: tflite-steering
|
||||
spec:
|
||||
containers:
|
||||
- name: tflite-steering
|
||||
image: docker.io/cyrilix/robocar-steering-tflite-edgetpu
|
||||
args:
|
||||
- "--model=/model/$(MODEL_STEERING)"
|
||||
- "--edge-verbosity=0"
|
||||
- "--img-width=$(MODEL_IMAGE_WIDTH)"
|
||||
- "--img-height=$(MODEL_IMAGE_HEIGHT)"
|
||||
- "--horizon=$(HORIZON)"
|
||||
- "--log=info"
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
runAsGroup: 0
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- name: models
|
||||
mountPath: /model
|
||||
- name: bus-usb
|
||||
mountPath: /dev/bus/usb
|
||||
- name: sys
|
||||
mountPath: /sys
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-tflite-steering
|
||||
- name: MQTT_TOPIC_CAMERA
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_CAMERA
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_TF_STEERING
|
||||
name: robocar
|
||||
- name: MODEL_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MODEL_STEERING
|
||||
name: robocar-models
|
||||
- name: MODEL_IMAGE_WIDTH
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MODEL_IMAGE_WIDTH
|
||||
name: robocar-models
|
||||
- name: MODEL_IMAGE_HEIGHT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MODEL_IMAGE_HEIGHT
|
||||
name: robocar-models
|
||||
- name: HORIZON
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: HORIZON
|
||||
name: robocar-models
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: LD_LIBRARY_PATH
|
||||
value: "/usr/local/lib/:/usr/lib"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
volumes:
|
||||
- name: models
|
||||
hostPath:
|
||||
path: /home/pi/models/steering
|
||||
type: DirectoryOrCreate
|
||||
- name: bus-usb
|
||||
hostPath:
|
||||
path: /dev/bus/usb
|
||||
- name: sys
|
||||
hostPath:
|
||||
path: /sys
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: steering
|
||||
annotations:
|
||||
reloader.stakater.com/auto: "true"
|
||||
spec:
|
||||
revisionHistoryLimit: 0
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
component: steering
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: steering
|
||||
spec:
|
||||
containers:
|
||||
- name: steering
|
||||
image: docker.io/cyrilix/robocar-steering
|
||||
args:
|
||||
- "-mqtt-retain=false"
|
||||
- "-debug=false"
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 1234
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-steering
|
||||
- name: MQTT_TOPIC_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_STEERING
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_TF_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_TF_STEERING
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_RC_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_STEERING
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_DRIVE_MODE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_DRIVE_MODE
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: throttle
|
||||
annotations:
|
||||
reloader.stakater.com/auto: "true"
|
||||
spec:
|
||||
revisionHistoryLimit: 0
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
component: throttle
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: throttle
|
||||
spec:
|
||||
containers:
|
||||
- name: throttle
|
||||
image: docker.io/cyrilix/robocar-throttle
|
||||
args:
|
||||
- "-mqtt-retain=false"
|
||||
- "-debug=false"
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 1234
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-throttle
|
||||
- name: MQTT_TOPIC_THROTTLE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_THROTTLE
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_RC_THROTTLE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_THROTTLE
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_DRIVE_MODE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_DRIVE_MODE
|
||||
name: robocar
|
||||
- name: THROTTLE_MIN
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: THROTTLE_MIN
|
||||
name: robocar-throttle
|
||||
- name: THROTTLE_MAX
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: THROTTLE_MAX
|
||||
name: robocar-throttle
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: recorder
|
||||
annotations:
|
||||
reloader.stakater.com/auto: "true"
|
||||
spec:
|
||||
revisionHistoryLimit: 0
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
component: recorder
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: recorder
|
||||
spec:
|
||||
containers:
|
||||
- name: recorder
|
||||
image: docker.io/cyrilix/robocar-recorder-store
|
||||
args:
|
||||
- "-mqtt-retain=true"
|
||||
- "-record-path=/records"
|
||||
- "-log=info"
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-recorder
|
||||
- name: MQTT_TOPIC_RECORDS
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RECORDS
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
volumeMounts:
|
||||
- mountPath: /records
|
||||
name: records
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
fsGroup: 1000
|
||||
fsGroupChangePolicy: OnRootMismatch
|
||||
volumes:
|
||||
- name: records
|
||||
hostPath:
|
||||
path: /home/pi/records
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: record
|
||||
annotations:
|
||||
reloader.stakater.com/auto: "true"
|
||||
spec:
|
||||
revisionHistoryLimit: 0
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
component: record
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: record
|
||||
spec:
|
||||
containers:
|
||||
- name: record
|
||||
image: docker.io/cyrilix/robocar-record
|
||||
args:
|
||||
- "-mqtt-retain=true"
|
||||
- "-debug=false"
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 1234
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-record
|
||||
- name: MQTT_TOPIC_CAMERA
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_CAMERA
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_STEERING
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_SWITCH_RECORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RC_SWITCH_RECORD
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_RECORDS
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_RECORDS
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: road
|
||||
annotations:
|
||||
reloader.stakater.com/auto: "true"
|
||||
spec:
|
||||
revisionHistoryLimit: 0
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
component: road
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: road
|
||||
spec:
|
||||
containers:
|
||||
- name: road
|
||||
image: docker.io/cyrilix/robocar-road
|
||||
args:
|
||||
- "-mqtt-retain=false"
|
||||
- "--log=info"
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 1234
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-road
|
||||
- name: MQTT_TOPIC_CAMERA
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_CAMERA
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_ROAD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_ROAD
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
@ -0,0 +1,12 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Endpoints
|
||||
metadata:
|
||||
name: mqtt
|
||||
labels:
|
||||
app: mqtt
|
||||
subsets:
|
||||
- addresses:
|
||||
- ip: 192.168.2.221
|
||||
ports:
|
||||
- port: 1883
|
@ -0,0 +1,34 @@
|
||||
---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- deployments.yaml
|
||||
- endpoints.yaml
|
||||
- services.yaml
|
||||
- configmap.yaml
|
||||
|
||||
images:
|
||||
- name: docker.io/cyrilix/robocar-arduino
|
||||
newTag: v0.4.0
|
||||
|
||||
- name: docker.io/cyrilix/robocar-led
|
||||
newTag: v0.4.0
|
||||
|
||||
- name: docker.io/cyrilix/robocar-steering-tflite-edgetpu
|
||||
newTag: v0.3.0
|
||||
|
||||
- name: docker.io/cyrilix/robocar-throttle
|
||||
newTag: v0.3.0
|
||||
|
||||
- name: docker.io/cyrilix/robocar-record
|
||||
newTag: v0.4.0
|
||||
|
||||
- name: docker.io/cyrilix/robocar-recorder-store
|
||||
newTag: v0.1.0
|
||||
|
||||
- name: docker.io/cyrilix/robocar-steering
|
||||
newTag: v0.4.0
|
||||
|
||||
- name: docker.io/cyrilix/robocar-road
|
||||
newTag: v0.1.0-4-g70f46bd
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: mqtt-credentials
|
||||
stringData:
|
||||
MQTT_USERNAME: satanas
|
||||
MQTT_PASSWORD: satanas
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mqtt
|
||||
spec:
|
||||
type: ClusterIP
|
||||
# Headless service, dns record will use ip endpoint that share same name
|
||||
clusterIP: None
|
||||
ports:
|
||||
- port: 1883
|
||||
name: mqtt
|
||||
protocol: TCP
|
33
ansible/roles/microservices/files/robocar/kustomization.yaml
Normal file
33
ansible/roles/microservices/files/robocar/kustomization.yaml
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
namespace: robocar
|
||||
|
||||
resources:
|
||||
- common/configmap.yaml
|
||||
- common/
|
||||
|
||||
images:
|
||||
- name: docker.io/cyrilix/robocar-arduino
|
||||
newTag: v0.3.0
|
||||
|
||||
- name: docker.io/cyrilix/robocar-led
|
||||
newTag: v0.3.0
|
||||
|
||||
- name: docker.io/cyrilix/robocar-steering-tflite-edgetpu
|
||||
newTag: v0.1.0
|
||||
|
||||
- name: docker.io/cyrilix/robocar-throttle
|
||||
newTag: v0.3.0
|
||||
|
||||
- name: docker.io/cyrilix/robocar-record
|
||||
newTag: v0.3.0
|
||||
|
||||
configurations:
|
||||
- common/configmap.yaml
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- https://github.com/stakater/Reloader/deployments/kubernetes
|
||||
|
||||
namespace: reloader
|
@ -0,0 +1,12 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: robocar-simulator
|
||||
data:
|
||||
#############
|
||||
# Simulator #
|
||||
#############
|
||||
SIMULATOR_ADDRESS: "192.168.2.237:9091"
|
||||
MQTT_TOPIC_SIMULATOR_STEERING: car/satanas/part/simulator/steering
|
||||
MQTT_TOPIC_SIMULATOR_THROTTLE: car/satanas/part/simulator/throttle
|
@ -0,0 +1,96 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: simulator
|
||||
annotations:
|
||||
reloader.stakater.com/auto: "true"
|
||||
spec:
|
||||
revisionHistoryLimit: 0
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
component: simulator
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: simulator
|
||||
spec:
|
||||
containers:
|
||||
- name: simulator
|
||||
image: docker.io/cyrilix/robocar-simulator
|
||||
args:
|
||||
- "-simulator-address=$(SIMULATOR_ADDRESS)"
|
||||
- "-car-style=donkey"
|
||||
- "-car-name=Satanas"
|
||||
- "-car-color=100,0,255"
|
||||
- "-camera-img-h=$(CAMERA_HEIGHT)"
|
||||
- "-camera-img-w=$(CAMERA_WIDTH)"
|
||||
- "-debug=false"
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 1234
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: mqtt-credentials
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-simulator
|
||||
- name: MQTT_TOPIC_CAMERA
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_CAMERA
|
||||
name: robocar
|
||||
- name: CAMERA_WIDTH
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: CAMERA_WIDTH
|
||||
name: robocar-camera
|
||||
- name: CAMERA_HEIGHT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: CAMERA_HEIGHT
|
||||
name: robocar-camera
|
||||
- name: MQTT_TOPIC_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_SIMULATOR_STEERING
|
||||
name: robocar-simulator
|
||||
- name: MQTT_TOPIC_THROTTLE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_SIMULATOR_THROTTLE
|
||||
name: robocar-simulator
|
||||
- name: MQTT_TOPIC_STEERING_CTRL
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_STEERING
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_THROTTLE_CTRL
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_THROTTLE
|
||||
name: robocar
|
||||
- name: SIMULATOR_ADDRESS
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: SIMULATOR_ADDRESS
|
||||
name: robocar-simulator
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
@ -0,0 +1,14 @@
|
||||
---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
namespace: robocar
|
||||
|
||||
resources:
|
||||
- ../common
|
||||
- deployments.yaml
|
||||
- configmap.yaml
|
||||
|
||||
images:
|
||||
- name: docker.io/cyrilix/robocar-simulator
|
||||
newTag: v0.3.0
|
192
ansible/roles/microservices/files/simulator-compose.yaml
Normal file
192
ansible/roles/microservices/files/simulator-compose.yaml
Normal file
@ -0,0 +1,192 @@
|
||||
version: '3.7'
|
||||
services:
|
||||
|
||||
arduino:
|
||||
image: docker.io/cyrilix/robocar-arduino:v0.3.0
|
||||
command:
|
||||
- "-device=/dev/ttyAMA1"
|
||||
- "-baud=115200"
|
||||
- "-mqtt-retain=false"
|
||||
- "-debug=false"
|
||||
devices:
|
||||
- "/dev/ttyAMA1:/dev/ttyAMA1:rw"
|
||||
user: "1234:20" # Set 20/dialout group to access to serial device
|
||||
network_mode: host
|
||||
environment:
|
||||
MQTT_BROKER: "${MQTT_BROKER}"
|
||||
MQTT_USERNAME: "${MQTT_USERNAME}"
|
||||
MQTT_PASSWORD: "${MQTT_PASSWORD}"
|
||||
MQTT_CLIENT_ID: rc-arduino
|
||||
MQTT_TOPIC_THROTTLE: "${MQTT_TOPIC_RC_THROTTLE}"
|
||||
MQTT_TOPIC_STEERING: "${MQTT_TOPIC_RC_STEERING}"
|
||||
MQTT_TOPIC_DRIVE_MODE: "${MQTT_TOPIC_RC_DRIVE_MODE}"
|
||||
MQTT_TOPIC_SWITCH_RECORD: "${MQTT_TOPIC_RC_SWITCH_RECORD}"
|
||||
MQTT_QOS: "0"
|
||||
TZ: "Europe/Paris"
|
||||
|
||||
led:
|
||||
image: docker.io/cyrilix/robocar-led:v0.3.0
|
||||
command:
|
||||
- "-mqtt-retain=false"
|
||||
- "-debug=false"
|
||||
devices:
|
||||
- "/dev/gpiomem:/dev/gpiomem:rw"
|
||||
- "/dev/gpiochip0:/dev/gpiochip0:rw"
|
||||
- "/dev/gpiochip1:/dev/gpiochip1:rw"
|
||||
user: "1234:997" # Set 997/gpio group to access to serial device
|
||||
network_mode: host
|
||||
privileged: true
|
||||
environment:
|
||||
MQTT_BROKER: "${MQTT_BROKER}"
|
||||
MQTT_USERNAME: "${MQTT_USERNAME}"
|
||||
MQTT_PASSWORD: "${MQTT_PASSWORD}"
|
||||
MQTT_CLIENT_ID: rc-led
|
||||
MQTT_TOPIC_DRIVE_MODE: "${MQTT_TOPIC_RC_DRIVE_MODE}"
|
||||
MQTT_TOPIC_RECORD: "${MQTT_TOPIC_RC_SWITCH_RECORD}"
|
||||
MQTT_QOS: "0"
|
||||
TZ: "Europe/Paris"
|
||||
|
||||
|
||||
tflite-steering:
|
||||
image: docker.io/cyrilix/robocar-steering-tflite-edgetpu:v0.1.0
|
||||
command:
|
||||
- "--model=/model/model_edgetpu.tflite"
|
||||
- "--edge-verbosity=0"
|
||||
- "-debug=false"
|
||||
user: "0:0"
|
||||
network_mode: host
|
||||
privileged: true
|
||||
volumes:
|
||||
- /dev/bus/usb:/dev/bus/usb
|
||||
- /sys:/sys
|
||||
- /home/pi/models/steering:/model
|
||||
environment:
|
||||
MQTT_BROKER: "${MQTT_BROKER}"
|
||||
MQTT_USERNAME: "${MQTT_USERNAME}"
|
||||
MQTT_PASSWORD: "${MQTT_PASSWORD}"
|
||||
MQTT_CLIENT_ID: rc-tflite-steering
|
||||
MQTT_TOPIC_CAMERA: "${MQTT_TOPIC_CAMERA}"
|
||||
MQTT_TOPIC_STEERING: "${MQTT_TOPIC_TF_STEERING}"
|
||||
MQTT_QOS: "0"
|
||||
LD_LIBRARY_PATH: "/usr/local/lib/:/usr/lib"
|
||||
TZ: "Europe/Paris"
|
||||
|
||||
steering:
|
||||
image: docker.io/cyrilix/robocar-steering:v0.3.0
|
||||
command:
|
||||
- "-mqtt-retain=false"
|
||||
- "-debug=false"
|
||||
user: "1234:1234"
|
||||
network_mode: host
|
||||
environment:
|
||||
MQTT_BROKER: "${MQTT_BROKER}"
|
||||
MQTT_USERNAME: "${MQTT_USERNAME}"
|
||||
MQTT_PASSWORD: "${MQTT_PASSWORD}"
|
||||
MQTT_CLIENT_ID: rc-steering
|
||||
MQTT_TOPIC_STEERING: "${MQTT_TOPIC_STEERING}"
|
||||
MQTT_TOPIC_TF_STEERING: "${MQTT_TOPIC_TF_STEERING}"
|
||||
MQTT_TOPIC_RC_STEERING: "${MQTT_TOPIC_RC_STEERING}"
|
||||
MQTT_TOPIC_DRIVE_MODE: "${MQTT_TOPIC_RC_DRIVE_MODE}"
|
||||
MQTT_QOS: "0"
|
||||
TZ: "Europe/Paris"
|
||||
|
||||
throttle:
|
||||
image: docker.io/cyrilix/robocar-throttle:v0.3.0
|
||||
command:
|
||||
- "-mqtt-retain=false"
|
||||
- "-debug=false"
|
||||
user: "1234:1234"
|
||||
network_mode: host
|
||||
environment:
|
||||
MQTT_BROKER: "${MQTT_BROKER}"
|
||||
MQTT_USERNAME: "${MQTT_USERNAME}"
|
||||
MQTT_PASSWORD: "${MQTT_PASSWORD}"
|
||||
MQTT_CLIENT_ID: rc-throttle
|
||||
MQTT_TOPIC_THROTTLE: "${MQTT_TOPIC_THROTTLE}"
|
||||
MQTT_TOPIC_RC_THROTTLE: "${MQTT_TOPIC_RC_THROTTLE}"
|
||||
MQTT_TOPIC_DRIVE_MODE: "${MQTT_TOPIC_RC_DRIVE_MODE}"
|
||||
THROTTLE_MIN: "${THROTTLE_MIN}"
|
||||
THROTTLE_MAX: "${THROTTLE_MAX}"
|
||||
MQTT_QOS: "0"
|
||||
TZ: "Europe/Paris"
|
||||
|
||||
road:
|
||||
image: docker.io/cyrilix/robocar-road:v0.1.0
|
||||
command:
|
||||
- "-horizon=20"
|
||||
- "-mqtt-retain=false"
|
||||
- "-debug=false"
|
||||
user: "1234:1234"
|
||||
network_mode: host
|
||||
environment:
|
||||
MQTT_BROKER: "${MQTT_BROKER}"
|
||||
MQTT_USERNAME: "${MQTT_USERNAME}"
|
||||
MQTT_PASSWORD: "${MQTT_PASSWORD}"
|
||||
MQTT_CLIENT_ID: rc-road
|
||||
MQTT_TOPIC_CAMERA: "${MQTT_TOPIC_CAMERA}"
|
||||
MQTT_TOPIC_ROAD: car/satanas/part/road
|
||||
MQTT_QOS: "0"
|
||||
TZ: "Europe/Paris"
|
||||
|
||||
# objects:
|
||||
# image: cyrilix/robocar-objects-detection
|
||||
# command:
|
||||
# - "-mqtt-retain=false"
|
||||
# - "-tf-model-path=/model/frozen_inference_graph.pb"
|
||||
# - "-tf-model-config-path=/model/ssd_mobilenet_v2_coco_2018_03_29.pbtxt"
|
||||
# user: "1234:1234"
|
||||
# volumes:
|
||||
# - /home/pi/models/objects-detection:/model
|
||||
# network_mode: host
|
||||
# environment:
|
||||
# MQTT_BROKER: "${MQTT_BROKER}"
|
||||
# MQTT_USERNAME: "${MQTT_USERNAME}"
|
||||
# MQTT_PASSWORD: "${MQTT_PASSWORD}"
|
||||
# MQTT_CLIENT_ID: rc-objects-detection
|
||||
# MQTT_TOPIC_CAMERA: "${MQTT_TOPIC_CAMERA}"
|
||||
# MQTT_TOPIC_OBJECTS: car/satanas/part/objects
|
||||
# MQTT_QOS: "0"
|
||||
# TZ: "Europe/Paris"
|
||||
|
||||
record:
|
||||
image: docker.io/cyrilix/robocar-record:v0.3.0
|
||||
command:
|
||||
- "-mqtt-retain=true"
|
||||
- "-debug=false"
|
||||
user: "1234:1234"
|
||||
network_mode: host
|
||||
environment:
|
||||
MQTT_BROKER: "${MQTT_BROKER}"
|
||||
MQTT_USERNAME: "${MQTT_USERNAME}"
|
||||
MQTT_PASSWORD: "${MQTT_PASSWORD}"
|
||||
MQTT_CLIENT_ID: rc-record
|
||||
MQTT_TOPIC_CAMERA: "${MQTT_TOPIC_CAMERA}"
|
||||
MQTT_TOPIC_STEERING: "${MQTT_TOPIC_RC_STEERING}"
|
||||
MQTT_TOPIC_SWITCH_RECORD: "${MQTT_TOPIC_RC_SWITCH_RECORD}"
|
||||
MQTT_TOPIC_RECORDS: "${MQTT_TOPIC_RECORDS}"
|
||||
MQTT_QOS: "0"
|
||||
TZ: "Europe/Paris"
|
||||
|
||||
simulator:
|
||||
image: docker.io/cyrilix/robocar-simulator:v0.3.0
|
||||
command:
|
||||
- "-simulator-address=${SIMULATOR_ADDRESS}"
|
||||
- "-car-style=donkey"
|
||||
- "-car-name=Satanas"
|
||||
- "-car-color=100,0,255"
|
||||
- "-camera-img-h=${CAMERA_HEIGHT}"
|
||||
- "-camera-img-w=${CAMERA_WIDTH}"
|
||||
- "-debug=false"
|
||||
user: "1234:1234"
|
||||
network_mode: host
|
||||
environment:
|
||||
MQTT_BROKER: "${MQTT_BROKER}"
|
||||
MQTT_USERNAME: "${MQTT_USERNAME}"
|
||||
MQTT_PASSWORD: "${MQTT_PASSWORD}"
|
||||
MQTT_CLIENT_ID: rc-simulator
|
||||
MQTT_TOPIC_CAMERA: "${MQTT_TOPIC_CAMERA}"
|
||||
MQTT_TOPIC_STEERING: "${MQTT_TOPIC_SIMULATOR_STEERING}"
|
||||
MQTT_TOPIC_THROTTLE: "${MQTT_TOPIC_SIMULATOR_THROTTLE}"
|
||||
MQTT_TOPIC_STEERING_CTRL: "${MQTT_TOPIC_STEERING}"
|
||||
MQTT_TOPIC_THROTTLE_CTRL: "${MQTT_TOPIC_THROTTLE}"
|
||||
TZ: "Europe/Paris"
|
77
ansible/roles/microservices/files/simulator.yaml
Normal file
77
ansible/roles/microservices/files/simulator.yaml
Normal file
@ -0,0 +1,77 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: simulator
|
||||
spec:
|
||||
containers:
|
||||
- name: simulator
|
||||
image: docker.io/cyrilix/robocar-simulator
|
||||
args:
|
||||
- "-simulator-address=${SIMULATOR_ADDRESS}"
|
||||
- "-debug=false"
|
||||
- "-car-style=donkey"
|
||||
- "-car-name=Satanas"
|
||||
- "-car-color=100,0,255"
|
||||
- "-camera-img-h=$(CAMERA_HEIGHT)"
|
||||
- "-camera-img-w=$(CAMERA_WIDTH)"
|
||||
securityContext:
|
||||
runAsUser: 1234
|
||||
runAsGroup: 1234
|
||||
env:
|
||||
- name: MQTT_BROKER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_BROKER
|
||||
name: robocar
|
||||
- name: MQTT_USERNAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_USERNAME
|
||||
name: robocar
|
||||
- name: MQTT_PASSWORD
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_PASSWORD
|
||||
name: robocar
|
||||
- name: MQTT_CLIENT_ID
|
||||
value: rc-simulator
|
||||
- name: MQTT_TOPIC_CAMERA
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_CAMERA
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_STEERING
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_SIMULATOR_STEERING
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_THROTTLE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_SIMULATOR_THROTTLE
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_STEERING_CTRL
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_STEERING
|
||||
name: robocar
|
||||
- name: MQTT_TOPIC_THROTTLE_CTRL
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: MQTT_TOPIC_THROTTLE
|
||||
name: robocar
|
||||
- name: CAMERA_HEIGHT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: CAMERA_HEIGHT
|
||||
name: robocar
|
||||
- name: CAMERA_WIDTH
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
key: CAMERA_WIDTH
|
||||
name: robocar
|
||||
- name: MQTT_QOS
|
||||
value: "0"
|
||||
- name: TZ
|
||||
value: "Europe/Paris"
|
@ -5,7 +5,13 @@
|
||||
src: env
|
||||
dest: /home/pi/.env
|
||||
|
||||
- name: Copy docker-compose file
|
||||
- name: Copy stack file
|
||||
copy:
|
||||
src: docker-compose.yaml
|
||||
src: "{{ item }}"
|
||||
dest: /home/pi/
|
||||
with_items:
|
||||
- docker-compose.yaml
|
||||
- simulator-compose.yaml
|
||||
- car.yaml
|
||||
- robocar.yaml
|
||||
- simulator.yaml
|
||||
|
Loading…
Reference in New Issue
Block a user