Skip to content

Commit

Permalink
basic deployment of PostgreSQL (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
guimou authored Dec 13, 2023
1 parent 420ca71 commit e000be0
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 0 deletions.
1 change: 1 addition & 0 deletions bootstrap/applications/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ kind: Kustomization

resources:
- shared-minio-app.yaml
- shared-database-app.yaml
Empty file.
80 changes: 80 additions & 0 deletions bootstrap/shared-database/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: ic-shared-db
name: ic-shared-db
annotations:
argocd.argoproj.io/sync-wave: "1"
spec:
selector:
matchLabels:
app: ic-shared-db
replicas: 1
template:
metadata:
labels:
app: ic-shared-db
spec:
containers:
- name: postgresql
image: registry.redhat.io/rhel9/postgresql-13:latest
resources:
limits:
memory: 512Mi
readinessProbe:
exec:
command:
- /usr/libexec/check-container
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
livenessProbe:
exec:
command:
- /usr/libexec/check-container
- '--live'
initialDelaySeconds: 120
timeoutSeconds: 10
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
env:
- name: POSTGRESQL_USER
valueFrom:
secretKeyRef:
name: claimdb
key: database-user
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
name: claimdb
key: database-password
- name: POSTGRESQL_DATABASE
valueFrom:
secretKeyRef:
name: claimdb
key: database-name
securityContext:
capabilities: {}
privileged: false
ports:
- containerPort: 5432
protocol: TCP
imagePullPolicy: IfNotPresent
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- name: claimdb-data
mountPath: /var/lib/pgsql/data
volumes:
- name: claimdb-data
persistentVolumeClaim:
claimName: claimdb
strategy:
type: Recreate
recreateParams:
timeoutSeconds: 600
resources: {}
activeDeadlineSeconds: 21600
18 changes: 18 additions & 0 deletions bootstrap/shared-database/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: ic-shared-db

commonLabels:
component: ic-shared-db

resources:
# wave 0
- namespace.yaml
# wave 1
- pvc.yaml
- secret.yaml
- deployment.yaml
- service.yaml
# wave 2
11 changes: 11 additions & 0 deletions bootstrap/shared-database/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: ic-shared-db
labels:
app: ic-shared-db
argocd.argoproj.io/managed-by: openshift-gitops
annotations:
openshift.io/display-name: "Shared postgreSQL Database"
argocd.argoproj.io/sync-wave: "0"
16 changes: 16 additions & 0 deletions bootstrap/shared-database/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: claimdb
namespace: ic-shared-db
labels:
app: ic-shared-db
annotations:
argocd.argoproj.io/sync-wave: "1"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
14 changes: 14 additions & 0 deletions bootstrap/shared-database/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
kind: Secret
apiVersion: v1
metadata:
name: claimdb
namespace: ic-shared-db
labels:
app: ic-shared-db
annotations:
argocd.argoproj.io/sync-wave: "1"
stringData:
database-name: claimdb
database-password: claimdb
database-user: claimdb
type: Opaque
20 changes: 20 additions & 0 deletions bootstrap/shared-database/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
apiVersion: v1
kind: Service
metadata:
name: claimdb
namespace: ic-shared-db
labels:
app: ic-shared-db
annotations:
argocd.argoproj.io/sync-wave: "1"
spec:
ports:
- name: postgresql
protocol: TCP
port: 5432
targetPort: 5432
selector:
app: ic-shared-db
sessionAffinity: None
type: ClusterIP

0 comments on commit e000be0

Please sign in to comment.