Skip to content

Commit

Permalink
Configure ingress rewrite path and targets depending on the nginx-con…
Browse files Browse the repository at this point in the history
…troller version. (microsoft#2)
  • Loading branch information
dsrodenas authored Dec 18, 2019
1 parent 044dc32 commit 920e908
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Deploy/helm/cart-api/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}(/|$)(.*)
- path: {{ $ingressPath }}
backend:
serviceName: cart
servicePort: http
Expand Down
2 changes: 1 addition & 1 deletion Deploy/helm/coupons-api/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}(/|$)(.*)
- path: {{ $ingressPath }}
backend:
serviceName: coupons
servicePort: http
Expand Down
26 changes: 13 additions & 13 deletions Deploy/helm/gvalues.template
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,27 @@ inf:
id: {{appinsightsik}}
ingress:
products:
path: /product-api
path: /product-api{{ingressrewritepath}}
profile:
path: /profile-api
path: /profile-api{{ingressrewritepath}}
coupons:
path: /coupons-api
path: /coupons-api{{ingressrewritepath}}
popularproducts:
path: /popular-products-api
path: /popular-products-api{{ingressrewritepath}}
stock:
path: /stock-api
path: /stock-api{{ingressrewritepath}}
imageclassifier:
path: /image-classifier-api
path: /image-classifier-api{{ingressrewritepath}}
mobilebff:
path: /mobilebff
path: /mobilebff{{ingressrewritepath}}
webbff:
path: /webbff
path: /webbff{{ingressrewritepath}}
login:
path: /login-api
path: /login-api{{ingressrewritepath}}
cart:
path: /cart-api
path: /cart-api{{ingressrewritepath}}
rewardsregistration:
path: /rewards-registration-api
path: /rewards-registration-api{{ingressrewritepath}}
apiurls:
popularproductsapiurl: http://popularproducts
productsapiurl: http://product
Expand All @@ -80,8 +80,8 @@ ingress:
kubernetes.io/ingress.class: {{ingressclass}}
ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/ssl-redirect: "false"
ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/rewrite-target: /$2
ingress.kubernetes.io/rewrite-target: /{{ingressrewritetarget}}
nginx.ingress.kubernetes.io/rewrite-target: /{{ingressrewritetarget}}
# hosts:
# - <guid>.<region>.aksapp.io # NOT NEEDED. SET BY SCRIPTS

Expand Down
2 changes: 1 addition & 1 deletion Deploy/helm/image-classifier-api/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}(/|$)(.*)
- path: {{ $ingressPath }}
backend:
serviceName: imageclassifier
servicePort: http
Expand Down
2 changes: 1 addition & 1 deletion Deploy/helm/login-api/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}(/|$)(.*)
- path: {{ $ingressPath }}
backend:
serviceName: login
servicePort: http
Expand Down
2 changes: 1 addition & 1 deletion Deploy/helm/mobilebff/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}(/|$)(.*)
- path: {{ $ingressPath }}
backend:
serviceName: mobilebff
servicePort: http
Expand Down
2 changes: 1 addition & 1 deletion Deploy/helm/popular-products-api/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}(/|$)(.*)
- path: {{ $ingressPath }}
backend:
serviceName: popularproducts
servicePort: http
Expand Down
2 changes: 1 addition & 1 deletion Deploy/helm/products-api/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}(/|$)(.*)
- path: {{ $ingressPath }}
backend:
serviceName: product
servicePort: http
Expand Down
2 changes: 1 addition & 1 deletion Deploy/helm/profiles-api/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}(/|$)(.*)
- path: {{ $ingressPath }}
backend:
serviceName: profile
servicePort: http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}(/|$)(.*)
- path: {{ $ingressPath }}
backend:
serviceName: rewards-registration
servicePort: http
Expand Down
2 changes: 1 addition & 1 deletion Deploy/helm/stock-api/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}(/|$)(.*)
- path: {{ $ingressPath }}
backend:
serviceName: stock
servicePort: http
Expand Down
2 changes: 1 addition & 1 deletion Deploy/helm/webbff/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}(/|$)(.*)
- path: {{ $ingressPath }}
backend:
serviceName: webbff
servicePort: http
Expand Down
7 changes: 7 additions & 0 deletions Deploy/powershell/Generate-Config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ $tokens.appinsightsik=$appinsightsId
$tokens.ingressclass=$ingressClass
$tokens.secissuer="TTFakeLogin"
$tokens.seckey="nEpLzQJGNSCNL5H6DIQCtTdNxf5VgAGcBbtXLms1YDD01KJBAs0WVawaEjn97uwB"
$tokens.ingressrewritepath=""
$tokens.ingressrewritetarget=""

if($ingressClass -ne "addon-http-application-routing") {
$tokens.ingressrewritepath="(/|$)(.*)"
$tokens.ingressrewritetarget="`$2"
}

Write-Host ($tokens | ConvertTo-Json) -ForegroundColor Yellow
Write-Host "===========================================================" -ForegroundColor Yellow
Expand Down

0 comments on commit 920e908

Please sign in to comment.