This commit is contained in:
Sense T 2023-09-06 04:41:05 +00:00
parent d5933d6be0
commit 54b5e8d6f9
10 changed files with 211 additions and 0 deletions

View File

@ -0,0 +1,37 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sgcc-electricity
spec:
selector:
matchLabels:
app: sgcc-electricity
template:
metadata:
labels:
app: sgcc-electricity
spec:
volumes:
- name: envfile
configMap:
name: sgcc-electricity
items:
- key: .env
path: .env
containers:
- name: sgcc-electricity
image: dockerproxy.com/dscao/sgcc_electricity
imagePullPolicy: Always
resources:
limits:
memory: "16Mi"
cpu: "100m"
env:
- name: HASS_URL
value: http://home-assistant:8124
envFrom:
- secretRef:
name: sgcc-electricity
command:
- ""

View File

@ -0,0 +1,13 @@
# yaml-language-server: $schema=https://json.schemastore.org/kustomization.json
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: hass
resources:
- deployment.yaml
secretGenerator:
- name: sgcc-electricity
files:
- config/HASS_TOKEN
- config/PASSWORD
- config/PHONE_NUMBER

View File

@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: home-assistant
spec:
selector:
matchLabels:
app: home-assistant
template:
metadata:
labels:
app: home-assistant
spec:
volumes:
- name: data
hostPath:
path: /data/home-assistant/data
- name: media
hostPath:
path: /data/home-assistant/media
containers:
- name: home-assistant
image: home-assistant
env:
- name: TZ
value: Asia/Shanghai
resources:
limits:
memory: "2Gi"
cpu: "2"
requests:
cpu: "500m"
memory: "128Mi"
ports:
- containerPort: 8123
name: web
volumeMounts:
- mountPath: /config
name: data
- mountPath: /media
name: media

View File

@ -0,0 +1,18 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: home-assistant
labels:
name: home-assistant
spec:
rules:
- host: ha.sense-t.eu.org
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: home-assistant
port:
number: 8124

View File

@ -0,0 +1,8 @@
# yaml-language-server: $schema=https://json.schemastore.org/kustomization.json
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- ingress.yaml
- service.yaml

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: home-assistant
spec:
type: LoadBalancer
selector:
app: home-assistant
ports:
- port: 8124
targetPort: web
ipFamilyPolicy: PreferDualStack
ipFamilies:
- IPv4
- IPv6

21
hass/kustomization.yaml Normal file
View File

@ -0,0 +1,21 @@
# yaml-language-server: $schema=https://json.schemastore.org/kustomization.json
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: hass
resources:
- home-assistant
- mqtt
configMapGenerator:
- name: mosquitto
files:
- config/mosquitto.conf
images:
- name: home-assistant
newName: m.daocloud.io/ghcr.io/home-assistant/home-assistant
newTag: 2023.8.4
- name: mosquitto
newName: eclipse-mosquitto
newTag: 2.0.17
- name: influxdb
newTag: 2.7.1-alpine

35
hass/mqtt/deployment.yaml Normal file
View File

@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mosquitto
spec:
selector:
matchLabels:
app: mosquitto
template:
metadata:
labels:
app: mosquitto
spec:
volumes:
- name: config
configMap:
name: mosquitto
- name: data
hostPath:
path: /data/home-assistant/mqtt
containers:
- name: mosquitto
image: mosquitto
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 1883
name: mqtt
volumeMounts:
- mountPath: /data
name: data
- mountPath: /mosquitto/config
name: config

View File

@ -0,0 +1,7 @@
# yaml-language-server: $schema=https://json.schemastore.org/kustomization.json
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml

16
hass/mqtt/service.yaml Normal file
View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: mosquitto
spec:
selector:
app: mosquitto
ports:
- port: 1883
targetPort: mqtt
name: mqtt
type: LoadBalancer
ipFamilyPolicy: PreferDualStack
ipFamilies:
- IPv4
- IPv6