microservices: deploy k8s stack
This commit is contained in:
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
|
Reference in New Issue
Block a user