Giter VIP home page Giter VIP logo

Comments (17)

Nerzal avatar Nerzal commented on May 16, 2024 1

I have send u a mail @pragyamehta

from mindaro.

lolodi avatar lolodi commented on May 16, 2024 1

Hi @Nerzal, this got fixed in our latest release.
The bits are already available with the latest VSCode extension version and they are going to be available in VS with the next release.

from mindaro.

andrx avatar andrx commented on May 16, 2024 1

Thank you for help @daniv-msft !

from mindaro.

lolodi avatar lolodi commented on May 16, 2024

Hello!
You are correct, we don't have a way to let you specify the container as of today. We'll add this to our backlog.
In the mean time you should be able to get unlocked by adding the containerPort to the container spec of the container running your code, similarly at how it is documented here: https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/
This way when we try to find a container that expose the same port as the service you selected, we can narrow it down to the right one.

from mindaro.

Nerzal avatar Nerzal commented on May 16, 2024

Thank you for the response, i'll try that tomorow and report back, if it works that way.

from mindaro.

Nerzal avatar Nerzal commented on May 16, 2024

Hi @lolodi,

i had the containerPort allready specified.
So that does not seem to be sufficient.

from mindaro.

lolodi avatar lolodi commented on May 16, 2024

Hi @Nerzal,
Could you please share the .yaml of your deployment and pod? I'd like to understand you configuration better to figure out what's causing this error.

from mindaro.

pragyamehta avatar pragyamehta commented on May 16, 2024

Hi @Nerzal In case you are hesitant to share the yaml here, feel free to send it over to my email - [email protected] and we will take a look and get back to you. Thanks!

from mindaro.

andrx avatar andrx commented on May 16, 2024

I have the same exception.
Using:
VS Code v1.57.1
Extension v1.0.120210702
GKE

I see that extension is calling this:

/Users/andrx/Library/Application Support/Code/User/globalStorage/mindaro.mindaro/file-downloader-downloads/binaries/dsc connect --service workflow-service-endpoint --env /var/folders/mx/v760697166b478rt409666500000gn/T/tmp-98526x35NNAP2LJza.env --script /var/folders/mx/v760697166b478rt409666500000gn/T/tmp-98526x35NNAP2LJza.env.cmd --control-port 53426 --ppid 98486 --namespace workflows --elevation-requests [{"requestType":"EditHostsFile"}] --local-port 3001

what could be the cause?

PS, running a single pod but there is a sidecar container

from mindaro.

daniv-msft avatar daniv-msft commented on May 16, 2024

(Reopening this issue)

Thanks for commenting on this issue @andrx! In order for us to look into this, could you please share the logs we create in $TMPDIR/Bridge to Kubernetes? We're interested in the latest bridge-library- and bridge-mindarocli- ones, where we should see more information about the bug you see. Could you please attach the logs to this Github issue, or send them to us by email to [email protected]?

Also, the call you share above looks good to me: our VS Code extension relies on separate binaries, and this is just the call we make when connecting to the cluster.

from mindaro.

andrx avatar andrx commented on May 16, 2024

Hey @daniv-msft

sure, I just wanted to provide more details. where do you keep the code for extension by the way? couldn't find it. had to reverse engineer extension.js :) but like you mentioned i think it's not the extension. it's the binaries.. also not sure if there is a source code on github to check it out...

here are the logs

2021-07-08T01:29:44.6568700Z | MindaroCli | TRACE | Event: Command.Start <json>{"properties":{"arguments":"connect --service workflow-service-endpoint --env /var/folders/mx/v760697166b478rt409666500000gn/t/tmp-98526hlytuvyw01sh.env --script /var/folders/mx/v760697166b478rt409666500000gn/t/tmp-98526hlytuvyw01sh.env.cmd --control-port 58120 --ppid 98486 --namespace workflows --elevation-requests [{\"requesttype\":\"edithostsfile\"}] --local-port 3001","isRoutingEnabled":"false"},"metrics":null}</json>\nOperation context: <json>{"clientRequestId":null,"correlationId":"4171f37d-4fe3-4a61-b6fa-e8d055225b761625700675010:8779862ba412","requestId":null,"userSubscriptionId":null,"startTime":"2021-07-08T01:29:44.4161340Z","userAgent":"VSCode/1.0.120210702","requestHttpMethod":null,"requestUri":null,"version":"1.0.20210615.1","requestHeaders":{},"loggingProperties":{"applicationName":"MindaroCli","deviceOperatingSystem":"Darwin 20.5.0 Darwin Kernel Version 20.5.0: Sat May  8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64","framework":".NET Core 3.1.9","macAddressHash":"cad6500748a79985263987a2b61d73c0b5ff24c9bcfd76af254af4d02d3cf45f","processId":2277,"targetEnvironment":"Production","commandId":"8779862ba412"}}</json>
2021-07-08T01:29:44.7293150Z | MindaroCli | TRACE | Running Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand...\nOperation context: <json>{"clientRequestId":null,"correlationId":"4171f37d-4fe3-4a61-b6fa-e8d055225b761625700675010:8779862ba412","requestId":null,"userSubscriptionId":null,"startTime":"2021-07-08T01:29:44.4161340Z","userAgent":"VSCode/1.0.120210702","requestHttpMethod":null,"requestUri":null,"version":"1.0.20210615.1","requestHeaders":{},"loggingProperties":{"applicationName":"MindaroCli","deviceOperatingSystem":"Darwin 20.5.0 Darwin Kernel Version 20.5.0: Sat May  8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64","framework":".NET Core 3.1.9","macAddressHash":"cad6500748a79985263987a2b61d73c0b5ff24c9bcfd76af254af4d02d3cf45f","processId":2277,"targetEnvironment":"Production","commandId":"8779862ba412","targetNamespaceName":"workflows","targetServiceName":"workflow-service-endpoint","isRoutingEnabled":false}}</json>
2021-07-08T01:29:44.7375010Z | MindaroCli | TRACE | Initializing progress reporter...
2021-07-08T01:29:47.4182050Z | MindaroCli | TRACE | Remoting started listening on 58120
2021-07-08T01:29:50.4341680Z | MindaroCli | TRACE | Waiting for EndpointManager to come up ...\n
2021-07-08T01:29:53.1235500Z | MindaroCli | TRACE | EndpointManager came up successfully.\n
2021-07-08T01:29:54.7451350Z | MindaroCli | WARNG | Failed to identify the container to use in pod 'workflow-service-app-8669bcb5b-k295f' from the container port information in the pod spec.
2021-07-08T01:29:54.7454120Z | MindaroCli | ERROR | Failed to identify the container to use in pod 'workflow-service-app-8669bcb5b-k295f' from the container port information in the pod spec.\n
2021-07-08T01:29:54.7465650Z | MindaroCli | TRACE | Stopping workload and cleaning up...\n
2021-07-08T01:29:55.0094430Z | MindaroCli | TRACE | Event: Command.End <json>{"properties":{"arguments":"connect --service workflow-service-endpoint --env /var/folders/mx/v760697166b478rt409666500000gn/t/tmp-98526hlytuvyw01sh.env --script /var/folders/mx/v760697166b478rt409666500000gn/t/tmp-98526hlytuvyw01sh.env.cmd --control-port 58120 --ppid 98486 --namespace workflows --elevation-requests [{\"requesttype\":\"edithostsfile\"}] --local-port 3001","result":"Failed","failureReason":"Failed to identify the container to use in pod 'workflow-service-app-8669bcb5b-k295f' from the container port information in the pod spec."},"metrics":{"duration":10401.0}}</json>
2021-07-08T01:29:52.6376830Z | Library | TRACE | Received response: '{"isSuccess":true,"errorMessage":null,"errorType":null}'
2021-07-08T01:29:53.1244240Z | Library | TRACE | Connecting to EndpointManager
2021-07-08T01:29:53.2636230Z | Library | TRACE | Received request segment: 'EndpointManager accepted connection<EOF>' of size 40
2021-07-08T01:29:53.2638280Z | Library | TRACE | Sending request: '{"apiname":"Ping","correlationId":"4171f37d-4fe3-4a61-b6fa-e8d055225b761625700675010:8779862ba412:3e1b0fe5c8b5:aaaf54655268"}'
2021-07-08T01:29:53.2640420Z | Library | TRACE | 130 bytes were sent.
2021-07-08T01:29:53.2651310Z | Library | TRACE | Received request segment: '{"isSuccess":true,"errorMessage":null,"errorType":null}<EOF>' of size 60
2021-07-08T01:29:53.2654200Z | Library | TRACE | Received response: '{"isSuccess":true,"errorMessage":null,"errorType":null}'
2021-07-08T01:29:53.6607530Z | Library | TRACE | Event: ConnectManagementClient-StartEndpointManager <json>{"properties":{"result":"Succeeded"},"metrics":{"durationInMs":6209.0}}</json>
2021-07-08T01:29:54.5672150Z | Library | TRACE | Dependency: Kubernetes <json>{"target":"GetV1ServiceAsync","success":true,"duration":null,"properties":{}}</json>
2021-07-08T01:29:54.6802370Z | Library | TRACE | Dependency: Kubernetes <json>{"target":"ListPodsInNamespaceAsync","success":true,"duration":null,"properties":{}}</json>
2021-07-08T01:29:54.6814470Z | Library | TRACE | Event: KubernetesRemoteEnvironmentManager-GetPodsFromService <json>{"properties":{"result":"Succeeded"},"metrics":{"durationInMs":111.0}}</json>
2021-07-08T01:29:54.6878880Z | Library | TRACE | Event: ConnectManagementClient-StartRemoteAgent <json>{"properties":{"result":"Failed"},"metrics":{"durationInMs":1017.0}}</json>
2021-07-08T01:29:54.6900130Z | Library | ERROR | Failed to start remote agent.
2021-07-08T01:29:54.7343540Z | Library | ERROR | Logging handled exception: Microsoft.BridgeToKubernetes.Common.Exceptions.UserVisibleException: {"Request":null,"Response":null,"RequestId":null,"ClientRequestId":null,"CorrelationRequestId":"4171f37d-4fe3-4a61-b6fa-e8d055225b761625700675010:8779862ba412:3e1b0fe5c8b5","Format":"Failed to identify the container to use in pod 'workflow-service-app-8669bcb5b-k295f' from the container port information in the pod spec.","Args":[],"StackTrace":"   at Microsoft.BridgeToKubernetes.Library.Utilities.RemoteContainerConnectionDetailsResolver.GetContainerFromPodAndService(V1Pod pod, V1Service service)\n   at Microsoft.BridgeToKubernetes.Library.Utilities.RemoteContainerConnectionDetailsResolver.ResolveConnectionDetails(RemoteContainerConnectionDetails remoteContainerConnectionDetails, CancellationToken cancellationToken)\n   at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.<>c__DisplayClass15_0.<<-ctor>b__0>d.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n   at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.<>c__DisplayClass19_0.<<StartRemoteAgentAsync>b__0>d.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n   at Microsoft.BridgeToKubernetes.Library.ManagementClients.ManagementClientExceptionStrategy.RunWithHandlingAsync[T](Func`1 func, FailureConfig failureConfig)","Message":"Failed to identify the container to use in pod 'workflow-service-app-8669bcb5b-k295f' from the container port information in the pod spec.","Data":{},"InnerException":null,"HelpLink":null,"Source":null,"HResult":-2146233088}
2021-07-08T01:29:54.7565430Z | Library | TRACE | Event: KubernetesRemoteEnvironmentManager-Restore <json>{"properties":{"result":"Succeeded"},"metrics":{"durationInMs":0.0}}</json>
2021-07-08T01:29:54.7567180Z | Library | TRACE | Event: KubernetesRemoteEnvironmentManager-RestoreRemoteAgent <json>{"properties":{"result":"Succeeded"},"metrics":{"durationInMs":7.0}}</json>
2021-07-08T01:29:54.7568270Z | Library | TRACE | Event: ConnectManagementClient-RestoreOriginalRemoteContainer <json>{"properties":{"result":"Succeeded"},"metrics":{"durationInMs":9.0}}</json>
2021-07-08T01:29:54.7585930Z | Library | TRACE | Event: LocalEnvironmentManager-StopWorkload <json>{"properties":{"result":"Succeeded"},"metrics":{"durationInMs":0.0}}</json>
2021-07-08T01:29:54.7587170Z | Library | TRACE | Event: ConnectManagementClient-StopLocalConnection <json>{"properties":{"result":"Succeeded"},"metrics":{"durationInMs":0.0}}</json>
(END)

from mindaro.

daniv-msft avatar daniv-msft commented on May 16, 2024

@andrx Thanks for your reply!
We're working on getting Bridge to Kubernetes open source, but it's not as of today. I expect we'll go open source in the coming months. If you want to get a status about this, you can follow this Github issue: #172

From the logs, we are not able to find the right container to target when you start Bridge. Here is how our logic tries to find the right container when looking at all the containers in pod workflow-service-app-8669bcb5b-k295f from the service workflow-service-endpoint:

  • If there is only one container choose that;
  • Else, if there are multiple containers, try to find the container with same port as the target port of the service (service.Spec.Ports.TargetPort);
  • Else, if the container is still not found, try to find the container which exposes the same port as the service (service.Spec.Ports.Port);
  • Else, return the error you saw.

Could you please confirm that none of these conditions are correct in the case of this pod?
If you prefer, you can also send us your service/pod specs and we can look at them to validate this.

from mindaro.

andrx avatar andrx commented on May 16, 2024

Hi @daniv-msft thanks for the list of conditions. I found out that our deployment yml doesn't contain ports.containerPort section. after adding this block it started working. Thanks again.

What if the app doesn't need any port? let's say it's just an app running in service mode consuming messages from kafka. Guess, it won't be able to find the container if there is also a sidecar.

from mindaro.

daniv-msft avatar daniv-msft commented on May 16, 2024

@andrx Thanks for looking more into this. Glad you found the solution.
I believe that you're right: if a pod has two containers (one to debug + one sidecar), that this sidecar isn't part of the sidecars we know we shouldn't select (istio, dapr), and that we have no way to know which one is the right one based on ports, I believe we'll return the error you saw above.
Adding @lolodi from my side who worked on this logic and might have more details.

We could imagine providing an option to let the user specify manually a container, but it doesn't seem to be a very common need so far.

from mindaro.

andrx avatar andrx commented on May 16, 2024

Yeah, i agree for debugging purposes on dev env we can set the port settings in yamls so the tool can figure out which container to choose though we have plenty of such microservices that are not used for web directly.
Also just to clarify, I might missed in the documentation. The tool only works when there is a single pod, right. I don't know all the magic that happens with the network using this hybrid approach but do you think it would be possible to use it in multi pod scenario?
Thanks in advance!

from mindaro.

daniv-msft avatar daniv-msft commented on May 16, 2024

@andrx If your service is backed by multiple pods, we'll automatically scale them down to 1 during the debugging so that we're sure our agent will get all the traffic. Once the debugging stops, the initial number of pods will be restored.
Please don't hesitate if you encounter any issues with this or have other questions.

from mindaro.

daniv-msft avatar daniv-msft commented on May 16, 2024

I'm closing this issue, but please don't hesitate to let me know if you still encounter any problems! Thanks again for reporting it.

from mindaro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.