diff --git a/hass/elect/deployment.yaml b/hass/elect/deployment.yaml new file mode 100644 index 0000000..9749b24 --- /dev/null +++ b/hass/elect/deployment.yaml @@ -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: + - "" + diff --git a/hass/elect/kustomization.yaml b/hass/elect/kustomization.yaml new file mode 100644 index 0000000..a6db3e8 --- /dev/null +++ b/hass/elect/kustomization.yaml @@ -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 \ No newline at end of file diff --git a/hass/home-assistant/deployment.yaml b/hass/home-assistant/deployment.yaml new file mode 100644 index 0000000..1d4182f --- /dev/null +++ b/hass/home-assistant/deployment.yaml @@ -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 \ No newline at end of file diff --git a/hass/home-assistant/ingress.yaml b/hass/home-assistant/ingress.yaml new file mode 100644 index 0000000..d1067fa --- /dev/null +++ b/hass/home-assistant/ingress.yaml @@ -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 diff --git a/hass/home-assistant/kustomization.yaml b/hass/home-assistant/kustomization.yaml new file mode 100644 index 0000000..9dd6a8f --- /dev/null +++ b/hass/home-assistant/kustomization.yaml @@ -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 \ No newline at end of file diff --git a/hass/home-assistant/service.yaml b/hass/home-assistant/service.yaml new file mode 100644 index 0000000..9c00a51 --- /dev/null +++ b/hass/home-assistant/service.yaml @@ -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 diff --git a/hass/kustomization.yaml b/hass/kustomization.yaml new file mode 100644 index 0000000..dbe604a --- /dev/null +++ b/hass/kustomization.yaml @@ -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 \ No newline at end of file diff --git a/hass/mqtt/deployment.yaml b/hass/mqtt/deployment.yaml new file mode 100644 index 0000000..a63d976 --- /dev/null +++ b/hass/mqtt/deployment.yaml @@ -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 \ No newline at end of file diff --git a/hass/mqtt/kustomization.yaml b/hass/mqtt/kustomization.yaml new file mode 100644 index 0000000..3ead957 --- /dev/null +++ b/hass/mqtt/kustomization.yaml @@ -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 \ No newline at end of file diff --git a/hass/mqtt/service.yaml b/hass/mqtt/service.yaml new file mode 100644 index 0000000..f7b3c9c --- /dev/null +++ b/hass/mqtt/service.yaml @@ -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