redhat-developer / intellij-kubernetes

IntelliJ Kubernetes plugin
https://plugins.jetbrains.com/plugin/15921-kubernetes-by-red-hat
Eclipse Public License 2.0
20 stars 20 forks source link

possibility to set namespaces manually when the autodiscover featre is disabled by the organization #717

Closed deejonz closed 8 months ago

deejonz commented 9 months ago

possibility to add namespaces manually when the autodiscover feature is disabled by the organization: com.redhat.devtools.intellij.kubernetes.model.util.ResourceException: Could not get Namespaces for server https://myorganization.com

adietish commented 8 months ago

Hi @deejonz:

Thanks for reporting what you're missing feature wise. I am not fully sure though what you're missing: You can manually set the current namespace as long as you know it's name.

  1. open up the cluster, have the "Namespaces" cathegory visible (not it's children)

  2. in the context menu to it you can pick "Set Current Namespace"

    image
  3. in the upcoming dialog, provide the name (autocomplete is available if listing namespaces is possible) and hit "Set"

    image

This would set the current namespace that you provide in name. What's missing for you? Glad if this is enough or if there's something I can add to improve your experience 😄

deejonz commented 8 months ago

Hi @adietish, thanks for your replay. I can't access such menu and it's stuck on loading ... so the only context menu I can see is 'Refresh' ...

Screenshot 2024-03-13 at 20 52 53 Screenshot 2024-03-13 at 20 53 01
adietish commented 8 months ago

Hi @deejonz, this looks very bad. Loading the tree is breaking even before the namespaces are retrieved.

Can you find any relevant stacktrace in the intellij logs (Help > Show Log in Finder, and then open the file in an editor)? It looks to me as if you face this issue when you dont have any current namespace set in the kube config, correct? If you try to list the namespaces on your cluster (ex. via kubectl), it errors with 403 forbidden, correct?

deejonz commented 8 months ago

like this?

com.redhat.devtools.intellij.kubernetes.model.util.ResourceException: Could not get Namespaces for server https://api.xxxxx.k8s.eu-central-1.aws.xxxxxxxx.com/
    at com.redhat.devtools.intellij.kubernetes.model.context.ActiveContext.getAllResources(ActiveContext.kt:148)
    at com.redhat.devtools.intellij.kubernetes.model.context.ActiveContext.getCurrentNamespace(ActiveContext.kt:122)
    at com.redhat.devtools.intellij.kubernetes.model.ResourceModel.getCurrentNamespace(ResourceModel.kt:106)
    at com.redhat.devtools.intellij.kubernetes.tree.KubernetesDescriptors$NamespacesFolderDescriptor.getSubLabel(KubernetesDescriptors.kt:126)
    at com.redhat.devtools.intellij.kubernetes.tree.KubernetesDescriptors$NamespacesFolderDescriptor.getSubLabel(KubernetesDescriptors.kt:114)
    at com.redhat.devtools.intellij.kubernetes.tree.TreeStructure$Descriptor.update(TreeStructure.kt:331)
    at com.intellij.ide.util.treeView.PresentableNodeDescriptor.getUpdatedPresentation(PresentableNodeDescriptor.java:88)
    at com.intellij.ide.util.treeView.PresentableNodeDescriptor.update(PresentableNodeDescriptor.java:32)
    at com.intellij.ui.tree.StructureTreeModel$Node.update(StructureTreeModel.java:486)
    at com.intellij.ui.tree.StructureTreeModel$Node.<init>(StructureTreeModel.java:467)
    at com.intellij.ui.tree.StructureTreeModel$Node.<init>(StructureTreeModel.java:460)
    at com.intellij.ui.tree.StructureTreeModel.getValidChildren(StructureTreeModel.java:418)
    at com.intellij.ui.tree.StructureTreeModel.validateChildren(StructureTreeModel.java:329)
    at com.intellij.ui.tree.StructureTreeModel.getNode(StructureTreeModel.java:323)
    at com.intellij.ui.tree.StructureTreeModel.getChildren(StructureTreeModel.java:343)
    at com.intellij.ui.tree.AsyncTreeModel$CmdGetChildren.computeNode(AsyncTreeModel.java:613)
    at com.intellij.ui.tree.AsyncTreeModel$Command.computeNode(AsyncTreeModel.java:489)
    at com.intellij.util.concurrency.Invoker$Task.run(Invoker.java:381)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:192)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:610)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:685)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:641)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:609)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:78)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:179)
    at com.intellij.util.concurrency.Invoker.startTask(Invoker.java:236)
    at com.intellij.util.concurrency.Invoker.invokeSafely(Invoker.java:194)
    at com.intellij.util.concurrency.Invoker.lambda$offerSafely$0(Invoker.java:177)
    at com.intellij.util.concurrency.Invoker$Background.lambda$offer$0(Invoker.java:508)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:244)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:30)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:222)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:218)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:210)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://api.xxxxx.k8s.eu-central-1.aws.xxxxxxxx.com/api/v1/namespaces. Message: Forbidden! User stefano-xxxxx-id doesn't have permission. namespaces is forbidden: User "stefano.xxxxx@xxxxxxx.com" cannot list resource "namespaces" in API group "" at the cluster scope.
    at io.fabric8.kubernetes.client.KubernetesClientException.copyAsCause(KubernetesClientException.java:238)
    at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.waitForResult(OperationSupport.java:538)
    at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.list(BaseOperation.java:427)
    at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.list(BaseOperation.java:392)
    at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.list(BaseOperation.java:93)
    at com.redhat.devtools.intellij.kubernetes.model.resource.NonNamespacedResourceOperator.loadAllResources(NonNamespacedResourceOperator.kt:51)
    at com.redhat.devtools.intellij.kubernetes.model.resource.NonNamespacedResourceOperator.getAllResources(NonNamespacedResourceOperator.kt:42)
    at com.redhat.devtools.intellij.kubernetes.model.resource.NonNamespacedResourceOperator.getAllResources(NonNamespacedResourceOperator.kt:34)
    at com.redhat.devtools.intellij.kubernetes.model.context.ActiveContext.getAllResources(ActiveContext.kt:141)
    ... 40 more
Caused by: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://api.xxxxx.k8s.eu-central-1.aws.xxxxxxxx.com/api/v1/namespaces. Message: Forbidden! User stefano.xxxxx-id doesn't have permission. namespaces is forbidden: User "stefano.xxxxx@xxxxxx.com" cannot list resource "namespaces" in API group "" at the cluster scope.
    at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.requestFailure(OperationSupport.java:728)
    at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.requestFailure(OperationSupport.java:708)
    at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.assertResponseCode(OperationSupport.java:657)
    at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.lambda$handleResponse$0(OperationSupport.java:587)
    at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
    at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
    at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
    at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.lambda$retryWithExponentialBackoff$2(OperationSupport.java:629)
    at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
    at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
    at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
    at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
    at io.fabric8.kubernetes.client.http.StandardHttpClient.lambda$withUpstreamCancellation$3(StandardHttpClient.java:100)
    at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
    at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
    at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
    at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
    at io.fabric8.kubernetes.client.http.ByteArrayBodyHandler.onBodyDone(ByteArrayBodyHandler.java:52)
    at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
    at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
    at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
    at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
    at io.fabric8.kubernetes.client.okhttp.OkHttpClientImpl$OkHttpAsyncBody.doConsume(OkHttpClientImpl.java:133)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    ... 1 more
adietish commented 8 months ago

@deejonz awesome, thanks! That's exactly what I needed. Explains it. Fixing it shouldn't take too long :)

deejonz commented 8 months ago

very good, thanks!

adietish commented 8 months ago

for my own documentation, here's how to create a user that cannot list the namespaces on minikube (assumes minikube cert & key exist at ~/.minikube/ca.crt, ~/.minikube/ca.key. Assumes that there's a minikube cluster in kube config). Minikube authorizes any request that is using a valid cert.

Required to replicate the issue:

Steps:

  1. EXEC: create a new user & context in kube config
    openssl genrsa -out user1.key 2048
    openssl req -new -key user1.key -out user1.csr -subj "/CN=user1/O=group1"
    openssl x509 -req -in user1.csr -CA ~/.minikube/ca.crt -CAkey ~/.minikube/ca.key -CAcreateserial -out user1.crt -days 500
    kubectl config set-credentials user1 --client-certificate=user1.crt --client-key=user1.key
    kubectl config set-context user1-context --cluster=minikube --user=user1
    kubectl config use-context user1-context
  2. EXEC: apply the following RBAC rules on minikube
    kind: ClusterRole
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
    namespace: default
    name: can-read-pods
    rules:
    - apiGroups: [""]
    resources: ["pods"]
    verbs: ["get", "watch", "list"]
    ---
    kind: ClusterRoleBinding
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
    name: read-pods
    namespace: default
    subjects:
    - kind: User
    name: user1
    apiGroup: rbac.authorization.k8s.io
    roleRef:
    kind: ClusterRole
    name: can-read-pods
    apiGroup: rbac.authorization.k8s.io
deejonz commented 8 months ago

I cannot change the organization config at all, you should change the plugin to allow to enter manually the namespace like other plugins I use.

adietish commented 8 months ago

@deejonz: sure thing, I was pasting the above only for my own documentation purposes so that I (and PR reviewers) can replicate a setup where things behave for me/us like they do for you :) The fix that will be available should allow you to manually set the current namespace and things then should behave correctly. We dont expect you to do anything for things to behave correctly.

deejonz commented 8 months ago

sure no problem

adietish commented 8 months ago

@deejonz here's how things behave with the current fix: With the above I have set up a context "user1-context" where listing namespace is not allowed, listing pods is allowed (to replicate your env). I then created a deployment with a pod in the "default" namespace. In the screenrecording, there's initially no current namespace set and there are therefore no pods listed. Using "Set current namespace" I then change the current namespace to "default" and the pod then gets listed.

https://github.com/redhat-developer/intellij-kubernetes/assets/25126/72de6d3a-80d7-4f2e-a335-9aeba92af20a

Missing anything?

deejonz commented 8 months ago

Hello, thanks for your investigation but this is not what I get here... when I open my context I see an unexpected IDE error, the message on the bottom right corner of the screen with the error icon. If I open it I see that stacktrace I pasted the last time. Inside the context menu I only see "loading..." as per the screenshot shared the last time. Right clicking anywhere the context menu is only showing "Refresh" or "Open Dashboard" which is giving another error:

Could not find Dashboard for cluster awd-id at https://api.eu.xxxxxxx.com/: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "src" is null

I'm using IntelliJ IDEA 2023.3.5 (Community Edition) but I was getting the same issue with the earlier versions.

adietish commented 8 months ago

Hi @deejonz, the fix is not merged nor published yet, it's only available in source on the PR branch. I can provide you with a binary that you can manually install and test. Would you be willing to? My goal with the above comment is to get your feedback on the screen recording: assuming that the screen recording shows how things work when fixed, would your needs be met?

Btw. the dashboard error is a different issue. It would be great if there was a stacktrace that you could share. I'd open a new issue for it.

deejonz commented 8 months ago

Hi @adietish, ok got it. Yes sure, please provide me the binary and I'll test it thanks.

adietish commented 8 months ago

Hi @deejonz, here's a test build: https://drive.google.com/file/d/1jBWENC0rnI0BDhHdng724GmQTBGj9BhN/view?usp=sharing You can manually install the zip via Settings > Plugins > "Gear Icon" > Install Plugin from Disk

image

Thanks for testing!

deejonz commented 8 months ago

Now it works! Very nice thank you. There are some of those errors I pasted above when opening deployments for example, but I'll create a separate task. Thanks.

adietish commented 8 months ago

Hi @deejonz, Logs normally are in a file that intellij writes to (Help > Show Log in ...). If there's nothing of interest in there, then I guess that we're missing logging statements :( I'd love to see what goes wrong with the console if you can find anything about it in your logs, that would be great. But it's very possible that we cannot determine the url to the console given the very restricted user rights that exists on the cluster.

deejonz commented 8 months ago

Well after sometime that I don't use the plugin it's not working anymore even if I do right-click -> refresh. Using kubectl get po -n my-staging from terminal works as expected.

image
adietish commented 8 months ago

Hi @deejonz, Do you have any stacktrace for this, please?

deejonz commented 8 months ago

Hi @adietish, yes I pasted it on the other bug I opened today. this is the stacktrace anyway:

2024-03-18 15:05:59,803 [ 255348]   WARN - #com.redhat.devtools.intellij.kubernetes.tree.TreeStructure - Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "src" is null
java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "src" is null
    at java.base/java.util.Base64$Decoder.decode(Base64.java:589)
    at io.fabric8.kubernetes.client.utils.OpenIDConnectionUtils.getDefaultHttpClientWithPemCert(OpenIDConnectionUtils.java:292)
    at io.fabric8.kubernetes.client.utils.OpenIDConnectionUtils.getOIDCProviderTokenEndpointAndRefreshToken(OpenIDConnectionUtils.java:330)
    at io.fabric8.kubernetes.client.utils.OpenIDConnectionUtils.resolveOIDCTokenFromAuthConfig(OpenIDConnectionUtils.java:86)
    at io.fabric8.kubernetes.client.utils.TokenRefreshInterceptor.extractNewAccessTokenFrom(TokenRefreshInterceptor.java:83)
    at io.fabric8.kubernetes.client.utils.TokenRefreshInterceptor.refreshToken(TokenRefreshInterceptor.java:76)
    at io.fabric8.kubernetes.client.utils.TokenRefreshInterceptor.before(TokenRefreshInterceptor.java:58)
    at io.fabric8.kubernetes.client.http.StandardHttpClient.consumeBytes(StandardHttpClient.java:65)
    at io.fabric8.kubernetes.client.http.SendAsyncUtils.bytes(SendAsyncUtils.java:51)
    at io.fabric8.kubernetes.client.http.HttpResponse$SupportedResponses.sendAsync(HttpResponse.java:105)
    at io.fabric8.kubernetes.client.http.StandardHttpClient.sendAsync(StandardHttpClient.java:52)
    at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.retryWithExponentialBackoff(OperationSupport.java:604)
    at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.handleResponse(OperationSupport.java:581)
    at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.submitList(BaseOperation.java:414)
    at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.list(BaseOperation.java:427)
    at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.list(BaseOperation.java:392)
    at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.list(BaseOperation.java:93)
    at com.redhat.devtools.intellij.kubernetes.model.resource.NamespacedResourceOperator.loadAllResources(NamespacedResourceOperator.kt:68)
    at com.redhat.devtools.intellij.kubernetes.model.resource.NamespacedResourceOperator.getAllResources(NamespacedResourceOperator.kt:54)
    at com.redhat.devtools.intellij.kubernetes.model.resource.NamespacedResourceOperator.getAllResources(NamespacedResourceOperator.kt:36)
    at com.redhat.devtools.intellij.kubernetes.model.context.ActiveContext.getAllResources(ActiveContext.kt:148)
    at com.redhat.devtools.intellij.kubernetes.model.ResourceModel.getAllResources(ResourceModel.kt:122)
    at com.redhat.devtools.intellij.kubernetes.model.ListableResources.list(ResourceModelQuery.kt:39)
    at com.redhat.devtools.intellij.kubernetes.tree.KubernetesStructure$createWorkloadElements$3$3.invoke(KubernetesStructure.kt:193)
    at com.redhat.devtools.intellij.kubernetes.tree.KubernetesStructure$createWorkloadElements$3$3.invoke(KubernetesStructure.kt:189)
    at com.redhat.devtools.intellij.kubernetes.tree.AbstractTreeStructureContribution$ElementNode.getChildElements(AbstractTreeStructureContribution.kt:97)
    at com.redhat.devtools.intellij.kubernetes.tree.AbstractTreeStructureContribution.getChildElements(AbstractTreeStructureContribution.kt:28)
    at com.redhat.devtools.intellij.kubernetes.tree.TreeStructure.getChildElements(TreeStructure.kt:71)
    at com.redhat.devtools.intellij.kubernetes.tree.TreeStructure.getChildElements(TreeStructure.kt:64)
    at com.intellij.ui.tree.StructureTreeModel.getValidChildren(StructureTreeModel.java:411)
    at com.intellij.ui.tree.StructureTreeModel.validateChildren(StructureTreeModel.java:329)
    at com.intellij.ui.tree.StructureTreeModel.getNode(StructureTreeModel.java:323)
    at com.intellij.ui.tree.StructureTreeModel.getChildren(StructureTreeModel.java:343)
    at com.intellij.ui.tree.AsyncTreeModel$CmdGetChildren.computeNode(AsyncTreeModel.java:613)
    at com.intellij.ui.tree.AsyncTreeModel$Command.computeNode(AsyncTreeModel.java:489)
    at com.intellij.util.concurrency.Invoker$Task.run(Invoker.java:381)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:192)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:610)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:685)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:641)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:609)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:78)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:179)
    at com.intellij.util.concurrency.Invoker.startTask(Invoker.java:236)
    at com.intellij.util.concurrency.Invoker.invokeSafely(Invoker.java:194)
    at com.intellij.util.concurrency.Invoker.lambda$offerSafely$0(Invoker.java:177)
    at com.intellij.util.concurrency.Invoker$Background.lambda$offer$0(Invoker.java:508)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:244)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:30)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:222)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:218)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:210)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:840)
2024-03-18 15:06:17,456 [ 273001]   INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities to files
adietish commented 8 months ago

@deejonz maybe restarting the IDE helps? I suspect an issue in the kubernetes-client library caused by a change in your access token or cluster certificate?

deejonz commented 8 months ago

@adietish so when I restart the IDE it works fine. I start to opening pods, deployment, etc to see if it works. At some point I get that issue with src is null. From that moment everything is stuck. If I refresh it's all broken like below:

image

here's another stacktrace a bit different:

2024-03-18 16:32:21,730 [  72403]   WARN - #com.redhat.devtools.intellij.kubernetes.model.ResourceWatch - Could not watch resource(s) ResourceKind(version=v1, clazz=class io.fabric8.kubernetes.api.model.Pod, kind=Pod).
java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "src" is null
    at java.base/java.util.Base64$Decoder.decode(Base64.java:589)
    at io.fabric8.kubernetes.client.utils.OpenIDConnectionUtils.getDefaultHttpClientWithPemCert(OpenIDConnectionUtils.java:292)
    at io.fabric8.kubernetes.client.utils.OpenIDConnectionUtils.getOIDCProviderTokenEndpointAndRefreshToken(OpenIDConnectionUtils.java:330)
    at io.fabric8.kubernetes.client.utils.OpenIDConnectionUtils.resolveOIDCTokenFromAuthConfig(OpenIDConnectionUtils.java:86)
    at io.fabric8.kubernetes.client.utils.TokenRefreshInterceptor.extractNewAccessTokenFrom(TokenRefreshInterceptor.java:83)
    at io.fabric8.kubernetes.client.utils.TokenRefreshInterceptor.refreshToken(TokenRefreshInterceptor.java:76)
    at io.fabric8.kubernetes.client.utils.TokenRefreshInterceptor.before(TokenRefreshInterceptor.java:58)
    at io.fabric8.kubernetes.client.http.StandardHttpClient.lambda$buildWebSocket$4(StandardHttpClient.java:124)
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
    at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
    at io.fabric8.kubernetes.client.http.StandardHttpClient.buildWebSocket(StandardHttpClient.java:124)
    at io.fabric8.kubernetes.client.http.StandardWebSocketBuilder.buildAsync(StandardWebSocketBuilder.java:43)
    at io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager.start(WatchConnectionManager.java:113)
    at io.fabric8.kubernetes.client.dsl.internal.AbstractWatchManager.startWatch(AbstractWatchManager.java:221)
    at io.fabric8.kubernetes.client.dsl.internal.AbstractWatchManager.<init>(AbstractWatchManager.java:87)
    at io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager.<init>(WatchConnectionManager.java:74)
    at io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager.<init>(WatchConnectionManager.java:83)
    at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.submitWatch(BaseOperation.java:635)
    at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.watch(BaseOperation.java:617)
    at io.fabric8.kubernetes.client.dsl.internal.BaseOperation.watch(BaseOperation.java:605)
    at com.redhat.devtools.intellij.kubernetes.model.resource.NamespacedResourceOperator.watchAll(NamespacedResourceOperator.kt:82)
    at com.redhat.devtools.intellij.kubernetes.model.context.ActiveContext$watch$1.invoke(ActiveContext.kt:296)
    at com.redhat.devtools.intellij.kubernetes.model.context.ActiveContext$watch$1.invoke(ActiveContext.kt:296)
    at com.redhat.devtools.intellij.kubernetes.model.ResourceWatch$WatchOperation.run(ResourceWatch.kt:141)
    at com.redhat.devtools.intellij.kubernetes.model.ResourceWatch$WatchOperationsRunner.run(ResourceWatch.kt:125)
    at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1375)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
2024-03-18 16:32:40,222 [  90895]   INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities to files
deejonz commented 8 months ago

I tried three times and I can reproduce everytime. It seems that error is not coming with a specific element, but only after opening a certain amount of items.

adietish commented 8 months ago

@deejonz:

It seems that error is not coming with a specific element, but only after opening a certain amount of items.

"items" as in different kubernetes resource types (categories in the resource tree)? Do you know how many categories you can open before it starts to fail?

deejonz commented 8 months ago

this last time 47 clicks, including opening items (like expanding pods one by one), I tried another time and it was 48.. very similar.

adietish commented 8 months ago

@deejonz I'm trying to setup an EKS cluster to replicate that one. Moving this discussion about the ResourceWatch to bug #726