[DEMO, do not merge] Generated EnsureReferences output for code-generator#738 - #242
Draft
gustavodiaz7722 wants to merge 1 commit into
Draft
gustavodiaz7722 wants to merge 1 commit into
gustavodiaz7722 wants to merge 1 commit into
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gustavodiaz7722 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
gustavodiaz7722
force-pushed
the
demo/ensure-references-generated-output
branch
2 times, most recently
from
September 14, 2026 23:04
672cb32 to
d80a3c7
Compare
Demonstration only, not for merge. Shows what aws-controllers-k8s/code-generator#738 emits in the context of a full service controller. Regenerated with no other change, so the diff is exactly the generated EnsureReferences methods. go.mod is untouched: the method compiles against the current runtime and stays inert until aws-controllers-k8s/runtime#267 lands, which is what invokes it. lambda covers all three reference shapes, so the per-shape behaviour is visible in one controller: function struct-nested Code.S3BucketRef, VPCConfig.SecurityGroupRefs, VPCConfig.SubnetRefs -> emitted layer_version struct-nested emitted event_source_mapping list-nested -> nothing emitted alias, code_signing_config, function_url_config, version top-level only -> nothing emitted function is the shape reported in aws-controllers-k8s/community#2431.
gustavodiaz7722
force-pushed
the
demo/ensure-references-generated-output
branch
from
September 14, 2026 23:46
d80a3c7 to
b41ced4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Demonstration only — not for merge.
Opened at the request of a reviewer on aws-controllers-k8s/code-generator#738, to show what that PR emits in the context of a full service controller.
lambda-controllerregenerated against code-generator#738 with no other change, so the diff is exactly the generatedEnsureReferencesmethods and nothing else. Local build stamps (pkg/version/version.go,ack-generate-metadata.yaml) were reverted deliberately, since they would otherwise show a spurious generator downgrade.Why lambda
It exercises all three reference shapes, so the per-shape behaviour is visible in one controller:
functionCode.S3BucketRef,VPCConfig.SecurityGroupRefs,VPCConfig.SubnetRefslayer_versionevent_source_mappingalias,code_signing_config,function_url_config,versionfunctionis the shape reported in aws-controllers-k8s/community#2431.The generated method
Each assignment is guarded on the declared resource actually holding a reference and on the target missing it, so it cannot clobber a reference the service did report. The container is constructed on the target when it is absent -- generated set-output code nils it when the response omits it, and without that the reference would be dropped in exactly the case it most needs restoring.
Compatibility
go.modis unchanged. The method compiles against the current runtime and stays inert until aws-controllers-k8s/runtime#267 lands, which defines the optionalReferenceEnsurerinterface and invokes it afterCreateand afterUpdate.Relationship to the existing hooks
templates/hooks/function/sdk_create_post_set_output.go.tplandsdk_read_one_post_set_output.go.tplcurrently restore these same references by hand. This PR does not remove either. runtime#267 subsumes the create-path half. The read-path half is left alone, andAdoptionPolicy_Adoptdeliberately replaces a declared reference along with the rest of the declared spec.Related: aws-controllers-k8s/code-generator#738, aws-controllers-k8s/runtime#267, aws-controllers-k8s/community#2431.