From dc2e7c215bc32e98b98430516e58197ce0e19d10 Mon Sep 17 00:00:00 2001 From: eiximenis Date: Thu, 19 Sep 2019 20:02:01 +0200 Subject: [PATCH] updated charts for local k8s deployment --- k8s/helm/app.yaml | 2 +- k8s/helm/basket-api/templates/configmap.yaml | 3 +-- k8s/helm/mobileshoppingagg/templates/configmap.yaml | 3 +++ k8s/helm/mobileshoppingagg/values.yaml | 7 +++++++ k8s/helm/ordering-api/templates/configmap.yaml | 3 +-- k8s/helm/webshoppingagg/templates/configmap.yaml | 3 +++ k8s/helm/webshoppingagg/values.yaml | 8 ++++++++ src/Web/WebMVC/Services/BasketService.cs | 7 ++++--- src/Web/WebMVC/appsettings.Development.json | 12 ++++++++++++ 9 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 src/Web/WebMVC/appsettings.Development.json diff --git a/k8s/helm/app.yaml b/k8s/helm/app.yaml index da0b9f55e..d57fd8836 100644 --- a/k8s/helm/app.yaml +++ b/k8s/helm/app.yaml @@ -25,7 +25,7 @@ app: # app global settings webhooks: webhooks-api # ingress entry for webhooks api webhooksweb: webhooks-web # ingress entry for webhooks web demo client svc: - basket: basket-apo # service name for basket api + basket: basket-api # service name for basket api catalog: catalog-api # service name for catalog api ordering: ordering-api # service name for ordering api orderingbackgroundtasks: ordering-backgroundtasks # service name for orderingbackgroundtasks diff --git a/k8s/helm/basket-api/templates/configmap.yaml b/k8s/helm/basket-api/templates/configmap.yaml index 911318fc1..2de0e28c7 100644 --- a/k8s/helm/basket-api/templates/configmap.yaml +++ b/k8s/helm/basket-api/templates/configmap.yaml @@ -1,5 +1,4 @@ {{- $name := include "basket-api.fullname" . -}} -{{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}} apiVersion: v1 kind: ConfigMap @@ -12,7 +11,7 @@ metadata: heritage: {{ .Release.Service }} data: basket__ConnectionString: {{ .Values.inf.redis.basket.constr }} - urls__IdentityUrl: http://{{ $identity }} + urls__IdentityUrl: http://{{ .Values.app.svc.identity }} basket__EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" all__EventBusConnection: {{ .Values.inf.eventbus.constr }} all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" diff --git a/k8s/helm/mobileshoppingagg/templates/configmap.yaml b/k8s/helm/mobileshoppingagg/templates/configmap.yaml index 6cad653a9..1ca69509f 100644 --- a/k8s/helm/mobileshoppingagg/templates/configmap.yaml +++ b/k8s/helm/mobileshoppingagg/templates/configmap.yaml @@ -24,3 +24,6 @@ data: internalurls__marketing__hc: http://{{ .Values.app.svc.marketing }}/hc internalurls__payment__hc: http://{{ .Values.app.svc.payment }}/hc internalurls__location__hc: http://{{ .Values.app.svc.locations }}/hc + internalurls__grpcBasket: "http://{{ .Values.app.svc.basket }}:{{ .Values.service.grpcPort }}" + internalurls__grpcCatalog: "http://{{ .Values.app.svc.catalog }}:{{ .Values.service.grpcPort }}" + internalurls__grpcOrdering: "http://{{ .Values.app.svc.ordering }}:{{ .Values.service.grpcPort }}" diff --git a/k8s/helm/mobileshoppingagg/values.yaml b/k8s/helm/mobileshoppingagg/values.yaml index fd26c7794..844a59441 100644 --- a/k8s/helm/mobileshoppingagg/values.yaml +++ b/k8s/helm/mobileshoppingagg/values.yaml @@ -10,6 +10,7 @@ image: service: type: ClusterIP port: 80 + grpcPort: 81 ingress: enabled: false @@ -54,6 +55,12 @@ env: key: internalurls__payment__hc - name: LocationUrlHC key: internalurls__location__hc + - name: urls__grpcBasket + key: internalurls__grpcBasket + - name: urls__grpcCatalog + key: internalurls__grpcCatalog + - name: urls__grpcOrdering + key: internalurls__grpcOrdering # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) values: - name: ASPNETCORE_ENVIRONMENT diff --git a/k8s/helm/ordering-api/templates/configmap.yaml b/k8s/helm/ordering-api/templates/configmap.yaml index efc829cda..e64a6c841 100644 --- a/k8s/helm/ordering-api/templates/configmap.yaml +++ b/k8s/helm/ordering-api/templates/configmap.yaml @@ -1,6 +1,5 @@ {{- $name := include "ordering-api.fullname" . -}} {{- $sqlsrv := include "sql-name" . -}} -{{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}} apiVersion: v1 kind: ConfigMap @@ -14,7 +13,7 @@ metadata: data: ordering__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.ordering.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }}; ordering__EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" - urls__IdentityUrl: http://{{ $identity }} + urls__IdentityUrl: http://{{ .Values.app.svc.identity }} all__EventBusConnection: {{ .Values.inf.eventbus.constr }} all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" \ No newline at end of file diff --git a/k8s/helm/webshoppingagg/templates/configmap.yaml b/k8s/helm/webshoppingagg/templates/configmap.yaml index efa3c7eaf..d01de8dcd 100644 --- a/k8s/helm/webshoppingagg/templates/configmap.yaml +++ b/k8s/helm/webshoppingagg/templates/configmap.yaml @@ -24,3 +24,6 @@ data: internalurls__marketing__hc: http://{{ .Values.app.svc.marketing }}/hc internalurls__payment__hc: http://{{ .Values.app.svc.payment }}/hc internalurls__location__hc: http://{{ .Values.app.svc.locations }}/hc + internalurls__grpcBasket: "http://{{ .Values.app.svc.basket }}:{{ .Values.service.grpcPort }}" + internalurls__grpcCatalog: "http://{{ .Values.app.svc.catalog }}:{{ .Values.service.grpcPort }}" + internalurls__grpcOrdering: "http://{{ .Values.app.svc.ordering }}:{{ .Values.service.grpcPort }}" diff --git a/k8s/helm/webshoppingagg/values.yaml b/k8s/helm/webshoppingagg/values.yaml index f4f2c5fd7..15501c727 100644 --- a/k8s/helm/webshoppingagg/values.yaml +++ b/k8s/helm/webshoppingagg/values.yaml @@ -10,6 +10,7 @@ image: service: type: ClusterIP port: 80 + grpcPort: 81 ingress: enabled: false @@ -54,6 +55,13 @@ env: key: internalurls__payment__hc - name: LocationUrlHC key: internalurls__location__hc + - name: urls__grpcBasket + key: internalurls__grpcBasket + - name: urls__grpcCatalog + key: internalurls__grpcCatalog + - name: urls__grpcOrdering + key: internalurls__grpcOrdering + # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) values: - name: ASPNETCORE_ENVIRONMENT diff --git a/src/Web/WebMVC/Services/BasketService.cs b/src/Web/WebMVC/Services/BasketService.cs index dee8fc781..418164b0b 100644 --- a/src/Web/WebMVC/Services/BasketService.cs +++ b/src/Web/WebMVC/Services/BasketService.cs @@ -34,9 +34,10 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services public async Task GetBasket(ApplicationUser user) { var uri = API.Basket.GetBasket(_basketByPassUrl, user.Id); - - var responseString = await _apiClient.GetStringAsync(uri); - + _logger.LogDebug($"[GetBasket] -> Calling {uri} to get the basket"); + var response = await _apiClient.GetAsync(uri); + _logger.LogDebug($"[GetBasket] -> response code {response.StatusCode}"); + var responseString = await response.Content.ReadAsStringAsync(); return string.IsNullOrEmpty(responseString) ? new Basket() { BuyerId = user.Id } : JsonConvert.DeserializeObject(responseString); diff --git a/src/Web/WebMVC/appsettings.Development.json b/src/Web/WebMVC/appsettings.Development.json new file mode 100644 index 000000000..9e1db71f1 --- /dev/null +++ b/src/Web/WebMVC/appsettings.Development.json @@ -0,0 +1,12 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug" + } + }, + "Serilog": { + "MinimumLevel": { + "Default": "Debug" + } + } +}