robocar-setup/ansible/roles/microservices/files/robocar/common-car/deployments.yaml
2024-01-13 18:26:23 +01:00

336 lines
9.5 KiB
YAML

---
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"
- "--steering-left-pwm=$(STEERING_LEFT_PWM)"
- "--steering-right-pwm=$(STEERING_RIGHT_PWM)"
- "--steering-center-pwm=$(STEERING_CENTER_PWM)"
- "--throttle-min-pwm=$(THROTTLE_MIN_PWM)"
- "--throttle-max-pwm=$(THROTTLE_MAX_PWM)"
- "--throttle-center-pwm=$(THROTTLE_ZERO_PWM)"
- '--throttle-feedback-config=/etc/robocar/thresholds.json'
- '--ctrl-throttle-min-pwm=$(CTRL_THROTTLE_MIN_PWM)'
- '--ctrl-throttle-max-pwm=$(CTRL_THROTTLE_MAX_PWM)'
- "-log=info"
volumeMounts:
- mountPath: "/dev/ttyAMA0"
name: serial
- mountPath: "/etc/robocar"
name: robocar
securityContext:
privileged: true
runAsUser: 1234
runAsGroup: 20 # Set 20/dialout group to access to serial device
envFrom:
- configMapRef:
name: robocar-throttle-pwm
- configMapRef:
name: robocar-steering-pwm
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_TOPIC_THROTTLE_FEEDBACK
valueFrom:
configMapKeyRef:
name: robocar
key: MQTT_TOPIC_THROTTLE_FEEDBACK
- name: MQTT_TOPIC_MAX_THROTTLE_CTRL
valueFrom:
configMapKeyRef:
name: robocar
key: MQTT_TOPIC_MAX_THROTTLE_CTRL
- name: CTRL_THROTTLE_MIN_PWM
valueFrom:
configMapKeyRef:
name: robocar-throttle-pwm
key: CTRL_THROTTLE_MIN_PWM
- name: CTRL_THROTTLE_MAX_PWM
valueFrom:
configMapKeyRef:
name: robocar-throttle-pwm
key: CTRL_THROTTLE_MAX_PWM
- name: MQTT_QOS
value: "0"
- name: TZ
value: "Europe/Paris"
volumes:
- name: serial
hostPath:
path: /dev/ttyAMA0
type: CharDevice
- name: robocar
configMap:
name: robocar-objects
---
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_TOPIC_SPEED_ZONE
valueFrom:
configMapKeyRef:
key: MQTT_TOPIC_SPEED_ZONE
name: robocar
- name: MQTT_TOPIC_THROTTLE
valueFrom:
configMapKeyRef:
key: MQTT_TOPIC_THROTTLE
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)"
- "--oci-model-registry=$(OCI_IMAGE_MODEL_REGISTRY)"
- "--oci-model-repository=$(OCI_IMAGE_MODEL_REPOSITORY)"
- "--oci-model-tag=$(OCI_IMAGE_MODEL_TAG)"
- "--edge-verbosity=0"
- "--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_OAK_COLOR
name: robocar
- name: MQTT_TOPIC_STEERING
valueFrom:
configMapKeyRef:
key: MQTT_TOPIC_TF_STEERING
name: robocar
- name: OCI_IMAGE_MODEL_REGISTRY
valueFrom:
configMapKeyRef:
key: OCI_IMAGE_MODEL_REGISTRY
name: robocar-models
- name: OCI_IMAGE_MODEL_REPOSITORY
valueFrom:
configMapKeyRef:
key: OCI_IMAGE_MODEL_REPOSITORY
name: robocar-models
- name: OCI_IMAGE_MODEL_TAG
valueFrom:
configMapKeyRef:
key: OCI_IMAGE_MODEL_TAG
name: robocar-models
#- 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