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

Metal3DataTemplate with templateReference cannot be deleted while Metal3Data with matching name exists #1357

Open
lentzi90 opened this issue Dec 12, 2023 · 7 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. triage/accepted Indicates an issue is ready to be actively worked on.

Comments

@lentzi90
Copy link
Member

lentzi90 commented Dec 12, 2023

What steps did you take and what happened:

  1. Create a Cluster with Metal3 for infra and make sure it has a MachineDeployment that uses a Metal3DataTemplate with a templateReference.
  2. Create another Metal3DataTemplate and Metal3MachineTemplate that references it.
  3. Update the MachineDeployment to use the new Metal3MachineTemplate and Metal3DataTemplate so that a rollout is triggered.
  4. When the rollout is complete, delete the old Metal3DataTemplate that is no longer used.
  5. The Metal3DataTemplate cannot be deleted because it thinks it is still in use

What did you expect to happen:

Old Metal3DataTemplates should be possible to delete when they are no longer used.

Anything else you would like to add:

The issue happens only when using templateReference. It is unclear to me what the function of this field is.
I have been able to do rollouts without issues when not using the templateReference and can then delete the old Metal3DataTemplate.

Relevant docs: https://github.com/metal3-io/cluster-api-provider-metal3/blob/main/docs/api.md#updating-metadata-and-networkdata

The process to allow updating the metaData and networkData is then to create a new Metal3DataTemplate and reference the new one in the Metal3MachineTemplate. This requires the Metal3Data to be linked to both Metal3DataTemplates.

I do not understand why the Metal3Data must be linked to both Metal3DataTemplates. It works just fine without from my experience.

Relevant code:

func (m *DataTemplateManager) dataObjectBelongsToTemplate(dataObject infrav1.Metal3Data) bool {
if dataObject.Spec.Template.Name == m.DataTemplate.Name {
return true
}
// Match TemplateReference
if dataObject.Spec.TemplateReference == "" && m.DataTemplate.Spec.TemplateReference == dataObject.Spec.Template.Name {
return true
}
if dataObject.Spec.TemplateReference != "" && m.DataTemplate.Spec.TemplateReference == dataObject.Spec.TemplateReference {
return true
}
return false
}

Environment:

  • Cluster-api version: v1.5.3
  • Cluster-api-provider-metal3 version: v1.5.2
  • Environment (metal3-dev-env or other): other
  • Kubernetes version: (use kubectl version): v1.28.3

/kind bug

@metal3-io-bot metal3-io-bot added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue lacks a `triage/foo` label and requires one. labels Dec 12, 2023
@lentzi90
Copy link
Member Author

/triage accepted
/cc @Rozzii @kashifest

@metal3-io-bot metal3-io-bot added triage/accepted Indicates an issue is ready to be actively worked on. and removed needs-triage Indicates an issue lacks a `triage/foo` label and requires one. labels Dec 12, 2023
@metal3-io-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues will close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@metal3-io-bot metal3-io-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 11, 2024
@lentzi90
Copy link
Member Author

/remove-lifecycle stale

@metal3-io-bot metal3-io-bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 11, 2024
@metal3-io-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues will close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@metal3-io-bot metal3-io-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 9, 2024
@Rozzii
Copy link
Member

Rozzii commented Jun 10, 2024

/remove-lifecycle stale

@metal3-io-bot metal3-io-bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 10, 2024
@Rozzii Rozzii moved this from Backlog to CAPM3 on hold / blocked in Metal3 - Roadmap Jun 28, 2024
@metal3-io-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues will close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@metal3-io-bot metal3-io-bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 8, 2024
@Rozzii
Copy link
Member

Rozzii commented Sep 11, 2024

/remove-lifecycle stale

@metal3-io-bot metal3-io-bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 11, 2024
@Rozzii Rozzii added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. triage/accepted Indicates an issue is ready to be actively worked on.
Projects
Status: CAPM3 on hold / blocked
Development

No branches or pull requests

3 participants