[DEMO, do not merge] Generated EnsureReferences output for code-generator#738 - #242
Draft
gustavodiaz7722 wants to merge 1 commit into
Draft
Conversation
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.
|
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 |
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 container existing on both objects and on the target actually missing the reference, so it cannot clobber a reference the service did report.
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 them, and they should not be removed on the strength of code-generator#738: only their create-path half is subsumed.EnsureReferencesis not invoked afterReadOne, so the adoption path inSyncanddeleteResourcestill need the read-path hook.Related: aws-controllers-k8s/code-generator#738, aws-controllers-k8s/runtime#267, aws-controllers-k8s/community#2431.