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

Owner references are not correctly resolved when primary resource has empty group #2723

Closed
mnk opened this issue Mar 9, 2025 · 1 comment

Comments

@mnk
Copy link
Contributor

mnk commented Mar 9, 2025

Bug Report

What did you do?

When implementing a workflow where the primary resource is a standard K8s kind (ConfigMap)
I was unable to get the secondary resources from the context.

What did you expect to see?

I expected to be able to fetch the secondary resources via context.getSecondaryResource

What did you see instead? Under which circumstances?

The secondary resources are always null

Environment

Running latest from main branch 5.0.4-SNAPSHOT

Possible Solution

The problem seems to be caused by a bug in the apiVersion matching. I will post a fix proposal as PR.

mnk added a commit to mnk/java-operator-sdk that referenced this issue Mar 9, 2025
The HasMetadata.getApiVersion(primaryResourceType) method return "/v1" for
the ConfigMap type. Since the K8s owner reference uses "v1" instead, the
secondary resource of a primary ConfigMap will not be tracked correctly.

Proposed fix for operator-framework#2723
mnk added a commit to mnk/java-operator-sdk that referenced this issue Mar 9, 2025
The HasMetadata.getApiVersion(primaryResourceType) method return "/v1" for
the ConfigMap type. Since the K8s owner reference uses "v1" instead, the
secondary resource of a primary ConfigMap will not be tracked correctly.

Proposed fix for operator-framework#2723

Signed-off-by: Mathias Nicolajsen Kjaergaard <[email protected]>
mnk added a commit to mnk/kubernetes-client that referenced this issue Mar 10, 2025
The HasMetadata#getApiVersion method is returning a string starting
with "/" when the group is "". This is not consistent with how owner
references are specified.

This issues is causing:
operator-framework/java-operator-sdk#2723
csviri pushed a commit to mnk/java-operator-sdk that referenced this issue Mar 11, 2025
The HasMetadata.getApiVersion(primaryResourceType) method return "/v1" for
the ConfigMap type. Since the K8s owner reference uses "v1" instead, the
secondary resource of a primary ConfigMap will not be tracked correctly.

Proposed fix for operator-framework#2723

Signed-off-by: Mathias Nicolajsen Kjaergaard <[email protected]>
csviri pushed a commit that referenced this issue Mar 12, 2025
The HasMetadata.getApiVersion(primaryResourceType) method return "/v1" for
the ConfigMap type. Since the K8s owner reference uses "v1" instead, the
secondary resource of a primary ConfigMap will not be tracked correctly.

Proposed fix for #2723

Signed-off-by: Mathias Nicolajsen Kjaergaard <[email protected]>
manusa pushed a commit to fabric8io/kubernetes-client that referenced this issue Mar 12, 2025
fix(model-core) apiVersion for core k8s resources

The HasMetadata#getApiVersion method is returning a string starting
with "/" when the group is "". This is not consistent with how owner
references are specified.

This issues is causing:
operator-framework/java-operator-sdk#2723
---
refactor: unify apiVersion computation from group & version

Co-authored-by: Chris Laprun <[email protected]>
@mnk
Copy link
Contributor Author

mnk commented Mar 12, 2025

Temporary workaround merged to java-operator-sdk and fix for root cause also merged to kubernetes-client

@mnk mnk closed this as completed Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant