Skip to content

sap_vm_provision/kubevirt_vm: Make evictionStrategy configurable - #166

Merged
newkit merged 2 commits into
sap-linuxlab:devfrom
aisa-b:fix-eviction-strategy
Aug 6, 2026
Merged

sap_vm_provision/kubevirt_vm: Make evictionStrategy configurable#166
newkit merged 2 commits into
sap-linuxlab:devfrom
aisa-b:fix-eviction-strategy

Conversation

@aisa-b

@aisa-b aisa-b commented Aug 2, 2026

Copy link
Copy Markdown

evictionStrategy was hardcoded to LiveMigrate under spec.template.spec.domain.
Two problems with this:

  • Wrong API level: KubeVirt expects evictionStrategy at spec.template.spec,
    not under domain. It was silently ignored (unknown field warning).
  • LiveMigrate breaks VMs on local storage (ReadWriteOnce PVCs can't migrate).
    VMs enter CrashLoopBackOff due to repeated eviction attempts.

Moved evictionStrategy to the correct level and exposed it as a variable
(sap_vm_provision_kubevirt_vm_eviction_strategy). Defaults to None which
works with any storage type. Users can override to LiveMigrate when using
shared storage (RWX).

Move evictionStrategy from spec.template.spec.domain (wrong API level,
silently ignored by KubeVirt) to spec.template.spec (correct level).
Expose as variable sap_vm_provision_kubevirt_vm_eviction_strategy,
defaulting to None for compatibility with ReadWriteOnce storage.
Users can override to LiveMigrate when using shared storage (RWX).
@aisa-b
aisa-b requested a review from newkit August 2, 2026 14:50
@marcelmamula
marcelmamula self-requested a review August 3, 2026 07:00
Comment thread roles/sap_vm_provision/defaults/main.yml
Comment thread roles/sap_vm_provision/defaults/main.yml Outdated
- Add (String) type hint to the comment to clarify quoting is required
- Create validations/kubevirt_vm.yml to assert the variable is a valid
  string and one of 'None' or 'LiveMigrate' before module execution
@aisa-b
aisa-b force-pushed the fix-eviction-strategy branch from 2773710 to cb4e090 Compare August 4, 2026 12:43
@aisa-b
aisa-b requested a review from marcelmamula August 6, 2026 14:26

@marcelmamula marcelmamula left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM from code perspetive.
@newkit will have to approve from actual testing perspective.

@newkit

newkit commented Aug 6, 2026

Copy link
Copy Markdown
Member

LGTM2

@newkit
newkit merged commit b6a0719 into sap-linuxlab:dev Aug 6, 2026
18 checks passed
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