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

Incorrect fix for ObjectMeta issue in CloudStackMachineTemplateResource in v1beta3 API #331

Closed
hrak opened this issue Dec 14, 2023 · 3 comments · Fixed by #332
Closed

Incorrect fix for ObjectMeta issue in CloudStackMachineTemplateResource in v1beta3 API #331

hrak opened this issue Dec 14, 2023 · 3 comments · Fixed by #332
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Milestone

Comments

@hrak
Copy link
Contributor

hrak commented Dec 14, 2023

/kind bug

What steps did you take and what happened:
[A clear and concise description of what the bug is.]

The v1beta3 API version bump was created to solve an issue related to creationTimestamp being null in a serialization of a CloudStackMachineTemplate resource (See related issues #166 #176 #237)

The solution applied here is to completely remove the ObjectMeta field from the CloudStackMachineTemplateSpec struct, but this is not the right fix for this issue, and against API conventions.

The main problem is that in v1beta1 and v1beta2, CloudStackMachineTemplateSpec is defined as this:

type CloudStackMachineTemplateResource struct {
	// Standard object's metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	// +optional
	// +nullable
	ObjectMeta metav1.ObjectMeta     `json:"metadata,omitempty"`
	Spec       CloudStackMachineSpec `json:"spec"`
}

while it should be defined as this:

type CloudStackMachineTemplateResource struct {
	// Standard object's metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	// +optional
	ObjectMeta clusterv1.ObjectMeta  `json:"metadata,omitempty"`
	Spec       CloudStackMachineSpec `json:"spec"`
}

Note the metav1 vs clusterv1 and removal of nullable. I've verified this in various other CAPI infra providers (CAPA, CAPZ).

clusterv1.ObjectMeta has been specifically introduced in CAPI to address this issue with creationTimestamp. See the elaborate comment at https://github.com/kubernetes-sigs/cluster-api/blob/36e9abaa070c0bb0dfbfc81d2e2795b245797db5/api/v1beta1/common_types.go#L271

What did you expect to happen:

No complete removal of ObjectMeta in CloudStackMachineTemplateResource.

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 14, 2023
@hrak
Copy link
Contributor Author

hrak commented Dec 14, 2023

I suggest we fix this before the release of 0.4.9 (since this is the sole reason we bumped the API), and also consider including #328 (to make the API version bump worthwhile) and #329 (cc @g-gaston )

@g-gaston
Copy link
Contributor

Cc @vignesh-goutham since he was leading the api change

hrak added a commit to Leaseweb/cluster-api-provider-cloudstack that referenced this issue Dec 18, 2023
This restores the field with the correct type, and converts the field for v1beta1 and 2

Fixes kubernetes-sigs#331
@rohityadavcloud rohityadavcloud added this to the v0.5.0 milestone Feb 8, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 8, 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. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants