Skip to content

Conversation

@hardcoretime
Copy link
Contributor

@hardcoretime hardcoretime commented Apr 2, 2025

Description

Why do we need it, and what problem does it solve?

When a VirtualImage is created without the StorageClass field in its specification and the default storage class is absent from the ModuleConfig, it is not handled after updating the default storage class in the ModuleConfig.

What is the expected result?

The default storage class field works properly in the reconciliation loop of the VirtualImage resource.

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: vi 
type: fix
summary: "The `VirtualImageDefaultStorageClass` from the `ModuleConfig` is handled correctly now." 

@hardcoretime hardcoretime added this to the v0.17.0 milestone Apr 2, 2025
@hardcoretime hardcoretime force-pushed the fix/vi/handle-mc-vi-default-storage-class branch from 7c204e6 to a7fbb78 Compare April 2, 2025 13:08
@hardcoretime hardcoretime marked this pull request as ready for review April 2, 2025 13:18
@hardcoretime hardcoretime requested a review from eofff April 2, 2025 13:18
@hardcoretime hardcoretime force-pushed the fix/vi/handle-mc-vi-default-storage-class branch from a53757f to 7ea57da Compare April 3, 2025 17:37
@hardcoretime hardcoretime marked this pull request as draft April 4, 2025 02:33
})
}

func IndexVIByNotReadyStorageClass(ctx context.Context, mgr manager.Manager) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why with this name you indexing by sc ready? And ignore non pvc VI please.

return nil, err
}

if virtualImages, ok := moduleConfig.Spec.Settings["virtualImages"].(map[string]interface{}); ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not hardcode please, use constant not string literal (set it if needed), next line too

Copy link
Contributor

Choose a reason for hiding this comment

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

"virtualImages" var seems like slice of VI, use virtualImagesSetting or something

var (
moduleConfigViDefaultStorageClass string
moduleConfig mcapi.ModuleConfig
moduleConfigName = "virtualization"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can it change?

oldViDefaultSc string
newViDefaultSc string
)
if virtualImages, ok := oldMc.Spec.Settings["virtualImages"].(map[string]interface{}); ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use consts, not string literals

@hardcoretime hardcoretime deleted the fix/vi/handle-mc-vi-default-storage-class branch April 14, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants