Skip to content

Commit

Permalink
📝 Update example with realistic annotation using the '.' character.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdobson committed Nov 16, 2024
1 parent 4013642 commit 89ce804
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/aws-auth/input/configmaps/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: aws-auth-base
namespace: kube-system
annotations:
aggregate: aws-auth
aggregate.auth.annotation: aws-auth
data:
mapRoles: |
- rolearn: arn:aws:iam::111122223333:role/admin-role
Expand Down
2 changes: 1 addition & 1 deletion examples/aws-auth/input/configmaps/tenant-acme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: aws-auth-tenant-acme
namespace: kube-system
annotations:
aggregate: aws-auth
aggregate.auth.annotation: aws-auth
data:
mapRoles: |
- rolearn: arn:aws:iam::111122223333:role/tenant-acme-role
Expand Down
2 changes: 1 addition & 1 deletion examples/aws-auth/input/configmaps/tenant-umbrella.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: aws-auth-tenant-umbrella
namespace: kube-system
annotations:
aggregate: aws-auth
aggregate.auth.annotation: aws-auth
data:
mapRoles: |
- rolearn: arn:aws:iam::111122223333:role/tenant-umbrella-role
Expand Down
2 changes: 1 addition & 1 deletion examples/aws-auth/input/templates/aws-auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
SELECT cm.data AS cm
FROM "ConfigMap.core" AS cm
WHERE cm.namespace = 'kube-system' AND
json_extract(cm.data, '$.metadata.annotations.aggregate') = 'aws-auth'
json_extract(cm.data, '$.metadata.annotations."aggregate.auth.annotation"') = 'aws-auth'
template:
language: cue
batchModeProcessing: true
Expand Down
6 changes: 3 additions & 3 deletions examples/aws-auth/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ input `ConfigMap` instances, so each piece of Terraform code can own its own
resource. Kumquat is the only thing that owns `aws-auth`.

The following template does just that. It also check for the presence of the
`aggregate` annotation on the inputs, and ensures the value is `aws-auth`.
This ensure that the template only merges `ConfigMap` instances that belong
`aggregate.auth.annotation` annotation on the inputs, and ensures the value is `aws-auth`.
This ensures that the template only merges `ConfigMap` instances that belong
in `aws-auth`. The choice of aggregation name and value was arbitrary.

```yaml
Expand All @@ -69,7 +69,7 @@ spec:
SELECT cm.data AS cm
FROM "ConfigMap.core" AS cm
WHERE cm.namespace = 'kube-system' AND
json_extract(cm.data, '$.metadata.annotations.aggregate') = 'aws-auth'
json_extract(cm.data, '$.metadata.annotations."aggregate.auth.annotation"') = 'aws-auth'
template:
language: cue
batchModeProcessing: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: aws-auth-base
namespace: kube-system
annotations:
aggregate: aws-auth
aggregate.auth.annotation: aws-auth
data:
mapRoles: |
- rolearn: arn:aws:iam::111122223333:role/admin-role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: aws-auth-tenant-acme
namespace: kube-system
annotations:
aggregate: aws-auth
aggregate.auth.annotation: aws-auth
data:
mapRoles: |
- rolearn: arn:aws:iam::111122223333:role/tenant-acme-role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: aws-auth-tenant-umbrella
namespace: kube-system
annotations:
aggregate: aws-auth
aggregate.auth.annotation: aws-auth
data:
mapRoles: |
- rolearn: arn:aws:iam::111122223333:role/tenant-umbrella-role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
SELECT cm.data AS cm
FROM "ConfigMap.core" AS cm
WHERE cm.namespace = 'kube-system' AND
json_extract(cm.data, '$.metadata.annotations.aggregate') = 'aws-auth'
json_extract(cm.data, '$.metadata.annotations."aggregate.auth.annotation"') = 'aws-auth'
template:
language: cue
batchModeProcessing: false
Expand Down

0 comments on commit 89ce804

Please sign in to comment.