Skip to content

defaultAndValidateMachineSpec() only validates, doesn't default #1670

@multi-io

Description

@multi-io

Unless I'm very confused right now, this code in defaultAndValidateMachineSpec() (part the of the mutating webhooks)

spec = &defaultedSpec

...only updates the passed-in pointer to the to-be-defaulted MachineSpec, but doesn't update the MachineSpec it points to. So the updated object will be garbage collected and the caller's MachineSpec will not be updated (i.e. defaulted).
Changing the line to something like *spec = defaultedSpec should fix it (or changing some function signatures so we pass pointers rather than values). I'm not sure about the implications because it seems like this bug has been in there since 2018. So maybe nobody really needed the provider-specific defaulting functionality?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.sig/cluster-managementDenotes a PR or issue as being assigned to SIG Cluster Management.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions