-
Notifications
You must be signed in to change notification settings - Fork 218
context.getSecondaryResource not containing some generated resources #2310
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
Comments
Hi, is your project open source? Would be great in that case if you could provide a link, if not than provide a reproducer please. Would be much easier to figure it out. Thx!! |
while i would like to know why this happens, for my purpose, i could get away by not using
I tried disabling |
Just to maybe give you a heads up, my use case involves creating a new namespace whenever my CR ( cluster scoped ) is created. My operator starts with watching all namespaces, but since I create new namespaces, will the josdk track events from them? That could explain why the operator never finds out about the resources created inside this namespace @csviri |
when i try to update a custom resource
upon creating the workload
|
@fhalde The reason is not working because the public class RoleDependentResource extends CRUDKubernetesDependentResource<Role, Workload> implements SecondaryToPrimaryMapper<Role> {
// omitted code
@Override
public Set<ResourceID> toPrimaryResourceIDs(Role role) {
return Mappers.fromOwnerReferences(true).toPrimaryResourceIDs(role);
}
} In this part:
A cluster scope aware Will document this. And for v5 we will take a look how to handle this automatically. The original mapper is created here: Line 90 in 0b17878
Note the false flag.
|
ah @csviri thanks a lot ! let me test it out :) |
@csviri if our CR was namespaced, do we need to make the above changes? e.g. we can have a "public" namespace where our CR gets created. Then our reconciler creates a separate namespace,role e.t.c |
In that case you don't have to do this change. |
related improvement issue: #2311 |
this worked 🙇 closing it |
Bug Report
What did you do?
I have a simple Managed dependent reconciler with the following configuration
i.e. the dependency chain is – role depends on namespace & role-binding depends on role & namespace. All dependends extend the
CRUDKubernetesDependentResource
What did you expect to see?
Inside the
RoleBindingDependentResource
, I have implemented thedesired
method that callscontext.getSecondaryResource
to get the role & namespace.What did you see instead? Under which circumstances?
Weirdly, context.getSecondaryResource is only able to return the Namespace but not the role
Environment
Kubernetes cluster type:
kind ( local )
$ Mention java-operator-sdk version from pom.xml file
4.8.1
$ java -version
openjdk version "21.0.2" 2024-01-16 LTS
OpenJDK Runtime Environment Corretto-21.0.2.13.1 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.2.13.1 (build 21.0.2+13-LTS, mixed mode, sharing)
$ kubectl version
Client Version: v1.29.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.2
Possible Solution
Additional context
I probably don't consider this as a bug and could be a genuine misunderstanding of the
dependsOn
andcontext.getSecondaryResource
The text was updated successfully, but these errors were encountered: