Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(convert): fixed panic in resource limits conversion #15

Merged
merged 1 commit into from
May 30, 2024

Conversation

astromechza
Copy link
Member

Hit a panic when converting a resources section that had resource requests but no limits.

This PR fixes it and adds a regression test.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1031c3870]

goroutine 1 [running]:
github.com/score-spec/score-k8s/internal/convert.buildResourceList(0x0)
	/home/runner/work/score-k8s/score-k8s/internal/convert/container_resources.go:45 +0x30
github.com/score-spec/score-k8s/internal/convert.convertContainerResources(0x14000498420)
	/home/runner/work/score-k8s/score-k8s/internal/convert/container_resources.go:33 +0x5c
github.com/score-spec/score-k8s/internal/convert.ConvertWorkload(0x1400049dc00, {0x1400061e2b0, 0xd})
	/home/runner/work/score-k8s/score-k8s/internal/convert/workloads.go:90 +0x730
main.init.func2(0x103ad40e0, {0x1400033a640, 0x2, 0x2})
	/home/runner/work/score-k8s/score-k8s/main_generate.go:206 +0xd44
github.com/spf13/cobra.(*Command).execute(0x103ad40e0, {0x1400033a600, 0x2, 0x2})
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:983 +0x840
github.com/spf13/cobra.(*Command).ExecuteC(0x103ad3e00)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
main.main()
	/home/runner/work/score-k8s/score-k8s/main.go:63 +0x24

Copy link
Contributor

@mathieu-benoit mathieu-benoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@astromechza astromechza merged commit f2a3559 into main May 30, 2024
3 checks passed
@astromechza astromechza deleted the fix-res-panic branch May 30, 2024 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants