Skip to content

Commit

Permalink
feat: deploy ferretdb
Browse files Browse the repository at this point in the history
  • Loading branch information
zebernst committed Sep 13, 2024
1 parent fb85171 commit 2425982
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 0 deletions.
30 changes: 30 additions & 0 deletions kubernetes/apps/database/ferretdb/app/externalsecret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/external-secrets.io/externalsecret_v1beta1.json
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: ferretdb
spec:
secretStoreRef:
kind: ClusterSecretStore
name: onepassword-connect
target:
name: ferretdb-secret
template:
engineVersion: v2
data:
FERRETDB_POSTGRESQL_URL: postgresql://{{ .FERRETDB_POSTGRES_USER }}:{{ .FERRETDB_POSTGRES_PASS }}@redspot16-rw.database.svc.cluster.local:5432/ferretdb
FERRETDB_TEST_ENABLE_NEW_AUTH: "true"
FERRETDB_SETUP_USERNAME: "{{ .FERRETDB_INIT_USER }}"
FERRETDB_SETUP_PASSWORD: "{{ .FERRETDB_INIT_PASS }}"
FERRETDB_SETUP_DATABASE: ferret
INIT_POSTGRES_DBNAME: ferretdb
INIT_POSTGRES_HOST: redspot16-rw.database.svc.cluster.local
INIT_POSTGRES_USER: "{{ .FERRETDB_POSTGRES_USER }}"
INIT_POSTGRES_PASS: "{{ .FERRETDB_POSTGRES_PASS }}"
INIT_POSTGRES_SUPER_PASS: "{{ .POSTGRES_SUPER_PASS }}"
dataFrom:
- extract:
key: ferretdb
- extract:
key: cloudnative-pg
97 changes: 97 additions & 0 deletions kubernetes/apps/database/ferretdb/app/helmrelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2.schema.json
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: ferretdb
spec:
interval: 30m
chart:
spec:
chart: app-template
version: 3.4.0
sourceRef:
kind: HelmRepository
name: bjw-s
namespace: flux-system
install:
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
strategy: rollback
retries: 3
values:
controllers:
ferretdb:
annotations:
reloader.stakater.com/auto: "true"
initContainers:
init-db:
image:
repository: ghcr.io/onedr0p/postgres-init
tag: 16
envFrom: &envFrom
- secretRef:
name: ferretdb-secret
containers:
app:
image:
repository: ghcr.io/ferretdb/ferretdb
tag: 1.24.0@sha256:e4e442895ae2aaf8284db3d012c8d0e1c84d6f353d16678a0d3edf6d7e81d624
env:
FERRETDB_HANDLER: pg
FERRETDB_MODE: normal
FERRETDB_LISTEN_ADDR: 0.0.0.0:27017
# FERRETDB_PROXY_ADDR: 10.2.3.138:27017
FERRETDB_LOG_LEVEL: info
FERRETDB_LOG_FORMAT: json
envFrom: *envFrom
probes:
liveness: &probes
enabled: true
custom: true
spec:
httpGet:
path: /debug/livez/
port: &healthPort 8088
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness:
<<: *probes
spec:
httpGet:
path: /debug/readyz
port: *healthPort
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities: { drop: [ "ALL" ] }
resources:
requests:
cpu: 10m
limits:
memory: 256Mi
defaultPodOptions:
securityContext:
runAsNonRoot: true
runAsUser: 65534
runAsGroup: 65534
seccompProfile: { type: RuntimeDefault }
service:
app:
controller: ferretdb
ports:
mongo:
enabled: true
port: 27017
protocol: TCP
appProtocol: mongodb
persistence:
state:
type: emptyDir
tmp:
type: emptyDir
8 changes: 8 additions & 0 deletions kubernetes/apps/database/ferretdb/app/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./externalsecret.yaml
- ./helmrelease.yaml
- ../../../../templates/gatus/guarded/
27 changes: 27 additions & 0 deletions kubernetes/apps/database/ferretdb/ks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app ferretdb
namespace: flux-system
spec:
targetNamespace: database
commonMetadata:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: cloudnative-pg-cluster
- name: external-secrets-stores
path: ./kubernetes/apps/database/ferretdb/app
prune: true
sourceRef:
kind: GitRepository
name: home-kubernetes
wait: false
interval: 30m
retryInterval: 1m
timeout: 5m
postBuild:
substitute:
APP: *app
1 change: 1 addition & 0 deletions kubernetes/apps/database/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ resources:
# Pre Flux-Kustomizations
- ./namespace.yaml
# Flux-Kustomizations
- ./ferretdb/ks.yaml
- ./cloudnative-pg/ks.yaml

0 comments on commit 2425982

Please sign in to comment.