Skip to content

pkg/conditions panics for k8s.io types #343

@aruiz14

Description

@aruiz14

While working on adding a test for some unrelated pull request, I found that my code was panicking at some part.
Since I needed to use any object type for my test, I thought it was good to use to use a simple one from the Kubernetes core types, so I picked corev1.Service.

I turns out that the Conditions field for corev1.ServiceStatus uses metav1.Condition, whose fields include LastTransitionTime. This name is different from LastUpdatedTime, which is what wrangler's pkg/condition expects to set.
Beware that there is no call to IsValid() for the result of getFieldValue(value, "LastUpdateTime"), hence causing the panic when unconditionally trying to set its value.

On a separate note, this makes me wonder if the https://github.com/rancher/wrangler/tree/master/pkg/generated/controllers package is actually useful or it could be cleaned up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions