Skip to content

Commit

Permalink
Updated helm charts to support devspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
eiximenis committed Feb 25, 2019
1 parent e310a52 commit 631696c
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 19 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,9 @@ pub/
.mfractor

# Ignore HealthCheckdb
*healthchecksdb*
*healthchecksdb*

# Ignores all extra inf.yaml and app.yaml that are copied by prepare-devspaces.ps1
src/**/app.yaml
src/**/inf.yaml

2 changes: 1 addition & 1 deletion k8s/helm/apigwmm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: config
mountPath: /app/configuration
mountPath: {{ .Values.ocelot.configPath }}
env:
- name: PATH_BASE
value: {{ include "pathBase" (list .Values.app.ingress.entries.mobilemarketingapigw .) }}
Expand Down
7 changes: 5 additions & 2 deletions k8s/helm/apigwmm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" (list .Values.app.ingress.entries.mobilemarketingapigw .) -}}
{{- $serviceName := .Values.app.svc.mobilemarketingapigw -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
Expand All @@ -23,11 +24,13 @@ spec:
{{- end }}
{{- end }}
rules:
- host: {{ .Values.inf.k8s.dns }}
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ .Values.app.svc.mobilemarketingapigw }}
serviceName: {{ $serviceName }}
servicePort: http
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions k8s/helm/apigwmm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ probes:
initialDelaySeconds: 90
periodSeconds: 60
port: 80
ocelot:
configPath: /app/configuration
2 changes: 1 addition & 1 deletion k8s/helm/apigwms/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: config
mountPath: /app/configuration
mountPath: {{ .Values ocelot.configPath }}
env:
- name: PATH_BASE
value: {{ include "pathBase" (list .Values.app.ingress.entries.mobileshoppingapigw .) }}
Expand Down
4 changes: 3 additions & 1 deletion k8s/helm/apigwms/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ probes:
timeoutSeconds: 5
initialDelaySeconds: 90
periodSeconds: 60
port: 80
port: 80
ocelot:
configPath: /app/configuration
2 changes: 1 addition & 1 deletion k8s/helm/apigwwm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: config
mountPath: /app/configuration
mountPath: {{ .Values ocelot.configPath }}
env:
- name: PATH_BASE
value: {{ include "pathBase" (list .Values.app.ingress.entries.webmarketingapigw .) }}
Expand Down
4 changes: 3 additions & 1 deletion k8s/helm/apigwwm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ probes:
timeoutSeconds: 5
initialDelaySeconds: 90
periodSeconds: 60
port: 80
port: 80
ocelot:
configPath: /app/configuration
27 changes: 18 additions & 9 deletions k8s/helm/deploy-all.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Param(
[parameter(Mandatory=$false)][string]$externalDns,
[parameter(Mandatory=$false)][string]$appName="eshop",
[parameter(Mandatory=$false)][bool]$deployInfrastructure=$true,
[parameter(Mandatory=$false)][bool]$deployCharts=$true,
[parameter(Mandatory=$false)][bool]$clean=$true,
[parameter(Mandatory=$false)][string]$aksName="",
[parameter(Mandatory=$false)][string]$aksRg="",
Expand Down Expand Up @@ -66,21 +67,29 @@ $charts = ("eshop-common", "apigwmm", "apigwms", "apigwwm", "apigwws", "basket-a
if ($deployInfrastructure) {
foreach ($infra in $infras) {
Write-Host "Installing infrastructure: $infra" -ForegroundColor Green
helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --name="$appName-$infra" $infra
helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set ingress.hosts={$dns} --name="$appName-$infra" $infra
}
}
else {
Write-Host "eShopOnContainers infrastructure (bbdd, redis, ...) charts aren't installed (-deployCharts is false)" -ForegroundColor Yellow
}

foreach ($chart in $charts) {
Write-Host "Installing: $chart" -ForegroundColor Green
if ($useCustomRegistry) {
helm install --set inf.registry.server=$registry --set inf.registry.login=$dockerUser --set inf.registry.pwd=$dockerPassword --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart
}
else {
if ($chart -ne "eshop-common") { # eshop-common is ignored when no secret must be deployed
helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart
if ($deployCharts) {
foreach ($chart in $charts) {
Write-Host "Installing: $chart" -ForegroundColor Green
if ($useCustomRegistry) {
helm install --set inf.registry.server=$registry --set inf.registry.login=$dockerUser --set inf.registry.pwd=$dockerPassword --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set ingress.hosts={$dns} --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart
}
else {
if ($chart -ne "eshop-common") { # eshop-common is ignored when no secret must be deployed
helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set ingress.hosts={$dns} --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart
}
}
}
}
else {
Write-Host "eShopOnContainers non-infrastructure charts aren't installed (-deployCharts is false)" -ForegroundColor Yellow
}

Write-Host "helm charts installed." -ForegroundColor Green

Expand Down
7 changes: 5 additions & 2 deletions k8s/helm/webmvc/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.mvc -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
Expand All @@ -23,11 +24,13 @@ spec:
{{- end }}
{{- end }}
rules:
- host: {{ .Values.inf.k8s.dns }}
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ .Values.app.svc.mvc }}
serviceName: {{ $serviceName }}
servicePort: http
{{- end }}
{{- end }}

0 comments on commit 631696c

Please sign in to comment.