vault + resources
This commit is contained in:
parent
0ee1fc7dd6
commit
8a897b9cee
@ -14,7 +14,32 @@ spec:
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: backend
|
app: backend
|
||||||
|
annotations:
|
||||||
|
traffic.sidecar.istio.io/excludeOutboundPorts: "8200"
|
||||||
|
vault.hashicorp.com/agent-init-first: "true"
|
||||||
|
vault.hashicorp.com/agent-inject: "true"
|
||||||
|
vault.hashicorp.com/agent-pre-populate-only: "true"
|
||||||
|
vault.hashicorp.com/auth-path: auth/kubernetes
|
||||||
|
vault.hashicorp.com/role: resources
|
||||||
|
vault.hashicorp.com/agent-inject-secret-resources-db: secrets/data/postgresql/apps/resources
|
||||||
|
vault.hashicorp.com/agent-inject-template-resources-db: |-
|
||||||
|
{{- with secret "secrets/data/postgresql/apps/resources" -}}
|
||||||
|
DATABASE_HOST=postgresql.resources.svc.cluster.local
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
DATABASE_NAME=resources_db
|
||||||
|
DATABASE_USER={{ index .Data.data "username" }}
|
||||||
|
DATABASE_PASSWORD={{ index .Data.data "password" }}
|
||||||
|
{{- end -}}
|
||||||
|
vault.hashicorp.com/agent-inject-secret-resources-s3: secrets/data/minio/apps/resources
|
||||||
|
vault.hashicorp.com/agent-inject-template-resources-s3: |-
|
||||||
|
{{- with secret "secrets/data/minio/apps/resources" -}}
|
||||||
|
YC_S3_ENDPOINT_URL={{ index .Data.data.client "endpoint" }}
|
||||||
|
YC_S3_BUCKET_NAME=resources
|
||||||
|
YC_S3_ACCESS_KEY_ID={{ index .Data.data "access_key" }}
|
||||||
|
YC_S3_SECRET_ACCESS_KEY={{ index .Data.data "secret_key" }}
|
||||||
|
{{- end -}}
|
||||||
spec:
|
spec:
|
||||||
|
serviceAccountName: resources-vault
|
||||||
volumes:
|
volumes:
|
||||||
- name: django-configmap
|
- name: django-configmap
|
||||||
configMap:
|
configMap:
|
||||||
@ -28,6 +53,14 @@ spec:
|
|||||||
- name: backend
|
- name: backend
|
||||||
image: cr.yandex/crp3ccidau046kdj8g9q/sarex-resources:prod_d642ef88
|
image: cr.yandex/crp3ccidau046kdj8g9q/sarex-resources:prod_d642ef88
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
|
command: ["/bin/sh", "-ec"]
|
||||||
|
args:
|
||||||
|
- |
|
||||||
|
set -a
|
||||||
|
[ -f /vault/secrets/resources-db ] && . /vault/secrets/resources-db
|
||||||
|
[ -f /vault/secrets/resources-s3 ] && . /vault/secrets/resources-s3
|
||||||
|
set +a
|
||||||
|
exec /server/entrypoint.sh
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
@ -39,51 +72,6 @@ spec:
|
|||||||
value: config.settings.production
|
value: config.settings.production
|
||||||
- name: API_ADDRESS
|
- name: API_ADDRESS
|
||||||
value: "8000"
|
value: "8000"
|
||||||
- name: DATABASE_NAME
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: database
|
|
||||||
name: postgresql-secret
|
|
||||||
- name: DATABASE_HOST
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: hostname
|
|
||||||
name: postgresql-secret
|
|
||||||
- name: DATABASE_USER
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: username
|
|
||||||
name: postgresql-secret
|
|
||||||
- name: DATABASE_PORT
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: port
|
|
||||||
name: postgresql-secret
|
|
||||||
- name: DATABASE_PASSWORD
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: password
|
|
||||||
name: postgresql-secret
|
|
||||||
- name: YC_S3_ACCESS_KEY_ID
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: username
|
|
||||||
name: s3-secret
|
|
||||||
- name: YC_S3_ENDPOINT_URL
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: host
|
|
||||||
name: s3-secret
|
|
||||||
- name: YC_S3_SECRET_ACCESS_KEY
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: password
|
|
||||||
name: s3-secret
|
|
||||||
- name: YC_S3_BUCKET_NAME
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
key: bucket
|
|
||||||
name: s3-secret
|
|
||||||
|
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
@ -97,20 +85,20 @@ spec:
|
|||||||
subPath: production.py
|
subPath: production.py
|
||||||
|
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
tcpSocket:
|
||||||
path: /ping
|
|
||||||
port: 8000
|
port: 8000
|
||||||
initialDelaySeconds: 10
|
initialDelaySeconds: 20
|
||||||
periodSeconds: 60
|
periodSeconds: 30
|
||||||
failureThreshold: 10
|
timeoutSeconds: 3
|
||||||
|
failureThreshold: 5
|
||||||
|
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
tcpSocket:
|
||||||
path: /ping
|
|
||||||
port: 8000
|
port: 8000
|
||||||
initialDelaySeconds: 5
|
initialDelaySeconds: 10
|
||||||
periodSeconds: 5
|
periodSeconds: 10
|
||||||
failureThreshold: 20
|
timeoutSeconds: 3
|
||||||
|
failureThreshold: 6
|
||||||
|
|
||||||
imagePullSecrets:
|
imagePullSecrets:
|
||||||
- name: regcred
|
- name: regcred
|
||||||
|
|||||||
@ -4,6 +4,7 @@ kind: Kustomization
|
|||||||
namespace: resources
|
namespace: resources
|
||||||
resources:
|
resources:
|
||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
|
- serviceaccount.yaml
|
||||||
- backend-deployment.yaml
|
- backend-deployment.yaml
|
||||||
- backend-service.yaml
|
- backend-service.yaml
|
||||||
- django-configmap.yaml
|
- django-configmap.yaml
|
||||||
|
|||||||
5
apps/resources/base/serviceaccount.yaml
Normal file
5
apps/resources/base/serviceaccount.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: resources-vault
|
||||||
|
namespace: resources
|
||||||
@ -8,4 +8,4 @@ patches:
|
|||||||
- path: replicas.yaml
|
- path: replicas.yaml
|
||||||
target:
|
target:
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
name: comparisons
|
name: backend
|
||||||
|
|||||||
@ -9,7 +9,7 @@ spec:
|
|||||||
chart:
|
chart:
|
||||||
spec:
|
spec:
|
||||||
chart: postgresql-contour
|
chart: postgresql-contour
|
||||||
version: "17.0.2"
|
version: "17.0.7"
|
||||||
sourceRef:
|
sourceRef:
|
||||||
kind: HelmRepository
|
kind: HelmRepository
|
||||||
name: yc-oci-charts
|
name: yc-oci-charts
|
||||||
@ -44,7 +44,7 @@ spec:
|
|||||||
image:
|
image:
|
||||||
registry: cr.yandex/crp3ccidau046kdj8g9q
|
registry: cr.yandex/crp3ccidau046kdj8g9q
|
||||||
repository: contour/postgresql
|
repository: contour/postgresql
|
||||||
tag: 17.0.2
|
tag: 17.0.7
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
metrics:
|
metrics:
|
||||||
enabled: false
|
enabled: false
|
||||||
@ -61,7 +61,7 @@ spec:
|
|||||||
command:
|
command:
|
||||||
- /bin/sh
|
- /bin/sh
|
||||||
- -c
|
- -c
|
||||||
- exec pg_isready -U "sarex" -d postgres -h 127.0.0.1 -p 5432
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
initialDelaySeconds: 30
|
initialDelaySeconds: 30
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
@ -72,7 +72,7 @@ spec:
|
|||||||
command:
|
command:
|
||||||
- /bin/sh
|
- /bin/sh
|
||||||
- -c
|
- -c
|
||||||
- exec pg_isready -U "sarex" -d postgres -h 127.0.0.1 -p 5432
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
initialDelaySeconds: 5
|
initialDelaySeconds: 5
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
@ -83,7 +83,7 @@ spec:
|
|||||||
command:
|
command:
|
||||||
- /bin/sh
|
- /bin/sh
|
||||||
- -c
|
- -c
|
||||||
- exec pg_isready -U "sarex" -d postgres -h 127.0.0.1 -p 5432
|
- exec pg_isready -U "postgres" -d postgres -h 127.0.0.1 -p 5432
|
||||||
initialDelaySeconds: 30
|
initialDelaySeconds: 30
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
timeoutSeconds: 5
|
timeoutSeconds: 5
|
||||||
@ -101,13 +101,20 @@ spec:
|
|||||||
effect: NoSchedule
|
effect: NoSchedule
|
||||||
contour:
|
contour:
|
||||||
enabled: true
|
enabled: true
|
||||||
adminUser: ""
|
adminUser: "postgres"
|
||||||
adminPasswordSecretKey: ""
|
|
||||||
sharedPreloadLibraries: "pg_stat_statements,uuid-ossp,ltree,postgis"
|
sharedPreloadLibraries: "pg_stat_statements,uuid-ossp,ltree,postgis"
|
||||||
|
vault:
|
||||||
|
enabled: true
|
||||||
|
role: postgresql
|
||||||
|
authPath: auth/kubernetes
|
||||||
|
secretPath: secrets/data/postgresql/admin
|
||||||
|
secretKey: postgres-password
|
||||||
|
usersSecretPath: secrets/data/postgresql/users
|
||||||
databases:
|
databases:
|
||||||
- name: resources_db
|
- name: resources_db
|
||||||
user: resources
|
user: resources
|
||||||
|
passwordKey: resources
|
||||||
extensions: []
|
extensions: []
|
||||||
restoreFromDump: false
|
restoreFromDump: false
|
||||||
s3-proxy:
|
s3-proxy:
|
||||||
endpointUrl: "s3-proxy-service.postgresql.svc.cluster.local"
|
endpointUrl: "s3-proxy-service.postgresql.svc.cluster.local"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user