@bluedynamics/cdk8s-plone 0.3.1 → 0.3.3

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 (68) hide show
  1. package/.jsii +2 -2
  2. package/lib/config/plone-vinyl-backend-response.vcl +25 -0
  3. package/lib/config/plone-vinyl-recv.vcl +18 -0
  4. package/{examples/volto → lib}/config/varnish.tpl.vcl +1 -1
  5. package/lib/httpcache.js +1 -1
  6. package/lib/plone.js +1 -1
  7. package/lib/vinylcache.js +1 -1
  8. package/package.json +3 -2
  9. package/.claude/claude.md +0 -39
  10. package/.claude/settings.local.json +0 -31
  11. package/CLAUDE.md +0 -352
  12. package/docs/superpowers/plans/2026-06-12-configurable-service-spec.md +0 -608
  13. package/docs/superpowers/specs/2026-06-12-configurable-service-spec-design.md +0 -192
  14. package/documentation/Makefile +0 -357
  15. package/documentation/README.md +0 -284
  16. package/documentation/mx.ini +0 -3
  17. package/documentation/sources/_static/logo.svg +0 -79
  18. package/documentation/sources/conf.py +0 -145
  19. package/documentation/sources/explanation/architecture.md +0 -336
  20. package/documentation/sources/explanation/cdk8s-workflow.md +0 -66
  21. package/documentation/sources/explanation/features.md +0 -374
  22. package/documentation/sources/explanation/index.md +0 -34
  23. package/documentation/sources/how-to/backup-and-restore.md +0 -107
  24. package/documentation/sources/how-to/configure-env-and-secrets.md +0 -184
  25. package/documentation/sources/how-to/configure-ingress-tls.md +0 -108
  26. package/documentation/sources/how-to/configure-security-context.md +0 -143
  27. package/documentation/sources/how-to/deploy-blicca.md +0 -334
  28. package/documentation/sources/how-to/deploy-volto.md +0 -324
  29. package/documentation/sources/how-to/deploy-with-httpcache.md +0 -224
  30. package/documentation/sources/how-to/deploy-with-vinyl-cache.md +0 -273
  31. package/documentation/sources/how-to/enable-prometheus-monitoring.md +0 -122
  32. package/documentation/sources/how-to/index.md +0 -85
  33. package/documentation/sources/how-to/scale-and-high-availability.md +0 -122
  34. package/documentation/sources/how-to/schedule-pods.md +0 -145
  35. package/documentation/sources/how-to/setup-prerequisites.md +0 -363
  36. package/documentation/sources/how-to/troubleshooting.md +0 -113
  37. package/documentation/sources/how-to/upgrade-and-rollout.md +0 -140
  38. package/documentation/sources/index.md +0 -109
  39. package/documentation/sources/reference/api/index.md +0 -40
  40. package/documentation/sources/reference/configuration-options.md +0 -352
  41. package/documentation/sources/reference/index.md +0 -41
  42. package/documentation/sources/tutorials/01-quick-start.md +0 -165
  43. package/documentation/sources/tutorials/index.md +0 -53
  44. package/examples/blicca/.env.example +0 -20
  45. package/examples/blicca/README.md +0 -339
  46. package/examples/blicca/__snapshots__/main.test.ts.snap +0 -1035
  47. package/examples/blicca/cdk8s.yaml +0 -6
  48. package/examples/blicca/config/varnish.tpl.vcl +0 -217
  49. package/examples/blicca/ingress.ts +0 -217
  50. package/examples/blicca/jest.config.js +0 -11
  51. package/examples/blicca/main.test.ts +0 -18
  52. package/examples/blicca/main.ts +0 -101
  53. package/examples/blicca/package.json +0 -36
  54. package/examples/blicca/postgres.cloudnativepg.ts +0 -63
  55. package/examples/blicca/postgres.plain.ts +0 -115
  56. package/examples/blicca/tsconfig.json +0 -33
  57. package/examples/volto/.env.example +0 -21
  58. package/examples/volto/README.md +0 -292
  59. package/examples/volto/__snapshots__/main.test.ts.snap +0 -1206
  60. package/examples/volto/cdk8s.yaml +0 -6
  61. package/examples/volto/ingress.ts +0 -229
  62. package/examples/volto/jest.config.js +0 -11
  63. package/examples/volto/main.test.ts +0 -18
  64. package/examples/volto/main.ts +0 -105
  65. package/examples/volto/package.json +0 -36
  66. package/examples/volto/postgres.cloudnativepg.ts +0 -63
  67. package/examples/volto/postgres.plain.ts +0 -115
  68. package/examples/volto/tsconfig.json +0 -33
@@ -1,1206 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Production Volto Example Synthesizes correctly 1`] = `
4
- [
5
- {
6
- "apiVersion": "v1",
7
- "kind": "Secret",
8
- "metadata": {
9
- "labels": {
10
- "app.kubernetes.io/component": "database",
11
- "app.kubernetes.io/instance": "postgresql",
12
- "app.kubernetes.io/name": "plone-postgresql",
13
- "app.kubernetes.io/part-of": "plone",
14
- },
15
- "name": "test-chart-db-secret-c8d5f897",
16
- },
17
- "stringData": {
18
- "database": "plone",
19
- "password": "admin@plone",
20
- "username": "plone",
21
- },
22
- },
23
- {
24
- "apiVersion": "v1",
25
- "kind": "Service",
26
- "metadata": {
27
- "labels": {
28
- "app.kubernetes.io/component": "database",
29
- "app.kubernetes.io/instance": "postgresql",
30
- "app.kubernetes.io/name": "plone-postgresql",
31
- "app.kubernetes.io/part-of": "plone",
32
- },
33
- "name": "test-chart-db-service-c87c80f5",
34
- },
35
- "spec": {
36
- "ports": [
37
- {
38
- "name": "postgresql",
39
- "port": 5432,
40
- "targetPort": 5432,
41
- },
42
- ],
43
- "selector": {
44
- "app.kubernetes.io/component": "database",
45
- "app.kubernetes.io/instance": "postgresql",
46
- "app.kubernetes.io/name": "plone-postgresql",
47
- "app.kubernetes.io/part-of": "plone",
48
- },
49
- },
50
- },
51
- {
52
- "apiVersion": "apps/v1",
53
- "kind": "StatefulSet",
54
- "metadata": {
55
- "labels": {
56
- "app.kubernetes.io/component": "database",
57
- "app.kubernetes.io/instance": "postgresql",
58
- "app.kubernetes.io/name": "plone-postgresql",
59
- "app.kubernetes.io/part-of": "plone",
60
- },
61
- "name": "test-chart-db-c879c687",
62
- },
63
- "spec": {
64
- "replicas": 1,
65
- "selector": {
66
- "matchLabels": {
67
- "app.kubernetes.io/component": "database",
68
- "app.kubernetes.io/instance": "postgresql",
69
- "app.kubernetes.io/name": "plone-postgresql",
70
- "app.kubernetes.io/part-of": "plone",
71
- },
72
- },
73
- "serviceName": "test-chart-db-service-c87c80f5",
74
- "template": {
75
- "metadata": {
76
- "labels": {
77
- "app.kubernetes.io/component": "database",
78
- "app.kubernetes.io/instance": "postgresql",
79
- "app.kubernetes.io/name": "plone-postgresql",
80
- "app.kubernetes.io/part-of": "plone",
81
- },
82
- },
83
- "spec": {
84
- "containers": [
85
- {
86
- "env": [
87
- {
88
- "name": "POSTGRES_USER",
89
- "valueFrom": {
90
- "secretKeyRef": {
91
- "key": "username",
92
- "name": "test-chart-db-secret-c8d5f897",
93
- },
94
- },
95
- },
96
- {
97
- "name": "POSTGRES_PASSWORD",
98
- "valueFrom": {
99
- "secretKeyRef": {
100
- "key": "password",
101
- "name": "test-chart-db-secret-c8d5f897",
102
- },
103
- },
104
- },
105
- {
106
- "name": "POSTGRES_DB",
107
- "valueFrom": {
108
- "secretKeyRef": {
109
- "key": "database",
110
- "name": "test-chart-db-secret-c8d5f897",
111
- },
112
- },
113
- },
114
- {
115
- "name": "PGDATA",
116
- "value": "/var/lib/postgresql/data/pgdata",
117
- },
118
- ],
119
- "image": "postgres:18",
120
- "livenessProbe": {
121
- "exec": {
122
- "command": [
123
- "pg_isready",
124
- "-U",
125
- "plone",
126
- "-d",
127
- "plone",
128
- ],
129
- },
130
- "initialDelaySeconds": 30,
131
- "periodSeconds": 15,
132
- "timeoutSeconds": 5,
133
- },
134
- "name": "postgresql",
135
- "ports": [
136
- {
137
- "containerPort": 5432,
138
- "name": "postgresql",
139
- },
140
- ],
141
- "readinessProbe": {
142
- "exec": {
143
- "command": [
144
- "pg_isready",
145
- "-U",
146
- "plone",
147
- "-d",
148
- "plone",
149
- ],
150
- },
151
- "initialDelaySeconds": 10,
152
- "periodSeconds": 10,
153
- "timeoutSeconds": 5,
154
- },
155
- "resources": {
156
- "limits": {
157
- "cpu": "1",
158
- "memory": "1Gi",
159
- },
160
- "requests": {
161
- "cpu": "100m",
162
- "memory": "256Mi",
163
- },
164
- },
165
- "volumeMounts": [
166
- {
167
- "mountPath": "/var/lib/postgresql/data",
168
- "name": "data",
169
- },
170
- ],
171
- },
172
- ],
173
- "securityContext": {
174
- "fsGroup": 999,
175
- },
176
- },
177
- },
178
- "volumeClaimTemplates": [
179
- {
180
- "metadata": {
181
- "labels": {
182
- "app.kubernetes.io/component": "database",
183
- "app.kubernetes.io/instance": "postgresql",
184
- "app.kubernetes.io/name": "plone-postgresql",
185
- "app.kubernetes.io/part-of": "plone",
186
- },
187
- "name": "data",
188
- },
189
- "spec": {
190
- "accessModes": [
191
- "ReadWriteOnce",
192
- ],
193
- "resources": {
194
- "requests": {
195
- "storage": "10Gi",
196
- },
197
- },
198
- },
199
- },
200
- ],
201
- },
202
- },
203
- {
204
- "apiVersion": "apps/v1",
205
- "kind": "Deployment",
206
- "metadata": {
207
- "labels": {
208
- "app.kubernetes.io/component": "backend",
209
- "app.kubernetes.io/name": "plone-backend-deployment",
210
- },
211
- "name": "test-chart-plone-backend-deployment-c8a3055e",
212
- },
213
- "spec": {
214
- "replicas": 2,
215
- "selector": {
216
- "matchLabels": {
217
- "app": "test-chart-plone-backend-c8848738",
218
- },
219
- },
220
- "template": {
221
- "metadata": {
222
- "labels": {
223
- "app": "test-chart-plone-backend-c8848738",
224
- "app.kubernetes.io/component": "backend",
225
- "app.kubernetes.io/managed-by": "cdk8s-plone",
226
- "app.kubernetes.io/name": "plone-backend",
227
- "app.kubernetes.io/part-of": "plone",
228
- "app.kubernetes.io/version": "test.version",
229
- },
230
- },
231
- "spec": {
232
- "containers": [
233
- {
234
- "env": [
235
- {
236
- "name": "SECRET_POSTGRESQL_USERNAME",
237
- "valueFrom": {
238
- "secretKeyRef": {
239
- "key": "username",
240
- "name": "test-chart-db-secret-c8d5f897",
241
- },
242
- },
243
- },
244
- {
245
- "name": "SECRET_POSTGRESQL_PASSWORD",
246
- "valueFrom": {
247
- "secretKeyRef": {
248
- "key": "password",
249
- "name": "test-chart-db-secret-c8d5f897",
250
- },
251
- },
252
- },
253
- {
254
- "name": "INSTANCE_db_storage",
255
- "value": "relstorage",
256
- },
257
- {
258
- "name": "INSTANCE_db_blob_mode",
259
- "value": "cache",
260
- },
261
- {
262
- "name": "INSTANCE_db_cache_size",
263
- "value": "5000",
264
- },
265
- {
266
- "name": "INSTANCE_db_cache_size_bytes",
267
- "value": "1500MB",
268
- },
269
- {
270
- "name": "INSTANCE_db_relstorage",
271
- "value": "postgresql",
272
- },
273
- {
274
- "name": "INSTANCE_db_relstorage_postgresql_dsn",
275
- "value": "host='test-chart-db-service-c87c80f5' dbname='plone' user='$(SECRET_POSTGRESQL_USERNAME)' password='$(SECRET_POSTGRESQL_PASSWORD)'",
276
- },
277
- {
278
- "name": "INSTANCE_db_relstorage_cache_local_mb",
279
- "value": "800",
280
- },
281
- ],
282
- "envFrom": [],
283
- "image": "plone/plone-backend:6.1.3",
284
- "imagePullPolicy": "IfNotPresent",
285
- "name": "backend-container",
286
- "readinessProbe": {
287
- "failureThreshold": 3,
288
- "httpGet": {
289
- "path": "/",
290
- "port": 8080,
291
- },
292
- "initialDelaySeconds": 10,
293
- "periodSeconds": 10,
294
- "successThreshold": 1,
295
- "timeoutSeconds": 15,
296
- },
297
- "resources": {
298
- "limits": {
299
- "cpu": "500m",
300
- "memory": "512Mi",
301
- },
302
- "requests": {
303
- "cpu": "200m",
304
- "memory": "256Mi",
305
- },
306
- },
307
- },
308
- ],
309
- "imagePullSecrets": [],
310
- },
311
- },
312
- },
313
- },
314
- {
315
- "apiVersion": "policy/v1",
316
- "kind": "PodDisruptionBudget",
317
- "metadata": {
318
- "labels": {
319
- "app.kubernetes.io/managed-by": "cdk8s-plone",
320
- "app.kubernetes.io/part-of": "plone",
321
- },
322
- "name": "test-chart-plone-backend-pdb-c8a5ffa9",
323
- },
324
- "spec": {
325
- "minAvailable": 1,
326
- "selector": {
327
- "matchLabels": {
328
- "app": "test-chart-plone-backend-c8848738",
329
- },
330
- },
331
- "unhealthyPodEvictionPolicy": "AlwaysAllow",
332
- },
333
- },
334
- {
335
- "apiVersion": "v1",
336
- "kind": "Service",
337
- "metadata": {
338
- "labels": {
339
- "app.kubernetes.io/component": "service",
340
- "app.kubernetes.io/managed-by": "cdk8s-plone",
341
- "app.kubernetes.io/name": "plone-backend-service",
342
- "app.kubernetes.io/part-of": "plone",
343
- },
344
- "name": "test-chart-plone-backend-service-c81ad65d",
345
- },
346
- "spec": {
347
- "ports": [
348
- {
349
- "name": "backend-http",
350
- "port": 8080,
351
- "targetPort": 8080,
352
- },
353
- ],
354
- "selector": {
355
- "app": "test-chart-plone-backend-c8848738",
356
- },
357
- },
358
- },
359
- {
360
- "apiVersion": "apps/v1",
361
- "kind": "Deployment",
362
- "metadata": {
363
- "labels": {
364
- "app.kubernetes.io/component": "frontend",
365
- "app.kubernetes.io/name": "plone-frontend-deployment",
366
- },
367
- "name": "test-chart-plone-frontend-deployment-c83abfa4",
368
- },
369
- "spec": {
370
- "replicas": 2,
371
- "selector": {
372
- "matchLabels": {
373
- "app": "test-chart-plone-frontend-c8e96701",
374
- },
375
- },
376
- "template": {
377
- "metadata": {
378
- "labels": {
379
- "app": "test-chart-plone-frontend-c8e96701",
380
- "app.kubernetes.io/component": "frontend",
381
- "app.kubernetes.io/managed-by": "cdk8s-plone",
382
- "app.kubernetes.io/name": "plone-frontend",
383
- "app.kubernetes.io/part-of": "plone",
384
- "app.kubernetes.io/version": "test.version",
385
- },
386
- },
387
- "spec": {
388
- "containers": [
389
- {
390
- "env": [
391
- {
392
- "name": "RAZZLE_INTERNAL_API_PATH",
393
- "value": "http://test-chart-plone-backend-service-c81ad65d:8080/Plone",
394
- },
395
- ],
396
- "envFrom": [],
397
- "image": "plone/plone-frontend:latest",
398
- "imagePullPolicy": "IfNotPresent",
399
- "name": "frontend-container",
400
- "resources": {
401
- "limits": {
402
- "cpu": "500m",
403
- "memory": "1Gi",
404
- },
405
- "requests": {
406
- "cpu": "200m",
407
- "memory": "256Mi",
408
- },
409
- },
410
- },
411
- ],
412
- "imagePullSecrets": [],
413
- },
414
- },
415
- },
416
- },
417
- {
418
- "apiVersion": "policy/v1",
419
- "kind": "PodDisruptionBudget",
420
- "metadata": {
421
- "labels": {
422
- "app.kubernetes.io/managed-by": "cdk8s-plone",
423
- "app.kubernetes.io/part-of": "plone",
424
- },
425
- "name": "test-chart-plone-frontend-pdb-c8069ea0",
426
- },
427
- "spec": {
428
- "minAvailable": 1,
429
- "selector": {
430
- "matchLabels": {
431
- "app": "test-chart-plone-frontend-c8e96701",
432
- },
433
- },
434
- "unhealthyPodEvictionPolicy": "AlwaysAllow",
435
- },
436
- },
437
- {
438
- "apiVersion": "v1",
439
- "kind": "Service",
440
- "metadata": {
441
- "labels": {
442
- "app.kubernetes.io/component": "service",
443
- "app.kubernetes.io/managed-by": "cdk8s-plone",
444
- "app.kubernetes.io/name": "plone-frontend-service",
445
- "app.kubernetes.io/part-of": "plone",
446
- },
447
- "name": "test-chart-plone-frontend-service-c874cc1a",
448
- },
449
- "spec": {
450
- "ports": [
451
- {
452
- "name": "frontend-http",
453
- "port": 3000,
454
- "targetPort": 3000,
455
- },
456
- ],
457
- "selector": {
458
- "app": "test-chart-plone-frontend-c8e96701",
459
- },
460
- },
461
- },
462
- {
463
- "apiVersion": "policy/v1",
464
- "kind": "PodDisruptionBudget",
465
- "metadata": {
466
- "labels": {
467
- "app.kubernetes.io/instance": "test-chart-httpcache-c89dd29d",
468
- "app.kubernetes.io/managed-by": "Helm",
469
- "app.kubernetes.io/name": "kube-httpcache",
470
- "app.kubernetes.io/version": "v0.9.1",
471
- "helm.sh/chart": "kube-httpcache-0.9.1",
472
- },
473
- "name": "test-chart-httpcache-c89dd29d-kube-httpcache",
474
- },
475
- "spec": {
476
- "maxUnavailable": 1,
477
- "selector": {
478
- "matchLabels": {
479
- "app.kubernetes.io/instance": "test-chart-httpcache-c89dd29d",
480
- "app.kubernetes.io/name": "kube-httpcache",
481
- },
482
- },
483
- },
484
- },
485
- {
486
- "apiVersion": "v1",
487
- "kind": "ServiceAccount",
488
- "metadata": {
489
- "labels": {
490
- "app.kubernetes.io/instance": "test-chart-httpcache-c89dd29d",
491
- "app.kubernetes.io/managed-by": "Helm",
492
- "app.kubernetes.io/name": "kube-httpcache",
493
- "app.kubernetes.io/version": "v0.9.1",
494
- "helm.sh/chart": "kube-httpcache-0.9.1",
495
- },
496
- "name": "test-chart-httpcache-c89dd29d-kube-httpcache",
497
- },
498
- },
499
- {
500
- "apiVersion": "v1",
501
- "data": {
502
- "secret": "<redacted-for-snapshot>",
503
- },
504
- "kind": "Secret",
505
- "metadata": {
506
- "labels": {
507
- "app.kubernetes.io/instance": "test-chart-httpcache-c89dd29d",
508
- "app.kubernetes.io/managed-by": "Helm",
509
- "app.kubernetes.io/name": "kube-httpcache",
510
- "app.kubernetes.io/version": "v0.9.1",
511
- "helm.sh/chart": "kube-httpcache-0.9.1",
512
- },
513
- "name": "test-chart-httpcache-c89dd29d-kube-httpcache",
514
- },
515
- "type": "Opaque",
516
- },
517
- {
518
- "apiVersion": "v1",
519
- "data": {
520
- "default.vcl.tmpl": "vcl 4.0;
521
-
522
- import std;
523
- import directors;
524
-
525
- probe ploneBackendProbe {
526
- .url = "/ok";
527
- .timeout = 5s;
528
- .interval = 15s;
529
- .window = 10;
530
- .threshold = 8;
531
- # .initial = 3;
532
- }
533
- backend ploneBackend {
534
- .host = "{{ .Env.BACKEND_SERVICE_NAME }}";
535
- .port = "{{ .Env.BACKEND_SERVICE_PORT }}";
536
- .probe = ploneBackendProbe;
537
- .connect_timeout = 0.5s;
538
- .first_byte_timeout = 120s;
539
- .between_bytes_timeout = 60s;
540
- }
541
-
542
- probe ploneFrontendProbe {
543
- .url = "/ok";
544
- .timeout = 5s;
545
- .interval = 15s;
546
- .window = 10;
547
- .threshold = 8;
548
- # .initial = 3;
549
- }
550
- backend ploneFrontend {
551
- .host = "{{ .Env.FRONTEND_SERVICE_NAME }}";
552
- .port = "{{ .Env.FRONTEND_SERVICE_PORT }}";
553
- .probe = ploneFrontendProbe;
554
- .connect_timeout = 0.5s;
555
- .first_byte_timeout = 120s;
556
- .between_bytes_timeout = 60s;
557
- }
558
-
559
- /* Only allow PURGE from kubernetes network */
560
- acl purge {
561
- "10.0.0.0/8";
562
- }
563
-
564
- sub detect_debug{
565
- # Requests with X-Varnish-Debug will display additional
566
- # information about requests
567
- unset req.http.x-vcl-debug;
568
- # Should be changed after switch to live
569
- #if (req.http.x-varnish-debug) {
570
- # set req.http.x-vcl-debug = false;
571
- #}
572
- set req.http.x-vcl-debug = true;
573
- }
574
-
575
- sub detect_auth{
576
- unset req.http.x-auth;
577
- if (
578
- (req.http.Cookie && (
579
- req.http.Cookie ~ "__ac(_(name|password|persistent))?=" || req.http.Cookie ~ "_ZopeId" || req.http.Cookie ~ "auth_token")) ||
580
- (req.http.Authenticate) ||
581
- (req.http.Authorization)
582
- ) {
583
- set req.http.x-auth = true;
584
- }
585
- }
586
-
587
- sub detect_requesttype{
588
- unset req.http.x-varnish-reqtype;
589
- set req.http.x-varnish-reqtype = "Default";
590
- if (req.http.x-auth){
591
- set req.http.x-varnish-reqtype = "auth";
592
- } elseif (req.url ~ "\\/@@(images|download|)\\/?(.*)?$"){
593
- set req.http.x-varnish-reqtype = "blob";
594
- } elseif (req.url ~ "\\/\\+\\+api\\+\\+/?(.*)?$") {
595
- set req.http.x-varnish-reqtype = "api";
596
- } else {
597
- set req.http.x-varnish-reqtype = "express";
598
- }
599
- }
600
-
601
- sub process_redirects{
602
- if (req.http.x-redirect-to) {
603
- return (synth(301, req.http.x-redirect-to));
604
- }
605
- }
606
-
607
- sub vcl_init {
608
- new lbPloneBackend = directors.round_robin();
609
- lbPloneBackend.add_backend(ploneBackend);
610
-
611
- new lbPloneFrontend = directors.round_robin();
612
- lbPloneFrontend.add_backend(ploneFrontend);
613
- }
614
-
615
- sub vcl_recv {
616
- # Annotate request with x-vcl-debug
617
- call detect_debug;
618
-
619
- # Annotate request with x-auth indicating if request is authenticated or not
620
- call detect_auth;
621
-
622
- # Annotate request with x-varnish-reqtype with a classification for the request
623
- call detect_requesttype;
624
-
625
- # Process redirects
626
- call process_redirects;
627
-
628
- # Routing: set the current Varnish backend to the matching Plone backend
629
- # Attention:
630
- # Confusing wording, we have two possible Varnish backends: the Plone frontend and the Plone backend *sigh*
631
- if ((req.url ~ "^/\\+\\+api\\+\\+") || (req.http.x-varnish-reqtype ~ "blob")) {
632
- set req.http.x-vcl-plone = "Backend";
633
- set req.backend_hint = lbPloneBackend.backend();
634
- # here we need a rewrite to add the virtualhost part of the URL for the Plone Backend
635
- set req.http.x-vcl-proto = "http";
636
- if (req.http.X-Forwarded-Proto) {
637
- set req.http.x-vcl-proto = req.http.X-Forwarded-Proto;
638
- }
639
- set req.url = "/VirtualHostBase/" + req.http.x-vcl-proto + "/" + req.http.host + "/Plone/VirtualHostRoot" + req.url;
640
- } else {
641
- set req.http.x-vcl-plone = "Frontend";
642
- set req.backend_hint = lbPloneFrontend.backend();
643
- }
644
-
645
- # short cut authenticated requests to pass
646
- if (req.http.x-auth) {
647
- return(pass);
648
- }
649
-
650
- # Sanitize cookies so they do not needlessly destroy cacheability for anonymous pages
651
- if (req.http.Cookie) {
652
- set req.http.Cookie = ";" + req.http.Cookie;
653
- set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");
654
- set req.http.Cookie = regsuball(req.http.Cookie, ";(sticky|I18N_LANGUAGE|statusmessages|__ac|_ZopeId|__cp|beaker\\.session|authomatic|serverid|__rf|auth_token)=", "; \\1=");
655
- set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
656
- set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");
657
-
658
- if (req.http.Cookie == "") {
659
- unset req.http.Cookie;
660
- }
661
- }
662
-
663
- # Handle the different request types
664
- if (req.method == "PURGE") {
665
- if (!client.ip ~ purge) {
666
- return (synth(405, "Not allowed."));
667
- } else {
668
- ban("req.url == " + req.url);
669
- return (synth(200, "Purged."));
670
- }
671
-
672
- } elseif (req.method == "BAN") {
673
- # Same ACL check as above:
674
- if (!client.ip ~ purge) {
675
- return (synth(405, "Not allowed."));
676
- }
677
- ban("req.http.host == " + req.http.host + "&& req.url == " + req.url);
678
- # Throw a synthetic page so the
679
- # request won't go to the backend.
680
- return (synth(200, "Ban added"));
681
-
682
- } elseif (req.method != "GET" &&
683
- req.method != "HEAD" &&
684
- req.method != "PUT" &&
685
- req.method != "POST" &&
686
- req.method != "PATCH" &&
687
- req.method != "TRACE" &&
688
- req.method != "OPTIONS" &&
689
- req.method != "DELETE") {
690
- /* Non-RFC2616 or CONNECT which is weird. */
691
- return (pipe);
692
- } elseif (req.method != "GET" &&
693
- req.method != "HEAD" &&
694
- req.method != "OPTIONS") {
695
- /* POST, PUT, PATCH will pass, always */
696
- return(pass);
697
- }
698
-
699
- return(hash);
700
- }
701
-
702
- sub vcl_pipe {
703
- /* This is not necessary if you do not do any request rewriting. */
704
- set req.http.connection = "close";
705
- }
706
-
707
- sub vcl_purge {
708
- return (synth(200, "PURGE: " + req.url + " - " + req.hash));
709
- }
710
-
711
- sub vcl_synth {
712
- if (resp.status == 301) {
713
- set resp.http.location = resp.reason;
714
- set resp.reason = "Moved";
715
- return (deliver);
716
- }
717
- }
718
-
719
- sub vcl_hit {
720
- if (obj.ttl >= 0s) {
721
- // A pure unadulterated hit, deliver it
722
- return (deliver);
723
- } elsif (obj.ttl + obj.grace > 0s) {
724
- // Object is in grace, deliver it
725
- // Automatically triggers a background fetch
726
- return (deliver);
727
- } else {
728
- return (restart);
729
- }
730
- }
731
-
732
-
733
- sub vcl_backend_response {
734
- # Annotate request with info about the backend used
735
- set beresp.http.x-varnish-plone-part = bereq.http.x-vcl-plone;
736
- # set beresp.http.x-varnish-plone-proto = bereq.http.x-vcl-proto;
737
- # set beresp.http.x-varnish-plone-host = bereq.http.x-vcl-host;
738
- # Don't allow static files to set cookies.
739
- # (?i) denotes case insensitive in PCRE (perl compatible regular expressions).
740
- # make sure you edit both and keep them equal.
741
- if (bereq.url ~ "(?i)\\.(pdf|asc|dat|txt|doc|xls|ppt|tgz|png|gif|jpeg|jpg|ico|swf|css|js)(\\?.*)?$") {
742
- unset beresp.http.set-cookie;
743
- }
744
- if (beresp.http.Set-Cookie) {
745
- set beresp.http.x-varnish-action = "FETCH (pass - response sets cookie)";
746
- set beresp.uncacheable = true;
747
- set beresp.ttl = 120s;
748
- return(deliver);
749
- }
750
- if (beresp.http.Cache-Control ~ "(private|no-cache|no-store)") {
751
- set beresp.http.x-varnish-action = "FETCH (pass - cache control disallows)";
752
- set beresp.uncacheable = true;
753
- set beresp.ttl = 120s;
754
- return(deliver);
755
- }
756
-
757
- # if (beresp.http.Authorization && !beresp.http.Cache-Control ~ "public") {
758
- # Do NOT cache if there is an "Authorization" header
759
- # beresp never has an Authorization header in beresp, right?
760
- if (beresp.http.Authorization) {
761
- set beresp.http.x-varnish-action = "FETCH (pass - authorized and no public cache control)";
762
- set beresp.uncacheable = true;
763
- set beresp.ttl = 120s;
764
- return(deliver);
765
- }
766
-
767
- # Use this rule IF no cache-control (SSR content)
768
- if ((bereq.http.x-varnish-reqtype ~ "express") && (!beresp.http.Cache-Control)) {
769
- set beresp.http.x-varnish-action = "INSERT (30s caching / 60s grace)";
770
- set beresp.uncacheable = false;
771
- set beresp.ttl = 30s;
772
- set beresp.grace = 60s;
773
- return(deliver);
774
- }
775
-
776
- if (!beresp.http.Cache-Control) {
777
- set beresp.http.x-varnish-action = "FETCH (override - backend not setting cache control)";
778
- set beresp.uncacheable = true;
779
- set beresp.ttl = 120s;
780
- return (deliver);
781
- }
782
-
783
- if (beresp.http.X-Anonymous && !beresp.http.Cache-Control) {
784
- set beresp.http.x-varnish-action = "FETCH (override - anonymous backend not setting cache control)";
785
- set beresp.ttl = 600s;
786
- return (deliver);
787
- }
788
-
789
- set beresp.http.x-varnish-action = "FETCH (insert)";
790
- return (deliver);
791
- }
792
-
793
- sub vcl_deliver {
794
-
795
- if (req.http.x-vcl-debug) {
796
- set resp.http.x-varnish-ttl = obj.ttl;
797
- set resp.http.x-varnish-grace = obj.grace;
798
- set resp.http.x-hits = obj.hits;
799
- set resp.http.x-varnish-reqtype = req.http.x-varnish-reqtype;
800
- if (req.http.x-auth) {
801
- set resp.http.x-auth = "Logged-in";
802
- } else {
803
- set resp.http.x-auth = "Anon";
804
- }
805
- if (obj.hits > 0) {
806
- set resp.http.x-cache = "HIT";
807
- } else {
808
- set resp.http.x-cache = "MISS";
809
- }
810
- } else {
811
- unset resp.http.x-varnish-action;
812
- unset resp.http.x-cache-operation;
813
- unset resp.http.x-cache-rule;
814
- unset resp.http.x-powered-by;
815
- }
816
- }
817
- ",
818
- },
819
- "kind": "ConfigMap",
820
- "metadata": {
821
- "name": "test-chart-httpcache-c89dd29d-kube-httpcache",
822
- },
823
- },
824
- {
825
- "apiVersion": "rbac.authorization.k8s.io/v1",
826
- "kind": "Role",
827
- "metadata": {
828
- "name": "test-chart-httpcache-c89dd29d-kube-httpcache",
829
- },
830
- "rules": [
831
- {
832
- "apiGroups": [
833
- "",
834
- ],
835
- "resources": [
836
- "endpoints",
837
- "pods",
838
- ],
839
- "verbs": [
840
- "watch",
841
- "get",
842
- ],
843
- },
844
- ],
845
- },
846
- {
847
- "apiVersion": "rbac.authorization.k8s.io/v1",
848
- "kind": "RoleBinding",
849
- "metadata": {
850
- "labels": {
851
- "app.kubernetes.io/instance": "test-chart-httpcache-c89dd29d",
852
- "app.kubernetes.io/managed-by": "Helm",
853
- "app.kubernetes.io/name": "kube-httpcache",
854
- "app.kubernetes.io/version": "v0.9.1",
855
- "helm.sh/chart": "kube-httpcache-0.9.1",
856
- },
857
- "name": "test-chart-httpcache-c89dd29d-kube-httpcache",
858
- },
859
- "roleRef": {
860
- "apiGroup": "rbac.authorization.k8s.io",
861
- "kind": "Role",
862
- "name": "test-chart-httpcache-c89dd29d-kube-httpcache",
863
- },
864
- "subjects": [
865
- {
866
- "kind": "ServiceAccount",
867
- "name": "test-chart-httpcache-c89dd29d-kube-httpcache",
868
- },
869
- ],
870
- },
871
- {
872
- "apiVersion": "v1",
873
- "kind": "Service",
874
- "metadata": {
875
- "labels": {
876
- "app.kubernetes.io/instance": "test-chart-httpcache-c89dd29d",
877
- "app.kubernetes.io/managed-by": "Helm",
878
- "app.kubernetes.io/name": "kube-httpcache",
879
- "app.kubernetes.io/version": "v0.9.1",
880
- "helm.sh/chart": "kube-httpcache-0.9.1",
881
- },
882
- "name": "test-chart-httpcache-c89dd29d-kube-httpcache",
883
- },
884
- "spec": {
885
- "ports": [
886
- {
887
- "name": "http",
888
- "port": 80,
889
- "protocol": "TCP",
890
- "targetPort": 8080,
891
- },
892
- {
893
- "name": "signaller",
894
- "port": 8090,
895
- "targetPort": 8090,
896
- },
897
- {
898
- "name": "metrics",
899
- "port": 9131,
900
- "targetPort": 9131,
901
- },
902
- ],
903
- "selector": {
904
- "app.kubernetes.io/instance": "test-chart-httpcache-c89dd29d",
905
- "app.kubernetes.io/name": "kube-httpcache",
906
- },
907
- "type": "ClusterIP",
908
- },
909
- },
910
- {
911
- "apiVersion": "apps/v1",
912
- "kind": "StatefulSet",
913
- "metadata": {
914
- "labels": {
915
- "app.kubernetes.io/instance": "test-chart-httpcache-c89dd29d",
916
- "app.kubernetes.io/managed-by": "Helm",
917
- "app.kubernetes.io/name": "kube-httpcache",
918
- "app.kubernetes.io/version": "v0.9.1",
919
- "helm.sh/chart": "kube-httpcache-0.9.1",
920
- },
921
- "name": "test-chart-httpcache-c89dd29d-kube-httpcache",
922
- },
923
- "spec": {
924
- "replicas": 2,
925
- "selector": {
926
- "matchLabels": {
927
- "app.kubernetes.io/instance": "test-chart-httpcache-c89dd29d",
928
- "app.kubernetes.io/name": "kube-httpcache",
929
- },
930
- },
931
- "serviceName": "test-chart-httpcache-c89dd29d-kube-httpcache",
932
- "template": {
933
- "metadata": {
934
- "labels": {
935
- "app.kubernetes.io/instance": "test-chart-httpcache-c89dd29d",
936
- "app.kubernetes.io/name": "kube-httpcache",
937
- },
938
- },
939
- "spec": {
940
- "containers": [
941
- {
942
- "args": [
943
- "-admin-addr=0.0.0.0",
944
- "-admin-port=6083",
945
- "-signaller-enable",
946
- "-signaller-port=8090",
947
- "-frontend-port=8080",
948
- "-frontend-watch=false",
949
- "-frontend-namespace=$(NAMESPACE)",
950
- "-frontend-service=test-chart-httpcache-c89dd29d-kube-httpcache",
951
- "-backend-watch",
952
- "-backend-namespace=$(NAMESPACE)",
953
- "-backend-service=test-chart-plone-backend-service-c81ad65d",
954
- "-varnish-secret-file=/etc/varnish/k8s-secret/secret",
955
- "-varnish-vcl-template=/etc/varnish/tmpl/default.vcl.tmpl",
956
- "-varnish-storage=malloc,128M",
957
- "-varnish-vcl-template-poll",
958
- "-backend-portname=backend-http",
959
- ],
960
- "env": [
961
- {
962
- "name": "NAMESPACE",
963
- "valueFrom": {
964
- "fieldRef": {
965
- "fieldPath": "metadata.namespace",
966
- },
967
- },
968
- },
969
- {
970
- "name": "BACKEND_SERVICE_NAME",
971
- "value": "test-chart-plone-backend-service-c81ad65d",
972
- },
973
- {
974
- "name": "BACKEND_SERVICE_PORT",
975
- "value": "8080",
976
- },
977
- {
978
- "name": "BACKEND_SITE_ID",
979
- "value": "Plone",
980
- },
981
- {
982
- "name": "FRONTEND_SERVICE_NAME",
983
- "value": "test-chart-plone-frontend-service-c874cc1a",
984
- },
985
- {
986
- "name": "FRONTEND_SERVICE_PORT",
987
- "value": "3000",
988
- },
989
- ],
990
- "image": "quay.io/mittwald/kube-httpcache:stable",
991
- "imagePullPolicy": "IfNotPresent",
992
- "name": "kube-httpcache",
993
- "resources": {
994
- "limits": {
995
- "cpu": "500m",
996
- "memory": "500Mi",
997
- },
998
- "requests": {
999
- "cpu": "100m",
1000
- "memory": "100Mi",
1001
- },
1002
- },
1003
- "securityContext": {},
1004
- "volumeMounts": [
1005
- {
1006
- "mountPath": "/etc/varnish/tmpl",
1007
- "name": "template",
1008
- },
1009
- {
1010
- "mountPath": "/etc/varnish/k8s-secret",
1011
- "name": "secret",
1012
- },
1013
- {
1014
- "mountPath": "/var/lib/varnish",
1015
- "name": "var",
1016
- },
1017
- ],
1018
- },
1019
- {
1020
- "args": [
1021
- "-no-exit",
1022
- ],
1023
- "command": [
1024
- "/exporter/prometheus_varnish_exporter",
1025
- ],
1026
- "env": [
1027
- {
1028
- "name": "VSM_NOPID",
1029
- "value": "1",
1030
- },
1031
- ],
1032
- "image": "quay.io/mittwald/kube-httpcache:stable",
1033
- "imagePullPolicy": "IfNotPresent",
1034
- "name": "exporter",
1035
- "ports": [
1036
- {
1037
- "containerPort": 9131,
1038
- "name": "metrics",
1039
- },
1040
- ],
1041
- "resources": {
1042
- "limits": {
1043
- "cpu": "100m",
1044
- "memory": "100Mi",
1045
- },
1046
- "requests": {
1047
- "cpu": "10m",
1048
- "memory": "50Mi",
1049
- },
1050
- },
1051
- "securityContext": {},
1052
- "volumeMounts": [
1053
- {
1054
- "mountPath": "/var/lib/varnish",
1055
- "name": "var",
1056
- },
1057
- ],
1058
- },
1059
- ],
1060
- "nodeSelector": {
1061
- "kubernetes.io/arch": "amd64",
1062
- },
1063
- "securityContext": {},
1064
- "serviceAccountName": "test-chart-httpcache-c89dd29d-kube-httpcache",
1065
- "volumes": [
1066
- {
1067
- "configMap": {
1068
- "name": "test-chart-httpcache-c89dd29d-kube-httpcache",
1069
- },
1070
- "name": "template",
1071
- },
1072
- {
1073
- "name": "secret",
1074
- "secret": {
1075
- "secretName": "test-chart-httpcache-c89dd29d-kube-httpcache",
1076
- },
1077
- },
1078
- {
1079
- "emptyDir": {},
1080
- "name": "var",
1081
- },
1082
- ],
1083
- },
1084
- },
1085
- },
1086
- },
1087
- {
1088
- "apiVersion": "networking.k8s.io/v1",
1089
- "kind": "Ingress",
1090
- "metadata": {
1091
- "annotations": {
1092
- "cert-manager.io/cluster-issuer": "letsencrypt-prod",
1093
- "kubernetes.io/ingress.class": "traefik",
1094
- },
1095
- "name": "test-chart-ingress-main-cached-c8b108e1",
1096
- },
1097
- "spec": {
1098
- "ingressClassName": "traefik",
1099
- "rules": [
1100
- {
1101
- "host": "mxplone-cached.example.com",
1102
- "http": {
1103
- "paths": [
1104
- {
1105
- "backend": {
1106
- "service": {
1107
- "name": "test-chart-httpcache-c89dd29d-kube-httpcache",
1108
- "port": {
1109
- "number": 80,
1110
- },
1111
- },
1112
- },
1113
- "path": "/",
1114
- "pathType": "Prefix",
1115
- },
1116
- ],
1117
- },
1118
- },
1119
- ],
1120
- },
1121
- },
1122
- {
1123
- "apiVersion": "networking.k8s.io/v1",
1124
- "kind": "Ingress",
1125
- "metadata": {
1126
- "annotations": {
1127
- "cert-manager.io/cluster-issuer": "letsencrypt-prod",
1128
- "kubernetes.io/ingress.class": "traefik",
1129
- },
1130
- "name": "test-chart-ingress-main-uncached-c85166a3",
1131
- },
1132
- "spec": {
1133
- "ingressClassName": "traefik",
1134
- "rules": [
1135
- {
1136
- "host": "mxplone-cached.example.com",
1137
- "http": {
1138
- "paths": [
1139
- {
1140
- "backend": {
1141
- "service": {
1142
- "name": "test-chart-plone-frontend-service-c874cc1a",
1143
- "port": {
1144
- "number": 3000,
1145
- },
1146
- },
1147
- },
1148
- "path": "/",
1149
- "pathType": "Prefix",
1150
- },
1151
- ],
1152
- },
1153
- },
1154
- ],
1155
- },
1156
- },
1157
- {
1158
- "apiVersion": "traefik.io/v1alpha1",
1159
- "kind": "Middleware",
1160
- "metadata": {
1161
- "name": "test-chart-ingress-main-maintenance-addprefix-c8dc1efe",
1162
- },
1163
- "spec": {
1164
- "addPrefix": {
1165
- "prefix": "/VirtualHostBase/https/mxplone-maintenance.example.com/VirtualHostRoot/",
1166
- },
1167
- },
1168
- },
1169
- {
1170
- "apiVersion": "networking.k8s.io/v1",
1171
- "kind": "Ingress",
1172
- "metadata": {
1173
- "annotations": {
1174
- "cert-manager.io/cluster-issuer": "letsencrypt-prod",
1175
- "kubernetes.io/ingress.class": "traefik",
1176
- "traefik.ingress.kubernetes.io/router.middlewares": "plone-test-chart-ingress-main-maintenance-addprefix-c8dc1efe@kubernetescrd",
1177
- },
1178
- "name": "test-chart-ingress-main-maintenance-c874242e",
1179
- },
1180
- "spec": {
1181
- "ingressClassName": "traefik",
1182
- "rules": [
1183
- {
1184
- "host": "mxplone-maintenance.example.com",
1185
- "http": {
1186
- "paths": [
1187
- {
1188
- "backend": {
1189
- "service": {
1190
- "name": "test-chart-plone-backend-service-c81ad65d",
1191
- "port": {
1192
- "number": 8080,
1193
- },
1194
- },
1195
- },
1196
- "path": "/",
1197
- "pathType": "Prefix",
1198
- },
1199
- ],
1200
- },
1201
- },
1202
- ],
1203
- },
1204
- },
1205
- ]
1206
- `;