Skip to content

Commit 08e9b26

Browse files
committed
Final adjustments to make envoy work with ingress and remove Polly from http calls
1 parent c124e9e commit 08e9b26

20 files changed

Lines changed: 187 additions & 232 deletions

File tree

k8s/gen-k8s-env-aks.ps1

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
[parameter(Mandatory=$true)][string]$serviceName,
55
[parameter(Mandatory=$true)][string]$dnsNamePrefix,
66
[parameter(Mandatory=$false)][string]$registryName,
7-
[parameter(Mandatory=$true)][string]$createAcr=$true,
7+
[parameter(Mandatory=$true)][bool]$createAcr=$true,
88
[parameter(Mandatory=$false)][int]$nodeCount=3,
9-
[parameter(Mandatory=$false)][string]$nodeVMSize="Standard_D2_v2"
9+
[parameter(Mandatory=$false)][string]$nodeVMSize="Standard_D2_v2",
10+
[parameter(Mandatory=$false)][bool]$enableHttpApplicationAddon=$true,
11+
[parameter(Mandatory=$false)][bool]$enableAzureMonitoring=$false,
12+
[parameter(Mandatory=$false)][ValidateSet("VirtualMachineScaleSets","AvailabilitySet",IgnoreCase=$true)]$vmSetType="VirtualMachineScaleSets"
1013
)
1114

1215
# Create resource group
@@ -15,20 +18,33 @@ az group create --name=$resourceGroupName --location=$location
1518

1619
if ($createAcr -eq $true) {
1720
# Create Azure Container Registry
18-
Write-Host "Creating Azure Container Registry..." -ForegroundColor Yellow
21+
if ([string]::IsNullOrEmpty($registryName)) {
22+
$registryName=$serviceName
23+
}
24+
Write-Host "Creating Azure Container Registry named $registryName" -ForegroundColor Yellow
1925
az acr create -n $registryName -g $resourceGroupName -l $location --admin-enabled true --sku Basic
2026
}
2127

2228
# Create kubernetes cluster in AKS
23-
Write-Host "Creating Kubernetes cluster in AKS..." -ForegroundColor Yellow
24-
az aks create --resource-group=$resourceGroupName --name=$serviceName --dns-name-prefix=$dnsNamePrefix --generate-ssh-keys --node-count=$nodeCount --node-vm-size=$nodeVMSize
29+
Write-Host "Creating AKS $resourceGroupName/$serviceName" -ForegroundColor Yellow
30+
az aks create --resource-group=$resourceGroupName --name=$serviceName --dns-name-prefix=$dnsNamePrefix --generate-ssh-keys --node-count=$nodeCount --node-vm-size=$nodeVMSize --vm-set-type $vmSetType
31+
32+
if ($enableHttpApplicationAddon) {
33+
Write-Host "Enabling Http Applciation Routing in AKS $serviceName" -ForegroundColor Yellow
34+
az aks enable-addons --resource-group $resourceGroupName --name $serviceName --addons http_application_routing
35+
}
36+
37+
if ($enableAzureMonitoring) {
38+
Write-Host "Enabling Azure Monitoring in AKS $serviceName" -ForegroundColor Yellow
39+
az aks enable-addons --resource-group $resourceGroupName --name $serviceName --addons monitoring
40+
}
2541

2642
# Retrieve kubernetes cluster configuration and save it under ~/.kube/config
2743
Write-Host "Getting Kubernetes config..." -ForegroundColor Yellow
2844
az aks get-credentials --resource-group=$resourceGroupName --name=$serviceName
2945

3046
if ($createAcr -eq $true) {
3147
# Show ACR credentials
32-
Write-Host "ACR credentials" -ForegroundColor Yellow
48+
Write-Host "ACR $registryName credentials:" -ForegroundColor Yellow
3349
az acr credential show -n $registryName
3450
}

k8s/gen-k8s-env.ps1

Lines changed: 0 additions & 33 deletions
This file was deleted.

k8s/helm/apigwmm/envoy.yaml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,39 @@ static_resources:
2323
domains:
2424
- "*"
2525
routes:
26-
- match:
26+
- name: "m-short"
27+
match:
2728
prefix: "/m/"
2829
route:
30+
auto_host_rewrite: true
2931
prefix_rewrite: "/marketing-api/"
3032
cluster: marketing
31-
- match:
33+
- name: "m-long"
34+
match:
3235
prefix: "/marketing-api/"
3336
route:
37+
auto_host_rewrite: true
3438
cluster: marketing
3539
http_filters:
36-
- name: envoy.router
40+
- name: envoy.router
41+
access_log:
42+
- name: envoy.file_access_log
43+
filter:
44+
not_health_check_filter: {}
45+
config:
46+
json_format:
47+
time: "%START_TIME%"
48+
protocol: "%PROTOCOL%"
49+
duration: "%DURATION%"
50+
request_method: "%REQ(:METHOD)%"
51+
request_host: "%REQ(HOST)%"
52+
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
53+
response_flags: "%RESPONSE_FLAGS%"
54+
route_name: "%ROUTE_NAME%"
55+
upstream_host: "%UPSTREAM_HOST%"
56+
upstream_cluster: "%UPSTREAM_CLUSTER%"
57+
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%"
58+
path: "/tmp/access.log"
3759
clusters:
3860
- name: marketing
3961
connect_timeout: 0.25s

k8s/helm/apigwms/envoy.yaml

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,68 +23,100 @@ static_resources:
2323
domains:
2424
- "*"
2525
routes:
26-
- match:
26+
- name: "c-short"
27+
match:
2728
prefix: "/c/"
2829
route:
30+
auto_host_rewrite: true
2931
prefix_rewrite: "/catalog-api/"
3032
cluster: catalog
31-
- match:
33+
- name: "c-long"
34+
match:
3235
prefix: "/catalog-api/"
3336
route:
37+
auto_host_rewrite: true
3438
cluster: catalog
35-
- match:
39+
- name: "o-short"
40+
match:
3641
prefix: "/o/"
3742
route:
43+
auto_host_rewrite: true
3844
prefix_rewrite: "/ordering-api/"
3945
cluster: ordering
40-
- match:
46+
- name: "o-long"
47+
match:
4148
prefix: "/ordering-api/"
4249
route:
50+
auto_host_rewrite: true
4351
cluster: ordering
44-
- match:
52+
- name: "b-short"
53+
match:
4554
prefix: "/b/"
4655
route:
56+
auto_host_rewrite: true
4757
prefix_rewrite: "/basket-api/"
4858
cluster: basket
49-
- match:
59+
- name: "b-long"
60+
match:
5061
prefix: "/basket-api/"
5162
route:
63+
auto_host_rewrite: true
5264
cluster: basket
53-
- match:
65+
- name: "agg"
66+
match:
5467
prefix: "/"
5568
route:
69+
auto_host_rewrite: true
5670
prefix_rewrite: "/"
5771
cluster: shoppingagg
5872
http_filters:
5973
- name: envoy.router
74+
access_log:
75+
- name: envoy.file_access_log
76+
filter:
77+
not_health_check_filter: {}
78+
config:
79+
json_format:
80+
time: "%START_TIME%"
81+
protocol: "%PROTOCOL%"
82+
duration: "%DURATION%"
83+
request_method: "%REQ(:METHOD)%"
84+
request_host: "%REQ(HOST)%"
85+
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
86+
response_flags: "%RESPONSE_FLAGS%"
87+
route_name: "%ROUTE_NAME%"
88+
upstream_host: "%UPSTREAM_HOST%"
89+
upstream_cluster: "%UPSTREAM_CLUSTER%"
90+
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%"
91+
path: "/tmp/access.log"
6092
clusters:
6193
- name: shoppingagg
6294
connect_timeout: 0.25s
63-
type: logical_dns
95+
type: strict_dns
6496
lb_policy: round_robin
6597
hosts:
6698
- socket_address:
6799
address: webshoppingagg
68100
port_value: 80
69101
- name: catalog
70102
connect_timeout: 0.25s
71-
type: logical_dns
103+
type: strict_dns
72104
lb_policy: round_robin
73105
hosts:
74106
- socket_address:
75107
address: catalog-api
76108
port_value: 80
77109
- name: basket
78110
connect_timeout: 0.25s
79-
type: logical_dns
111+
type: strict_dns
80112
lb_policy: round_robin
81113
hosts:
82114
- socket_address:
83115
address: basket-api
84116
port_value: 80
85117
- name: ordering
86118
connect_timeout: 0.25s
87-
type: logical_dns
119+
type: strict_dns
88120
lb_policy: round_robin
89121
hosts:
90122
- socket_address:

k8s/helm/apigwwm/envoy.yaml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,51 @@ static_resources:
2323
domains:
2424
- "*"
2525
routes:
26-
- match:
26+
- name: "m-short"
27+
match:
2728
prefix: "/m/"
2829
route:
30+
auto_host_rewrite: true
2931
prefix_rewrite: "/marketing-api/"
3032
cluster: marketing
31-
- match:
33+
- name: "m-long"
34+
match:
3235
prefix: "/marketing-api/"
3336
route:
37+
auto_host_rewrite: true
3438
cluster: marketing
3539
http_filters:
36-
- name: envoy.router
40+
- name: envoy.router
41+
access_log:
42+
- name: envoy.file_access_log
43+
filter:
44+
not_health_check_filter: {}
45+
config:
46+
json_format:
47+
time: "%START_TIME%"
48+
protocol: "%PROTOCOL%"
49+
duration: "%DURATION%"
50+
request_method: "%REQ(:METHOD)%"
51+
request_host: "%REQ(HOST)%"
52+
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%"
53+
response_flags: "%RESPONSE_FLAGS%"
54+
route_name: "%ROUTE_NAME%"
55+
upstream_host: "%UPSTREAM_HOST%"
56+
upstream_cluster: "%UPSTREAM_CLUSTER%"
57+
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%"
58+
path: "/tmp/access.log"
3759
clusters:
3860
- name: marketing
3961
connect_timeout: 0.25s
40-
type: logical_dns
62+
type: strict_dns
4163
lb_policy: round_robin
4264
hosts:
4365
- socket_address:
4466
address: marketing-api
4567
port_value: 80
4668
- name: locations
4769
connect_timeout: 0.25s
48-
type: logical_dns
70+
type: strict_dns
4971
lb_policy: round_robin
5072
hosts:
5173
- socket_address:

k8s/helm/apigwwm/templates/ingress.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ç{{- if .Values.ingress.enabled -}}
1+
{{- if .Values.ingress.enabled -}}
22
{{- $ingressPath := include "pathBase" . -}}
33
{{- $serviceName := .Values.app.svc.webmarketingapigw -}}
44

0 commit comments

Comments
 (0)