apiVersion: v1 kind: Service metadata: name: brave-sync spec: selector: app.kubernetes.io/name: brave-sync ports: - name: http port: 8295 targetPort: http --- apiVersion: apps/v1 kind: Deployment metadata: name: brave-sync spec: replicas: 1 strategy: type: Recreate selector: matchLabels: app.kubernetes.io/name: brave-sync template: metadata: labels: app.kubernetes.io/name: brave-sync annotations: checksum/schema: {{ .Files.Get "schema/table.json" | sha256sum }} spec: {{- if hasKey .Values "imagePullSecret" }} {{- if .Values.imagePullSecret }} imagePullSecrets: - name: {{ .Values.imagePullSecret | quote }} {{- end }} {{- else }} imagePullSecrets: - name: quay-pull-secret {{- end }} initContainers: - name: initialize-table image: amazon/aws-cli:2.31.9 command: ["/bin/sh", "-ec"] args: - | until aws dynamodb list-tables --endpoint-url "$AWS_ENDPOINT" >/dev/null 2>&1; do sleep 2; done if ! aws dynamodb describe-table --table-name "$TABLE_NAME" --endpoint-url "$AWS_ENDPOINT" >/dev/null 2>&1; then aws dynamodb create-table --cli-input-json file:///schema/table.json --endpoint-url "$AWS_ENDPOINT" aws dynamodb update-time-to-live --table-name "$TABLE_NAME" --time-to-live-specification 'Enabled=true,AttributeName=ExpirationTime' --endpoint-url "$AWS_ENDPOINT" fi env: - name: AWS_ACCESS_KEY_ID value: GOSYNC - name: AWS_SECRET_ACCESS_KEY value: GOSYNC - name: AWS_REGION value: us-west-2 - name: AWS_ENDPOINT value: http://brave-sync-dynamodb:8000 - name: TABLE_NAME value: client-entity-dev volumeMounts: - name: schema mountPath: /schema readOnly: true containers: - name: sync image: {{ printf "registry.brunner.ninja/feedc0de/brave-sync:%s" .Chart.AppVersion | quote }} imagePullPolicy: IfNotPresent env: - name: ENV value: local - name: AWS_ACCESS_KEY_ID value: GOSYNC - name: AWS_SECRET_ACCESS_KEY value: GOSYNC - name: AWS_REGION value: us-west-2 - name: AWS_ENDPOINT value: http://brave-sync-dynamodb:8000 - name: TABLE_NAME value: client-entity-dev - name: REDIS_URL value: brave-sync-valkey:6379 ports: - name: http containerPort: 8295 resources: requests: cpu: 50m memory: 96Mi limits: memory: 256Mi startupProbe: httpGet: path: /health-check port: http failureThreshold: 24 periodSeconds: 5 readinessProbe: httpGet: path: /health-check port: http periodSeconds: 10 livenessProbe: httpGet: path: /health-check port: http periodSeconds: 20 volumes: - name: schema configMap: name: brave-sync-schema