Skip to content

Commit

Permalink
[home] added HACS to initcontainers to HA
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberdev committed Sep 29, 2023
1 parent ecf470a commit bc5023d
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 52 deletions.
61 changes: 29 additions & 32 deletions apps/home/ha/base/db.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,35 @@
apiVersion: "acid.zalan.do/v1"
kind: postgresql
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: db-ha
name: home-database
namespace: homeassistant
annotations:
argocd.argoproj.io/sync-options: Delete=false
spec:
dockerImage: ghcr.io/zalando/spilo-15:3.0-p1
teamId: "db"
numberOfInstances: 1
users:
admin:
- superuser
- createdb
homeuser: []
databases:
homeassistant: homeuser
imageName: ghcr.io/cloudnative-pg/postgresql:15.3
primaryUpdateStrategy: unsupervised
instances: 3
startDelay: 180
stopDelay: 180
resources:
requests:
memory: 128Mi
cpu: 100m
limits:
memory: 256Mi
cpu: 200m
postgresql:
version: "15"
volume:
size: 1Gi
parameters:
shared_buffers: 128MB
pg_stat_statements.max: '10000'
pg_stat_statements.track: all
auto_explain.log_min_duration: '10s'
bootstrap:
initdb:
database: home
owner: home
storage:
storageClass: iscsi
additionalVolumes:
- name: data
mountPath: /home/postgres/pgdata/partitions
targetContainers:
- postgres
volumeSource:
PersistentVolumeClaim:
claimName: homeassistant-postgres
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: postgres-operator
operator: In
values:
- enabled
size: 40Gi
monitoring:
enablePodMonitor: true
62 changes: 42 additions & 20 deletions apps/home/ha/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ spec:
runAsUser: 65533
env:
- name: DB_USERNAME
valueFrom: { secretKeyRef: { name: homeuser.db-ha.credentials.postgresql.acid.zalan.do, key: username } }
valueFrom: { secretKeyRef: { name: home-database-app, key: username } }
- name: DB_PASSWORD
valueFrom: { secretKeyRef: { name: homeuser.db-ha.credentials.postgresql.acid.zalan.do, key: password } }
valueFrom: { secretKeyRef: { name: home-database-app, key: password } }
- name: DB_STRING
value: "postgresql://${DB_USERNAME}:${DB_PASSWORD}@db-ha.homeassistant.svc.cluster.local:5432/homeassistant?client_encoding=utf8&sslmode=require"
value: "postgresql://${DB_USERNAME}:${DB_PASSWORD}@home-database-rw.homeassistant.svc.cluster.local:5432/home?client_encoding=utf8&sslmode=require"
volumeMounts:
- name: temp-config
mountPath: /tmp/git
Expand All @@ -44,6 +44,20 @@ spec:
- secretRef:
name: git-vars
optional: true
- name: hacs-install
image: alpine:3.16.2
command: ["sh", "-c", "if [ ! -f /config/.hacs-installed ]; then apk add bash wget && wget -O - https://get.hacs.xyz | bash - && touch /config/.hacs-installed; fi"]
securityContext:
allowPrivilegeEscalation: false
runAsUser: 0
seccompProfile:
type: RuntimeDefault
capabilities:
drop:
- ALL
volumeMounts:
- mountPath: /config
name: config-volume
containers:
- env:
- name: TZ
Expand All @@ -64,27 +78,35 @@ spec:
protocol: TCP
resources:
limits:
cpu: 350m
memory: 800Mi
cpu: 750m
memory: 2Gi
requests:
cpu: 200m
memory: 500Mi
cpu: 350m
memory: 1Gi
livenessProbe:
tcpSocket:
port: 8123
periodSeconds: 20
initialDelaySeconds: 60
httpGet:
path: /
port: api
scheme: HTTP
initialDelaySeconds: 10
failureThreshold: 5
timeoutSeconds: 2
readinessProbe:
tcpSocket:
port: 8123
periodSeconds: 10
initialDelaySeconds: 3
httpGet:
path: /
port: api
scheme: HTTP
initialDelaySeconds: 10
failureThreshold: 5
timeoutSeconds: 2
startupProbe:
tcpSocket:
port: 8123
timeoutSeconds: 5
periodSeconds: 10
initialDelaySeconds: 60
httpGet:
path: /
port: api
scheme: HTTP
initialDelaySeconds: 25
failureThreshold: 5
timeoutSeconds: 2
securityContext:
privileged: true
volumeMounts:
Expand Down

0 comments on commit bc5023d

Please sign in to comment.