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

🌱 Rename the pause-reconcile annotation to paused #636

Merged

Conversation

aruneshpa
Copy link
Contributor

@aruneshpa aruneshpa commented Jul 19, 2024

What does this PR do, and why is it needed?

This change renames the "pause-reconcile" annotation used to pause the reconciliation of a VM to "paused". This is consistent with other components using "paused" to indicate an entity being paused.

Additionally, introduce a helper package that can be used to check if an annotation is present (regardless of the value) in a readable way.

Testing Done:

  1. Create a VM on v1alpha3 version with paused annotation set.
# k get --raw  https://127.0.0.1:6443/apis/vmoperator.vmware.com/v1alpha3/namespaces/parunesh-ns/virtualmachines/parunesh-vm | jq -r '.metadata.annotations | to_entries[] | select(.key == "vmoperator.vmware.com/paused")'
{
  "key": "vmoperator.vmware.com/paused",
  "value": "something"
}
  1. Ensure that the VM doesn't have pause-reconcile annotation set
# k get --raw  https://127.0.0.1:6443/apis/vmoperator.vmware.com/v1alpha3/namespaces/parunesh-ns/virtualmachines/parunesh-vm | jq -r '.metadata.annotations | to_entries[] | select(.key == "vmoperator.vmware.com/pause-reconcile")'
#
  1. Fetch the resource at v1alpha2 and v1alpha1 version and ensure that the pause-reconcile annotation is set.
# k get --raw  https://127.0.0.1:6443/apis/vmoperator.vmware.com/v1alpha2/namespaces/parunesh-ns/virtualmachines/parunesh-vm | jq -r '.metadata.annotations | to_entries[] | select(.key == "vmoperator.vmware.com/pause-reconcile")'
{
  "key": "vmoperator.vmware.com/pause-reconcile",
  "value": "something"
}
# k get --raw  https://127.0.0.1:6443/apis/vmoperator.vmware.com/v1alpha1/namespaces/parunesh-ns/virtualmachines/parunesh-vm | jq -r '.metadata.annotations | to_entries[] | select(.key == "vmoperator.vmware.com/pause-reconcile")'
{
  "key": "vmoperator.vmware.com/pause-reconcile",
  "value": "something"
}

Please add a release note if necessary:

Rename the pause-reconcile annotation to paused

@aruneshpa aruneshpa requested review from akutz and bryanv July 19, 2024 22:37
@aruneshpa aruneshpa self-assigned this Jul 19, 2024
@github-actions github-actions bot added the size/L Denotes a PR that changes 100-499 lines. label Jul 19, 2024
@aruneshpa aruneshpa force-pushed the feature/rename-pause-annotation branch from 40d4a09 to 90d5ddd Compare July 19, 2024 23:13
@akutz
Copy link
Collaborator

akutz commented Jul 22, 2024

I did realize a concern last night -- will this be confused with a VM being paused as in being in a suspended state?

@aruneshpa
Copy link
Contributor Author

I did realize a concern last night -- will this be confused with a VM being paused as in being in a suspended state?

I think this should be fine since the suspended state is conveyed through spec and status. It also helps that this is clearly called out in the API docs.

@aruneshpa
Copy link
Contributor Author

@bryanv and @akutz , the tricky thing I want to call out is, after this change, I am proactively removing the label that doesn't correspond to the destination schema version. For example, if a v1a3 VM was created with both "pause-reconcile" and "paused" annotations, and this resource is fetched at v1a2, the conversion logic will drop the "paused" annotation from the resource (which the user had explicitly applied).
This should be fine since these annotations are considered as reserved. I would like your thoughts on this.

@bryanv
Copy link
Contributor

bryanv commented Jul 26, 2024

@bryanv and @akutz , the tricky thing I want to call out is, after this change, I am proactively removing the label that doesn't correspond to the destination schema version. For example, if a v1a3 VM was created with both "pause-reconcile" and "paused" annotations, and this resource is fetched at v1a2, the conversion logic will drop the "paused" annotation from the resource (which the user had explicitly applied). This should be fine since these annotations are considered as reserved. I would like your thoughts on this.

I don't think that will be a big deal for this annotation. Note though that we do have the hub version stashed away in the annotation so if we really wanted/needed to we could restore it.

@aruneshpa aruneshpa force-pushed the feature/rename-pause-annotation branch from 90d5ddd to 58b4b72 Compare August 22, 2024 17:58
This change renames the "pause-reconcile" annotation used to pause the
reconciliation of a VM to "paused".  This is consistent with other
components using "paused" to indicate an entity being paused.

Additionally, introduce a helper package that can be used to check if
an annotation is present (regardless of the value) in a readable way.
@aruneshpa aruneshpa force-pushed the feature/rename-pause-annotation branch from 58b4b72 to c6cfb8d Compare August 22, 2024 23:55
Copy link

Code Coverage

Package Line Rate Health
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/clustercontentlibraryitem 81%
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/contentlibraryitem 85%
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/utils 97%
github.com/vmware-tanzu/vm-operator/controllers/infra/capability 86%
github.com/vmware-tanzu/vm-operator/controllers/infra/configmap 71%
github.com/vmware-tanzu/vm-operator/controllers/infra/node 77%
github.com/vmware-tanzu/vm-operator/controllers/infra/secret 77%
github.com/vmware-tanzu/vm-operator/controllers/storagepolicyquota 97%
github.com/vmware-tanzu/vm-operator/controllers/util/encoding 73%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachine/storagepolicyusage 99%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachine/virtualmachine 87%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachine/volume 86%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineclass 75%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinepublishrequest 81%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinereplicaset 67%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice 83%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice/providers 92%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinesetresourcepolicy 80%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha1 72%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha1/conditions 88%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha1/patch 78%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha2 73%
github.com/vmware-tanzu/vm-operator/pkg/builder 95%
github.com/vmware-tanzu/vm-operator/pkg/conditions 88%
github.com/vmware-tanzu/vm-operator/pkg/config 100%
github.com/vmware-tanzu/vm-operator/pkg/config/env 100%
github.com/vmware-tanzu/vm-operator/pkg/context/operation 100%
github.com/vmware-tanzu/vm-operator/pkg/patch 78%
github.com/vmware-tanzu/vm-operator/pkg/prober 91%
github.com/vmware-tanzu/vm-operator/pkg/prober/probe 90%
github.com/vmware-tanzu/vm-operator/pkg/prober/worker 77%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere 76%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/client 80%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/clustermodules 71%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/config 72%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/contentlibrary 74%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/credentials 100%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/network 80%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/placement 77%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/session 73%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/sysprep 100%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/vcenter 82%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/virtualmachine 77%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/vmlifecycle 67%
github.com/vmware-tanzu/vm-operator/pkg/record 78%
github.com/vmware-tanzu/vm-operator/pkg/topology 91%
github.com/vmware-tanzu/vm-operator/pkg/util 87%
github.com/vmware-tanzu/vm-operator/pkg/util/annotations 100%
github.com/vmware-tanzu/vm-operator/pkg/util/cloudinit 89%
github.com/vmware-tanzu/vm-operator/pkg/util/cloudinit/validate 91%
github.com/vmware-tanzu/vm-operator/pkg/util/image 100%
github.com/vmware-tanzu/vm-operator/pkg/util/kube 80%
github.com/vmware-tanzu/vm-operator/pkg/util/kube/cource 100%
github.com/vmware-tanzu/vm-operator/pkg/util/kube/spq 100%
github.com/vmware-tanzu/vm-operator/pkg/util/ptr 100%
github.com/vmware-tanzu/vm-operator/pkg/util/resize 97%
github.com/vmware-tanzu/vm-operator/pkg/util/vmopv1 91%
github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/client 68%
github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/vm 86%
github.com/vmware-tanzu/vm-operator/pkg/webconsolevalidation 100%
github.com/vmware-tanzu/vm-operator/webhooks/common 100%
github.com/vmware-tanzu/vm-operator/webhooks/persistentvolumeclaim/validation 95%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachine/mutation 87%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachine/validation 95%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineclass/mutation 62%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineclass/validation 89%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinepublishrequest/validation 92%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinereplicaset/validation 90%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineservice/mutation 67%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineservice/validation 92%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinesetresourcepolicy/validation 89%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinewebconsolerequest/v1alpha1/validation 92%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinewebconsolerequest/v1alpha2/validation 92%
Summary 82% (9207 / 11192)

Minimum allowed line rate is 79%

Copy link
Member

@dilyar85 dilyar85 left a comment

Choose a reason for hiding this comment

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

LGTM!

@aruneshpa aruneshpa merged commit 08c4efa into vmware-tanzu:main Aug 23, 2024
11 checks passed
@aruneshpa aruneshpa deleted the feature/rename-pause-annotation branch August 23, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-not-required size/L Denotes a PR that changes 100-499 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants