microsoft / mindaro

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

Cannot connect to IBM Kubernetes Service #206

Closed chromey closed 3 years ago

chromey commented 3 years ago

Describe the bug I am unable to connect to an IBM Kubernetes Service cluster using BtK. Error message is Failed to refresh the kubeconfig token: Error loading discovery document: Endpoint is on a different host than authority: https://identity-2.eu-central.iam.cloud.ibm.com/identity/authorize

To Reproduce Just trying to establish a connection using the Kubernetes: Debug (Local Tunnel) command kubectl get pods works normally.

Logs

2021-07-17T18:11:54.4248010Z | MindaroCli | TRACE | Event: Command.Start <json>{"properties":{"arguments":"refresh-credentials --namespace dc-app-xsp","isRoutingEnabled":"false"},"metrics":null}</json>\nOperation context: <json>{"clientRequestId":null,"correlationId":"b82225f1-4495-44cc-9b61-b5c987e0980f1626545480322:ae80dd150014","requestId":null,"userSubscriptionId":null,"startTime":"2021-07-17T18:11:54.0547620Z","userAgent":"VSCode/1.0.120210709","requestHttpMethod":null,"requestUri":null,"version":"1.0.20210708.15","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":"a2e8ba9db850dcdaf451d22a617c434ef4adbc7898fb2849106e040504f53419","processId":57269,"targetEnvironment":"Production","commandId":"ae80dd150014"}}</json>
2021-07-17T18:11:54.4933720Z | MindaroCli | TRACE | Running Microsoft.BridgeToKubernetes.Exe.Commands.Connect.RefreshCredentialsCommand...
2021-07-17T18:11:54.4964480Z | MindaroCli | TRACE | Initializing progress reporter...
2021-07-17T18:11:55.4200300Z | MindaroCli | ERROR | Dependency: List Contexts <json>{"target":null,"success":false,"duration":null,"properties":{"requestId":"null","clientRequestId":"null","correlationRequestId":"null"}}</json>
2021-07-17T18:11:55.4286370Z | MindaroCli | ERROR | Logging handled exception: System.InvalidOperationException: {"ClassName":"System.InvalidOperationException","Message":"Error loading discovery document: Endpoint is on a different host than authority: https://identity-2.eu-central.iam.cloud.ibm.com/identity/authorize","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":"   at IdentityModel.OidcClient.OidcClient.EnsureProviderInformationAsync(CancellationToken cancellationToken)\n   at IdentityModel.OidcClient.OidcClient.EnsureConfigurationAsync(CancellationToken cancellationToken)\n   at IdentityModel.OidcClient.OidcClient.RefreshTokenAsync(String refreshToken, IDictionary`2 extraParameters, CancellationToken cancellationToken)\n   at k8s.Authentication.OidcTokenProvider.RefreshToken()","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2146233079,"Source":"IdentityModel.OidcClient","WatsonBuckets":null}
2021-07-17T18:11:55.4306780Z | MindaroCli | ERROR | Error loading discovery document: Endpoint is on a different host than authority: https://identity-2.eu-central.iam.cloud.ibm.com/identity/authorize\n
2021-07-17T18:11:56.1366170Z | MindaroCli | TRACE | Event: Command.End <json>{"properties":{"arguments":"refresh-credentials --namespace dc-app-xsp","result":"Failed","failureReason":"Error loading discovery document: Endpoint is on a different host than authority: https://identity-2.eu-central.iam.cloud.ibm.com/identity/authorize"},"metrics":{"duration":1773.0}}</json>

Environment Details Client used: VS Code Client's version: mindaro.mindaro@1.0.120210709 Operating System: macOS

amsoedal commented 3 years ago

Hi @chromey, thanks for reporting this! We use the C# KubernetesClient for this operation, and we recently bumped the version of that package that we're depending on. Can you try with the staging bits (instructions here) and see if it helps? If not, I'll open an issue on their repo. Thanks!

chromey commented 3 years ago

Hi @amsoedal, happy to report that it works with that version. Thanks a lot!

amsoedal commented 3 years ago

Awesome! This change will go into our next VSCode extension sometime next week.