init
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
{{#if isPostgres}}
|
||||
# --- PostgreSQL Deployment ---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: "{{appName}}-db"
|
||||
namespace: "{{namespace}}"
|
||||
labels:
|
||||
app: "{{appName}}-db"
|
||||
managed-by: cloudhost
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: "{{appName}}-db"
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: "{{appName}}-db"
|
||||
spec:
|
||||
containers:
|
||||
- name: postgres
|
||||
image: postgres:16-alpine
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
env:
|
||||
- name: POSTGRES_DB
|
||||
value: "{{dbName}}"
|
||||
- name: POSTGRES_USER
|
||||
value: "appuser"
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: "{{appName}}-db-secret"
|
||||
key: password
|
||||
volumeMounts:
|
||||
- name: db-storage
|
||||
mountPath: /var/lib/postgresql/data
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "256Mi"
|
||||
limits:
|
||||
cpu: "500m"
|
||||
memory: "512Mi"
|
||||
volumes:
|
||||
- name: db-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: "{{appName}}-db"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: "{{appName}}-db"
|
||||
namespace: "{{namespace}}"
|
||||
spec:
|
||||
selector:
|
||||
app: "{{appName}}-db"
|
||||
ports:
|
||||
- port: 5432
|
||||
targetPort: 5432
|
||||
type: ClusterIP
|
||||
{{/if}}
|
||||
|
||||
{{#if isMysql}}
|
||||
# --- MySQL Deployment ---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: "{{appName}}-db"
|
||||
namespace: "{{namespace}}"
|
||||
labels:
|
||||
app: "{{appName}}-db"
|
||||
managed-by: cloudhost
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: "{{appName}}-db"
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: "{{appName}}-db"
|
||||
spec:
|
||||
containers:
|
||||
- name: mysql
|
||||
image: mysql:8.0
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
env:
|
||||
- name: MYSQL_DATABASE
|
||||
value: "{{dbName}}"
|
||||
- name: MYSQL_USER
|
||||
value: "appuser"
|
||||
- name: MYSQL_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: "{{appName}}-db-secret"
|
||||
key: password
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: "{{appName}}-db-secret"
|
||||
key: password
|
||||
volumeMounts:
|
||||
- name: db-storage
|
||||
mountPath: /var/lib/mysql
|
||||
resources:
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "256Mi"
|
||||
limits:
|
||||
cpu: "500m"
|
||||
memory: "512Mi"
|
||||
volumes:
|
||||
- name: db-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: "{{appName}}-db"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: "{{appName}}-db"
|
||||
namespace: "{{namespace}}"
|
||||
spec:
|
||||
selector:
|
||||
app: "{{appName}}-db"
|
||||
ports:
|
||||
- port: 3306
|
||||
targetPort: 3306
|
||||
type: ClusterIP
|
||||
{{/if}}
|
||||
Reference in New Issue
Block a user