chore: align extra-resources with sdk v0.5.0 and template#86
Closed
chore: align extra-resources with sdk v0.5.0 and template#86
Conversation
b6ed217 to
320ce29
Compare
There was a problem hiding this comment.
Pull request overview
Aligns function-extra-resources with the latest function SDK/template conventions while keeping existing branch behavior.
Changes:
- Adds package capability metadata (
spec.capabilities: [composition]). - Migrates request/response resource requirement handling to
RequiredResources/Requirements.Resources. - Refactors deterministic sorting comparisons using typed helpers (
lessByKind/lessAs).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| package/crossplane.yaml | Declares package capabilities to match current template expectations. |
| input/v1beta1/resource_select.go | Updates an optionality-related comment near selector label matcher logic. |
| fn.go | Migrates to RequiredResources APIs and refactors sorting comparisons with typed helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fn.go
Outdated
Comment on lines
258
to
264
| less, lessErr := lessByKind(t.Kind(), vali, valj) | ||
| if lessErr != nil { | ||
| err = lessErr | ||
| return false | ||
| } | ||
| return less | ||
| }) |
There was a problem hiding this comment.
If lessByKind returns an error once, the sort comparator may continue to be invoked many more times, doing unnecessary work and potentially overwriting err. Add an early guard at the top of the comparator (e.g., if err != nil { return false }) and consider only setting err if it’s currently nil.
d1b90ef to
92630bd
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.
Description of your changes
This PR aligns
function-extra-resourceswith the latest function SDK/template direction while preserving the current branch behavior (including namespaced selectors and max receive size support).Key updates:
req.RequiredResourcesrequest.GetRequiredResources(...)rsp.Requirements.ResourceslessByKind/lessAs) for safer comparisons.crossplane-runtime/v2.spec.capabilities: [composition]Rebase/conflict resolution notes:
MaxRecvMessageSize) and re-applying the SDK migration/sorting improvements.Validation:
go test ./...golangci-lint runFixes #
I have: