Skip to content

Commit a247337

Browse files
authored
Add support for the PolicyEngine resource (#33)
Issue #, if available: Description of changes: Adds a new PolicyEngine custom resource to the bedrock-agentcore-control controller, enabling AgentCore policy engines to be managed declaratively via Kubernetes. - Enabled the resource in generator.yaml (removed PolicyEngine from the ignore list) and configured its full CRUD mapping: - PolicyEngineId renamed to ID (primary key) across the Create/Get/Update/Delete operations. - Name marked immutable; EncryptionKeyArn immutable with a cross-resource reference to KMS Key. - Read-only status fields sourced from GetPolicyEngine: CreatedAt, UpdatedAt, StatusReasons. - synced / updateable / deletable conditions keyed off Status.Status (ACTIVE, plus the *_FAILED terminal states). - ValidationException treated as terminal; 404 mapped to ResourceNotFoundException. - Custom hooks (hooks/policy_engine/): - sdk_update_post_build_request — wraps Description updates in the API's UpdatedDescription optional-value shape. - sdk_update_pre_build_request — syncs tags and short-circuits when only tags differ. - sdk_read_one_post_set_output — fetches tags on read APIs are unavailable (logs and continues rather than failing reconcile). - Generated artifacts: new API types (policy_engine.go), CRD manifest, resource manager/SDK/references/identifiers/delta, RBAC and Helm role entries, and controller registration in cmd/controller/main.go. - E2E tests (test/e2e/tests/test_policy_engine.py): create/delete, update description, and update tags. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 9918030 commit a247337

33 files changed

Lines changed: 3080 additions & 24 deletions
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2026-06-22T22:57:25Z"
2+
build_date: "2026-06-24T23:08:34Z"
33
build_hash: 2ae5d2cfadaa2a10b2ccb9e73a111b2a91c36642
4-
go_version: go1.26.4
4+
go_version: go1.26.2
55
version: v0.60.0
6-
api_directory_checksum: 690c23f673c0c713394e7370ed49ca7ae518422d
6+
api_directory_checksum: abe5cc81ff91c1051ef312264c44cf7a52573587
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.41.5
99
generator_config_info:
10-
file_checksum: c0e74d88a5f60e8b47268a9ff81d835bdd37ed2d
10+
file_checksum: a56edc199bac647a07a6a5f25cfc3b01e123e5c5
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/enums.go

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/generator.yaml

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ignore:
1313
- Oauth2CredentialProvider
1414
- OnlineEvaluationConfig
1515
- Policy
16-
- PolicyEngine
16+
# - PolicyEngine
1717
# - WorkloadIdentity
1818

1919
field_paths:
@@ -178,6 +178,87 @@ resources:
178178
sdk_update_post_build_request:
179179
template_path: hooks/memory/sdk_update_post_build_request.go.tpl
180180

181+
PolicyEngine:
182+
ignore_idempotency_token: true
183+
renames:
184+
operations:
185+
CreatePolicyEngine:
186+
output_fields:
187+
PolicyEngineId: ID
188+
GetPolicyEngine:
189+
input_fields:
190+
PolicyEngineId: ID
191+
UpdatePolicyEngine:
192+
input_fields:
193+
PolicyEngineId: ID
194+
DeletePolicyEngine:
195+
input_fields:
196+
PolicyEngineId: ID
197+
fields:
198+
ID:
199+
is_primary_key: true
200+
Name:
201+
is_immutable: true
202+
EncryptionKeyArn:
203+
is_immutable: true
204+
references:
205+
resource: Key
206+
service_name: kms
207+
path: Status.ACKResourceMetadata.ARN
208+
Description:
209+
set:
210+
- method: Update
211+
ignore: "to"
212+
CreatedAt:
213+
is_read_only: true
214+
from:
215+
operation: GetPolicyEngine
216+
path: CreatedAt
217+
UpdatedAt:
218+
is_read_only: true
219+
from:
220+
operation: GetPolicyEngine
221+
path: UpdatedAt
222+
StatusReasons:
223+
is_read_only: true
224+
from:
225+
operation: GetPolicyEngine
226+
path: StatusReasons
227+
synced:
228+
when:
229+
- path: Status.Status
230+
in:
231+
- ACTIVE
232+
- CREATE_FAILED
233+
- UPDATE_FAILED
234+
- DELETE_FAILED
235+
updateable:
236+
when:
237+
- path: Status.Status
238+
in:
239+
- ACTIVE
240+
deletable:
241+
when:
242+
- path: Status.Status
243+
in:
244+
- ACTIVE
245+
- CREATE_FAILED
246+
- UPDATE_FAILED
247+
- DELETE_FAILED
248+
exceptions:
249+
errors:
250+
404:
251+
code: ResourceNotFoundException
252+
terminal_codes:
253+
- ValidationException
254+
hooks:
255+
sdk_read_one_post_set_output:
256+
template_path: hooks/policy_engine/sdk_read_one_post_set_output.go.tpl
257+
sdk_update_pre_build_request:
258+
template_path: hooks/policy_engine/sdk_update_pre_build_request.go.tpl
259+
sdk_update_post_build_request:
260+
template_path: hooks/policy_engine/sdk_update_post_build_request.go.tpl
261+
181262
WorkloadIdentity:
182263
fields:
183264
Name:

apis/v1alpha1/policy_engine.go

Lines changed: 122 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/types.go

Lines changed: 37 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)