- New package app/billing: Init/RecordUsage/Close with auto-migrate - Integration in actionHandler: record tenant_id, operation, msg_count, msg_bytes - Helm chart: billing section in values.yaml, secret-billing.yaml, env vars in deployment - Optional: billing disabled by default (BILLING_PG_HOST not set = no-op) - Table: sqs_usage_records with index on (tenant_id, recorded_at)
98 lines
3.4 KiB
YAML
98 lines
3.4 KiB
YAML
# deployment.yaml — Deployment shared-sqs с RollingUpdate
|
||
# Created: 2026-04-11
|
||
apiVersion: apps/v1
|
||
kind: Deployment
|
||
metadata:
|
||
name: shared-sqs
|
||
namespace: {{ .Values.namespace }}
|
||
labels:
|
||
{{- include "shared-sqs.labels" . | nindent 4 }}
|
||
spec:
|
||
replicas: {{ .Values.replicaCount }}
|
||
strategy:
|
||
type: {{ .Values.strategy.type }}
|
||
{{- if eq .Values.strategy.type "RollingUpdate" }}
|
||
rollingUpdate:
|
||
maxSurge: {{ .Values.strategy.rollingUpdate.maxSurge }}
|
||
maxUnavailable: {{ .Values.strategy.rollingUpdate.maxUnavailable }}
|
||
{{- end }}
|
||
selector:
|
||
matchLabels:
|
||
{{- include "shared-sqs.selectorLabels" . | nindent 6 }}
|
||
template:
|
||
metadata:
|
||
labels:
|
||
{{- include "shared-sqs.selectorLabels" . | nindent 8 }}
|
||
spec:
|
||
containers:
|
||
- name: shared-sqs
|
||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||
ports:
|
||
- containerPort: {{ .Values.service.port }}
|
||
name: http
|
||
env:
|
||
- name: SHARED_SQS_ADMIN_TOKEN
|
||
valueFrom:
|
||
secretKeyRef:
|
||
name: shared-sqs-admin
|
||
key: token
|
||
- name: SHARED_SQS_SEED_DEMO
|
||
value: {{ .Values.seedDemo | quote }}
|
||
- name: REDIS_ADDR
|
||
valueFrom:
|
||
secretKeyRef:
|
||
name: shared-sqs-redis
|
||
key: addr
|
||
- name: REDIS_USER
|
||
valueFrom:
|
||
secretKeyRef:
|
||
name: shared-sqs-redis
|
||
key: user
|
||
- name: REDIS_PASSWORD
|
||
valueFrom:
|
||
secretKeyRef:
|
||
name: shared-sqs-redis
|
||
key: password
|
||
- name: NUBES_ENDPOINT
|
||
value: {{ .Values.nubesEndpoint | quote }}
|
||
{{- if .Values.billing.enabled }}
|
||
- name: BILLING_PG_HOST
|
||
value: {{ .Values.billing.postgres.host | quote }}
|
||
- name: BILLING_PG_PORT
|
||
value: {{ .Values.billing.postgres.port | quote }}
|
||
- name: BILLING_PG_DATABASE
|
||
value: {{ .Values.billing.postgres.database | quote }}
|
||
- name: BILLING_PG_USER
|
||
value: {{ .Values.billing.postgres.user | quote }}
|
||
- name: BILLING_PG_SSLMODE
|
||
value: {{ .Values.billing.postgres.sslmode | quote }}
|
||
- name: BILLING_PG_PASSWORD
|
||
valueFrom:
|
||
secretKeyRef:
|
||
{{- if .Values.billing.postgres.existingSecret }}
|
||
name: {{ .Values.billing.postgres.existingSecret }}
|
||
{{- else }}
|
||
name: shared-sqs-billing-pg
|
||
{{- end }}
|
||
key: {{ .Values.billing.postgres.secretKey | default "password" }}
|
||
{{- end }}
|
||
resources:
|
||
{{- toYaml .Values.resources | nindent 10 }}
|
||
livenessProbe:
|
||
httpGet:
|
||
path: {{ .Values.probes.liveness.path }}
|
||
port: {{ .Values.service.port }}
|
||
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }}
|
||
periodSeconds: {{ .Values.probes.liveness.periodSeconds }}
|
||
readinessProbe:
|
||
httpGet:
|
||
path: {{ .Values.probes.readiness.path }}
|
||
port: {{ .Values.service.port }}
|
||
initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }}
|
||
periodSeconds: {{ .Values.probes.readiness.periodSeconds }}
|
||
{{- with .Values.imagePullSecrets }}
|
||
imagePullSecrets:
|
||
{{- toYaml . | nindent 8 }}
|
||
{{- end }}
|