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

debugging dont work #1

Open
cmoulliard opened this issue Oct 7, 2019 · 2 comments
Open

debugging dont work #1

cmoulliard opened this issue Oct 7, 2019 · 2 comments
Assignees

Comments

@cmoulliard
Copy link

Problem

The java application starts very well

/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.1.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:50592,suspend=y,server=n -javaagent:/Users/dabou/Library/Caches/IntelliJIdea2019.2/captureAgent/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "/Users/dabou/Downloads/podsetoperatorinjava-master/target/classes:/Users/dabou/.m2/repository/io/fabric8/kubernetes-client/4.6.0/kubernetes-client-4.6.0.jar:/Users/dabou/.m2/repository/io/fabric8/kubernetes-model/4.6.0/kubernetes-model-4.6.0.jar:/Users/dabou/.m2/repository/io/fabric8/kubernetes-model-common/4.6.0/kubernetes-model-common-4.6.0.jar:/Users/dabou/.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.9.9/jackson-module-jaxb-annotations-2.9.9.jar:/Users/dabou/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar:/Users/dabou/.m2/repository/javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar:/Users/dabou/.m2/repository/com/squareup/okhttp3/okhttp/3.12.0/okhttp-3.12.0.jar:/Users/dabou/.m2/repository/com/squareup/okio/okio/1.15.0/okio-1.15.0.jar:/Users/dabou/.m2/repository/com/squareup/okhttp3/logging-interceptor/3.12.0/logging-interceptor-3.12.0.jar:/Users/dabou/.m2/repository/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.jar:/Users/dabou/.m2/repository/org/slf4j/jul-to-slf4j/1.7.26/jul-to-slf4j-1.7.26.jar:/Users/dabou/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.9.9/jackson-dataformat-yaml-2.9.9.jar:/Users/dabou/.m2/repository/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar:/Users/dabou/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.9.3/jackson-databind-2.9.9.3.jar:/Users/dabou/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/dabou/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.9/jackson-core-2.9.9.jar:/Users/dabou/.m2/repository/io/fabric8/zjsonpatch/0.3.0/zjsonpatch-0.3.0.jar:/Users/dabou/.m2/repository/com/github/mifmif/generex/1.0.2/generex-1.0.2.jar:/Users/dabou/.m2/repository/dk/brics/automaton/automaton/1.11-8/automaton-1.11-8.jar:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar" io.fabric8.podset.operator.PodSetOperatorMain
Connected to the target VM, address: '127.0.0.1:50592', transport: 'socket'
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Oct 07, 2019 7:05:13 PM io.fabric8.podset.operator.controller.PodSetController run
INFO: Starting PodSet controller
Oct 07, 2019 7:05:14 PM io.fabric8.podset.operator.controller.PodSetController run
INFO: trying to fetch item from workqueue...
Oct 07, 2019 7:05:14 PM io.fabric8.podset.operator.controller.PodSetController run
INFO: Work Queue is empty

but if we want to debug, then break points is not called when a CR is deployed on ocp3.11
Screenshot 2019-10-07 19 10 05

and logs report such information

io.fabric8.podset.operator.controller.PodSetController$1.onAdd()
Oct 07, 2019 7:05:49 PM io.fabric8.podset.operator.controller.PodSetController enqueuePodSet
INFO: enqueuePodSet(example-podset)
Oct 07, 2019 7:05:49 PM io.fabric8.podset.operator.controller.PodSetController enqueuePodSet
INFO: Going to enqueue key scoped/example-podset
Oct 07, 2019 7:05:49 PM io.fabric8.podset.operator.controller.PodSetController enqueuePodSet
INFO: Adding item to workqueue
Oct 07, 2019 7:05:49 PM io.fabric8.podset.operator.controller.PodSetController run
INFO: Got scoped/example-podset
Oct 07, 2019 7:05:49 PM io.fabric8.podset.operator.controller.PodSetController run
SEVERE: PodSet example-podset in workqueue no longer exists

Question: Do we have to perform a specific step to debug a java operator (= connected to an informer queue) ?

@rohanKanojia
Copy link
Owner

rohanKanojia commented Oct 7, 2019

I'm not sure if any special step is required. While writing I did most of my testing on minikube. I will test this on 3.11 and get back on this.

@rohanKanojia rohanKanojia self-assigned this Oct 7, 2019
@rohanKanojia
Copy link
Owner

Unfortunately, I could not try it out on Openshift online as I don't have access to create CRDs on the Openshift online cluster I use.

~/go/src/github.com/fabric8io/podsetoperatorinjava/src/main/resources : $ oc create -f crd.yaml 
Error from server (Forbidden): error when creating "crd.yaml": customresourcedefinitions.apiextensions.k8s.io is forbidden: User "rohanKanojia" cannot create customresourcedefinitions.apiextensions.k8s.io at the cluster scope: no RBAC policy matched
~/go/src/github.com/fabric8io/podsetoperatorinjava/src/main/resources : $ 

When I ran this on Minishift, I was able to hit breakpoint:
Screenshot from 2019-10-16 19-26-34

However, I also faced the same error. I think it is because I hardcoded namespace here:

public PodSetController(KubernetesClient kubernetesClient, MixedOperation<PodSet, PodSetList, DoneablePodSet, Resource<PodSet, DoneablePodSet>> podSetClient, SharedIndexInformer<Pod> podInformer, SharedIndexInformer<PodSet> podSetInformer) {
this.kubernetesClient = kubernetesClient;
this.podSetClient = podSetClient;
this.podSetLister = new Lister<>(podSetInformer.getIndexer(), "default");
this.podSetInformer = podSetInformer;
this.podLister = new Lister<>(podInformer.getIndexer(), "default");
this.podInformer = podInformer;
this.workqueue = new ArrayBlockingQueue<>(1024);

I think we should pick namespace either from kubeconfig or maybe as a commandline argument.

rohanKanojia added a commit that referenced this issue Oct 16, 2019
As reported in #1 , this project doesn't seem to be working for
users who have namespace set other than default.
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

2 participants