issue-14: structure kubernetes
All checks were successful
Cadoles/hydra-sql/pipeline/pr-develop This commit looks good

This commit is contained in:
2023-06-15 15:38:14 +02:00
parent 6e3f0e7a61
commit 22231f791f
29 changed files with 308 additions and 73 deletions

View File

@ -0,0 +1,8 @@
---
nameReference:
- kind: Secret
fieldSpecs:
- path: spec/superuserSecret/name
kind: Cluster
- path: spec/bootstrap/initdb/secret/name
kind: Cluster

View File

@ -0,0 +1,32 @@
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
generatorOptions:
disableNameSuffixHash: true
configurations:
- ./configurations/cnpg-cluster.yaml
resources:
- ./resources/hydra-sql-cnpg-cluster.yaml
secretgenerator:
- name: hydra-sql-postgres-admin
type: secret
literals:
- username=postgres
- password=notsosecret
- name: hydra-sql-postgres-user
type: Secret
literals:
- username=hydra-sql
- password=NotSoSecretButThisIsBad
vars:
- name: APP_DATABASE_SERVICE_NAME
objref:
name: hydra-sql-postgres
kind: Cluster
apiVersion: postgresql.cnpg.io/v1
fieldref:
fieldpath: metadata.name

View File

@ -0,0 +1,17 @@
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: hydra-sql-postgres
spec:
instances: 3
primaryUpdateStrategy: unsupervised
superuserSecret:
name: hydra-sql-postgres-admin
bootstrap:
initdb:
database: hydra-sql
owner: hydra-sql
secret:
name: hydra-sql-postgres-user
storage:
size: 20Gi

View File

@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namePrefix: hydra-sql-
components:
- components/hydra-sql-cnpg
resources:
- resources/hydra-sql-kube

View File

@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./resources/hydra-sql-service.yaml
- ./resources/hydra-sql-deployment.yaml

View File

@ -0,0 +1,55 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.kompose.service: hydra-sql
name: hydra-sql
spec:
replicas: 3
selector:
matchLabels:
io.kompose.service: hydra-sql
strategy:
type: Recreate
template:
metadata:
labels:
io.kompose.service: hydra-sql
spec:
restartPolicy: Always
containers:
- image: reg.cadoles.com/cadoles/hydra-sql-kube
imagePullPolicy: Always
name: hydra-sql-php-fpm
args: ["/usr/sbin/php-fpm81", "-F", "-e"]
resources: {}
env:
- name: PHP_FPM_LISTEN
value: 127.0.0.1:9000
- name: PHP_MEMORY_LIMIT
value: 128m
- name: PHP_FPM_MEMORY_LIMIT
value: 128m
- name: PHP_FPM_LOG_LEVEL
value: warning
- name: APP_DATABASE_SERVICE_NAME
value: $(APP_DATABASE_SERVICE_NAME)-rw
- image: reg.cadoles.com/cadoles/hydra-sql-kube
imagePullPolicy: Always
name: hydra-sql-nginx
args: ["/usr/sbin/nginx"]
env:
- name: NGINX_APP_UPSTREAM_BACKEND_SERVER
value: 127.0.0.1:9000
- name: NGINX_APP_ROOT
value: "/public"
- name: NGINX_APP_PHP_INDEX
value: "/index.php"
- name: NGINX_ERROR_LOG_LEVEL
value: "warn"
- name: NGINX_APP_PHP_NON_FILE_PATTERN
value: "^/index\\.php(/|$)"
ports:
- containerPort: 8080
resources: {}

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
io.kompose.service: hydra-sql
name: hydra-sql
spec:
type: ClusterIP
ports:
- name: hydra-sql-http
port: 80
targetPort: 8080
selector:
io.kompose.service: hydra-sql

View File

@ -0,0 +1,3 @@
*
!.gitignore
!.gitkeep