Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
9afa68a111
|
|||
|
1119bb529f
|
|||
|
26286ce194
|
|||
|
7913a0044d
|
|||
|
871d0dc890
|
|||
|
7409995780
|
|||
|
9d4f3ac560
|
@@ -6,7 +6,7 @@ matrix:
|
|||||||
- rules
|
- rules
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
build:
|
build-${APP}:
|
||||||
image: plugins/kaniko
|
image: plugins/kaniko
|
||||||
settings:
|
settings:
|
||||||
registry:
|
registry:
|
||||||
@@ -19,7 +19,7 @@ steps:
|
|||||||
auto_tag: true
|
auto_tag: true
|
||||||
dockerfile: apps/${APP}/Dockerfile
|
dockerfile: apps/${APP}/Dockerfile
|
||||||
when:
|
when:
|
||||||
event: [push, tag]
|
event: [tag]
|
||||||
ref:
|
ref:
|
||||||
exclude:
|
exclude:
|
||||||
- refs/tags/*-configchange
|
- refs/tags/*-configchange
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ matrix:
|
|||||||
- rules
|
- rules
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
deploy:
|
deploy-${APP}:
|
||||||
image: quay.io/wollud1969/k8s-admin-helper:0.3.4
|
image: quay.io/wollud1969/k8s-admin-helper:0.3.4
|
||||||
environment:
|
environment:
|
||||||
KUBE_CONFIG_CONTENT:
|
KUBE_CONFIG_CONTENT:
|
||||||
@@ -16,7 +16,8 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig
|
- printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig
|
||||||
- export KUBECONFIG=/tmp/kubeconfig
|
- export KUBECONFIG=/tmp/kubeconfig
|
||||||
- echo "Deploying application ${APP} (${IMAGE}) to namespace ${NAMESPACE}"
|
- echo "Deploying application ${APP} ($IMAGE) to namespace $NAMESPACE"
|
||||||
|
- cat deployment/${APP}-deployment.yaml | sed "s,%IMAGE%,$IMAGE,g" | kubectl apply -n $NAMESPACE -f -
|
||||||
when:
|
when:
|
||||||
event: [tag]
|
event: [tag]
|
||||||
ref:
|
ref:
|
||||||
@@ -25,4 +26,4 @@ steps:
|
|||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- build
|
- build
|
||||||
- pre_deploy
|
- predeploy
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ steps:
|
|||||||
--from-file=scenes=config/scenes.yaml
|
--from-file=scenes=config/scenes.yaml
|
||||||
--namespace=$NAMESPACE
|
--namespace=$NAMESPACE
|
||||||
--dry-run=client -o yaml | kubectl apply -f -
|
--dry-run=client -o yaml | kubectl apply -f -
|
||||||
|
- kubectl apply -f deployment/configmap.yaml -n $NAMESPACE
|
||||||
when:
|
when:
|
||||||
event: [tag]
|
event: [tag]
|
||||||
|
|
||||||
|
|||||||
73
deployment/abstraction-deployment.yaml
Normal file
73
deployment/abstraction-deployment.yaml
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: abstraction
|
||||||
|
labels:
|
||||||
|
app: abstraction
|
||||||
|
component: home-automation
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: abstraction
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
reloader.stakater.com/auto: "true"
|
||||||
|
configmap.reloader.stakater.com/reload: "home-automation-environment,home-automation-config"
|
||||||
|
labels:
|
||||||
|
app: abstraction
|
||||||
|
component: home-automation
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: abstraction
|
||||||
|
image: %IMAGE%
|
||||||
|
env:
|
||||||
|
- name: MQTT_BROKER
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_MQTT_BROKER
|
||||||
|
- name: MQTT_PORT
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_MQTT_PORT
|
||||||
|
- name: REDIS_HOST
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_REDIS_HOST
|
||||||
|
- name: REDIS_PORT
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_REDIS_PORT
|
||||||
|
- name: REDIS_DB
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_REDIS_DB
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /app/config
|
||||||
|
readOnly: true
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- "ps aux | grep -v grep | grep python"
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 512Mi
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
volumes:
|
||||||
|
- name: config-volume
|
||||||
|
configMap:
|
||||||
|
name: home-automation-config
|
||||||
102
deployment/api-deployment.yaml
Normal file
102
deployment/api-deployment.yaml
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: api
|
||||||
|
namespace: homea2
|
||||||
|
labels:
|
||||||
|
app: api
|
||||||
|
component: home-automation
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: api
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
reloader.stakater.com/auto: "true"
|
||||||
|
configmap.reloader.stakater.com/reload: "home-automation-environment,home-automation-config"
|
||||||
|
labels:
|
||||||
|
app: api
|
||||||
|
component: home-automation
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: api
|
||||||
|
image: %IMAGE%
|
||||||
|
ports:
|
||||||
|
- containerPort: 8001
|
||||||
|
name: http
|
||||||
|
env:
|
||||||
|
- name: MQTT_BROKER
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_MQTT_BROKER
|
||||||
|
- name: MQTT_PORT
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_MQTT_PORT
|
||||||
|
- name: REDIS_HOST
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_REDIS_HOST
|
||||||
|
- name: REDIS_PORT
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_REDIS_PORT
|
||||||
|
- name: REDIS_DB
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_REDIS_DB
|
||||||
|
- name: REDIS_CHANNEL
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: API_REDIS_CHANNEL
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /app/config
|
||||||
|
readOnly: true
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: 8001
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /health
|
||||||
|
port: 8001
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 1000m
|
||||||
|
memory: 1Gi
|
||||||
|
requests:
|
||||||
|
cpu: 200m
|
||||||
|
memory: 256Mi
|
||||||
|
volumes:
|
||||||
|
- name: config-volume
|
||||||
|
configMap:
|
||||||
|
name: home-automation-config
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: api
|
||||||
|
labels:
|
||||||
|
app: api
|
||||||
|
component: home-automation
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: api
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 8001
|
||||||
|
name: http
|
||||||
|
type: ClusterIP
|
||||||
23
deployment/configmap.yaml
Normal file
23
deployment/configmap.yaml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: home-automation-environment
|
||||||
|
namespace: homea2
|
||||||
|
data:
|
||||||
|
# Default environment variables
|
||||||
|
SHARED_MQTT_BROKER: "172.23.1.102"
|
||||||
|
SHARED_MQTT_PORT: "1883"
|
||||||
|
SHARED_REDIS_HOST: "172.23.1.116"
|
||||||
|
SHARED_REDIS_PORT: "6379"
|
||||||
|
SHARED_REDIS_DB: "8"
|
||||||
|
|
||||||
|
# UI specific environment variables
|
||||||
|
UI_UI_PORT: "8002"
|
||||||
|
UI_API_BASE: "http://api:8001"
|
||||||
|
UI_BASE_PATH: "/"
|
||||||
|
|
||||||
|
# API specific environment variables
|
||||||
|
API_REDIS_CHANNEL: "ui:updates"
|
||||||
|
|
||||||
|
# Rules specific environment variables
|
||||||
|
RULES_RULES_CONFIG: "/app/config/rules.yaml"
|
||||||
78
deployment/rules-deployment.yaml
Normal file
78
deployment/rules-deployment.yaml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: rules
|
||||||
|
labels:
|
||||||
|
app: rules
|
||||||
|
component: home-automation
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: rules
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
reloader.stakater.com/auto: "true"
|
||||||
|
configmap.reloader.stakater.com/reload: "home-automation-environment,home-automation-config"
|
||||||
|
labels:
|
||||||
|
app: rules
|
||||||
|
component: home-automation
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: rules
|
||||||
|
image: %IMAGE%
|
||||||
|
env:
|
||||||
|
- name: MQTT_BROKER
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_MQTT_BROKER
|
||||||
|
- name: MQTT_PORT
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_MQTT_PORT
|
||||||
|
- name: REDIS_HOST
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_REDIS_HOST
|
||||||
|
- name: REDIS_PORT
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_REDIS_PORT
|
||||||
|
- name: REDIS_DB
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: SHARED_REDIS_DB
|
||||||
|
- name: RULES_CONFIG
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: RULES_RULES_CONFIG
|
||||||
|
volumeMounts:
|
||||||
|
- name: config-volume
|
||||||
|
mountPath: /app/config
|
||||||
|
readOnly: true
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- "ps aux | grep -v grep | grep python"
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 512Mi
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
volumes:
|
||||||
|
- name: config-volume
|
||||||
|
configMap:
|
||||||
|
name: home-automation-config
|
||||||
79
deployment/ui-deployment.yaml
Normal file
79
deployment/ui-deployment.yaml
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: ui
|
||||||
|
namespace: homea2
|
||||||
|
labels:
|
||||||
|
app: ui
|
||||||
|
component: home-automation
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: ui
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
annotations:
|
||||||
|
reloader.stakater.com/auto: "true"
|
||||||
|
configmap.reloader.stakater.com/reload: "home-automation-environment"
|
||||||
|
labels:
|
||||||
|
app: ui
|
||||||
|
component: home-automation
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: ui
|
||||||
|
image: %IMAGE%
|
||||||
|
ports:
|
||||||
|
- containerPort: 8002
|
||||||
|
name: http
|
||||||
|
env:
|
||||||
|
- name: UI_PORT
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: UI_UI_PORT
|
||||||
|
- name: API_BASE
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: UI_API_BASE
|
||||||
|
- name: BASE_PATH
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: home-automation-environment
|
||||||
|
key: UI_BASE_PATH
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 8002
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
periodSeconds: 10
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 8002
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 512Mi
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: ui
|
||||||
|
labels:
|
||||||
|
app: ui
|
||||||
|
component: home-automation
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: ui
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 8002
|
||||||
|
name: http
|
||||||
|
type: ClusterIP
|
||||||
Reference in New Issue
Block a user