Skip to content

Add "OwnerType" Annotation for Non-GC'ed DependentResources #2585

@coltmcnealy-lh

Description

@coltmcnealy-lh

I have a reconciler that extends KubernetesCRUDNoGCDependentResource. The created dependent has the following annotations:

metadata:
  annotations:
    io.javaoperatorsdk/primary-name: my-thing
    io.javaoperatorsdk/primary-namespace: my-namespace

In my operator, I have several different CustomResourceDefinitions and reconcilers. Therefore, I can and do have multiple custom resources in the my-namespace namespace called my-thing.

In my own code, I need to determine the owner of these resources. I can solve that by putting labels/annotations on them myself (this is quite a bit of work). However, I imagine that this is likely a vulnerability to bugs.

Proposed Solution

Add another annotation to NoGC resources and use that for determining ownership:

metadata:
  annotations:
    io.javaoperatorsdk/primary-type: MyCustomResource

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions