diff --git a/docker-compose.yml b/docker-compose.yml index f1bd68076..39a0217be 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -109,37 +109,37 @@ services: image: rabbitmq:3-management-alpine mobileshoppingapigw: - image: eshop/ocelotapigw-ms + image: eshop/ocelotapigw-ms:${TAG:-latest} build: context: . dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile mobilemarketingapigw: - image: eshop/ocelotapigw-mm + image: eshop/ocelotapigw-mm:${TAG:-latest} build: context: . dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile2 webshoppingapigw: - image: eshop/ocelotapigw-ws + image: eshop/ocelotapigw-ws:${TAG:-latest} build: context: . dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile3 webmarketingapigw: - image: eshop/ocelotapigw-wm + image: eshop/ocelotapigw-wm:${TAG:-latest} build: context: . dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile mobileshoppingagg: - image: eshop/mobileshoppingagg + image: eshop/mobileshoppingagg:${TAG:-latest} build: context: . dockerfile: src/ApiGateways/Mobile.Bff.Shopping/aggregator/Dockerfile webshoppingagg: - image: eshop/webshoppingagg + image: eshop/webshoppingagg:${TAG:-latest} build: context: . dockerfile: src/ApiGateways/Web.Bff.Shopping/aggregator/Dockerfile diff --git a/k8s/conf_cloud.yml b/k8s/conf_cloud.yml index 0f079fd3f..891de14bc 100644 --- a/k8s/conf_cloud.yml +++ b/k8s/conf_cloud.yml @@ -4,13 +4,11 @@ metadata: name: externalcfg labels: app: eshop -data: +data: # Basket.API entries - BasketBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX in case of using Azure) - BasketRedisConStr: REDIS CONNECTION STRING FOR BASKET + basket__ConnectionString: REDIS CONNECTION STRING FOR BASKET # Catalog.API entries - CatalogBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX in case of using Azure) - CatalogSqlDb: Catalog SQL SERVER CONNECTION STRING (Server=xxxx;Intial Catalog=yyy;....) + catalog__ConnectionString: Catalog SQL SERVER CONNECTION STRING (Server=xxxx;Intial Catalog=yyy;....) # Identity.API entries IdentitySqlDb: Identity SQL SERVER CONNECTION STRING (Server=xxxx;Intial Catalog=yyy;....) # Locations.API entries @@ -30,5 +28,7 @@ data: # Payment.API entries PaymentBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX in case of using Azure) # Global entries - UseAzureServiceBus: "TRUE" IF USE AZURE SB ("FALSE" FOR USING RABBITMQ) - keystore: REDIS CONNECTION STRING FOR KEYSTORE \ No newline at end of file + all_UseAzureServiceBus: "TRUE" IF USE AZURE SB ("FALSE" FOR USING RABBITMQ) + keystore: REDIS CONNECTION STRING FOR KEYSTORE + all_EventBusConnection: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX in case of using Azure) + all_InstrumentationKey: APPINSIGHTS KEY \ No newline at end of file diff --git a/k8s/conf_local.yml b/k8s/conf_local.yml index 9a2059e63..615754bcf 100644 --- a/k8s/conf_local.yml +++ b/k8s/conf_local.yml @@ -5,28 +5,23 @@ metadata: labels: app: eshop data: - BasketBus: rabbitmq - BasketRedisConStr: basket-data - CatalogBus: rabbitmq - CatalogSqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word; - CatalogAzureStorageEnabled: "False" - IdentitySqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.IdentityDb;User Id=sa;Password=Pass@word; - LocationsBus: rabbitmq - LocationsNoSqlDb: mongodb://nosql-data - LocationsNoSqlDbName: LocationsDb - MarketingBus: rabbitmq - MarketingNoSqlDb: mongodb://nosql-data - MarketingNoSqlDbName: MarketingDb - MarketingSqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word; - OrderingBus: rabbitmq - OrderingSqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word; - PaymentBus: rabbitmq - UseAzureServiceBus: "False" - EnableLoadTest: "False" + basket__ConnectionString: basket-data + catalog__ConnectionString: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word; + catalog__AzureStorageEnabled: "False" + identity__ConnectionString: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.IdentityDb;User Id=sa;Password=Pass@word; + locations__ConnectionString: mongodb://nosql-data + locations__Database: LocationsDb + marketing__MongoConnectionString: mongodb://nosql-data + marketing__MongoDatabase: MarketingDb + marketing__ConnectionString: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word; + ordering__ConnectionString: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word; keystore: keystore-data - GracePeriodManager_GracePeriodTime: "1" - GracePeriodManager_CheckUpdateTime: "15000" - Instrumentation_Key: "" + GracePeriodManager__GracePeriodTime: "1" + GracePeriodManager__CheckUpdateTime: "15000" + all__EventBusConnection: rabbitmq + all__InstrumentationKey: "" + all__EnableLoadTest: "False" + all__UseAzureServiceBus: "False" diff --git a/k8s/deploy.ps1 b/k8s/deploy.ps1 index 3d9c54b5c..1ac5a2770 100644 --- a/k8s/deploy.ps1 +++ b/k8s/deploy.ps1 @@ -65,7 +65,7 @@ if ($buildImages) { docker-compose -p .. -f ../docker-compose.yml build Write-Host "Pushing images to $registry/$dockerOrg..." -ForegroundColor Yellow - $services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "marketing.api","payment.api","locations.api", "webmvc", "webspa", "webstatus", "ocelotapigw") + $services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "marketing.api","payment.api","locations.api", "webmvc", "webspa", "webstatus", "ocelotapigw-mm", "ocelotapigw-ms", "ocelotapigw-wm", "ocelotapigw-ws", "mobileshoppingagg", "webshoppingagg") foreach ($service in $services) { $imageFqdn = if ($useDockerHub) {"$dockerOrg/${service}"} else {"$registry/$dockerOrg/${service}"} @@ -103,6 +103,7 @@ if (-not [string]::IsNullOrEmpty($dockerUser)) { Write-Host "Removing existing services & deployments.." -ForegroundColor Yellow ExecKube -cmd 'delete deployments --all' ExecKube -cmd 'delete services --all' +ExecKube -cmd 'delete configmap internalurls' ExecKube -cmd 'delete configmap urls' ExecKube -cmd 'delete configmap externalcfg' ExecKube -cmd 'delete configmap ocelot' @@ -116,47 +117,28 @@ if ($deployInfrastructure) { Write-Host 'Deploying ocelot APIGW' -ForegroundColor Yellow -ExecKube "create configmap ocelot --from-file=ocelot/configuration.json" +ExecKube "create configmap ocelot --from-file=mm=ocelot/configuration-mobile-marketing.json --from-file=ms=ocelot/configuration-mobile-shopping.json --from-file=wm=ocelot/configuration-web-marketing.json --from-file=ws=ocelot/configuration-web-shopping.json " ExecKube -cmd "apply -f ocelot/deployment.yaml" ExecKube -cmd "apply -f ocelot/service.yaml" Write-Host 'Deploying code deployments (Web APIs, Web apps, ...)' -ForegroundColor Yellow ExecKube -cmd 'create -f services.yaml' +ExecKube -cmd 'create -f internalurls.yaml' ExecKube -cmd 'create configmap urls ` - --from-literal=BasketUrl=http://basket ` - --from-literal=BasketHealthCheckUrl=http://basket/hc ` - --from-literal=CatalogUrl=http://$($externalDns)/catalog-api ` - --from-literal=CatalogHealthCheckUrl=http://catalog/hc ` - --from-literal=PicBaseUrl=http://$($externalDns)/catalog-api/api/v1/catalog/items/[0]/pic/ ` - --from-literal=Marketing_PicBaseUrl=http://$($externalDns)/marketing-api/api/v1/campaigns/[0]/pic/ ` - --from-literal=IdentityUrl=http://$($externalDns)/identity ` - --from-literal=IdentityHealthCheckUrl=http://identity/hc ` - --from-literal=OrderingUrl=http://ordering ` - --from-literal=OrderingHealthCheckUrl=http://ordering/hc ` - --from-literal=MvcClientExternalUrl=http://$($externalDns)/webmvc ` - --from-literal=WebMvcHealthCheckUrl=http://webmvc/hc ` - --from-literal=MvcClientOrderingUrl=http://ordering ` - --from-literal=MvcClientCatalogUrl=http://catalog ` - --from-literal=MvcClientBasketUrl=http://basket ` - --from-literal=MvcClientMarketingUrl=http://marketing ` - --from-literal=MvcClientLocationsUrl=http://locations ` - --from-literal=MarketingHealthCheckUrl=http://marketing/hc ` - --from-literal=WebSpaHealthCheckUrl=http://webspa/hc ` - --from-literal=SpaClientMarketingExternalUrl=http://$($externalDns)/marketing-api ` - --from-literal=SpaClientOrderingExternalUrl=http://$($externalDns)/ordering-api ` - --from-literal=SpaClientCatalogExternalUrl=http://$($externalDns)/catalog-api ` - --from-literal=SpaClientBasketExternalUrl=http://$($externalDns)/basket-api ` - --from-literal=SpaClientIdentityExternalUrl=http://$($externalDns)/identity ` - --from-literal=SpaClientLocationsUrl=http://$($externalDns)/locations-api ` - --from-literal=LocationsHealthCheckUrl=http://locations/hc ` - --from-literal=SpaClientExternalUrl=http://$($externalDns) ` - --from-literal=LocationApiClient=http://$($externalDns)/locations-api ` - --from-literal=MarketingApiClient=http://$($externalDns)/marketing-api ` - --from-literal=BasketApiClient=http://$($externalDns)/basket-api ` - --from-literal=OrderingApiClient=http://$($externalDns)/ordering-api ` - --from-literal=PaymentHealthCheckUrl=http://payment/hc' - + --from-literal=PicBaseUrl=http://$($externalDns)/webshoppingapigw/api/v1/c/catalog/items/[0]/pic/ ` + --from-literal=Marketing_PicBaseUrl=http://$($externalDns)/webmarketingapigw/api/v1/m/campaigns/[0]/pic/ ` + --from-literal=mvc_e=http://$($externalDns)/webmvc ` + --from-literal=marketingapigw_e=http://$($externalDns)/webmarketingapigw ` + --from-literal=webshoppingapigw_e=http://$($externalDns)/webshoppingapigw ` + --from-literal=mobileshoppingagg_e=http://$($externalDns)/mobileshoppingagg ` + --from-literal=webshoppingagg_e=http://$($externalDns)/webshoppingagg ` + --from-literal=identity_e=http://$($externalDns)/identity ` + --from-literal=spa_e=http://$($externalDns) ` + --from-literal=locations_e=http://$($externalDns)/locations-api ` + --from-literal=marketing_e=http://$($externalDns)/marketing-api ` + --from-literal=basket_e=http://$($externalDns)/basket-api ` + --from-literal=ordering_e=http://$($externalDns)/ordering-api ' ExecKube -cmd 'label configmap urls app=eshop' @@ -184,7 +166,14 @@ ExecKube -cmd 'set image deployments/payment payment=${registryPath}${dockerOrg} ExecKube -cmd 'set image deployments/webmvc webmvc=${registryPath}${dockerOrg}/webmvc:$imageTag' ExecKube -cmd 'set image deployments/webstatus webstatus=${registryPath}${dockerOrg}/webstatus:$imageTag' ExecKube -cmd 'set image deployments/webspa webspa=${registryPath}${dockerOrg}/webspa:$imageTag' -ExecKube -cmd 'set image deployments/ocelot ocelot=${registryPath}${dockerOrg}/ocelotapigw:$imageTag' + +ExecKube -cmd 'set image deployments/mobileshoppingagg mobileshoppingagg=${registryPath}${dockerOrg}/mobileshoppingagg:$imageTag' +ExecKube -cmd 'set image deployments/webshoppingagg webshoppingagg=${registryPath}${dockerOrg}/webshoppingagg:$imageTag' + +ExecKube -cmd 'set image deployments/apigwmm apigwmm=${registryPath}${dockerOrg}/ocelotapigw-mm:$imageTag' +ExecKube -cmd 'set image deployments/apigwms apigwms=${registryPath}${dockerOrg}/ocelotapigw-ms:$imageTag' +ExecKube -cmd 'set image deployments/apigwwm apigwwm=${registryPath}${dockerOrg}/ocelotapigw-wm:$imageTag' +ExecKube -cmd 'set image deployments/apigwws apigwws=${registryPath}${dockerOrg}/ocelotapigw-ws:$imageTag' Write-Host "Execute rollout..." -ForegroundColor Yellow ExecKube -cmd 'rollout resume deployments/basket' @@ -197,7 +186,12 @@ ExecKube -cmd 'rollout resume deployments/payment' ExecKube -cmd 'rollout resume deployments/webmvc' ExecKube -cmd 'rollout resume deployments/webstatus' ExecKube -cmd 'rollout resume deployments/webspa' -ExecKube -cmd 'rollout resume deployments/ocelot' +ExecKube -cmd 'rollout resume deployments/mobileshoppingagg' +ExecKube -cmd 'rollout resume deployments/webshoppingagg' +ExecKube -cmd 'rollout resume deployments/apigwmm' +ExecKube -cmd 'rollout resume deployments/apigwms' +ExecKube -cmd 'rollout resume deployments/apigwwm' +ExecKube -cmd 'rollout resume deployments/apigwws' Write-Host "WebSPA is exposed at http://$externalDns, WebMVC at http://$externalDns/webmvc, WebStatus at http://$externalDns/webstatus" -ForegroundColor Yellow diff --git a/k8s/deployments.yaml b/k8s/deployments.yaml index 9935b83d7..10007fe4c 100644 --- a/k8s/deployments.yaml +++ b/k8s/deployments.yaml @@ -21,32 +21,32 @@ spec: valueFrom: configMapKeyRef: name: externalcfg - key: BasketRedisConStr + key: basket__ConnectionString - name: EventBusConnection valueFrom: configMapKeyRef: name: externalcfg - key: BasketBus + key: all__EventBusConnection - name: AzureServiceBusEnabled valueFrom: configMapKeyRef: name: externalcfg - key: UseAzureServiceBus + key: all__UseAzureServiceBus - name: ApplicationInsights__InstrumentationKey valueFrom: configMapKeyRef: name: externalcfg - key: Instrumentation_Key + key: all__InstrumentationKey - name: IdentityUrl valueFrom: configMapKeyRef: name: urls - key: IdentityUrl + key: identity_e - name: UseLoadTest valueFrom: configMapKeyRef: name: externalcfg - key: EnableLoadTest + key: all__EnableLoadTest - name: OrchestratorType value: 'K8S' ports: @@ -56,15 +56,8 @@ spec: path: /hc port: 80 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /hc - port: 80 - scheme: HTTP - initialDelaySeconds: 60 - periodSeconds: 10 + initialDelaySeconds: 300 + periodSeconds: 240 imagePullSecrets: - name: registry-key --- @@ -91,7 +84,7 @@ spec: valueFrom: configMapKeyRef: name: externalcfg - key: CatalogSqlDb + key: catalog__ConnectionString - name: PicBaseUrl valueFrom: configMapKeyRef: @@ -101,17 +94,17 @@ spec: valueFrom: configMapKeyRef: name: externalcfg - key: CatalogAzureStorageEnabled + key: catalog__AzureStorageEnabled - name: EventBusConnection valueFrom: configMapKeyRef: name: externalcfg - key: CatalogBus + key: all__EventBusConnection - name: ApplicationInsights__InstrumentationKey valueFrom: configMapKeyRef: name: externalcfg - key: Instrumentation_Key + key: all__InstrumentationKey - name: OrchestratorType value: 'K8S' ports: @@ -121,15 +114,8 @@ spec: path: /hc port: 80 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /hc - port: 80 - scheme: HTTP - initialDelaySeconds: 60 - periodSeconds: 10 + initialDelaySeconds: 300 + periodSeconds: 240 imagePullSecrets: - name: registry-key --- @@ -156,7 +142,7 @@ spec: valueFrom: configMapKeyRef: name: externalcfg - key: IdentitySqlDb + key: identity__ConnectionString - name: DPConnectionString valueFrom: configMapKeyRef: @@ -168,37 +154,47 @@ spec: valueFrom: configMapKeyRef: name: urls - key: MvcClientExternalUrl + key: mvc_e - name: SpaClient valueFrom: configMapKeyRef: name: urls - key: SpaClientExternalUrl + key: spa_e - name: LocationApiClient valueFrom: configMapKeyRef: name: urls - key: LocationApiClient + key: locations_e - name: MarketingApiClient valueFrom: configMapKeyRef: name: urls - key: MarketingApiClient + key: marketing_e - name: BasketApiClient valueFrom: configMapKeyRef: name: urls - key: BasketApiClient + key: basket_e - name: OrderingApiClient valueFrom: configMapKeyRef: name: urls - key: OrderingApiClient + key: ordering_e + - name: MobileShoppingAggClient + valueFrom: + configMapKeyRef: + name: urls + key: mobileshoppingagg_e + - name: WebShoppingAggClient + valueFrom: + configMapKeyRef: + name: urls + key: webshoppingagg_e - name: ApplicationInsights__InstrumentationKey valueFrom: configMapKeyRef: name: externalcfg - key: Instrumentation_Key + key: all__InstrumentationKey - name: OrchestratorType value: 'K8S' ports: @@ -208,15 +204,8 @@ spec: path: /hc port: 80 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /hc - port: 80 - scheme: HTTP - initialDelaySeconds: 60 - periodSeconds: 10 + initialDelaySeconds: 300 + periodSeconds: 240 imagePullSecrets: - name: registry-key --- @@ -243,42 +232,42 @@ spec: valueFrom: configMapKeyRef: name: externalcfg - key: OrderingSqlDb + key: ordering__ConnectionString - name: EventBusConnection valueFrom: configMapKeyRef: name: externalcfg - key: OrderingBus + key: all__EventBusConnection - name: AzureServiceBusEnabled valueFrom: configMapKeyRef: name: externalcfg - key: UseAzureServiceBus + key: all__UseAzureServiceBus - name: IdentityUrl valueFrom: configMapKeyRef: name: urls - key: IdentityUrl + key: identity_e - name: CheckUpdateTime valueFrom: configMapKeyRef: name: externalcfg - key: GracePeriodManager_CheckUpdateTime + key: GracePeriodManager__CheckUpdateTime - name: GracePeriodTime valueFrom: configMapKeyRef: name: externalcfg - key: GracePeriodManager_GracePeriodTime + key: GracePeriodManager__GracePeriodTime - name: ApplicationInsights__InstrumentationKey valueFrom: configMapKeyRef: name: externalcfg - key: Instrumentation_Key + key: all__InstrumentationKey - name: UseLoadTest valueFrom: configMapKeyRef: name: externalcfg - key: EnableLoadTest + key: all__EnableLoadTest - name: OrchestratorType value: 'K8S' ports: @@ -288,15 +277,8 @@ spec: path: /hc port: 80 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /hc - port: 80 - scheme: HTTP - initialDelaySeconds: 60 - periodSeconds: 10 + initialDelaySeconds: 300 + periodSeconds: 240 imagePullSecrets: - name: registry-key --- @@ -323,42 +305,42 @@ spec: valueFrom: configMapKeyRef: name: externalcfg - key: LocationsNoSqlDb + key: locations__ConnectionString - name: Database valueFrom: configMapKeyRef: name: externalcfg - key: LocationsNoSqlDbName + key: locations__Database - name: AzureServiceBusEnabled valueFrom: configMapKeyRef: name: externalcfg - key: UseAzureServiceBus + key: all__UseAzureServiceBus - name: EventBusConnection valueFrom: configMapKeyRef: name: externalcfg - key: LocationsBus + key: all__EventBusConnection - name: IdentityUrl valueFrom: configMapKeyRef: - name: urls - key: IdentityUrl + name: internalurls + key: identity - name: IdentityUrlExternal valueFrom: configMapKeyRef: name: urls - key: IdentityUrl + key: identity_e - name: ApplicationInsights__InstrumentationKey valueFrom: configMapKeyRef: name: externalcfg - key: Instrumentation_Key + key: all__InstrumentationKey - name: UseLoadTest valueFrom: configMapKeyRef: name: externalcfg - key: EnableLoadTest + key: all__EnableLoadTest - name: OrchestratorType value: 'K8S' ports: @@ -368,15 +350,8 @@ spec: path: /hc port: 80 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /hc - port: 80 - scheme: HTTP - initialDelaySeconds: 60 - periodSeconds: 10 + initialDelaySeconds: 300 + periodSeconds: 240 imagePullSecrets: - name: registry-key --- @@ -403,37 +378,37 @@ spec: valueFrom: configMapKeyRef: name: externalcfg - key: MarketingSqlDb + key: marketing__ConnectionString - name: MongoConnectionString valueFrom: configMapKeyRef: name: externalcfg - key: MarketingNoSqlDb + key: marketing__MongoConnectionString - name: MongoDatabase valueFrom: configMapKeyRef: name: externalcfg - key: MarketingNoSqlDbName + key: marketing__MongoDatabase - name: AzureServiceBusEnabled valueFrom: configMapKeyRef: name: externalcfg - key: UseAzureServiceBus + key: all__UseAzureServiceBus - name: EventBusConnection valueFrom: configMapKeyRef: name: externalcfg - key: MarketingBus + key: all__EventBusConnection - name: IdentityUrl valueFrom: configMapKeyRef: - name: urls - key: IdentityUrl + name: internalurls + key: identity - name: IdentityUrlExternal valueFrom: configMapKeyRef: name: urls - key: IdentityUrl + key: identity_e - name: PicBaseUrl valueFrom: configMapKeyRef: @@ -443,12 +418,12 @@ spec: valueFrom: configMapKeyRef: name: externalcfg - key: Instrumentation_Key + key: all__InstrumentationKey - name: UseLoadTest valueFrom: configMapKeyRef: name: externalcfg - key: EnableLoadTest + key: all__EnableLoadTest - name: OrchestratorType value: 'K8S' ports: @@ -458,15 +433,8 @@ spec: path: /hc port: 80 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /hc - port: 80 - scheme: HTTP - initialDelaySeconds: 60 - periodSeconds: 10 + initialDelaySeconds: 300 + periodSeconds: 240 imagePullSecrets: - name: registry-key --- @@ -493,17 +461,17 @@ spec: valueFrom: configMapKeyRef: name: externalcfg - key: UseAzureServiceBus + key: all__UseAzureServiceBus - name: EventBusConnection valueFrom: configMapKeyRef: name: externalcfg - key: PaymentBus + key: all__EventBusConnection - name: ApplicationInsights__InstrumentationKey valueFrom: configMapKeyRef: name: externalcfg - key: Instrumentation_Key + key: all__InstrumentationKey - name: OrchestratorType value: 'K8S' ports: @@ -513,15 +481,8 @@ spec: path: /hc port: 80 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /hc - port: 80 - scheme: HTTP - initialDelaySeconds: 60 - periodSeconds: 10 + initialDelaySeconds: 300 + periodSeconds: 240 imagePullSecrets: - name: registry-key --- @@ -551,81 +512,66 @@ spec: key: keystore - name: IsClusterEnv value: 'True' - - name: BasketUrl + - name: PurchaseUrl valueFrom: configMapKeyRef: - name: urls - key: MvcClientBasketUrl + name: internalurls + key: apigwws - name: CallBackUrl valueFrom: configMapKeyRef: name: urls - key: MvcClientExternalUrl - - name: LocationsUrl - valueFrom: - configMapKeyRef: - name: urls - key: MvcClientLocationsUrl - - name: CatalogUrl - valueFrom: - configMapKeyRef: - name: urls - key: MvcClientCatalogUrl + key: mvc_e - name: IdentityUrl valueFrom: configMapKeyRef: name: urls - key: IdentityUrl - - name: OrderingUrl - valueFrom: - configMapKeyRef: - name: urls - key: MvcClientOrderingUrl + key: identity_e - name: MarketingUrl valueFrom: configMapKeyRef: - name: urls - key: MvcClientMarketingUrl + name: internalurls + key: apigwwm - name: BasketUrlHC valueFrom: configMapKeyRef: - name: urls - key: BasketHealthCheckUrl + name: internalurls + key: basket__hc - name: CatalogUrlHC valueFrom: configMapKeyRef: - name: urls - key: CatalogHealthCheckUrl + name: internalurls + key: catalog__hc - name: IdentityUrlHC valueFrom: configMapKeyRef: - name: urls - key: IdentityHealthCheckUrl + name: internalurls + key: identity__hc - name: OrderingUrlHC valueFrom: configMapKeyRef: - name: urls - key: OrderingHealthCheckUrl + name: internalurls + key: ordering__hc - name: MarketingUrlHC valueFrom: configMapKeyRef: - name: urls - key: MarketingHealthCheckUrl + name: internalurls + key: marketing__hc - name: PaymentUrlHC valueFrom: configMapKeyRef: - name: urls - key: PaymentHealthCheckUrl + name: internalurls + key: payment__hc - name: ApplicationInsights__InstrumentationKey valueFrom: configMapKeyRef: name: externalcfg - key: Instrumentation_Key + key: all__InstrumentationKey - name: UseLoadTest valueFrom: configMapKeyRef: name: externalcfg - key: EnableLoadTest + key: all__EnableLoadTest - name: OrchestratorType value: 'K8S' ports: @@ -635,15 +581,8 @@ spec: path: /hc port: 80 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /hc - port: 80 - scheme: HTTP - initialDelaySeconds: 60 - periodSeconds: 10 + initialDelaySeconds: 300 + periodSeconds: 240 imagePullSecrets: - name: registry-key --- @@ -669,53 +608,53 @@ spec: - name: BasketUrl valueFrom: configMapKeyRef: - name: urls - key: BasketHealthCheckUrl + name: internalurls + key: basket__hc - name: CatalogUrl valueFrom: configMapKeyRef: - name: urls - key: CatalogHealthCheckUrl + name: internalurls + key: catalog__hc - name: IdentityUrl valueFrom: configMapKeyRef: - name: urls - key: IdentityHealthCheckUrl + name: internalurls + key: identity__hc - name: OrderingUrl valueFrom: configMapKeyRef: - name: urls - key: OrderingHealthCheckUrl + name: internalurls + key: ordering__hc - name: LocationsUrl valueFrom: configMapKeyRef: - name: urls - key: LocationsHealthCheckUrl + name: internalurls + key: locations__hc - name: MarketingUrl valueFrom: configMapKeyRef: - name: urls - key: MarketingHealthCheckUrl + name: internalurls + key: marketing__hc - name: mvc valueFrom: configMapKeyRef: - name: urls - key: WebMvcHealthCheckUrl + name: internalurls + key: mvc__hc - name: spa valueFrom: configMapKeyRef: - name: urls - key: WebSpaHealthCheckUrl + name: internalurls + key: spa__hc - name: PaymentUrl valueFrom: configMapKeyRef: - name: urls - key: PaymentHealthCheckUrl + name: internalurls + key: payment__hc - name: ApplicationInsights__InstrumentationKey valueFrom: configMapKeyRef: name: externalcfg - key: Instrumentation_Key + key: all__InstrumentationKey - name: OrchestratorType value: 'K8S' ports: @@ -749,76 +688,61 @@ spec: key: keystore - name: IsClusterEnv value: 'True' - - name: BasketUrl + - name: PurchaseUrl valueFrom: configMapKeyRef: name: urls - key: SpaClientBasketExternalUrl + key: webshoppingapigw_e - name: CallBackUrl valueFrom: configMapKeyRef: name: urls - key: SpaClientExternalUrl - - name: CatalogUrl - valueFrom: - configMapKeyRef: - name: urls - key: SpaClientCatalogExternalUrl + key: spa_e - name: IdentityUrl valueFrom: configMapKeyRef: name: urls - key: SpaClientIdentityExternalUrl - - name: OrderingUrl - valueFrom: - configMapKeyRef: - name: urls - key: SpaClientOrderingExternalUrl + key: identity_e - name: MarketingUrl valueFrom: configMapKeyRef: name: urls - key: SpaClientMarketingExternalUrl - - name: LocationsUrl - valueFrom: - configMapKeyRef: - name: urls - key: SpaClientLocationsUrl + key: marketingapigw_e - name: BasketUrlHC valueFrom: configMapKeyRef: - name: urls - key: BasketHealthCheckUrl + name: internalurls + key: basket__hc - name: CatalogUrlHC valueFrom: configMapKeyRef: - name: urls - key: CatalogHealthCheckUrl + name: internalurls + key: catalog__hc - name: IdentityUrlHC valueFrom: configMapKeyRef: - name: urls - key: IdentityHealthCheckUrl + name: internalurls + key: identity__hc - name: OrderingUrlHC valueFrom: configMapKeyRef: - name: urls - key: OrderingHealthCheckUrl + name: internalurls + key: ordering__hc - name: MarketingUrlHC valueFrom: configMapKeyRef: - name: urls - key: MarketingHealthCheckUrl + name: internalurls + key: marketing__hc - name: PaymentUrlHC valueFrom: configMapKeyRef: - name: urls - key: PaymentHealthCheckUrl + name: internalurls + key: payment__hc - name: ApplicationInsights__InstrumentationKey valueFrom: configMapKeyRef: name: externalcfg - key: Instrumentation_Key + key: all__InstrumentationKey - name: OrchestratorType value: 'K8S' ports: @@ -828,14 +752,96 @@ spec: path: /hc port: 80 scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /hc - port: 80 - scheme: HTTP - initialDelaySeconds: 60 - periodSeconds: 10 + initialDelaySeconds: 300 + periodSeconds: 240 imagePullSecrets: - name: registry-key +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: webshoppingagg +spec: + paused: true + template: + metadata: + labels: + app: eshop + component: webshoppingagg + spec: + containers: + - name: webshoppingagg + image: eshop/webshoppingagg + imagePullPolicy: Always + env: + - name: ASPNETCORE_URLS + value: http://0.0.0.0:80 + - name: urls__basket + valueFrom: + configMapKeyRef: + name: internalurls + key: basket + - name: urls__catalog + valueFrom: + configMapKeyRef: + name: internalurls + key: catalog + - name: urls__orders + valueFrom: + configMapKeyRef: + name: internalurls + key: ordering + - name: urls__identity + valueFrom: + configMapKeyRef: + name: internalurls + key: identity + ports: + - containerPort: 80 + imagePullSecrets: + - name: registry-key +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: mobileshoppingagg +spec: + paused: true + template: + metadata: + labels: + app: eshop + component: mobileshoppingagg + spec: + containers: + - name: mobileshoppingagg + image: eshop/mobileshoppingagg + imagePullPolicy: Always + env: + - name: ASPNETCORE_URLS + value: http://0.0.0.0:80 + - name: urls__basket + valueFrom: + configMapKeyRef: + name: internalurls + key: basket + - name: urls__catalog + valueFrom: + configMapKeyRef: + name: internalurls + key: catalog + - name: urls__orders + valueFrom: + configMapKeyRef: + name: internalurls + key: ordering + - name: urls__identity + valueFrom: + configMapKeyRef: + name: internalurls + key: identity + ports: + - containerPort: 80 + imagePullSecrets: + - name: registry-key +--- diff --git a/k8s/ingress.yaml b/k8s/ingress.yaml index 59012bf26..b5773bb25 100644 --- a/k8s/ingress.yaml +++ b/k8s/ingress.yaml @@ -11,22 +11,10 @@ spec: rules: - http: paths: - - path: /basket-api - backend: - serviceName: ocelot - servicePort: 80 - - path: /catalog-api - backend: - serviceName: ocelot - servicePort: 80 - path: /identity backend: serviceName: identity servicePort: 80 - - path: /ordering-api - backend: - serviceName: ocelot - servicePort: 80 - path: /webmvc backend: serviceName: webmvc @@ -35,25 +23,37 @@ spec: backend: serviceName: webstatus servicePort: 80 - - path: /marketing-api + - path: /webshoppingapigw + backend: + serviceName: ocelotapigw-ws + servicePort: 80 + - path: /webmarketingapigw backend: - serviceName: ocelot + serviceName: ocelotapigw-wm servicePort: 80 - - path: /payment-api + - path: /mobilemarketingapigw + backend: + serviceName: ocelotapigw-mm + servicePort: 80 + - path: /mobileshoppingapigw backend: - serviceName: ocelot + serviceName: ocelotapigw-ms + servicePort: 80 + - path: /webshoppingagg + backend: + serviceName: webshoppingagg servicePort: 80 - - path: /locations-api + - path: /mobileshoppingagg backend: - serviceName: ocelot + serviceName: mobileshoppingagg servicePort: 80 + - path: /payment-api + backend: + serviceName: payment + servicePort: 80 - path: / backend: serviceName: webspa servicePort: 80 - - path: /ocelot - backend: - serviceName: ocelot - servicePort: 80 - + diff --git a/k8s/internalurls.yaml b/k8s/internalurls.yaml new file mode 100644 index 000000000..e42ef23ec --- /dev/null +++ b/k8s/internalurls.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: internalurls + labels: + app: eshop +data: +# Internal Services & healthchecks + basket: http://basket + basket__hc: http://basket/hc + catalog: http://catalog + catalog__hc: http://catalog/hc + identity: http://identity + identity__hc: http://identity/hc + ordering: http://ordering + ordering__hc: http://ordering/hc + marketing: http://marketing + marketing__hc: http://marketing/hc + locations: http://locations + locations__hc: http://locations/hc + payment__hc: http://payment/hc + mvc__hc: http://webmvc/hc + spa__hc: http://webspa/hc +# Aggreggators + mobileshoppingagg: http://mobileshoppingagg + webshoppingagg: http://webshoppingagg +# API GWs + apigwmm: http://ocelotapigw-mm + apigwms: http://ocelotapigw-ms + apigwwm: http://ocelotapigw-wm + apigwws: http://ocelotapigw-ws \ No newline at end of file diff --git a/k8s/ocelot/configuration-mobile-marketing.json b/k8s/ocelot/configuration-mobile-marketing.json new file mode 100644 index 000000000..666df1633 --- /dev/null +++ b/k8s/ocelot/configuration-mobile-marketing.json @@ -0,0 +1,34 @@ +{ + "ReRoutes": [ + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "marketing", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/m/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "locations", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/l/{everything}", + "UpstreamHttpMethod": [] + } + + ], + "GlobalConfiguration": { + "RequestIdKey": "OcRequestId", + "AdministrationPath": "/administration" + } +} + \ No newline at end of file diff --git a/k8s/ocelot/configuration-mobile-shopping.json b/k8s/ocelot/configuration-mobile-shopping.json new file mode 100644 index 000000000..edf0714a0 --- /dev/null +++ b/k8s/ocelot/configuration-mobile-shopping.json @@ -0,0 +1,142 @@ +{ + "ReRoutes": [ + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "catalog", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/c/{everything}", + "UpstreamHttpMethod": [ "GET" ] + }, + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "basket", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/b/{everything}", + "UpstreamHttpMethod": [], + "AuthenticationOptions": { + "AuthenticationProviderKey": "IdentityApiKey", + "AllowedScopes": [] + } + }, + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "ordering", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/o/{everything}", + "UpstreamHttpMethod": [], + "AuthenticationOptions": { + "AuthenticationProviderKey": "IdentityApiKey", + "AllowedScopes": [] + } + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "webshoppingagg", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/{everything}", + "UpstreamHttpMethod": [ "POST", "PUT", "GET" ], + "AuthenticationOptions": { + "AuthenticationProviderKey": "IdentityApiKey", + "AllowedScopes": [] + } + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "ordering", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/orders-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "basket", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/basket-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "catalog", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/catalog-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "marketing", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/marketing-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "payment", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/payment-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "locations.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/location-api/{everything}", + "UpstreamHttpMethod": [] + } + + ], + "GlobalConfiguration": { + "RequestIdKey": "OcRequestId", + "AdministrationPath": "/administration" + } + } + \ No newline at end of file diff --git a/k8s/ocelot/configuration-web-marketing.json b/k8s/ocelot/configuration-web-marketing.json new file mode 100644 index 000000000..666df1633 --- /dev/null +++ b/k8s/ocelot/configuration-web-marketing.json @@ -0,0 +1,34 @@ +{ + "ReRoutes": [ + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "marketing", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/m/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "locations", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/l/{everything}", + "UpstreamHttpMethod": [] + } + + ], + "GlobalConfiguration": { + "RequestIdKey": "OcRequestId", + "AdministrationPath": "/administration" + } +} + \ No newline at end of file diff --git a/k8s/ocelot/configuration-web-shopping.json b/k8s/ocelot/configuration-web-shopping.json new file mode 100644 index 000000000..edf0714a0 --- /dev/null +++ b/k8s/ocelot/configuration-web-shopping.json @@ -0,0 +1,142 @@ +{ + "ReRoutes": [ + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "catalog", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/c/{everything}", + "UpstreamHttpMethod": [ "GET" ] + }, + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "basket", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/b/{everything}", + "UpstreamHttpMethod": [], + "AuthenticationOptions": { + "AuthenticationProviderKey": "IdentityApiKey", + "AllowedScopes": [] + } + }, + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "ordering", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/o/{everything}", + "UpstreamHttpMethod": [], + "AuthenticationOptions": { + "AuthenticationProviderKey": "IdentityApiKey", + "AllowedScopes": [] + } + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "webshoppingagg", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/{everything}", + "UpstreamHttpMethod": [ "POST", "PUT", "GET" ], + "AuthenticationOptions": { + "AuthenticationProviderKey": "IdentityApiKey", + "AllowedScopes": [] + } + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "ordering", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/orders-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "basket", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/basket-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "catalog", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/catalog-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "marketing", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/marketing-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "payment", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/payment-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "locations.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/location-api/{everything}", + "UpstreamHttpMethod": [] + } + + ], + "GlobalConfiguration": { + "RequestIdKey": "OcRequestId", + "AdministrationPath": "/administration" + } + } + \ No newline at end of file diff --git a/k8s/ocelot/configuration.json b/k8s/ocelot/configuration.json deleted file mode 100644 index 7a94504c3..000000000 --- a/k8s/ocelot/configuration.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "ReRoutes": [ - { - "DownstreamPathTemplate": "/{everything}", - "DownstreamScheme": "http", - "DownstreamHost": "ordering", - "DownstreamPort": 80, - "UpstreamPathTemplate": "/ordering-api/{everything}", - "UpstreamHttpMethod": [] - }, - { - "DownstreamPathTemplate": "/{everything}", - "DownstreamScheme": "http", - "DownstreamHost": "basket", - "DownstreamPort": 80, - "UpstreamPathTemplate": "/basket-api/{everything}", - "UpstreamHttpMethod": [] - }, - { - "DownstreamPathTemplate": "/{everything}", - "DownstreamScheme": "http", - "DownstreamHost": "catalog", - "DownstreamPort": 80, - "UpstreamPathTemplate": "/catalog-api/{everything}", - "UpstreamHttpMethod": [] - }, - { - "DownstreamPathTemplate": "/{everything}", - "DownstreamScheme": "http", - "DownstreamHost": "marketing", - "DownstreamPort": 80, - "UpstreamPathTemplate": "/marketing-api/{everything}", - "UpstreamHttpMethod": [] - }, - { - "DownstreamPathTemplate": "/{everything}", - "DownstreamScheme": "http", - "DownstreamHost": "payment", - "DownstreamPort": 80, - "UpstreamPathTemplate": "/payment-api/{everything}", - "UpstreamHttpMethod": [] - }, - { - "DownstreamPathTemplate": "/{everything}", - "DownstreamScheme": "http", - "DownstreamHost": "locations", - "DownstreamPort": 80, - "UpstreamPathTemplate": "/location-api/{everything}", - "UpstreamHttpMethod": [] - } - - ], - "GlobalConfiguration": { - "RequestIdKey": "OcRequestId", - "AdministrationPath": "/administration" - } - } - \ No newline at end of file diff --git a/k8s/ocelot/deployment.yaml b/k8s/ocelot/deployment.yaml index 4800172e6..516f91b2f 100644 --- a/k8s/ocelot/deployment.yaml +++ b/k8s/ocelot/deployment.yaml @@ -1,19 +1,27 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: ocelot + name: apigwmm spec: paused: true template: metadata: labels: app: eshop - component: ocelot + component: apigwmm spec: containers: - - name: ocelot - image: eshop/ocelotapigw + - name: apigwmm + image: eshop/ocelotapigw-mm imagePullPolicy: Always + env: + - name: PATH_BASE + value: /mobilemarketingapigw + - name: IdentityUrl + valueFrom: + configMapKeyRef: + name: internalurls + key: identity ports: - containerPort: 80 volumeMounts: @@ -24,8 +32,124 @@ spec: configMap: name: ocelot items: - - key: configuration.json + - key: mm path: configuration.json imagePullSecrets: - name: registry-key - +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: apigwms +spec: + paused: true + template: + metadata: + labels: + app: eshop + component: apigwms + spec: + containers: + - name: apigwms + image: eshop/ocelotapigw-ms + imagePullPolicy: Always + env: + - name: PATH_BASE + value: /mobileshoppingapigw + - name: IdentityUrl + valueFrom: + configMapKeyRef: + name: internalurls + key: identity + ports: + - containerPort: 80 + volumeMounts: + - name: config + mountPath: /app/configuration + volumes: + - name: config + configMap: + name: ocelot + items: + - key: ms + path: configuration.json + imagePullSecrets: + - name: registry-key +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: apigwwm +spec: + paused: true + template: + metadata: + labels: + app: eshop + component: apigwwm + spec: + containers: + - name: apigwwm + image: eshop/ocelotapigw-wm + imagePullPolicy: Always + env: + - name: PATH_BASE + value: /webmarketingapigw + - name: IdentityUrl + valueFrom: + configMapKeyRef: + name: internalurls + key: identity + ports: + - containerPort: 80 + volumeMounts: + - name: config + mountPath: /app/configuration + volumes: + - name: config + configMap: + name: ocelot + items: + - key: wm + path: configuration.json + imagePullSecrets: + - name: registry-key +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: apigwws +spec: + paused: true + template: + metadata: + labels: + app: eshop + component: apigwws + spec: + containers: + - name: apigwws + image: eshop/ocelotapigw-ws + imagePullPolicy: Always + env: + - name: PATH_BASE + value: /webshoppingapigw + - name: IdentityUrl + valueFrom: + configMapKeyRef: + name: internalurls + key: identity + ports: + - containerPort: 80 + volumeMounts: + - name: config + mountPath: /app/configuration + volumes: + - name: config + configMap: + name: ocelot + items: + - key: ws + path: configuration.json + imagePullSecrets: + - name: registry-key \ No newline at end of file diff --git a/k8s/ocelot/service.yaml b/k8s/ocelot/service.yaml index 6b376ca78..858b54b21 100644 --- a/k8s/ocelot/service.yaml +++ b/k8s/ocelot/service.yaml @@ -3,11 +3,53 @@ kind: Service metadata: labels: app: eshop - component: ocelot - name: ocelot + component: ocelotapigw-mm + name: ocelotapigw-mm spec: ports: - port: 80 selector: app: eshop - component: ocelot + component: apigwmm +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: eshop + component: ocelotapigw-ms + name: ocelotapigw-ms +spec: + ports: + - port: 80 + selector: + app: eshop + component: apigwms +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: eshop + component: ocelotapigw-wm + name: ocelotapigw-wm +spec: + ports: + - port: 80 + selector: + app: eshop + component: apigwwm +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: eshop + component: ocelotapigw-ws + name: ocelotapigw-ws +spec: + ports: + - port: 80 + selector: + app: eshop + component: apigwws diff --git a/src/ApiGateways/ApiGw-Base/Startup.cs b/src/ApiGateways/ApiGw-Base/Startup.cs index 254849d89..f6a36b59e 100644 --- a/src/ApiGateways/ApiGw-Base/Startup.cs +++ b/src/ApiGateways/ApiGw-Base/Startup.cs @@ -70,6 +70,12 @@ namespace OcelotApiGw public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { + var pathBase = _cfg["PATH_BASE"]; + if (!string.IsNullOrEmpty(pathBase)) + { + app.UsePathBase(pathBase); + } + if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); diff --git a/src/ApiGateways/Mobile.Bff.Marketing/apigw/configuration.json b/src/ApiGateways/Mobile.Bff.Marketing/apigw/configuration.json index 22fdca1b2..85d6777e6 100644 --- a/src/ApiGateways/Mobile.Bff.Marketing/apigw/configuration.json +++ b/src/ApiGateways/Mobile.Bff.Marketing/apigw/configuration.json @@ -1 +1,34 @@ -{} \ No newline at end of file +{ + "ReRoutes": [ + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "marketing.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/m/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "locations.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/l/{everything}", + "UpstreamHttpMethod": [] + } + + ], + "GlobalConfiguration": { + "RequestIdKey": "OcRequestId", + "AdministrationPath": "/administration" + } + } + \ No newline at end of file diff --git a/src/ApiGateways/Mobile.Bff.Shopping/apigw/configuration.json b/src/ApiGateways/Mobile.Bff.Shopping/apigw/configuration.json index 22fdca1b2..1de765949 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/apigw/configuration.json +++ b/src/ApiGateways/Mobile.Bff.Shopping/apigw/configuration.json @@ -1 +1,142 @@ -{} \ No newline at end of file +{ + "ReRoutes": [ + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "catalog.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/c/{everything}", + "UpstreamHttpMethod": [ "GET" ] + }, + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "basket.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/b/{everything}", + "UpstreamHttpMethod": [], + "AuthenticationOptions": { + "AuthenticationProviderKey": "IdentityApiKey", + "AllowedScopes": [] + } + }, + { + "DownstreamPathTemplate": "/api/{version}/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "ordering.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/api/{version}/o/{everything}", + "UpstreamHttpMethod": [], + "AuthenticationOptions": { + "AuthenticationProviderKey": "IdentityApiKey", + "AllowedScopes": [] + } + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "webshoppingagg", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/{everything}", + "UpstreamHttpMethod": [ "POST", "PUT", "GET" ], + "AuthenticationOptions": { + "AuthenticationProviderKey": "IdentityApiKey", + "AllowedScopes": [] + } + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "ordering.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/orders-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "basket.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/basket-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "catalog.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/catalog-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "marketing.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/marketing-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "payment.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/payment-api/{everything}", + "UpstreamHttpMethod": [] + }, + { + "DownstreamPathTemplate": "/{everything}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "locations.api", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/location-api/{everything}", + "UpstreamHttpMethod": [] + } + + ], + "GlobalConfiguration": { + "RequestIdKey": "OcRequestId", + "AdministrationPath": "/administration" + } + } + \ No newline at end of file