diff --git a/clusters/brusnika-stage/infrastructure/kustomization.yaml b/clusters/brusnika-stage/infrastructure/kustomization.yaml index d57bd25..fb82b17 100644 --- a/clusters/brusnika-stage/infrastructure/kustomization.yaml +++ b/clusters/brusnika-stage/infrastructure/kustomization.yaml @@ -6,6 +6,7 @@ resources: - ../../../infrastructure/istio-gateway/brusnika-stage - ../../../infrastructure/istio-config/brusnika-stage - ../../../infrastructure/vault/brusnika-stage + - ../../../infrastructure/spicedb/brusnika-stage - ../../../infrastructure/rabbitmq/brusnika-stage - ../../../infrastructure/zitadel/brusnika-stage - ../../../infrastructure/openobserve/brusnika-stage diff --git a/infrastructure/spicedb/brusnika-stage/kustomization.yaml b/infrastructure/spicedb/brusnika-stage/kustomization.yaml new file mode 100644 index 0000000..a5056bc --- /dev/null +++ b/infrastructure/spicedb/brusnika-stage/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- namespace.yaml +- postgresql.yaml +- spicedb.yaml diff --git a/infrastructure/spicedb/brusnika-stage/namespace.yaml b/infrastructure/spicedb/brusnika-stage/namespace.yaml new file mode 100644 index 0000000..6264487 --- /dev/null +++ b/infrastructure/spicedb/brusnika-stage/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: spicedb diff --git a/infrastructure/spicedb/brusnika-stage/postgresql.yaml b/infrastructure/spicedb/brusnika-stage/postgresql.yaml new file mode 100644 index 0000000..7eb6296 --- /dev/null +++ b/infrastructure/spicedb/brusnika-stage/postgresql.yaml @@ -0,0 +1,79 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: postgres-data + namespace: spicedb +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-path + resources: + requests: + storage: 10Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: postgres + namespace: spicedb +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: spicedb-postgres + template: + metadata: + labels: + app: spicedb-postgres + spec: + tolerations: + - key: dedicated + operator: Equal + value: processing-light + effect: NoSchedule + containers: + - name: postgres + image: postgres:17.5 + ports: + - name: postgres + containerPort: 5432 + env: + - name: PGDATA + value: /var/lib/postgresql/data/pgdata + envFrom: + - secretRef: + name: postgres-secret + volumeMounts: + - name: data + mountPath: /var/lib/postgresql/data + resources: + requests: + cpu: 100m + memory: 256Mi + readinessProbe: + exec: + command: + - sh + - -ec + - pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB" + initialDelaySeconds: 5 + periodSeconds: 5 + volumes: + - name: data + persistentVolumeClaim: + claimName: postgres-data +--- +apiVersion: v1 +kind: Service +metadata: + name: postgres + namespace: spicedb +spec: + selector: + app: spicedb-postgres + ports: + - name: postgres + port: 5432 + targetPort: postgres diff --git a/infrastructure/spicedb/brusnika-stage/spicedb.yaml b/infrastructure/spicedb/brusnika-stage/spicedb.yaml new file mode 100644 index 0000000..f41855f --- /dev/null +++ b/infrastructure/spicedb/brusnika-stage/spicedb.yaml @@ -0,0 +1,60 @@ +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: spicedb + namespace: spicedb +spec: + interval: 5m + timeout: 10m + chart: + spec: + chart: spicedb + version: 0.1.4-prod + sourceRef: + kind: HelmRepository + name: yc-oci-charts + namespace: flux-system + interval: 10m + install: + remediation: + retries: 3 + upgrade: + remediation: + retries: 0 + remediateLastFailure: false + values: + replicas: 1 + image: + repository: cr.yandex/crp3ccidau046kdj8g9q/spicedb-prod + tag: v1.54.0 + imagePullSecrets: + - name: regcred + datastore: + mode: external + database: spicedb + username: spicedb + auth: + existingSecret: spicedb-secret + istio: + enabled: false + deploymentName: spicedb + tolerations: + - key: dedicated + operator: Equal + value: processing-light + effect: NoSchedule + resources: + requests: + cpu: 100m + memory: 256Mi + migration: + hook: + enabled: false + postRenderers: + - kustomize: + patches: + - target: + kind: Job + patch: "- op: add\n path: /spec/template/spec/tolerations\n value:\n \ + \ - key: dedicated\n operator: Equal\n value: processing-light\n\ + \ effect: NoSchedule\n"