pluto icon indicating copy to clipboard operation
pluto copied to clipboard

Pluto mistakes a ControllerRevisions resource for a DaemonSet resource

Open JamesMarino opened this issue 3 years ago • 1 comments

What happened?

When running pluto detect-api-resources --target-versions k8s=v1.21.0 on my AWS EKS Kubernetes cluster four resources of type DaemonSet with name kube-proxy were listed as being a removed version extensions/v1beta1.

Upon looking at the single kube-proxy resource there was no extensions/v1beta1 value in the kubectl.kubernetes.io/last-applied-configuration or apiVersion fields of this resource.

When debugging and stepping through the code I realised that this was actually referring to a ControllerRevisions resource and not a DaemonSet. It seems the code prioritises the kubectl.kubernetes.io/last-applied-configuration annotation to get the kind of resource rather than carrying through the original resource kind.

What did you expect to happen?

I expected the output to show me the correct resource and where to look, saying the DaemonSet resource was the removed kind did not make me think about the ControllerRevisions resource.

How can we reproduce this?

This might be something OpenShift / AWS EKS related as the ControllerRevisions resource doesn't seem to be standard Kubernetes.

Creating a ControllerRevisions resource and setting the annotation kubectl.kubernetes.io/last-applied-configuration to

{"apiVersion":"apps/v1","kind":"DaemonSet","metadata":{"annotations":{}}}

should be able to reproduce this.

Version

v5.12.0

Search

  • [X] I did search for other open and closed issues before opening this.

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

Additional context

Happy to submit a PR eventually if keeping the original resources Kind and not using the kind in the change annotations JSON is the way to go.

As a work around I am currently editing the ControllerRevisions kubectl.kubernetes.io/last-applied-configuration to manually remove the bad API versions.

JamesMarino avatar Jan 12 '23 01:01 JamesMarino

Thanks for the detailed report!

Seems like your suggestion to carry through the kind from the originally discovered resource is the right way to go. If you're willing to submit a PR that would be greatly appreciated.

sudermanjr avatar Feb 09 '23 18:02 sudermanjr