Skip to content

Commit

Permalink
Document Engine 1.4.1 and asset storage fallback fixes (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
lazyoldbear authored Jul 31, 2024
1 parent 20c1cfe commit 0e6a281
Show file tree
Hide file tree
Showing 12 changed files with 189 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ jobs:
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
ct install --target-branch ${{ github.event.repository.default_branch }} \
--helm-extra-args "--timeout 600s"
--helm-extra-args "--timeout 300s"
45 changes: 32 additions & 13 deletions charts/document-engine/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,56 @@
# Changelog

- [Changelog](#changelog)
- [2.8.0](#280)
- [2.9.0](#290)
- [Added](#added)
- [Changed](#changed)
- [Fixed](#fixed)
- [2.7.3](#273)
- [2.8.0](#280)
- [Added](#added-1)
- [Changed](#changed-1)
- [Fixed](#fixed-1)
- [2.7.2](#272)
- [2.7.3](#273)
- [Changed](#changed-2)
- [Fixed](#fixed-2)
- [2.7.2](#272)
- [Fixed](#fixed-3)
- [2.7.0](#270)
- [Changed](#changed-2)
- [2.6.2](#262)
- [Added](#added-1)
- [Changed](#changed-3)
- [2.6.0](#260)
- [2.6.2](#262)
- [Added](#added-2)
- [2.4.0](#240)
- [Changed](#changed-4)
- [2.6.0](#260)
- [Added](#added-3)
- [2.3.0](#230)
- [2.4.0](#240)
- [Added](#added-4)
- [2.2.0](#220)
- [2.3.0](#230)
- [Added](#added-5)
- [2.2.0](#220)
- [Added](#added-6)
- [2.1.0](#210)
- [Changed](#changed-4)
- [2.0.0](#200)
- [Changed](#changed-5)
- [2.0.0](#200)
- [Changed](#changed-6)

## 2.9.0

### Added

* Azure blob storage support.
* Introduced `pspdfkit.signingTrustConfigMaps` for ConfigMaps to mount to `/certificate-stores/`

### Changed

* [Document Engine 1.4.1](https://pspdfkit.com/changelog/document-engine/#1.4.1)

### Fixed

* Asset storage fallback.

## 2.8.0

### Added

* [Document Engine 1.4.0](https://pspdfkit.com/changelog/document-engine/#1.4.0)
* Support for OpenTelemetry traces, enabled by setting `pspdfkit.observability.opentelemetry.enabled` to `true`.
* Unless the collector is placed as a sidecar and receives by grpc at port `4317`, other parameters are also necessary.
* Please note: standard OpenTelemetry environment variables are used, and the following values are just convenience wrappers, therefore other configuration approaches (e.g. setting variables through mutations or post build patches) will also work.
Expand All @@ -46,6 +64,7 @@

### Changed

* [Document Engine 1.4.0](https://pspdfkit.com/changelog/document-engine/#1.4.0)
* Changed `pspdfkit.storage.enableMigrationJobs` to `pspdfkit.storage.databaseMigrationJob.enabled`.
* Renamed `.Values.pspdfkit.storage.redis.sentinels` to `.Values.pspdfkit.storage.redis.sentinel`.
* Slight refinement of trust information parameters: all files from `pspdfkit.trustConfigMaps` are now mounted to `/certificate-stores-custom/` to avoid confusion with `/certificate-stores/` which services for document signature validation certificates.
Expand Down
4 changes: 2 additions & 2 deletions charts/document-engine/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: document-engine
description: PSPDFKit Document Engine
icon: data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwMCIgaGVpZ2h0PSIxMDAwIiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMzQyLjU2NyA2NTguNjEyTDMyOS40OTYgNjY1LjkxNUwzMzguNzk5IDY1NC4yODZDMzk5LjMxIDU3OS44NDIgNDMzLjAyNiA0ODcuMjExIDQzNC41MjggMzkxLjI4OEw0MzQuNzYgMzc2LjMxTDQ0MC4xMSAzOTAuMjY1QzQ3NC40MDUgNDc5LjkzMiA1MzcuODc4IDU1NS40NDggNjIwLjMxIDYwNC42NTRMNjMzLjE0OCA2MTIuMzI5TDYxOC4zNTYgNjA5Ljk1N0M1MjMuNTc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appVersion: "1.4.0"
version: 2.9.0
appVersion: "1.4.1"

maintainers:
- name: PSPDFKit
Expand Down
2 changes: 1 addition & 1 deletion charts/document-engine/ci/2-with-db-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ postgresql:
primary:
persistence:
enabled: true
size: 1Gi
size: 512Mi
storageClass: standard
accessModes:
- ReadWriteOnce
Expand Down
4 changes: 3 additions & 1 deletion charts/document-engine/ci/3-with-db-s3-redis-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ pspdfkit:
podLabels:
do: "that"
assetStorageBackend: s3
enableAssetStorageFallback: true
enableAssetStorageFallbackPostgres: true
postgres:
enabled: true
host: postgresql
Expand Down Expand Up @@ -46,7 +48,7 @@ postgresql:
primary:
persistence:
enabled: true
size: 1Gi
size: 512Mi
storageClass: standard
accessModes:
- ReadWriteOnce
Expand Down
49 changes: 49 additions & 0 deletions charts/document-engine/ci/4-with-db-azure-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
pspdfkit:
storage:
databaseMigrationJob:
enabled: false
assetStorageBackend: azure
enableAssetStorageFallback: true
enableAssetStorageFallbackPostgres: true
postgres:
enabled: true
host: postgresql
port: 5432
username: postgres
azure:
# This is "well known" storage account for Azure Storage Emulator
# See https://learn.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string#configure-a-connection-string-for-azurite
accountName: devstoreaccount1
accountKey: "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
container: "document-engine-assets"
apiUrl: "http://127.0.0.1:10000/devstoreaccount1"

# Azurite as sidecar
sidecars:
- name: azurite
image: mcr.microsoft.com/azure-storage/azurite:latest
imagePullPolicy: Always
ports:
- containerPort: 10000
name: blob
protocol: TCP

postgresql:
enabled: true
fullnameOverride: postgresql
nameOverride: postgresql
primary:
persistence:
enabled: true
size: 512Mi
storageClass: standard
accessModes:
- ReadWriteOnce
volumePermissions:
enabled: true

minio:
enabled: false

redis:
enabled: false
1 change: 1 addition & 0 deletions charts/document-engine/ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
* `1-no-storage-values.yaml` — Document Engine with no storage, processing only
* `2-with-db-values.yaml` — Basic configuration with PostgreSQL database
* `3-with-db-s3-redis-values.yaml` — PostgreSQL, MinIO as S3 asset storage backend and Redis for rendering cache
* `4-with-db-azure-values.yaml` — PostgreSQL and Azurite to test Azure Blob storage
55 changes: 42 additions & 13 deletions charts/document-engine/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ License secret name
{{- end -}}

{{- define "document-engine.license.available" -}}
{{- if or .Values.pspdfkit.license.activationKey .Values.pspdfkit.license.externalSecret.name -}}
{{- if or .Values.pspdfkit.license.activationKey
.Values.pspdfkit.license.externalSecret.name -}}
{{- true -}}
{{- else -}}
{{- false -}}
Expand Down Expand Up @@ -187,7 +188,8 @@ Database secrets
{{- end -}}
{{- end -}}
{{- define "document-engine.storage.postgres.createSecret" -}}
{{- if and .Values.pspdfkit.storage.postgres.enabled (not .Values.pspdfkit.storage.postgres.externalSecretName) -}}
{{- if and .Values.pspdfkit.storage.postgres.enabled
(not .Values.pspdfkit.storage.postgres.externalSecretName) -}}
{{- true -}}
{{- else -}}
{{- false -}}
Expand All @@ -202,7 +204,8 @@ Database secrets
{{- end -}}
{{- end -}}
{{- define "document-engine.storage.postgres.createAdminSecret" -}}
{{- if and .Values.pspdfkit.storage.postgres.enabled (not .Values.pspdfkit.storage.postgres.externalAdminSecretName) -}}
{{- if and .Values.pspdfkit.storage.postgres.enabled
(not .Values.pspdfkit.storage.postgres.externalAdminSecretName) -}}
{{- true -}}
{{- else -}}
{{- false -}}
Expand All @@ -217,7 +220,8 @@ Database secrets
{{- end -}}
{{- end -}}
{{- define "document-engine.storage.redis.createSecret" -}}
{{- if and .Values.pspdfkit.storage.redis.enabled (not .Values.pspdfkit.storage.redis.externalSecretName) -}}
{{- if and .Values.pspdfkit.storage.redis.enabled
(not .Values.pspdfkit.storage.redis.externalSecretName) -}}
{{- true -}}
{{- else -}}
{{- false -}}
Expand All @@ -228,21 +232,18 @@ Database secrets
Object storage parameters
*/}}
{{- define "document-engine.storage.s3.enabled" -}}
{{- if .Values.pspdfkit.storage.assetStorageBackend -}}
{{- with .Values.pspdfkit.storage.assetStorageBackend -}}
{{- if eq . "s3" -}}
{{- true -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}
{{- if or (eq .Values.pspdfkit.storage.assetStorageBackend "s3")
(and .Values.pspdfkit.storage.enableAssetStorageFallback
.Values.pspdfkit.storage.enableAssetStorageFallbackS3 ) -}}
{{- true -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}

{{- define "document-engine.storage.s3.createSecret" -}}
{{- if and (eq (include "document-engine.storage.s3.enabled" .) "true") (not .Values.pspdfkit.storage.s3.externalSecretName) -}}
{{- if and (eq (include "document-engine.storage.s3.enabled" .) "true")
(not .Values.pspdfkit.storage.s3.externalSecretName) -}}
{{- true -}}
{{- else -}}
{{- false -}}
Expand All @@ -257,6 +258,34 @@ Object storage parameters
{{- end -}}
{{- end -}}

{{- define "document-engine.storage.azure.enabled" -}}
{{- if or (eq .Values.pspdfkit.storage.assetStorageBackend "azure")
(and .Values.pspdfkit.storage.enableAssetStorageFallback
.Values.pspdfkit.storage.enableAssetStorageFallbackAzure ) -}}
{{- true -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}


{{- define "document-engine.storage.azure.createSecret" -}}
{{- if and (eq (include "document-engine.storage.azure.enabled" .) "true")
(not .Values.pspdfkit.storage.azure.externalSecretName) -}}
{{- true -}}
{{- else -}}
{{- false -}}
{{- end -}}
{{- end -}}

{{- define "document-engine.storage.azure.secret.name" -}}
{{- if (eq (include "document-engine.storage.azure.createSecret" .) "true") -}}
{{- printf "%s-s3" (include "document-engine.fullname" .) -}}
{{- else -}}
{{- .Values.pspdfkit.storage.azure.externalSecretName -}}
{{- end -}}
{{- end -}}

{{/*
Jobs
*/}}
Expand Down
14 changes: 7 additions & 7 deletions charts/document-engine/templates/config.ConfigMap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ data:
{{- end }}
{{- with .Values.pspdfkit.storage }}
ASSET_STORAGE_BACKEND: {{ default "built-in" .assetStorageBackend | quote }}
{{- if .enableAssetStorageFallback }}
ENABLE_ASSET_STORAGE_FALLBACK: "false"
ENABLE_ASSET_STORAGE_FALLBACK_POSTGRES: "false"
ENABLE_ASSET_STORAGE_FALLBACK_S3: "false"
ENABLE_ASSET_STORAGE_FALLBACK_AZURE: "false"
{{- else }}
{{- if .enableAssetStorageFallback }}
ENABLE_ASSET_STORAGE_FALLBACK: {{ .enableAssetStorageFallback | quote }}
ENABLE_ASSET_STORAGE_FALLBACK_POSTGRES: {{ .enableAssetStorageFallbackPostgres | quote }}
ENABLE_ASSET_STORAGE_FALLBACK_S3: {{ .enableAssetStorageFallbackS3 | quote }}
ENABLE_ASSET_STORAGE_FALLBACK_AZURE: {{ .enableAssetStorageFallbackAzure | quote }}
{{- end }}
{{- else }}
ENABLE_ASSET_STORAGE_FALLBACK: "false"
ENABLE_ASSET_STORAGE_FALLBACK_POSTGRES: "false"
ENABLE_ASSET_STORAGE_FALLBACK_S3: "false"
ENABLE_ASSET_STORAGE_FALLBACK_AZURE: "false"
{{- end }}
USE_REDIS_CACHE: {{ .redis.enabled | quote }}
USE_REDIS_TTL_FOR_PRERENDERING: {{ .redis.useTtlForPrerendering | quote }}
REDIS_TTL: {{ .redis.ttlSeconds | int | quote }}
Expand Down
23 changes: 23 additions & 0 deletions charts/document-engine/templates/config.storage-azure.Secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if (eq (include "document-engine.storage.azure.createSecret" .) "true") }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "document-engine.storage.azure.secret.name" . }}
labels:
{{- include "document-engine.labels" . | nindent 4 }}
data:
{{- with .Values.pspdfkit.storage }}
{{- if eq .assetStorageBackend "azure" }}
AZURE_STORAGE_DEFAULT_CONTAINER: {{ .azure.container | b64enc | quote }}
{{- if .azure.connectionString }}
AZURE_STORAGE_ACCOUNT_CONNECTION_STRING: {{ .azure.connectionString | b64enc | quote }}
{{- else if and .azure.accountName .azure.accountKey }}
AZURE_STORAGE_ACCOUNT_NAME: {{ .azure.accountName | b64enc | quote }}
AZURE_STORAGE_ACCOUNT_KEY: {{ .azure.accountKey | b64enc | quote }}
{{- end }}
{{- if .azure.apiUrl }}
AZURE_STORAGE_API_URL: {{ .azure.apiUrl | b64enc | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions charts/document-engine/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ spec:
{{- if (include "document-engine.storage.s3.createSecret" .) }}
checksum/s3-secret: {{ include (print $.Template.BasePath "/config.storage-s3.Secret.yaml") . | sha256sum }}
{{- end }}
{{- if (include "document-engine.storage.azure.createSecret" .) }}
checksum/azure-secret: {{ include (print $.Template.BasePath "/config.storage-azure.Secret.yaml") . | sha256sum }}
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -84,6 +87,10 @@ spec:
- secretRef:
name: {{ include "document-engine.storage.s3.secret.name" . }}
{{- end }}
{{- if eq (include "document-engine.storage.azure.enabled" .) "true" }}
- secretRef:
name: {{ include "document-engine.storage.azure.secret.name" . }}
{{- end }}
{{- with .Values.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
Loading

0 comments on commit 0e6a281

Please sign in to comment.