Skip to content

Commit

Permalink
fix panic when running KCM/OC locally when downloading pricing data
Browse files Browse the repository at this point in the history
Signed-off-by: saweber <saweber@gmail.com>
  • Loading branch information
saweber committed Oct 26, 2023
1 parent 5cd7340 commit e633b99
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/cloud/aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,9 @@ func (aws *AWS) DownloadPricingData() error {
storageClassMap := make(map[string]map[string]string)
for _, storageClass := range storageClasses {
params := storageClass.Parameters
params["provisioner"] = storageClass.Provisioner
if params != nil {
params["provisioner"] = storageClass.Provisioner
}
storageClassMap[storageClass.ObjectMeta.Name] = params
if storageClass.GetAnnotations()["storageclass.kubernetes.io/is-default-class"] == "true" || storageClass.GetAnnotations()["storageclass.beta.kubernetes.io/is-default-class"] == "true" {
storageClassMap["default"] = params
Expand Down

1 comment on commit e633b99

@lmello
Copy link
Member

@lmello lmello commented on e633b99 Oct 30, 2023

Choose a reason for hiding this comment

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

Thanks for fixing this bug. I just hit it today when trying to update to use the latest master.


goroutine 1 [running]:
github.com/opencost/opencost/pkg/cloud/aws.(*AWS).DownloadPricingData(0xc0511eca00)
	/app/pkg/cloud/aws/provider.go:896 +0x849
github.com/opencost/opencost/pkg/costmodel.Initialize({0x0, 0x0, 0xc000f9fc40?})
	/app/pkg/costmodel/router.go:1744 +0x21bb
github.com/opencost/opencost/pkg/cmd/costmodel.Execute(0x1?)
	/app/pkg/cmd/costmodel/costmodel.go:35 +0x105
github.com/opencost/opencost/pkg/cmd.newCostModelCommand.func1(0xc001196a00?, {0x28f6aa6?, 0x0?, 0x0?})
	/app/pkg/cmd/commands.go:108 +0x31
github.com/spf13/cobra.(*Command).execute(0xc001196a00, {0x43520e8, 0x0, 0x0})
	/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:856 +0x67c
github.com/spf13/cobra.(*Command).ExecuteC(0xc001196c80)
	/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
github.com/opencost/opencost/pkg/cmd.Execute(0x60?, {0x0, 0x0, 0x0})
	/app/pkg/cmd/commands.go:61 +0x305
main.main()
	/app/cmd/costmodel/main.go:11 +0x25

Please sign in to comment.