Separation db-cluster and app
This commit is contained in:
23
cnpg-liquid/.helmignore
Normal file
23
cnpg-liquid/.helmignore
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
||||||
24
cnpg-liquid/Chart.yaml
Normal file
24
cnpg-liquid/Chart.yaml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: cnpg-liquid
|
||||||
|
description: A Helm chart for Kubernetes
|
||||||
|
|
||||||
|
# A chart can be either an 'application' or a 'library' chart.
|
||||||
|
#
|
||||||
|
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||||
|
# to be deployed.
|
||||||
|
#
|
||||||
|
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||||
|
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||||
|
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||||
|
type: application
|
||||||
|
|
||||||
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
|
# to the chart and its templates, including the app version.
|
||||||
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
|
version: 0.1.0
|
||||||
|
|
||||||
|
# This is the version number of the application being deployed. This version number should be
|
||||||
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
|
# It is recommended to use it with quotes.
|
||||||
|
appVersion: "1.16.0"
|
||||||
@@ -2,6 +2,9 @@ apiVersion: postgresql.cnpg.io/v1
|
|||||||
kind: Cluster
|
kind: Cluster
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ required "Cluster name required" .Values.cnpg.clusterName }}
|
name: {{ required "Cluster name required" .Values.cnpg.clusterName }}
|
||||||
|
annotations:
|
||||||
|
"helm.sh/hook": pre-install
|
||||||
|
"helm.sh/hook-weight": "-1"
|
||||||
spec:
|
spec:
|
||||||
startDelay: 300
|
startDelay: 300
|
||||||
stopDelay: 300
|
stopDelay: 300
|
||||||
14
cnpg-liquid/values.yaml
Normal file
14
cnpg-liquid/values.yaml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
s3:
|
||||||
|
endpointUrl: https://storage.yandexcloud.net
|
||||||
|
secretName: s3-credentials
|
||||||
|
accessKeyKey: ACCESS_KEY_ID
|
||||||
|
secretKeyKey: ACCESS_SECRET_KEY
|
||||||
|
cnpg:
|
||||||
|
clusterName: liquid-db
|
||||||
|
backup:
|
||||||
|
enable: true
|
||||||
|
destinationPath: "s3://liquid-code/backup"
|
||||||
|
recovery:
|
||||||
|
enable: false
|
||||||
|
oldClusterName: liquid-db
|
||||||
|
sourcePath: "s3://liquid-code/backup"
|
||||||
@@ -34,7 +34,7 @@ spec:
|
|||||||
- name: PG_URI
|
- name: PG_URI
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: {{ required "Cluster name required" .Values.cnpg.clusterName }}-app
|
name: {{ required "Cluster creds secret required!" .Values.database.secretName }}
|
||||||
key: uri
|
key: uri
|
||||||
envFrom:
|
envFrom:
|
||||||
- secretRef:
|
- secretRef:
|
||||||
|
|||||||
37
liquid-code-chart/templates/pre-install-migration.yaml
Normal file
37
liquid-code-chart/templates/pre-install-migration.yaml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: {{.Release.Name}}-migration-job
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/managed-by: {{.Release.Service | quote }}
|
||||||
|
app.kubernetes.io/instance: {{.Release.Name | quote }}
|
||||||
|
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
||||||
|
helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}"
|
||||||
|
annotations:
|
||||||
|
"helm.sh/hook": pre-install
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
name: {{.Release.Name}}-migration-pod
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/managed-by: {{.Release.Service | quote }}
|
||||||
|
app.kubernetes.io/instance: {{.Release.Name | quote }}
|
||||||
|
helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}"
|
||||||
|
spec:
|
||||||
|
restartPolicy: Never
|
||||||
|
containers:
|
||||||
|
- name: {{ .Release.Name }}-backend
|
||||||
|
image: ghcr.io/nullptroma/liquid-backend:1.0.0
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
env:
|
||||||
|
- name: PG_URI
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ required "Cluster creds secret required!" .Values.database.secretName }}
|
||||||
|
key: uri
|
||||||
|
- name: MIGRATE_ONLY
|
||||||
|
value: "1"
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: github-registry
|
||||||
@@ -3,15 +3,8 @@ s3:
|
|||||||
secretName: s3-credentials
|
secretName: s3-credentials
|
||||||
accessKeyKey: ACCESS_KEY_ID
|
accessKeyKey: ACCESS_KEY_ID
|
||||||
secretKeyKey: ACCESS_SECRET_KEY
|
secretKeyKey: ACCESS_SECRET_KEY
|
||||||
cnpg:
|
|
||||||
clusterName: liquid-db
|
|
||||||
backup:
|
|
||||||
enable: true
|
|
||||||
destinationPath: "s3://liquid-code/backup"
|
|
||||||
recovery:
|
|
||||||
enable: false
|
|
||||||
oldClusterName: liquid-db
|
|
||||||
sourcePath: "s3://liquid-code/backup"
|
|
||||||
jwt:
|
jwt:
|
||||||
secretName: jwt-secrets
|
secretName: jwt-secrets
|
||||||
|
database:
|
||||||
|
secretName: liquid-db-app
|
||||||
imagePullSecret: github-registry
|
imagePullSecret: github-registry
|
||||||
|
|||||||
Reference in New Issue
Block a user