@bluedynamics/cdk8s-plone 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/.jsii +47 -28
  2. package/API.md +28 -3
  3. package/lib/config/plone-vinyl-backend-response.vcl +25 -0
  4. package/lib/config/plone-vinyl-recv-routing-volto.vcl +21 -0
  5. package/lib/config/plone-vinyl-recv.vcl +18 -0
  6. package/{examples/volto → lib}/config/varnish.tpl.vcl +1 -1
  7. package/lib/httpcache.js +1 -1
  8. package/lib/imports/vinyl.bluedynamics.eu.d.ts +398 -66
  9. package/lib/imports/vinyl.bluedynamics.eu.js +169 -17
  10. package/lib/plone.js +1 -1
  11. package/lib/vinylcache.d.ts +21 -0
  12. package/lib/vinylcache.js +21 -2
  13. package/package.json +3 -2
  14. package/.claude/claude.md +0 -39
  15. package/.claude/settings.local.json +0 -31
  16. package/CLAUDE.md +0 -352
  17. package/docs/superpowers/plans/2026-06-12-configurable-service-spec.md +0 -608
  18. package/docs/superpowers/specs/2026-06-12-configurable-service-spec-design.md +0 -192
  19. package/documentation/Makefile +0 -357
  20. package/documentation/README.md +0 -284
  21. package/documentation/mx.ini +0 -3
  22. package/documentation/sources/_static/logo.svg +0 -79
  23. package/documentation/sources/conf.py +0 -145
  24. package/documentation/sources/explanation/architecture.md +0 -336
  25. package/documentation/sources/explanation/cdk8s-workflow.md +0 -66
  26. package/documentation/sources/explanation/features.md +0 -374
  27. package/documentation/sources/explanation/index.md +0 -34
  28. package/documentation/sources/how-to/backup-and-restore.md +0 -107
  29. package/documentation/sources/how-to/configure-env-and-secrets.md +0 -184
  30. package/documentation/sources/how-to/configure-ingress-tls.md +0 -108
  31. package/documentation/sources/how-to/configure-security-context.md +0 -143
  32. package/documentation/sources/how-to/deploy-blicca.md +0 -334
  33. package/documentation/sources/how-to/deploy-volto.md +0 -324
  34. package/documentation/sources/how-to/deploy-with-httpcache.md +0 -224
  35. package/documentation/sources/how-to/deploy-with-vinyl-cache.md +0 -273
  36. package/documentation/sources/how-to/enable-prometheus-monitoring.md +0 -122
  37. package/documentation/sources/how-to/index.md +0 -85
  38. package/documentation/sources/how-to/scale-and-high-availability.md +0 -122
  39. package/documentation/sources/how-to/schedule-pods.md +0 -145
  40. package/documentation/sources/how-to/setup-prerequisites.md +0 -363
  41. package/documentation/sources/how-to/troubleshooting.md +0 -113
  42. package/documentation/sources/how-to/upgrade-and-rollout.md +0 -140
  43. package/documentation/sources/index.md +0 -109
  44. package/documentation/sources/reference/api/index.md +0 -40
  45. package/documentation/sources/reference/configuration-options.md +0 -352
  46. package/documentation/sources/reference/index.md +0 -41
  47. package/documentation/sources/tutorials/01-quick-start.md +0 -165
  48. package/documentation/sources/tutorials/index.md +0 -53
  49. package/examples/blicca/.env.example +0 -20
  50. package/examples/blicca/README.md +0 -339
  51. package/examples/blicca/__snapshots__/main.test.ts.snap +0 -1035
  52. package/examples/blicca/cdk8s.yaml +0 -6
  53. package/examples/blicca/config/varnish.tpl.vcl +0 -217
  54. package/examples/blicca/ingress.ts +0 -217
  55. package/examples/blicca/jest.config.js +0 -11
  56. package/examples/blicca/main.test.ts +0 -18
  57. package/examples/blicca/main.ts +0 -101
  58. package/examples/blicca/package.json +0 -36
  59. package/examples/blicca/postgres.cloudnativepg.ts +0 -63
  60. package/examples/blicca/postgres.plain.ts +0 -115
  61. package/examples/blicca/tsconfig.json +0 -33
  62. package/examples/volto/.env.example +0 -21
  63. package/examples/volto/README.md +0 -292
  64. package/examples/volto/__snapshots__/main.test.ts.snap +0 -1206
  65. package/examples/volto/cdk8s.yaml +0 -6
  66. package/examples/volto/ingress.ts +0 -229
  67. package/examples/volto/jest.config.js +0 -11
  68. package/examples/volto/main.test.ts +0 -18
  69. package/examples/volto/main.ts +0 -105
  70. package/examples/volto/package.json +0 -36
  71. package/examples/volto/postgres.cloudnativepg.ts +0 -63
  72. package/examples/volto/postgres.plain.ts +0 -115
  73. package/examples/volto/tsconfig.json +0 -33
@@ -1,374 +0,0 @@
1
- ---
2
- myst:
3
- html_meta:
4
- "description": "Overview of cdk8s-plone features: deployment variants, high availability, caching, resource management, monitoring, and multi-language support."
5
- "property=og:description": "Overview of cdk8s-plone features: deployment variants, high availability, caching, resource management, monitoring, and multi-language support."
6
- "property=og:title": "Features"
7
- "keywords": "Plone, cdk8s, Kubernetes, features, Volto, Varnish, Prometheus"
8
- ---
9
-
10
- # Features
11
-
12
- Complete overview of cdk8s-plone features and capabilities.
13
-
14
- ## Core features
15
-
16
- (deployment-variants)=
17
-
18
- ### Deployment variants
19
-
20
- cdk8s-plone supports two deployment modes to match your requirements:
21
-
22
- **Volto (React single-page frontend)**
23
- - React-based user interface
24
- - Headless CMS architecture
25
- - Separate frontend and backend services
26
- - Best for: API-first architectures, SPA frontends
27
-
28
- **Blicca (server-side rendered Plone)**
29
- - The Plone backend renders the UI and serves HTML directly
30
- - Integrated single-service deployment
31
- - Best for: single-service setups, legacy migrations, existing add-ons
32
-
33
- Blicca is the new name for the variant Plone formerly called "Classic UI".
34
- Both are equally current; they differ in their rendering approach.
35
-
36
- See {doc}`architecture` for a deeper architectural comparison of the two variants.
37
-
38
- ### High availability
39
-
40
- **Configurable Replicas**
41
- - Set any number of replicas for backend and frontend
42
- - Default: 2 replicas per component
43
- - Supports horizontal scaling for increased capacity
44
-
45
- **Pod Disruption Budgets**
46
- - Ensures minimum availability during voluntary disruptions
47
- - Prevents too many pods being unavailable simultaneously
48
- - Configurable `minAvailable` or `maxUnavailable` thresholds
49
-
50
- **Example:**
51
- ```typescript
52
- backend: {
53
- replicas: 5,
54
- minAvailable: 3, // Keep at least 3 pods running
55
- }
56
- ```
57
-
58
- ### HTTP caching with Varnish
59
-
60
- cdk8s-plone supports two caching backends: the self-contained mittwald kube-httpcache Helm chart (`PloneHttpcache`) and the operator-managed cloud-vinyl VinylCache (`PloneVinylCache`).
61
-
62
- **kube-httpcache Integration (PloneHttpcache)**
63
- - Production-grade Varnish deployment, no operator required
64
- - Cluster-wide cache invalidation
65
- - Automatic invalidation on content changes
66
- - HTTP/2 support
67
-
68
- **cloud-vinyl VinylCache Integration (PloneVinylCache)**
69
- - Operator-managed Varnish via VinylCache custom resource
70
- - Structured VCL generation with snippet injection hooks
71
- - Built-in cache invalidation proxy (PURGE, BAN, xkey)
72
- - Requires the cloud-vinyl operator in the cluster
73
-
74
- **Benefits:**
75
- - Dramatically reduced backend load
76
- - Faster response times
77
- - Better scalability
78
- - Lower resource requirements
79
-
80
- **Monitoring:**
81
- - Built-in Prometheus exporter
82
- - Cache hit/miss metrics
83
- - Performance monitoring
84
-
85
- ### Resource management
86
-
87
- **Fine-Grained Control**
88
- - CPU requests and limits
89
- - Memory requests and limits
90
- - Per-component configuration
91
- - Kubernetes-native resource management
92
-
93
- **Example:**
94
- ```typescript
95
- backend: {
96
- requestCpu: '500m',
97
- limitCpu: '2',
98
- requestMemory: '512Mi',
99
- limitMemory: '2Gi',
100
- }
101
- ```
102
-
103
- ### Health monitoring
104
-
105
- **Readiness Probes**
106
- - Ensures pods are ready before receiving traffic
107
- - Configurable delays and thresholds
108
- - Enabled by default for backend
109
- - Prevents downtime during startup
110
-
111
- **Liveness Probes**
112
- - Automatic restart of unhealthy pods
113
- - Configurable for backend and frontend
114
- - Recommended for frontend to detect SSR hangs
115
- - Prevents stuck processes
116
-
117
- **Example:**
118
- ```typescript
119
- frontend: {
120
- livenessEnabled: true,
121
- livenessInitialDelaySeconds: 30,
122
- livenessFailureThreshold: 3,
123
- readinessEnabled: true,
124
- readinessInitialDelaySeconds: 10,
125
- }
126
- ```
127
-
128
- ### Environment configuration
129
-
130
- **Flexible Environment Variables**
131
- - Use cdk8s-plus-30 Env API
132
- - Support for values, ConfigMaps, and Secrets
133
- - Per-component environment configuration
134
-
135
- **Example:**
136
- ```typescript
137
- import { Env } from 'cdk8s-plus-30';
138
-
139
- backend: {
140
- environment: {
141
- variables: {
142
- SITE: Env.value('MySite'),
143
- DB_USER: Env.fromSecret('db-credentials', 'username'),
144
- CORS_ALLOW: Env.fromConfigMap('app-config', 'cors-origins'),
145
- },
146
- },
147
- }
148
- ```
149
-
150
- ### Kubernetes annotations
151
-
152
- **Three Levels of Annotations**
153
- - **Deployment annotations**: Metadata for the deployment resource
154
- - **Pod annotations**: Applied to pod templates (Prometheus, service mesh)
155
- - **Service annotations**: Applied to services (external-dns, load balancers)
156
-
157
- **Example:**
158
- ```typescript
159
- backend: {
160
- podAnnotations: {
161
- 'prometheus.io/scrape': 'true',
162
- 'prometheus.io/port': '8080',
163
- },
164
- serviceAnnotations: {
165
- 'external-dns.alpha.kubernetes.io/hostname': 'backend.example.com',
166
- },
167
- }
168
- ```
169
-
170
- ### Private registry support
171
-
172
- **Image Pull Secrets**
173
- - Support for private container registries
174
- - Multiple secrets supported
175
- - Applied to all deployments
176
-
177
- **Example:**
178
- ```typescript
179
- new Plone(chart, 'my-plone', {
180
- imagePullSecrets: ['docker-registry', 'gcr-registry'],
181
- backend: { image: 'private-registry.io/plone-backend:6.1.3' },
182
- })
183
- ```
184
-
185
- ## Multi-language support
186
-
187
- ### TypeScript and JavaScript
188
-
189
- **Native CDK8S experience**
190
- - Full TypeScript type definitions
191
- - IDE autocomplete and validation
192
- - Familiar syntax for web developers
193
-
194
- **Installation:**
195
- ```shell
196
- npm install @bluedynamics/cdk8s-plone
197
- ```
198
-
199
- **Example:**
200
- ```typescript
201
- import { Plone, PloneVariant } from '@bluedynamics/cdk8s-plone';
202
-
203
- new Plone(chart, 'my-plone', {
204
- variant: PloneVariant.VOLTO,
205
- backend: { image: 'plone/plone-backend:6.1.3' },
206
- });
207
- ```
208
-
209
- ### Python
210
-
211
- **JSII-generated bindings**
212
- - Pythonic API
213
- - Type hints support
214
- - Familiar syntax for Python developers
215
-
216
- **Installation:**
217
- ```shell
218
- pip install cdk8s-plone
219
- ```
220
-
221
- **Example:**
222
- ```python
223
- from cdk8s_plone import Plone, PloneVariant
224
-
225
- Plone(chart, "my-plone",
226
- variant=PloneVariant.VOLTO,
227
- backend={"image": "plone/plone-backend:6.1.3"}
228
- )
229
- ```
230
-
231
- ## Infrastructure as code benefits
232
-
233
- ### Type safety
234
-
235
- **Compile-time validation**
236
- - Catch configuration errors before deployment
237
- - IDE validation and autocomplete
238
- - Refactoring support
239
-
240
- **Example:**
241
- ```typescript
242
- // TypeScript catches this error at compile time
243
- backend: {
244
- image: 'plone/plone-backend:6.1.3',
245
- replicas: 'three', // ❌ Type error: Expected number
246
- }
247
- ```
248
-
249
- ### Reusability
250
-
251
- **Construct composition**
252
- - Create custom constructs
253
- - Encapsulate best practices
254
- - Share across projects
255
-
256
- **Example:**
257
- ```typescript
258
- class ProductionPlone extends Construct {
259
- constructor(scope: Construct, id: string) {
260
- super(scope, id);
261
-
262
- const plone = new Plone(this, 'plone', {
263
- variant: PloneVariant.VOLTO,
264
- backend: {
265
- replicas: 3,
266
- minAvailable: 2,
267
- requestCpu: '500m',
268
- limitCpu: '2',
269
- },
270
- });
271
-
272
- new PloneHttpcache(this, 'cache', {
273
- plone: plone,
274
- replicas: 2,
275
- });
276
- }
277
- }
278
- ```
279
-
280
- ### Testing
281
-
282
- **Unit testing**
283
- - Test infrastructure definitions
284
- - Validate resource creation
285
- - Catch regressions early
286
-
287
- **Example:**
288
- ```typescript
289
- test('creates backend deployment', () => {
290
- const chart = Testing.chart();
291
- new Plone(chart, 'test-plone', {
292
- backend: { image: 'plone/plone-backend:6.1.3' },
293
- });
294
-
295
- const results = Testing.synth(chart);
296
- expect(results).toMatchSnapshot();
297
- });
298
- ```
299
-
300
- ### Programmatic control
301
-
302
- **Dynamic configuration**
303
- - Use loops and conditionals
304
- - Environment-based configuration
305
- - Dynamic resource generation
306
-
307
- **Example:**
308
- ```typescript
309
- const environments = ['dev', 'staging', 'prod'];
310
-
311
- environments.forEach(env => {
312
- new Plone(chart, `plone-${env}`, {
313
- backend: {
314
- replicas: env === 'prod' ? 5 : 2,
315
- requestMemory: env === 'prod' ? '1Gi' : '512Mi',
316
- },
317
- });
318
- });
319
- ```
320
-
321
- ## Production-ready features
322
-
323
- ### Manifest generation
324
-
325
- **Standard Kubernetes YAML**
326
- - Generates standard Kubernetes manifests
327
- - No proprietary formats
328
- - Apply with `kubectl apply -f`
329
-
330
- **Output:**
331
- ```shell
332
- cdk8s synth
333
- # Creates dist/ directory with YAML files
334
- kubectl apply -f dist/
335
- ```
336
-
337
- ### Helm chart integration
338
-
339
- **PloneHttpcache uses Helm**
340
- - Leverages battle-tested kube-httpcache chart
341
- - Automatic updates available
342
- - Community-maintained
343
-
344
- ### Monitoring integration
345
-
346
- **Prometheus ready**
347
- - ServiceMonitor support for Varnish
348
- - Pod annotations for scraping
349
- - Standard metrics endpoints
350
-
351
- **Example:**
352
- ```typescript
353
- new PloneHttpcache(chart, 'cache', {
354
- plone: plone,
355
- servicemonitor: true, // Creates ServiceMonitor
356
- exporterEnabled: true, // Enables Prometheus exporter sidecar
357
- });
358
- ```
359
-
360
- ## Upcoming features
361
-
362
- Features planned for future releases:
363
-
364
- - **Backup Integration**: Automated backup configurations
365
- - **Monitoring Dashboards**: Pre-built Grafana dashboards
366
-
367
- **Note:** Ingress and TLS management are intentionally out of scope - these should be handled by your cluster's ingress controller and cert-manager. RelStorage with PostgreSQL is already supported through external database configuration (separation of concerns).
368
-
369
- ## See also
370
-
371
- - {doc}`architecture` — System architecture and design.
372
- - {doc}`/reference/configuration-options` — Complete configuration reference.
373
- - {doc}`/tutorials/01-quick-start` — Getting started tutorial.
374
- - [Example project](https://github.com/bluedynamics/cdk8s-plone-example) — Complete working example.
@@ -1,34 +0,0 @@
1
- ---
2
- myst:
3
- html_meta:
4
- "description": "Understanding-oriented discussion of cdk8s-plone concepts, architecture, and design decisions."
5
- "property=og:description": "Understanding-oriented discussion of cdk8s-plone concepts, architecture, and design decisions."
6
- "property=og:title": "Explanation"
7
- "keywords": "Plone, cdk8s, Kubernetes, architecture, design, concepts"
8
- ---
9
-
10
- # Explanation
11
-
12
- **Understanding-oriented discussion of concepts, architecture, and design decisions.**
13
-
14
- Explanation guides clarify and illuminate particular topics. They broaden the understanding of cdk8s-plone and help you make informed decisions about how to use it.
15
-
16
- ## Architecture and concepts
17
-
18
- ```{toctree}
19
- ---
20
- maxdepth: 1
21
- titlesonly: true
22
- ---
23
- features
24
- architecture
25
- cdk8s-workflow
26
- ```
27
-
28
- ---
29
-
30
- **Ready to get started?** Jump into the [Tutorials](../tutorials/index.md) for hands-on lessons.
31
-
32
- **Need to solve a problem?** See the [How-To Guides](../how-to/index.md) for task-oriented solutions.
33
-
34
- **Looking for specifications?** Check the [Reference](../reference/index.md) section for API documentation.
@@ -1,107 +0,0 @@
1
- ---
2
- myst:
3
- html_meta:
4
- "description": "Back up and restore a cdk8s-plone deployment by protecting the PostgreSQL database that holds the Plone content."
5
- "property=og:description": "Back up and restore a cdk8s-plone deployment by protecting the PostgreSQL database that holds the Plone content."
6
- "property=og:title": "Back up and restore"
7
- "keywords": "Plone, cdk8s, Kubernetes, backup, restore, PostgreSQL, CloudNativePG, pg_dump, RelStorage"
8
- ---
9
-
10
- # Back up and restore
11
-
12
- This guide shows you how to back up and restore a Plone deployment.
13
-
14
- `cdk8s-plone` does not run backups.
15
- It deploys the application; your data lives in PostgreSQL, so you protect the database.
16
-
17
- ## What to back up
18
-
19
- Plone stores its content in the ZODB, which this stack keeps in PostgreSQL through RelStorage.
20
- A backup of the PostgreSQL database is a backup of your site content.
21
-
22
- If your configuration keeps blobs on a separate volume rather than in the database, back up that volume as well.
23
- The application images and Kubernetes manifests are reproducible from your `cdk8s-plone` code, so they do not need a backup.
24
-
25
- ## Back up a CloudNativePG database
26
-
27
- CloudNativePG performs scheduled and on-demand backups to object storage through its own resources.
28
-
29
- Configure object-store backups on the `Cluster`, then schedule them with a `ScheduledBackup`:
30
-
31
- ```yaml
32
- apiVersion: postgresql.cnpg.io/v1
33
- kind: ScheduledBackup
34
- metadata:
35
- name: plone-daily
36
- spec:
37
- schedule: "0 0 2 * * *"
38
- backupOwnerReference: self
39
- cluster:
40
- name: <cluster-name>
41
- ```
42
-
43
- Take an immediate backup with a `Backup` resource:
44
-
45
- ```yaml
46
- apiVersion: postgresql.cnpg.io/v1
47
- kind: Backup
48
- metadata:
49
- name: plone-manual
50
- spec:
51
- cluster:
52
- name: <cluster-name>
53
- ```
54
-
55
- See the [CloudNativePG backup documentation](https://cloudnative-pg.io/documentation/current/backup/) for object-store credentials and retention policies.
56
-
57
- ## Back up a plain or standalone database
58
-
59
- For a database without an operator, take a logical dump with `pg_dump` from a client pod:
60
-
61
- ```shell
62
- kubectl exec -n <namespace> <postgres-pod> -- \
63
- pg_dump -U <user> -d <database> -Fc -f /tmp/plone.dump
64
- kubectl cp <namespace>/<postgres-pod>:/tmp/plone.dump ./plone.dump
65
- ```
66
-
67
- Run this on a schedule with a `CronJob`, and store the dump off-cluster.
68
-
69
- ## Restore
70
-
71
- For CloudNativePG, create a new `Cluster` with a `bootstrap.recovery` stanza that points at a backup, following the [CloudNativePG recovery guide](https://cloudnative-pg.io/documentation/current/recovery/).
72
-
73
- For a logical dump, restore into an empty database with `pg_restore`:
74
-
75
- ```shell
76
- kubectl cp ./plone.dump <namespace>/<postgres-pod>:/tmp/plone.dump
77
- kubectl exec -n <namespace> <postgres-pod> -- \
78
- pg_restore -U <user> -d <database> --clean --if-exists /tmp/plone.dump
79
- ```
80
-
81
- After the database is restored, restart the backend so it reconnects:
82
-
83
- ```shell
84
- kubectl rollout restart deployment/<backend-deployment> -n <namespace>
85
- ```
86
-
87
- ```{warning}
88
- Restoring overwrites the current database.
89
- Take a fresh backup before you restore, so you can return to the current state if the restore goes wrong.
90
- ```
91
-
92
- ## Verify
93
-
94
- Confirm a backup completed and is recent:
95
-
96
- ```shell
97
- kubectl get backup -n <namespace>
98
- kubectl get scheduledbackup -n <namespace>
99
- ```
100
-
101
- After a restore, open the site and confirm your content is present.
102
-
103
- ## See also
104
-
105
- - {doc}`/how-to/upgrade-and-rollout` — back up before a risky upgrade.
106
- - {doc}`/explanation/architecture` — where Plone stores its data.
107
- - [CloudNativePG documentation](https://cloudnative-pg.io/documentation/current/) — backup, recovery, and retention.
@@ -1,184 +0,0 @@
1
- ---
2
- myst:
3
- html_meta:
4
- "description": "Configure environment variables and secrets on Plone backend and frontend pods with cdk8s-plone using the cdk8s-plus Env API."
5
- "property=og:description": "Configure environment variables and secrets on Plone backend and frontend pods with cdk8s-plone using the cdk8s-plus Env API."
6
- "property=og:title": "Configure environment variables and secrets"
7
- "keywords": "Plone, cdk8s, Kubernetes, environment variables, secrets, ConfigMap, imagePullSecrets, Env"
8
- ---
9
-
10
- # Configure environment variables and secrets
11
-
12
- This guide shows you how to set environment variables on Plone backend and frontend pods and how to source sensitive values from Kubernetes Secrets and ConfigMaps.
13
- Use it to inject a RelStorage DSN, an admin password, or any runtime configuration without baking values into the image.
14
-
15
- ## Prerequisites
16
-
17
- - A working Plone deployment using `cdk8s-plone`.
18
- - Familiarity with the cdk8s-plus `Env` API and the `EnvValue` helpers it provides.
19
- - `kubectl` access to the target namespace for creating Secrets and ConfigMaps.
20
-
21
- ## Set a plain environment variable on the backend
22
-
23
- Pass an `environment` object to `backend`.
24
- Build each value with `Env.value` for a literal string.
25
-
26
- ```typescript
27
- import { Plone, PloneVariant } from '@bluedynamics/cdk8s-plone';
28
- import { Env } from 'cdk8s-plus-30';
29
-
30
- new Plone(chart, 'plone', {
31
- variant: PloneVariant.VOLTO,
32
- backend: {
33
- image: 'plone/plone-backend:6.1.3',
34
- environment: {
35
- variables: {
36
- PLONE_TIMEZONE: Env.value('Europe/Vienna'),
37
- ZSERVER_THREADS: Env.value('4'),
38
- },
39
- },
40
- },
41
- });
42
- ```
43
-
44
- The `environment` option is typed as the cdk8s-plus `Env` construct.
45
- Its `variables` map takes an `EnvValue` for every entry, so always wrap raw strings in `Env.value`.
46
-
47
- ## Reference a value from a Secret
48
-
49
- Store sensitive values such as a RelStorage DSN or an admin password in a Kubernetes Secret, then reference them with `Env.fromSecret`.
50
-
51
- First create the Secret in the cluster.
52
-
53
- ```shell
54
- kubectl create secret generic plone-backend-secrets \
55
- --namespace <namespace> \
56
- --from-literal=relstorage-dsn='dbname=plone host=db user=plone password=s3cret' \
57
- --from-literal=admin-password='change-me'
58
- ```
59
-
60
- Reference the existing Secret by name, then read individual keys from it.
61
-
62
- ```typescript
63
- import { Plone, PloneVariant } from '@bluedynamics/cdk8s-plone';
64
- import { Env, Secret } from 'cdk8s-plus-30';
65
-
66
- const backendSecret = Secret.fromSecretName(
67
- chart,
68
- 'backend-secret',
69
- 'plone-backend-secrets',
70
- );
71
-
72
- new Plone(chart, 'plone', {
73
- variant: PloneVariant.VOLTO,
74
- backend: {
75
- image: 'plone/plone-backend:6.1.3',
76
- environment: {
77
- variables: {
78
- RELSTORAGE_DSN: Env.fromSecret(backendSecret, 'relstorage-dsn'),
79
- ADMIN_PASSWORD: Env.fromSecret(backendSecret, 'admin-password'),
80
- },
81
- },
82
- },
83
- });
84
- ```
85
-
86
- `Env.fromSecret` renders a `secretKeyRef` in the pod template, so the value never appears in plain text in the synthesized manifest.
87
-
88
- ## Reference a value from a ConfigMap
89
-
90
- For non-sensitive configuration that you manage separately from the chart, read keys from a ConfigMap with `Env.fromConfigMap`.
91
-
92
- ```typescript
93
- import { Env, ConfigMap } from 'cdk8s-plus-30';
94
-
95
- const settings = ConfigMap.fromConfigMapName(
96
- chart,
97
- 'settings',
98
- 'plone-settings',
99
- );
100
-
101
- // inside backend.environment.variables:
102
- // LOG_LEVEL: Env.fromConfigMap(settings, 'log-level'),
103
- ```
104
-
105
- ## Set variables on the frontend
106
-
107
- The frontend accepts the same `environment` option as the backend.
108
-
109
- ```typescript
110
- import { Plone, PloneVariant } from '@bluedynamics/cdk8s-plone';
111
- import { Env } from 'cdk8s-plus-30';
112
-
113
- new Plone(chart, 'plone', {
114
- variant: PloneVariant.VOLTO,
115
- frontend: {
116
- image: 'plone/plone-frontend:16.0.0',
117
- environment: {
118
- variables: {
119
- RAZZLE_API_PATH: Env.value('https://plone.example.com/++api++'),
120
- },
121
- },
122
- },
123
- });
124
- ```
125
-
126
- The Volto frontend automatically injects `RAZZLE_INTERNAL_API_PATH` when you do not set it.
127
- Override it through `environment` only when your service topology requires a non-default internal address.
128
-
129
- ```typescript
130
- frontend: {
131
- image: 'plone/plone-frontend:16.0.0',
132
- environment: {
133
- variables: {
134
- RAZZLE_INTERNAL_API_PATH: Env.value('http://plone-backend:8080/Plone'),
135
- },
136
- },
137
- }
138
- ```
139
-
140
- ## Pull from a private registry
141
-
142
- Image registry credentials are not environment variables.
143
- List the names of existing pull secrets in the top-level `imagePullSecrets` option.
144
-
145
- ```typescript
146
- new Plone(chart, 'plone', {
147
- variant: PloneVariant.VOLTO,
148
- imagePullSecrets: ['my-registry-credentials'],
149
- backend: {
150
- image: 'registry.example.com/plone-backend:6.1.3',
151
- },
152
- frontend: {
153
- image: 'registry.example.com/plone-frontend:16.0.0',
154
- },
155
- });
156
- ```
157
-
158
- Create the pull secret beforehand with `kubectl create secret docker-registry <name>`.
159
-
160
- ## Verify
161
-
162
- Synthesize the manifests and inspect the rendered Deployment for the expected entries.
163
-
164
- ```shell
165
- cdk8s synth
166
-
167
- # Confirm literal values and secret references appear on the backend container
168
- grep -A 3 'RELSTORAGE_DSN' dist/*.yaml
169
- grep -B 1 -A 4 'secretKeyRef' dist/*.yaml
170
- ```
171
-
172
- A `secretKeyRef` block in the output confirms the value resolves at runtime from the Secret rather than being stored in the manifest.
173
- After applying, check that the variables reach the container.
174
-
175
- ```shell
176
- kubectl apply -f dist/
177
- kubectl exec -n <namespace> deployment/<plone-backend-deployment> -- env | grep RELSTORAGE_DSN
178
- ```
179
-
180
- ## See also
181
-
182
- - {doc}`/reference/api/index` — full construct and option reference.
183
- - {doc}`/reference/configuration-options` — guide to `environment` and `imagePullSecrets`.
184
- - {doc}`/how-to/configure-security-context` — harden the pods that run with these variables.