microsoft / mindaro

Bridge to Kubernetes - for Visual Studio and Visual Studio Code
MIT License
307 stars 106 forks source link

Cannot add the namespace to a service in KubernetesLocalProcessConfig.yaml #168

Open corey-aloia opened 3 years ago

corey-aloia commented 3 years ago

Apply the following yaml:

version: 0.1
env:
  - name: my-service
    value: $(services:my-service:9094)

Notice that the hostname will be updated to:

my-service.svc.cluster.local

now add the namespace:

version: 0.1
env:
  - name: my-service
    value: $(services:my-service.mynamespace:9094)

And the bridge will not start with

Error: An unexpected error occurred: 'Value cannot be null. (Parameter 'source')'

Now try the FQDN

version: 0.1
env:
  - name: my-service
    value: $(services:my-service.mynamespace.svc.cluster.local:9094)`

the k8 bridge will start, but now the /etc/hosts will have:

my-service.mynamespace.svc.cluster.local.svc.cluster.local

Here is the log output that occurs when adding the namespace, and getting the Value cannot be null error:

2021-04-29T19:34:24.4545820Z | MindaroCli | TRACE | Running Microsoft.BridgeToKubernetes.Exe.Commands.Connect.PrepConnectCommand...
2021-04-29T19:34:24.4574720Z | MindaroCli | TRACE | Initializing progress reporter...
2021-04-29T19:34:26.2457830Z | MindaroCli | ERROR | Dependency: Prep Connect <json>{"target":null,"success":false,"duration":null,"properties":{"requestId":"null","clientRequestId":"null","correlationRequestId":"null"}}</json>
2021-04-29T19:34:27.2914080Z | MindaroCli | ERROR | An unexpected error occurred: 'Value cannot be null. (Parameter 'source')'\n
2021-04-29T19:34:27.2928760Z | MindaroCli | ERROR | To see our active issues or file a bug report, please visit https://aka.ms/bridge-to-k8s-report.\n
2021-04-29T19:34:27.2935070Z | MindaroCli | ERROR | For diagnostic information, see logs at '/var/folders/rm/v2w2w1qn2l922q670t727jm40000gn/T/Bridge To Kubernetes'.\n
2021-04-29T19:34:27.2991960Z | MindaroCli | ERROR | Logging handled exception: System.ArgumentNullException: {"ClassName":"System.ArgumentNullException","Message":"Value cannot be null.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":"   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)\n   at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)\n   at Microsoft.BridgeToKubernetes.Library.Connect.KubernetesRemoteEnvironmentManager.GetReachableServicesAsync(String namespaceName, ILocalProcessConfig localProcessConfig, IProgress`1 progress, CancellationToken cancellationToken)\n   at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.<>c__DisplayClass13_0.<<GetElevationRequestsAsync>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)\n   at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.GetElevationRequestsAsync(IProgress`1 progress, CancellationToken cancellationToken)\n   at Microsoft.BridgeToKubernetes.Exe.Commands.Connect.PrepConnectCommand.ExecuteAsync()\n   at Microsoft.BridgeToKubernetes.Exe.CliApp.RunCommandAsync(String[] args, CancellationToken cancellationToken)\n   at Microsoft.BridgeToKubernetes.Exe.CliApp.ExecuteAsync(String[] args, CancellationToken cancellationToken)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2147467261,"Source":"System.Linq","WatsonBuckets":null,"ParamName":"source"}
2021-04-29T19:34:27.3008740Z | MindaroCli | TRACE | Event: Command.End <json>{"properties":{"arguments":"prep-connect --output json --namespace kiwis","result":"Failed","failureReason":"Value cannot be null. (Parameter 'source')"},"metrics":{"duration":2984.0}}
rakeshvanga commented 3 years ago

@corey-aloia, Thanks for bringing this issue to us. It seems that there is an issue on our side where we are not handling the namespaced services. I've opened a bug on our side and will update the thread once it is fixed.

rakeshvanga commented 3 years ago

@corey-aloia I'm not able to repro this issue. Can you share the following details: