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

Can I debug and load configMap locally? #124

Open
344089386 opened this issue Jul 21, 2020 · 26 comments
Open

Can I debug and load configMap locally? #124

344089386 opened this issue Jul 21, 2020 · 26 comments

Comments

@344089386
Copy link

I have loaded configMap but configuration["Redis:Configuration"] is null.I heard that configMap should be mounted to POD or Deployment. Can't you debug it locally?

image
image
image
image

@tintoy
Copy link
Owner

tintoy commented Jul 21, 2020

Can you check the section of the readme about how to turn on logging for the client? It should be able to log the requests it’s making which might give us a clue as to what’s going wrong...

@344089386
Copy link
Author

344089386 commented Jul 21, 2020

Can you check the section of the readme about how to turn on logging for the client? It should be able to log the requests it’s making which might give us a clue as to what’s going wrong...

@tintoy
I don't know where exactly you mean. Could you be more specific?

@344089386
Copy link
Author

@tintoy
Is this?
image
image

@tintoy
Copy link
Owner

tintoy commented Jul 21, 2020

Yep - from memory you can even send the logs to Serilog as well.

@tintoy
Copy link
Owner

tintoy commented Jul 21, 2020

As long as it logs to the console or the VS debugger console it should show you the requests it’s making (there is a property on the client options to log requests.

@tintoy
Copy link
Owner

tintoy commented Jul 21, 2020

(As you guessed, it’s the logger factory property). Sorry am viewing this on my phone as I’m not near a computer right now.

Take a look at the ConfigMap sample in the repository, it logs requests and does most of what you’d need to hook up configuration from a ConfigMap.

@344089386
Copy link
Author

I looked at the ConfigMap sample and it seems that it still can't solve my problem.
@tintoy

@344089386
Copy link
Author

Do you use ConfigMap as the configuration center code?Can you send it to me for reference?

@tintoy
Copy link
Owner

tintoy commented Jul 22, 2020

Are you able to run that sample successfully?

@344089386
Copy link
Author

344089386 commented Jul 22, 2020

Can the. @tintoy
image
image
image

@tintoy
Copy link
Owner

tintoy commented Jul 22, 2020

What happens when you press enter?

@344089386
Copy link
Author

344089386 commented Jul 22, 2020

@tintoy
image

Delete seems to delete unsuccessful, after the creation of an error.

After I manually delete, perform as follows.
image

@tintoy
Copy link
Owner

tintoy commented Jul 22, 2020

In your own program, do you see any keys in the IConfiguration once it has been built? What is the name of the namespace that your config map is in?

@344089386
Copy link
Author

344089386 commented Jul 23, 2020

@tintoy
Loading the local appSettings. json will work fine. The namespace name is microservice.
I'll send you the code, so you can run it?

@tintoy
Copy link
Owner

tintoy commented Jul 23, 2020

It looks like in your original example code you are not specifying the namespace where the configmap lives - can you try passing the namespace in your original program and see if that works?

@344089386
Copy link
Author

@tintoy
No.
image

@tintoy
Copy link
Owner

tintoy commented Jul 23, 2020

What keys does the configuration have?

@344089386
Copy link
Author

344089386 commented Jul 23, 2020

@tintoy
appsettings.json
{ "RemoteServices": { "Default": { "BaseUrl": "http://localhost:65115/" } }, "AuthServer": { "Authority": "http://localhost:64999", "ApiName": "BackendAdminAppGateway" }, "ElasticSearch": { "Url": "http://139.224.255.200:3005" }, "ConnectionStrings": { "Default": "HOST=60.22.155.248;PORT=30000;DATABASE=MsDemo_Identity;PASSWORD=123456;USER ID=postgres;" }, "Redis": { "Configuration": "139.224.255.200:3002" }, "ReRoutes": [ { "DownstreamPathTemplate": "/api/identity/{everything}", "DownstreamScheme": "http", "UpstreamPathTemplate": "/api/identity/{everything}", "ServiceName": "identity-service", "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { "DownstreamPathTemplate": "/api/multi-tenancy/{everything}", "DownstreamScheme": "http", "UpstreamPathTemplate": "/api/multi-tenancy/{everything}", "ServiceName": "multi-tenancy-service", "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] }, { "DownstreamPathTemplate": "/api/productManagement/{everything}", "DownstreamScheme": "http", "UpstreamPathTemplate": "/api/productManagement/{everything}", "ServiceName": "product-management-service", "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ] } ], "GlobalConfiguration": { "ServiceDiscoveryProvider": { "Namespace": "microservice", "Type": "kube" } }, "Logging": { "LogLevel": { "Default": "Warning" } }, "AllowedHosts": "*" }

@tintoy
Copy link
Owner

tintoy commented Jul 23, 2020

Sorry I mean what keys are in the IConfiguration? It’s enumerable I think so you can use foreach to see all the keys.

@344089386
Copy link
Author

@tintoy
Just this one key
image

@344089386
Copy link
Author

@tintoy
I'm not using it now, I'm just going to mount it, and that's fine.
Now I would like to ask how this method should be used and what needs to be configured?Is there any documentation for that

image

@tintoy
Copy link
Owner

tintoy commented Jul 27, 2020

@344089386
Copy link
Author

344089386 commented Jul 27, 2020

@tintoy
I don't know you used Ocelot.Provider.Kubernetes this component.
image
image

I can't find the service. When I access the gateway, an error will be reported:
image
Direct access to a link to a service is possible.Not through the gateway.

@tintoy
Copy link
Owner

tintoy commented Jul 27, 2020

The extension method from this library is called AddKubeClient(), I’m not sure what AddKubernetes() does?

@tintoy
Copy link
Owner

tintoy commented Jul 27, 2020

I’m not sure how Ocelot’s Kubernetes support works but I’m not aware of an integration between it and this library...

@344089386
Copy link
Author

344089386 commented Jul 30, 2020

I decided to use consult as the service discovery and configuration center. No more trouble.

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