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

ept_rvi_mode and hv_mode always attemp to update on apply #3

Open
abhinit-kumar opened this issue Jan 24, 2025 · 2 comments
Open

ept_rvi_mode and hv_mode always attemp to update on apply #3

abhinit-kumar opened this issue Jan 24, 2025 · 2 comments

Comments

@abhinit-kumar
Copy link

We are trying to use provider-vsphere latest vSphere version 0.1.0, which is based on Terraform vSphere provider version 2.5.1.
We have encountered an issue with the hvMode variable behavior in this provider version.

Issue Summary:

Default Behavior:
The hvMode variable, when not specified in the composition, is automatically set to hvAuto by default.
The provider supports three values for hvMode: hvAuto, hvOn, hvOff.

Below is the excerpts from composition being used:

---removed for brevity---
            apiVersion: virtualmachine.crossplane.io/v1alpha1
            kind: VSphereVirtualMachine
            metadata:
              name: vmvspheretemplate
              annotations:
                gotemplating.fn.crossplane.io/composition-resource-name: "vmcreation"
            spec:
              forProvider:
                name: {{ $vmName }}
                resourcePoolId: {{ $resourcepoolid }}
                datastoreId: {{ $datastoreid }}
                efiSecureBootEnabled: false
                firmware: "efi"
                numCpus: {{ $cpu }}
                memory: {{ $memory }}
                guestId: {{ $guestid }}
---removed for brevity---

Behavior Observed:
With vSphere V8, the hvMode value in the status field is always blank ("") after applying the claim.
With vSphere V7, the hvMode value is correctly set to hvAuto in status field.

Output of command $kubectl describe VSphereVirtualMachine vmvspheretemplate in vSphere 7:

---removed for brevity---
    Disk:
      Label:                       Hard disk 1
      Size:                        60
    Ept Rvi Mode:                  automatic
    Extra Config Reboot Required:  true
    Firmware:                      bios
    Force Power Off:               true
    Guest Id:                      ubuntu64Guest
    Hardware Version:              19
    Host System Id:                host-xxxx
    Hv Mode:                       hvAuto                                                      <<hvMode: hvAuto applied by the provider
    Ide Controller Count:          2
    Latency Sensitivity:           normal
    Memory:                        2048
    Memory Limit:                  -1
    Memory Share Count:            20480
    Memory Share Level:            normal
    Migrate Wait Timeout:          30
    Name:                          prod-test-110
---removed for brevity---

Output of command $kubectl describe VSphereVirtualMachine vmvspheretemplate in vSphere 8:

---removed for brevity---
    Disk:
      Label:                       Hard disk 1
      Size:                        60
    Ept Rvi Mode:                  automatic
    Extra Config Reboot Required:  true
    Firmware:                      bios
    Force Power Off:               true
    Guest Id:                      ubuntu64Guest
    Hardware Version:              19
    Host System Id:                host-xxxx
    Hv Mode:                       ""                                                             <<hvMode left blank, however being applied continuously by the provider
    Ide Controller Count:          2
    Latency Sensitivity:           normal
    Memory:                        2048
    Memory Limit:                  -1
    Memory Share Count:            20480
    Memory Share Level:            normal
    Migrate Wait Timeout:          30
    Name:                          prod-test-115
---removed for brevity---

Impact:
In vSphere V8 environments, since the hvMode value in the status field is blank, the provider tries to re-apply the claim repeatedly.
Each re-apply leads to a reboot, causing a continuous loop of VM reboot.

Note on Terraform Provider:
When we try to create a virtual machine (VM) using the Terraform provider in vSphere with hashicorp/vsphere:2.9.3, it works as expected.

Reference:
This issue seems related to a known bug discussed in the Terraform vSphere provider GitHub repository given below.

hashicorp/terraform-provider-vsphere#1902

@abhinit-kumar
Copy link
Author

I compiled a new version of this provider with TERRAFORM_PROVIDER_VERSION=2.9.3 and TERRAFORM_VERSION=1.10.4 and works well. And is also backward compatible. We have tested the same on vSphare 7 and 8 both versions.

@abhinit-kumar
Copy link
Author

If allowed I can open a PR to update TERRAFORM_PROVIDER_VERSION to 2.9.3 and TERRAFORM_VERSION to 1.10.4.

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

No branches or pull requests

1 participant