Skip to content

Commit 9fb1b28

Browse files
mortenljx10an14-nav
andcommitted
Correct expression to deny compacted topics with local retention
Co-authored-by: @x10an14-nav <[email protected]>
1 parent ff8f750 commit 9fb1b28

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

charts/kafkarator/templates/clusterpolicy.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ spec:
6262
cel:
6363
expressions:
6464
- expression: >-
65-
object.spec.config.cleanupPolicy == 'compact' && (
66-
object.spec.config.localRetentionBytes > 0 ||
67-
object.spec.config.localRetentionHours > 0
68-
)
65+
(!has(object.spec.config.cleanupPolicy) || object.spec.config.cleanupPolicy == 'delete') ||
66+
(
67+
(!has(object.spec.config.localRetentionBytes) || object.spec.config.localRetentionBytes < 0) &&
68+
(!has(object.spec.config.localRetentionHours) || object.spec.config.localRetentionHours < 0)
69+
)
6970
{{- end }}

examples/topic.yaml

+7-5
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ metadata:
55
annotations:
66
kafka.nais.io/removeDataWhenResourceIsDeleted: "true"
77
name: mytopic
8-
namespace: default
8+
namespace: basseng
99
labels:
10-
team: default
10+
team: basseng
1111
spec:
12-
pool: some-pool
12+
pool: dev-nais-dev
1313
config:
14+
cleanupPolicy: delete
1415
retentionHours: 900
16+
localRetentionHours: 100
1517
acl:
1618
- access: read
17-
team: default
19+
team: basseng
1820
application: myapplication
1921
- access: write
20-
team: default
22+
team: basseng
2123
application: otherapplication

0 commit comments

Comments
 (0)