3 Commits
0.0.1 ... 0.0.5

Author SHA1 Message Date
046430d1d1 reload configmap
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-11-06 17:53:01 +01:00
000510202e separate configmap and deployment, add reloader
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-11-06 17:47:00 +01:00
6fbc82d89e use dedicated user
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-11-06 17:38:50 +01:00
4 changed files with 56 additions and 46 deletions

View File

@ -6,7 +6,11 @@ COPY src/requirements.txt .
COPY src/main.py .
COPY src/message_processor.py .
RUN pip install --no-cache-dir -r requirements.txt
RUN \
addgroup -S appgroup && \
adduser -S appuser -G appgroup && \
apk add --no-cache bash && \
pip install --no-cache-dir -r requirements.txt
ENV MQTT_BROKER=""
@ -21,5 +25,7 @@ ENV DEFAULT_HIGH_TEMPERATURE=""
ENV MAINTENANCE_TEMPERATURE=""
ENV BOXES=""
USER appuser
CMD ["python", "main.py"]

45
deployment/configmap.yml Normal file
View File

@ -0,0 +1,45 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: heating-controller-config
namespace: homea
data:
MQTT_BROKER: "emqx01-anonymous-cluster-internal.broker.svc.cluster.local"
MQTT_PORT: "1883"
MQTT_CLIENT_PREFIX: "HeatingController"
MQTT_BOX_TOPIC_PREFIXES: |
{
"high_temp": "heating/config/high_temp/",
"cmd": "heating/command/"
}
MQTT_CENTRAL_TOPICS: |
{
"general_off": "heating/system/general_off",
"maintenance_mode": "heating/system/maintenance_mode",
"status": "heating/system/status"
}
MQTT_STATUS_TOPIC: "heating/status"
OFF_TEMPERATURE: "5.0"
LOW_TEMPERATURE: "15.0"
DEFAULT_HIGH_TEMPERATURE: "21.0"
MAINTENANCE_TEMPERATURE: "30.0"
BOXES: |
{
"box1": {
"label": "living_room",
"windows": [
{ "topic": "window/living_room/garden_side", "label": "garden_side" }
],
"output_topic": "output/living_room"
},
"box2": {
"label": "kitchen",
"windows": [
{ "topic": "window/kitchen/street_side", "label": "street_side" },
{ "topic": "window/kitchen/garden_side", "label": "garden_side" },
{ "topic": "window/kitchen/garden_door", "label": "garden_door" }
],
"output_topic": "output/kitchen"
}
}

View File

@ -1,52 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: heating-controller-config
data:
MQTT_BROKER: "emqx01-anonymous-cluster-internal.broker.svc.cluster.local"
MQTT_PORT: "1883"
MQTT_CLIENT_PREFIX: "HeatingController"
MQTT_BOX_TOPIC_PREFIXES: |
{
"high_temp": "heating/config/high_temp/",
"cmd": "heating/command/"
}
MQTT_CENTRAL_TOPICS: |
{
"general_off": "heating/system/general_off",
"maintenance_mode": "heating/system/maintenance_mode",
"status": "heating/system/status"
}
MQTT_STATUS_TOPIC: "heating/status"
OFF_TEMPERATURE: "5.0"
LOW_TEMPERATURE: "15.0"
DEFAULT_HIGH_TEMPERATURE: "21.0"
MAINTENANCE_TEMPERATURE: "30.0"
BOXES: |
{
"box1": {
"label": "living_room",
"windows": [
{ "topic": "window/living_room/street_side", "label": "street_side" },
{ "topic": "window/living_room/garden_side", "label": "garden_side" }
],
"output_topic": "output/living_room"
},
"box2": {
"label": "kitchen",
"windows": [
{ "topic": "window/kitchen/street_side", "label": "street_side" },
{ "topic": "window/kitchen/garden_side", "label": "garden_side" },
{ "topic": "window/kitchen/garden_door", "label": "garden_door" }
],
"output_topic": "output/kitchen"
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: heating-controller
annotations:
configmap.reloader.stakater.com/reload: "heating-controller-config"
spec:
replicas: 1
selector:

2
deployment/deploy.sh Normal file → Executable file
View File

@ -16,6 +16,8 @@ kubectl create namespace $NAMESPACE \
-o yaml | \
kubectl -f - apply
kubectl apply -f $DEPLOYMENT_DIR/configmap.yml -n $NAMESPACE
cat $DEPLOYMENT_DIR/deploy-yml.tmpl | \
sed -e 's,%IMAGE%,'$IMAGE_NAME':'$IMAGE_TAG','g | \
kubectl apply -f - -n $NAMESPACE