Skip to content

Conversation

yaroslavborbat
Copy link
Member

@yaroslavborbat yaroslavborbat commented Aug 5, 2025

Description

This PR introduces a new Maintenance condition for VirtualMachine resources that enables safe VM state manipulation during clone and restore operations. The maintenance mode ensures the VM is stopped and prevents the controller from creating or managing underlying resources (KVVM, KVVMI, Pods).

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

During VM clone or restore operations, we need to ensure:

  1. The VM is gracefully stopped
  2. No underlying resources (KVVM, KVVMI, Pods) exist or get recreated
  3. The VM controller doesn't interfere with the clone/restore process

What is the expected result?

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: vm
type: feature
summary: Added Maintenance condition for VirtualMachine
impact_level: low

@loktev-d loktev-d self-assigned this Aug 7, 2025
@loktev-d loktev-d added this to the v0.25.0 milestone Aug 12, 2025
@loktev-d loktev-d force-pushed the feat/vm/maitance-mode branch 2 times, most recently from f2ce212 to b6449fd Compare August 14, 2025 14:54
@loktev-d loktev-d added the e2e/run Run e2e test on cluster of PR author label Aug 15, 2025
@deckhouse-BOaTswain
Copy link
Contributor

deckhouse-BOaTswain commented Aug 15, 2025

Workflow has started.
Follow the progress here: Workflow Run

The target step completed with status: cancelled.

@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Aug 15, 2025
@loktev-d loktev-d added the e2e/run Run e2e test on cluster of PR author label Aug 15, 2025
@deckhouse-BOaTswain
Copy link
Contributor

deckhouse-BOaTswain commented Aug 15, 2025

Workflow has started.
Follow the progress here: Workflow Run

The target step completed with status: failure.

@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Aug 15, 2025
@loktev-d loktev-d added the e2e/run Run e2e test on cluster of PR author label Aug 15, 2025
@deckhouse-BOaTswain
Copy link
Contributor

deckhouse-BOaTswain commented Aug 15, 2025

Workflow has started.
Follow the progress here: Workflow Run

The target step completed with status: failure.

@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Aug 15, 2025
yaroslavborbat and others added 16 commits August 15, 2025 13:11
Signed-off-by: Yaroslav Borbat <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Yaroslav Borbat <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
@deckhouse-BOaTswain
Copy link
Contributor

deckhouse-BOaTswain commented Aug 26, 2025

Workflow has started.
Follow the progress here: Workflow Run

The target step completed with status: failure.

@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Aug 26, 2025
@loktev-d loktev-d added the e2e/run Run e2e test on cluster of PR author label Aug 26, 2025
@deckhouse-BOaTswain
Copy link
Contributor

deckhouse-BOaTswain commented Aug 26, 2025

Workflow has started.
Follow the progress here: Workflow Run

The target step completed with status: failure.

@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Aug 26, 2025
@loktev-d loktev-d added the e2e/run Run e2e test on cluster of PR author label Aug 26, 2025
@deckhouse-BOaTswain
Copy link
Contributor

deckhouse-BOaTswain commented Aug 26, 2025

Workflow has started.
Follow the progress here: Workflow Run

The target step completed with status: cancelled.

@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Aug 26, 2025
@loktev-d loktev-d added the e2e/run Run e2e test on cluster of PR author label Aug 26, 2025
@deckhouse-BOaTswain
Copy link
Contributor

deckhouse-BOaTswain commented Aug 26, 2025

Workflow has started.
Follow the progress here: Workflow Run

The target step completed with status: failure.

@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Aug 26, 2025
@@ -0,0 +1,123 @@
/*
Copyright 2024 Flant JSC
Copy link
Contributor

Choose a reason for hiding this comment

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

2025

@@ -45,6 +45,7 @@ type Validator struct {
func NewValidator(ipam internal.IPAM, client client.Client, service *service.BlockDeviceService, log *log.Logger) *Validator {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove pls ipam internal.IPAM, it's unused

@@ -0,0 +1,54 @@
/*
Copyright 2024 Flant JSC
Copy link
Contributor

Choose a reason for hiding this comment

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

2025

}

// Hide all other conditions when in maintenance mode
if changed.Status.Conditions != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just

changed.Status.Conditions = []metav1.Condition{maintenance}

Signed-off-by: Daniil Loktev <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
@loktev-d loktev-d added the e2e/run Run e2e test on cluster of PR author label Aug 26, 2025
@deckhouse-BOaTswain
Copy link
Contributor

Workflow has started.
Follow the progress here: Workflow Run

@Isteb4k Isteb4k self-requested a review August 26, 2025 12:36
Isteb4k
Isteb4k previously approved these changes Aug 26, 2025
@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Aug 26, 2025
@loktev-d loktev-d marked this pull request as ready for review August 26, 2025 12:50
@Isteb4k Isteb4k self-requested a review August 26, 2025 13:04
@loktev-d loktev-d merged commit 0f1e028 into main Aug 26, 2025
26 of 27 checks passed
@loktev-d loktev-d deleted the feat/vm/maitance-mode branch August 26, 2025 13:07
nevermarine pushed a commit that referenced this pull request Aug 27, 2025
This PR introduces a new Maintenance condition for VirtualMachine resources that enables safe VM state manipulation during clone and restore operations. The maintenance mode ensures the VM is stopped and prevents the controller from creating or managing underlying resources (KVVM, KVVMI, Pods).

During VM clone or restore operations, we need to ensure:
- The VM is gracefully stopped
- No underlying resources (KVVM, KVVMI, Pods) exist or get recreated
- The VM controller doesn't interfere with the clone/restore process

Signed-off-by: Yaroslav Borbat <[email protected]>
Signed-off-by: Daniil Loktev <[email protected]>
Co-authored-by: Daniil Loktev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants