mirror of
https://github.com/block/buzz.git
synced 2026-11-08 02:11:36 +00:00
Co-authored-by: coder <d97ebdbb198c7237c94f84ea8bb8a73583ea067407eebd0062abbb3962527fb1@buzz.block.builderlab.xyz> Signed-off-by: coder <d97ebdbb198c7237c94f84ea8bb8a73583ea067407eebd0062abbb3962527fb1@buzz.block.builderlab.xyz>
335 lines
11 KiB
YAML
335 lines
11 KiB
YAML
suite: production render
|
|
# Multi-template scope: needed so $.Template.BasePath lookups in deployment.yaml
|
|
# (e.g. checksum/secret include of secret-chart.yaml) resolve at render time.
|
|
templates:
|
|
- templates/deployment.yaml
|
|
- templates/secret-chart.yaml
|
|
- templates/serviceaccount.yaml
|
|
- templates/service.yaml
|
|
- templates/pvc-git.yaml
|
|
tests:
|
|
- it: renders cleanly in production profile (external pg/redis)
|
|
set:
|
|
relayUrl: wss://buzz.example.com
|
|
ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000"
|
|
externalPostgresql.url: postgres://u:p@h:5432/d
|
|
externalRedis.url: redis://h:6379
|
|
s3.endpoint: http://minio:9000
|
|
s3.accessKey: a
|
|
s3.secretKey: s
|
|
asserts:
|
|
- equal:
|
|
path: kind
|
|
value: Deployment
|
|
template: templates/deployment.yaml
|
|
- equal:
|
|
path: kind
|
|
value: ServiceAccount
|
|
template: templates/serviceaccount.yaml
|
|
- equal:
|
|
path: kind
|
|
value: Service
|
|
template: templates/service.yaml
|
|
- notContains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: BUZZ_S3_REGION
|
|
any: true
|
|
template: templates/deployment.yaml
|
|
- contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: BUZZ_S3_ADDRESSING_STYLE
|
|
value: "path"
|
|
template: templates/deployment.yaml
|
|
- contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: BUZZ_MEDIA_MIGRATION_PHASE
|
|
value: "legacy-only"
|
|
template: templates/deployment.yaml
|
|
- contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: BUZZ_HUDDLE_AUDIO_AVAILABLE
|
|
value: "true"
|
|
template: templates/deployment.yaml
|
|
|
|
- it: renders the dual-read-and-write migration phase
|
|
set:
|
|
relayUrl: wss://buzz.example.com
|
|
ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000"
|
|
externalPostgresql.url: postgres://u:p@h:5432/d
|
|
externalRedis.url: redis://h:6379
|
|
s3.endpoint: http://minio:9000
|
|
s3.accessKey: a
|
|
s3.secretKey: s
|
|
relay.mediaMigrationPhase: dual-read-and-write
|
|
asserts:
|
|
- contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: BUZZ_MEDIA_MIGRATION_PHASE
|
|
value: "dual-read-and-write"
|
|
template: templates/deployment.yaml
|
|
|
|
- it: lets a new deployment opt directly into sharded-only media
|
|
set:
|
|
relayUrl: wss://buzz.example.com
|
|
ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000"
|
|
externalPostgresql.url: postgres://u:p@h:5432/d
|
|
externalRedis.url: redis://h:6379
|
|
s3.endpoint: http://minio:9000
|
|
s3.accessKey: a
|
|
s3.secretKey: s
|
|
relay.mediaMigrationPhase: sharded-only
|
|
asserts:
|
|
- contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: BUZZ_MEDIA_MIGRATION_PHASE
|
|
value: "sharded-only"
|
|
template: templates/deployment.yaml
|
|
|
|
- it: renders virtual-hosted S3 addressing for providers that require it
|
|
set:
|
|
relayUrl: wss://buzz.example.com
|
|
ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000"
|
|
externalPostgresql.url: postgres://u:p@h:5432/d
|
|
externalRedis.url: redis://h:6379
|
|
s3.endpoint: https://storage.railway.app
|
|
s3.bucket: buzz-media-example
|
|
s3.region: auto
|
|
s3.addressingStyle: virtual
|
|
s3.accessKey: a
|
|
s3.secretKey: s
|
|
asserts:
|
|
- contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: BUZZ_S3_REGION
|
|
value: "auto"
|
|
template: templates/deployment.yaml
|
|
- contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: BUZZ_S3_ADDRESSING_STYLE
|
|
value: "virtual"
|
|
template: templates/deployment.yaml
|
|
|
|
- it: lets an explicit value disable huddle audio in a single-replica render
|
|
set:
|
|
relayUrl: wss://buzz.example.com
|
|
ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000"
|
|
externalPostgresql.url: postgres://u:p@h:5432/d
|
|
externalRedis.url: redis://h:6379
|
|
s3.endpoint: http://minio:9000
|
|
s3.accessKey: a
|
|
s3.secretKey: s
|
|
relay.huddleAudioAvailable: false
|
|
asserts:
|
|
- contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: BUZZ_HUDDLE_AUDIO_AVAILABLE
|
|
value: "false"
|
|
template: templates/deployment.yaml
|
|
|
|
- it: lets an explicit value enable huddle audio in HA when the operator owns external audio behavior
|
|
set:
|
|
relayUrl: wss://buzz.example.com
|
|
ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000"
|
|
externalPostgresql.url: postgres://u:p@h:5432/d
|
|
externalRedis.url: redis://h:6379
|
|
s3.endpoint: http://minio:9000
|
|
s3.accessKey: a
|
|
s3.secretKey: s
|
|
replicaCount: 3
|
|
persistence.git.accessMode: ReadWriteOnce
|
|
relay.huddleAudioAvailable: true
|
|
asserts:
|
|
- contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: BUZZ_HUDDLE_AUDIO_AVAILABLE
|
|
value: "true"
|
|
template: templates/deployment.yaml
|
|
|
|
- it: renders HA cleanly with replicaCount=3 + RWO git + Redis (no RWM needed)
|
|
set:
|
|
relayUrl: wss://buzz.example.com
|
|
ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000"
|
|
externalPostgresql.url: postgres://u:p@h:5432/d
|
|
externalRedis.url: redis://h:6379
|
|
s3.endpoint: http://minio:9000
|
|
s3.accessKey: a
|
|
s3.secretKey: s
|
|
replicaCount: 3
|
|
persistence.git.accessMode: ReadWriteOnce
|
|
asserts:
|
|
- equal:
|
|
path: spec.replicas
|
|
value: 3
|
|
template: templates/deployment.yaml
|
|
- equal:
|
|
path: spec.accessModes[0]
|
|
value: ReadWriteOnce
|
|
template: templates/pvc-git.yaml
|
|
- contains:
|
|
path: spec.template.spec.containers[0].env
|
|
content:
|
|
name: BUZZ_HUDDLE_AUDIO_AVAILABLE
|
|
value: "false"
|
|
template: templates/deployment.yaml
|
|
|
|
- it: mounts a per-pod emptyDir git scratch volume when persistence is disabled
|
|
set:
|
|
relayUrl: wss://buzz.example.com
|
|
ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000"
|
|
externalPostgresql.url: postgres://u:p@h:5432/d
|
|
externalRedis.url: redis://h:6379
|
|
s3.endpoint: http://minio:9000
|
|
s3.accessKey: a
|
|
s3.secretKey: s
|
|
replicaCount: 5
|
|
persistence.git.enabled: false
|
|
asserts:
|
|
- equal:
|
|
path: spec.replicas
|
|
value: 5
|
|
template: templates/deployment.yaml
|
|
# git-repos is still mounted (BUZZ_GIT_REPO_PATH must be a real dir)…
|
|
- contains:
|
|
path: spec.template.spec.containers[0].volumeMounts
|
|
content:
|
|
name: git-repos
|
|
mountPath: /var/lib/buzz/git
|
|
template: templates/deployment.yaml
|
|
# …but as a per-pod emptyDir, not a shared PVC (no multi-attach).
|
|
- contains:
|
|
path: spec.template.spec.volumes
|
|
content:
|
|
name: git-repos
|
|
emptyDir:
|
|
sizeLimit: 10Gi
|
|
template: templates/deployment.yaml
|
|
# No PVC is rendered at all when persistence is disabled.
|
|
- hasDocuments:
|
|
count: 0
|
|
template: templates/pvc-git.yaml
|
|
|
|
- it: preserves image defaults when Pod extensions are empty
|
|
set:
|
|
relayUrl: wss://buzz.example.com
|
|
ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000"
|
|
externalPostgresql.url: postgres://u:p@h:5432/d
|
|
externalRedis.url: redis://h:6379
|
|
s3.endpoint: http://minio:9000
|
|
s3.accessKey: a
|
|
s3.secretKey: s
|
|
asserts:
|
|
- notExists:
|
|
path: spec.template.spec.initContainers
|
|
template: templates/deployment.yaml
|
|
- notExists:
|
|
path: spec.template.spec.containers[0].command
|
|
template: templates/deployment.yaml
|
|
- notExists:
|
|
path: spec.template.spec.containers[0].args
|
|
template: templates/deployment.yaml
|
|
|
|
- it: appends generic Pod extensions and overrides the relay command
|
|
set:
|
|
relayUrl: wss://buzz.example.com
|
|
ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000"
|
|
externalPostgresql.url: postgres://u:p@h:5432/d
|
|
externalRedis.url: redis://h:6379
|
|
s3.endpoint: http://minio:9000
|
|
s3.accessKey: a
|
|
s3.secretKey: s
|
|
relay.command:
|
|
- /opt/wrapper/wrapper
|
|
relay.args:
|
|
- /usr/local/bin/buzz-relay
|
|
relay.extraVolumeMounts:
|
|
- name: wrapper
|
|
mountPath: /opt/wrapper
|
|
extraInitContainers:
|
|
- name: install-wrapper
|
|
image: example.com/wrapper-init:v1
|
|
args:
|
|
- /opt/wrapper/wrapper
|
|
env:
|
|
- name: LITERAL_TEMPLATE
|
|
value: '{{ .Release.Name }}'
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
resources:
|
|
requests:
|
|
cpu: 10m
|
|
memory: 16Mi
|
|
volumeMounts:
|
|
- name: wrapper
|
|
mountPath: /opt/wrapper
|
|
extraVolumes:
|
|
- name: wrapper
|
|
emptyDir: {}
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[0].name
|
|
value: install-wrapper
|
|
template: templates/deployment.yaml
|
|
- equal:
|
|
path: spec.template.spec.initContainers[0].securityContext.runAsNonRoot
|
|
value: true
|
|
template: templates/deployment.yaml
|
|
# Extension fragments are deliberately rendered with toYaml, not tpl.
|
|
- equal:
|
|
path: spec.template.spec.initContainers[0].env[0].value
|
|
value: '{{ .Release.Name }}'
|
|
template: templates/deployment.yaml
|
|
- equal:
|
|
path: spec.template.spec.containers[0].command
|
|
value:
|
|
- /opt/wrapper/wrapper
|
|
template: templates/deployment.yaml
|
|
- equal:
|
|
path: spec.template.spec.containers[0].args
|
|
value:
|
|
- /usr/local/bin/buzz-relay
|
|
template: templates/deployment.yaml
|
|
- contains:
|
|
path: spec.template.spec.containers[0].volumeMounts
|
|
content:
|
|
name: wrapper
|
|
mountPath: /opt/wrapper
|
|
template: templates/deployment.yaml
|
|
- contains:
|
|
path: spec.template.spec.volumes
|
|
content:
|
|
name: wrapper
|
|
emptyDir: {}
|
|
template: templates/deployment.yaml
|
|
|
|
- it: appends generic init containers after the bundled MinIO readiness gate
|
|
release:
|
|
name: rel
|
|
set:
|
|
relayUrl: wss://buzz.example.com
|
|
ownerPubkey: "0000000000000000000000000000000000000000000000000000000000000000"
|
|
postgresql.enabled: true
|
|
redis.enabled: true
|
|
minio.enabled: true
|
|
extraInitContainers:
|
|
- name: install-wrapper
|
|
image: example.com/wrapper-init:v1
|
|
asserts:
|
|
- equal:
|
|
path: spec.template.spec.initContainers[0].name
|
|
value: wait-for-bucket
|
|
template: templates/deployment.yaml
|
|
- equal:
|
|
path: spec.template.spec.initContainers[1].name
|
|
value: install-wrapper
|
|
template: templates/deployment.yaml
|