@ -0,0 +1,8 @@ | |||||
# Kubernetes deployment | |||||
This folder contains the files required to deploy eShopOnContainers to a Kubernetes cluster. | |||||
For more information see the following articles in the [wiki](https://github.com/dotnet-architecture/eShopOnContainers/wiki): | |||||
- [Deploy to Local Kubernetes](https://github.com/dotnet-architecture/eShopOnContainers/wiki/Deploy-to-Local-Kubernetes) | |||||
- [Deploy to Azure Kubernetes Service (AKS)](https://github.com/dotnet-architecture/eShopOnContainers/wiki/Deploy-to-Azure-Kubernetes-Service-(AKS)) |
@ -0,0 +1,50 @@ | |||||
Param( | |||||
[parameter(Mandatory=$true)][string]$resourceGroupName, | |||||
[parameter(Mandatory=$true)][string]$location, | |||||
[parameter(Mandatory=$true)][string]$serviceName, | |||||
[parameter(Mandatory=$true)][string]$dnsNamePrefix, | |||||
[parameter(Mandatory=$false)][string]$registryName, | |||||
[parameter(Mandatory=$true)][bool]$createAcr=$true, | |||||
[parameter(Mandatory=$false)][int]$nodeCount=3, | |||||
[parameter(Mandatory=$false)][string]$nodeVMSize="Standard_D2_v2", | |||||
[parameter(Mandatory=$false)][bool]$enableHttpApplicationAddon=$true, | |||||
[parameter(Mandatory=$false)][bool]$enableAzureMonitoring=$false, | |||||
[parameter(Mandatory=$false)][ValidateSet("VirtualMachineScaleSets","AvailabilitySet",IgnoreCase=$true)]$vmSetType="VirtualMachineScaleSets" | |||||
) | |||||
# Create resource group | |||||
Write-Host "Creating Azure Resource Group..." -ForegroundColor Yellow | |||||
az group create --name=$resourceGroupName --location=$location | |||||
if ($createAcr -eq $true) { | |||||
# Create Azure Container Registry | |||||
if ([string]::IsNullOrEmpty($registryName)) { | |||||
$registryName=$serviceName | |||||
} | |||||
Write-Host "Creating Azure Container Registry named $registryName" -ForegroundColor Yellow | |||||
az acr create -n $registryName -g $resourceGroupName -l $location --admin-enabled true --sku Basic | |||||
} | |||||
# Create kubernetes cluster in AKS | |||||
Write-Host "Creating AKS $resourceGroupName/$serviceName" -ForegroundColor Yellow | |||||
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 | |||||
if ($enableHttpApplicationAddon) { | |||||
Write-Host "Enabling Http Applciation Routing in AKS $serviceName" -ForegroundColor Yellow | |||||
az aks enable-addons --resource-group $resourceGroupName --name $serviceName --addons http_application_routing | |||||
} | |||||
if ($enableAzureMonitoring) { | |||||
Write-Host "Enabling Azure Monitoring in AKS $serviceName" -ForegroundColor Yellow | |||||
az aks enable-addons --resource-group $resourceGroupName --name $serviceName --addons monitoring | |||||
} | |||||
# Retrieve kubernetes cluster configuration and save it under ~/.kube/config | |||||
Write-Host "Getting Kubernetes config..." -ForegroundColor Yellow | |||||
az aks get-credentials --resource-group=$resourceGroupName --name=$serviceName | |||||
if ($createAcr -eq $true) { | |||||
# Show ACR credentials | |||||
Write-Host "ACR $registryName credentials:" -ForegroundColor Yellow | |||||
az acr credential show -n $registryName | |||||
} |
@ -0,0 +1,18 @@ | |||||
apiVersion: v1 | |||||
kind: ServiceAccount | |||||
metadata: | |||||
name: admin-user | |||||
namespace: kubernetes-dashboard | |||||
--- | |||||
apiVersion: rbac.authorization.k8s.io/v1 | |||||
kind: ClusterRoleBinding | |||||
metadata: | |||||
name: admin-user | |||||
roleRef: | |||||
apiGroup: rbac.authorization.k8s.io | |||||
kind: ClusterRole | |||||
name: cluster-admin | |||||
subjects: | |||||
- kind: ServiceAccount | |||||
name: admin-user | |||||
namespace: kubernetes-dashboard |
@ -0,0 +1,20 @@ | |||||
Param ( | |||||
[parameter(Mandatory=$false)][string]$aksName="", | |||||
[parameter(Mandatory=$false)][string]$aksRg="" | |||||
) | |||||
if ($aksName -and $aksRg) { | |||||
$aks=$(az aks show -n $aksName -g $aksRg -o json | ConvertFrom-Json) | |||||
if (-not $aks) { | |||||
Write-Host "AKS $aksName not found in RG $aksRg" -ForegroundColor Red | |||||
exit 1 | |||||
} | |||||
Write-Host "Switching kubectl context to $aksRg/$aksName" -ForegroundColor Yellow | |||||
az aks get-credentials -g $aksRg -n $aksName | |||||
} | |||||
Write-Host "Installing cert-manager on current cluster" | |||||
kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v0.11.0/cert-manager.yaml --validate=false |
@ -0,0 +1,18 @@ | |||||
apiVersion: v1 | |||||
kind: ServiceAccount | |||||
metadata: | |||||
name: tiller | |||||
namespace: kube-system | |||||
--- | |||||
apiVersion: rbac.authorization.k8s.io/v1 | |||||
kind: ClusterRoleBinding | |||||
metadata: | |||||
name: tiller | |||||
roleRef: | |||||
apiGroup: rbac.authorization.k8s.io | |||||
kind: ClusterRole | |||||
name: cluster-admin | |||||
subjects: | |||||
- kind: ServiceAccount | |||||
name: tiller | |||||
namespace: kube-system |
@ -0,0 +1,12 @@ | |||||
apiVersion: v1 | |||||
kind: ConfigMap | |||||
metadata: | |||||
labels: | |||||
# addonmanager.kubernetes.io/mode: Reconcile | |||||
app: addon-http-application-routing-ingress-nginx | |||||
kubernetes.io/cluster-service: "true" | |||||
name: addon-http-application-routing-nginx-configuration | |||||
namespace: kube-system | |||||
data: | |||||
proxy-buffer-size: "128k" | |||||
proxy-buffers: "4 256k" |
@ -0,0 +1,21 @@ | |||||
# Patterns to ignore when building packages. | |||||
# This supports shell glob matching, relative path matching, and | |||||
# negation (prefixed with !). Only one pattern per line. | |||||
.DS_Store | |||||
# Common VCS dirs | |||||
.git/ | |||||
.gitignore | |||||
.bzr/ | |||||
.bzrignore | |||||
.hg/ | |||||
.hgignore | |||||
.svn/ | |||||
# Common backup files | |||||
*.swp | |||||
*.bak | |||||
*.tmp | |||||
*~ | |||||
# Various IDEs | |||||
.project | |||||
.idea/ | |||||
*.tmproj |
@ -0,0 +1,5 @@ | |||||
apiVersion: v1 | |||||
appVersion: "1.0" | |||||
description: A Helm chart for Kubernetes | |||||
name: apigwmm | |||||
version: 0.1.0 |
@ -0,0 +1,75 @@ | |||||
admin: | |||||
access_log_path: "/dev/null" | |||||
address: | |||||
socket_address: | |||||
address: 0.0.0.0 | |||||
port_value: 8001 | |||||
static_resources: | |||||
listeners: | |||||
- address: | |||||
socket_address: | |||||
address: 0.0.0.0 | |||||
port_value: 80 | |||||
filter_chains: | |||||
- filters: | |||||
- name: envoy.http_connection_manager | |||||
config: | |||||
codec_type: auto | |||||
stat_prefix: ingress_http | |||||
route_config: | |||||
name: eshop_backend_route | |||||
virtual_hosts: | |||||
- name: eshop_backend | |||||
domains: | |||||
- "*" | |||||
routes: | |||||
- name: "m-short" | |||||
match: | |||||
prefix: "/m/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
prefix_rewrite: "/marketing-api/" | |||||
cluster: marketing | |||||
- name: "m-long" | |||||
match: | |||||
prefix: "/marketing-api/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
cluster: marketing | |||||
http_filters: | |||||
- name: envoy.router | |||||
access_log: | |||||
- name: envoy.file_access_log | |||||
filter: | |||||
not_health_check_filter: {} | |||||
config: | |||||
json_format: | |||||
time: "%START_TIME%" | |||||
protocol: "%PROTOCOL%" | |||||
duration: "%DURATION%" | |||||
request_method: "%REQ(:METHOD)%" | |||||
request_host: "%REQ(HOST)%" | |||||
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" | |||||
response_flags: "%RESPONSE_FLAGS%" | |||||
route_name: "%ROUTE_NAME%" | |||||
upstream_host: "%UPSTREAM_HOST%" | |||||
upstream_cluster: "%UPSTREAM_CLUSTER%" | |||||
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%" | |||||
path: "/tmp/access.log" | |||||
clusters: | |||||
- name: marketing | |||||
connect_timeout: 0.25s | |||||
type: logical_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: marketing-api | |||||
port_value: 80 | |||||
- name: locations | |||||
connect_timeout: 0.25s | |||||
type: logical_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: locations-api | |||||
port_value: 80 |
@ -0,0 +1,2 @@ | |||||
eShop API Gateway for Mobile Marketing services installed | |||||
---------------------------------------------------------- |
@ -0,0 +1,32 @@ | |||||
{{/* vim: set filetype=mustache: */}} | |||||
{{/* | |||||
Expand the name of the chart. | |||||
*/}} | |||||
{{- define "apigwmm.name" -}} | |||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create a default fully qualified app name. | |||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | |||||
If release name contains chart name it will be used as a full name. | |||||
*/}} | |||||
{{- define "apigwmm.fullname" -}} | |||||
{{- if .Values.fullnameOverride -}} | |||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- $name := default .Chart.Name .Values.nameOverride -}} | |||||
{{- if contains $name .Release.Name -}} | |||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create chart name and version as used by the chart label. | |||||
*/}} | |||||
{{- define "apigwmm.chart" -}} | |||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} |
@ -0,0 +1,52 @@ | |||||
{{- define "suffix-name" -}} | |||||
{{- if .Values.app.name -}} | |||||
{{- .Values.app.name -}} | |||||
{{- else -}} | |||||
{{- .Release.Name -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "sql-name" -}} | |||||
{{- if .Values.inf.sql.host -}} | |||||
{{- .Values.inf.sql.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "sql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "mongo-name" -}} | |||||
{{- if .Values.inf.mongo.host -}} | |||||
{{- .Values.inf.mongo.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "nosql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "url-of" -}} | |||||
{{- $name := first .}} | |||||
{{- $ctx := last .}} | |||||
{{- if eq $name "" -}} | |||||
{{- $ctx.Values.inf.k8s.dns -}} | |||||
{{- else -}} | |||||
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just <dns>/<name> */}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "pathBase" -}} | |||||
{{- if .Values.inf.k8s.suffix -}} | |||||
{{- $suffix := include "suffix-name" . -}} | |||||
{{- printf "%s-%s" .Values.pathBase $suffix -}} | |||||
{{- else -}} | |||||
{{- .Values.pathBase -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "fqdn-image" -}} | |||||
{{- if .Values.inf.registry -}} | |||||
{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} | |||||
{{- else -}} | |||||
{{- .Values.image.repository -}} | |||||
{{- end -}} | |||||
{{- end -}} |
@ -0,0 +1,110 @@ | |||||
{{- $name := include "apigwmm.fullname" . -}} | |||||
{{- $cfgname := printf "%s-%s" "cfg" $name -}} | |||||
{{- $envoycfgname := printf "%s-%s" "envoy" $name -}} | |||||
apiVersion: apps/v1beta2 | |||||
kind: Deployment | |||||
metadata: | |||||
name: {{ template "apigwmm.fullname" . }} | |||||
labels: | |||||
ufo: {{ $cfgname}} | |||||
app: {{ template "apigwmm.name" . }} | |||||
chart: {{ template "apigwmm.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
replicas: {{ .Values.replicaCount }} | |||||
selector: | |||||
matchLabels: | |||||
app: {{ template "apigwmm.name" . }} | |||||
release: {{ .Release.Name }} | |||||
template: | |||||
metadata: | |||||
labels: | |||||
app: {{ template "apigwmm.name" . }} | |||||
release: {{ .Release.Name }} | |||||
{{ if .Values.inf.mesh.enabled -}} | |||||
annotations: | |||||
linkerd.io/inject: enabled | |||||
{{- end }} | |||||
spec: | |||||
{{ if .Values.inf.registry -}} | |||||
imagePullSecrets: | |||||
- name: {{ .Values.inf.registry.secretName }} | |||||
{{- end }} | |||||
volumes: | |||||
- name: config | |||||
configMap: | |||||
name: {{ $envoycfgname }} | |||||
items: | |||||
- key: envoy.yaml | |||||
path: envoy.yaml | |||||
containers: | |||||
- name: {{ .Chart.Name }} | |||||
{{ if .Values.probes -}} | |||||
{{- if .Values.probes.liveness -}} | |||||
livenessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.liveness.port }} | |||||
path: {{ .Values.probes.liveness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.liveness.periodSeconds }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.probes -}} | |||||
{{- if .Values.probes.readiness }} | |||||
readinessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.readiness.port }} | |||||
path: {{ .Values.probes.readiness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.readiness.periodSeconds }} | |||||
timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" | |||||
imagePullPolicy: IfNotPresent | |||||
volumeMounts: | |||||
- name: config | |||||
mountPath: {{ .Values.envoy.configPath }} | |||||
env: | |||||
- name: PATH_BASE | |||||
value: {{ include "pathBase" . }} | |||||
- name: k8sname | |||||
value: {{ .Values.clusterName }} | |||||
{{- if .Values.env.values -}} | |||||
{{- range .Values.env.values }} | |||||
- name: {{ .name }} | |||||
value: {{ .value | quote }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.env.configmap -}} | |||||
{{- range .Values.env.configmap }} | |||||
- name: {{ .name }} | |||||
valueFrom: | |||||
configMapKeyRef: | |||||
name: {{ $cfgname }} | |||||
key: {{ .key }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
ports: | |||||
- name: http | |||||
containerPort: 80 | |||||
protocol: TCP | |||||
- name: admin | |||||
containerPort: 8001 | |||||
protocol: TCP | |||||
resources: | |||||
{{ toYaml .Values.resources | indent 12 }} | |||||
{{- with .Values.nodeSelector }} | |||||
nodeSelector: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.affinity }} | |||||
affinity: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.tolerations }} | |||||
tolerations: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
@ -0,0 +1,14 @@ | |||||
{{- $name := include "apigwmm.fullname" . -}} | |||||
apiVersion: v1 | |||||
kind: ConfigMap | |||||
metadata: | |||||
name: "envoy-{{ $name }}" | |||||
labels: | |||||
app: {{ template "apigwmm.name" . }} | |||||
chart: {{ template "apigwmm.chart" .}} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
data: | |||||
{{ (.Files.Glob "envoy.yaml").AsConfig | indent 2 }} | |||||
@ -0,0 +1,46 @@ | |||||
{{- if .Values.ingress.enabled -}} | |||||
{{- $ingressPath := include "pathBase" . -}} | |||||
{{- $serviceName := .Values.app.svc.mobilemarketingapigw -}} | |||||
apiVersion: extensions/v1beta1 | |||||
kind: Ingress | |||||
metadata: | |||||
name: {{ template "apigwmm.fullname" . }} | |||||
labels: | |||||
app: {{ template "apigwmm.name" . }} | |||||
chart: {{ template "apigwmm.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
{{- with .Values.ingress.annotations }} | |||||
annotations: | |||||
{{ toYaml . | indent 4 }} | |||||
{{- end }} | |||||
{{- if and .Values.inf.tls.enabled .Values.inf.tls.issuer }} | |||||
cert-manager.io/issuer: {{ .Values.inf.tls.issuer }} | |||||
{{- end }} | |||||
{{- if .Values.inf.mesh.enabled }} | |||||
{{- with .Values.ingress.mesh.annotations }} | |||||
{{ toYaml . | indent 4 }} | |||||
{{- end }} | |||||
{{- end }} | |||||
spec: | |||||
{{- if .Values.ingress.tls }} | |||||
tls: | |||||
{{- range .Values.ingress.tls }} | |||||
- hosts: | |||||
{{- range .hosts }} | |||||
- {{ . }} | |||||
{{- end }} | |||||
secretName: {{ .secretName }} | |||||
{{- end }} | |||||
{{- end }} | |||||
rules: | |||||
{{- range .Values.ingress.hosts }} | |||||
- host: {{ . }} | |||||
http: | |||||
paths: | |||||
- path: {{ $ingressPath }} | |||||
backend: | |||||
serviceName: {{ $serviceName }} | |||||
servicePort: http | |||||
{{- end }} | |||||
{{- end }} |
@ -0,0 +1,23 @@ | |||||
apiVersion: v1 | |||||
kind: Service | |||||
metadata: | |||||
name: {{ .Values.app.svc.mobilemarketingapigw }} | |||||
labels: | |||||
app: {{ template "apigwmm.name" . }} | |||||
chart: {{ template "apigwmm.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
type: {{ .Values.service.type }} | |||||
ports: | |||||
- port: {{ .Values.service.port }} | |||||
targetPort: http | |||||
protocol: TCP | |||||
name: http | |||||
- port: {{ .Values.service.adminPort }} | |||||
targetPort: admin | |||||
protocol: TCP | |||||
name: admin | |||||
selector: | |||||
app: {{ template "apigwmm.name" . }} | |||||
release: {{ .Release.Name }} |
@ -0,0 +1,45 @@ | |||||
replicaCount: 1 | |||||
clusterName: eshop-aks | |||||
pathBase: /mobilemarketingapigw | |||||
image: | |||||
repository: envoyproxy/envoy | |||||
tag: v1.11.1 | |||||
service: | |||||
type: ClusterIP | |||||
port: 80 | |||||
adminPort: 8001 | |||||
ingress: | |||||
enabled: true | |||||
annotations: | |||||
nginx.ingress.kubernetes.io/rewrite-target: "/" | |||||
ingress.kubernetes.io/rewrite-target: "/" | |||||
tls: [] | |||||
resources: {} | |||||
nodeSelector: {} | |||||
tolerations: [] | |||||
affinity: {} | |||||
env: {} | |||||
envoy: | |||||
configPath: /etc/envoy | |||||
probes: | |||||
liveness: | |||||
path: /ready | |||||
initialDelaySeconds: 5 | |||||
periodSeconds: 15 | |||||
port: 8001 | |||||
readiness: | |||||
path: /ready | |||||
initialDelaySeconds: 5 | |||||
periodSeconds: 60 | |||||
port: 8001 |
@ -0,0 +1,21 @@ | |||||
# Patterns to ignore when building packages. | |||||
# This supports shell glob matching, relative path matching, and | |||||
# negation (prefixed with !). Only one pattern per line. | |||||
.DS_Store | |||||
# Common VCS dirs | |||||
.git/ | |||||
.gitignore | |||||
.bzr/ | |||||
.bzrignore | |||||
.hg/ | |||||
.hgignore | |||||
.svn/ | |||||
# Common backup files | |||||
*.swp | |||||
*.bak | |||||
*.tmp | |||||
*~ | |||||
# Various IDEs | |||||
.project | |||||
.idea/ | |||||
*.tmproj |
@ -0,0 +1,5 @@ | |||||
apiVersion: v1 | |||||
appVersion: "1.0" | |||||
description: A Helm chart for Kubernetes | |||||
name: apigwms | |||||
version: 0.1.0 |
@ -0,0 +1,139 @@ | |||||
admin: | |||||
access_log_path: "/dev/null" | |||||
address: | |||||
socket_address: | |||||
address: 0.0.0.0 | |||||
port_value: 8001 | |||||
static_resources: | |||||
listeners: | |||||
- address: | |||||
socket_address: | |||||
address: 0.0.0.0 | |||||
port_value: 80 | |||||
filter_chains: | |||||
- filters: | |||||
- name: envoy.http_connection_manager | |||||
config: | |||||
codec_type: auto | |||||
stat_prefix: ingress_http | |||||
route_config: | |||||
name: eshop_backend_route | |||||
virtual_hosts: | |||||
- name: eshop_backend | |||||
domains: | |||||
- "*" | |||||
routes: | |||||
- name: "c-short" | |||||
match: | |||||
prefix: "/c/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
prefix_rewrite: "/catalog-api/" | |||||
cluster: catalog | |||||
- name: "c-long" | |||||
match: | |||||
prefix: "/catalog-api/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
cluster: catalog | |||||
- name: "o-short" | |||||
match: | |||||
prefix: "/o/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
prefix_rewrite: "/ordering-api/" | |||||
cluster: ordering | |||||
- name: "o-long" | |||||
match: | |||||
prefix: "/ordering-api/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
cluster: ordering | |||||
- name: "h-long" | |||||
match: | |||||
prefix: "/hub/notificationhub" | |||||
route: | |||||
auto_host_rewrite: true | |||||
cluster: signalr-hub | |||||
timeout: 300s | |||||
- name: "b-short" | |||||
match: | |||||
prefix: "/b/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
prefix_rewrite: "/basket-api/" | |||||
cluster: basket | |||||
- name: "b-long" | |||||
match: | |||||
prefix: "/basket-api/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
cluster: basket | |||||
- name: "agg" | |||||
match: | |||||
prefix: "/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
prefix_rewrite: "/" | |||||
cluster: shoppingagg | |||||
http_filters: | |||||
- name: envoy.router | |||||
access_log: | |||||
- name: envoy.file_access_log | |||||
filter: | |||||
not_health_check_filter: {} | |||||
config: | |||||
json_format: | |||||
time: "%START_TIME%" | |||||
protocol: "%PROTOCOL%" | |||||
duration: "%DURATION%" | |||||
request_method: "%REQ(:METHOD)%" | |||||
request_host: "%REQ(HOST)%" | |||||
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" | |||||
response_flags: "%RESPONSE_FLAGS%" | |||||
route_name: "%ROUTE_NAME%" | |||||
upstream_host: "%UPSTREAM_HOST%" | |||||
upstream_cluster: "%UPSTREAM_CLUSTER%" | |||||
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%" | |||||
path: "/tmp/access.log" | |||||
clusters: | |||||
- name: shoppingagg | |||||
connect_timeout: 0.25s | |||||
type: strict_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: webshoppingagg | |||||
port_value: 80 | |||||
- name: catalog | |||||
connect_timeout: 0.25s | |||||
type: strict_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: catalog-api | |||||
port_value: 80 | |||||
- name: basket | |||||
connect_timeout: 0.25s | |||||
type: strict_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: basket-api | |||||
port_value: 80 | |||||
- name: ordering | |||||
connect_timeout: 0.25s | |||||
type: strict_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: ordering-api | |||||
port_value: 80 | |||||
- name: signalr-hub | |||||
connect_timeout: 0.25s | |||||
type: strict_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: ordering-signalrhub | |||||
port_value: 80 |
@ -0,0 +1,2 @@ | |||||
eShop API Gateway for Mobile Shopping services installed | |||||
-------------------------------------------------------- |
@ -0,0 +1,32 @@ | |||||
{{/* vim: set filetype=mustache: */}} | |||||
{{/* | |||||
Expand the name of the chart. | |||||
*/}} | |||||
{{- define "apigwms.name" -}} | |||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create a default fully qualified app name. | |||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | |||||
If release name contains chart name it will be used as a full name. | |||||
*/}} | |||||
{{- define "apigwms.fullname" -}} | |||||
{{- if .Values.fullnameOverride -}} | |||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- $name := default .Chart.Name .Values.nameOverride -}} | |||||
{{- if contains $name .Release.Name -}} | |||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create chart name and version as used by the chart label. | |||||
*/}} | |||||
{{- define "apigwms.chart" -}} | |||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} |
@ -0,0 +1,52 @@ | |||||
{{- define "suffix-name" -}} | |||||
{{- if .Values.app.name -}} | |||||
{{- .Values.app.name -}} | |||||
{{- else -}} | |||||
{{- .Release.Name -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "sql-name" -}} | |||||
{{- if .Values.inf.sql.host -}} | |||||
{{- .Values.inf.sql.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "sql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "mongo-name" -}} | |||||
{{- if .Values.inf.mongo.host -}} | |||||
{{- .Values.inf.mongo.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "nosql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "url-of" -}} | |||||
{{- $name := first .}} | |||||
{{- $ctx := last .}} | |||||
{{- if eq $name "" -}} | |||||
{{- $ctx.Values.inf.k8s.dns -}} | |||||
{{- else -}} | |||||
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just <dns>/<name> */}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "pathBase" -}} | |||||
{{- if .Values.inf.k8s.suffix -}} | |||||
{{- $suffix := include "suffix-name" . -}} | |||||
{{- printf "%s-%s" .Values.pathBase $suffix -}} | |||||
{{- else -}} | |||||
{{- .Values.pathBase -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "fqdn-image" -}} | |||||
{{- if .Values.inf.registry -}} | |||||
{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} | |||||
{{- else -}} | |||||
{{- .Values.image.repository -}} | |||||
{{- end -}} | |||||
{{- end -}} |
@ -0,0 +1,110 @@ | |||||
{{- $name := include "apigwms.fullname" . -}} | |||||
{{- $cfgname := printf "%s-%s" "cfg" $name -}} | |||||
{{- $envoycfgname := printf "%s-%s" "envoy" $name -}} | |||||
apiVersion: apps/v1beta2 | |||||
kind: Deployment | |||||
metadata: | |||||
name: {{ template "apigwms.fullname" . }} | |||||
labels: | |||||
ufo: {{ $cfgname}} | |||||
app: {{ template "apigwms.name" . }} | |||||
chart: {{ template "apigwms.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
replicas: {{ .Values.replicaCount }} | |||||
selector: | |||||
matchLabels: | |||||
app: {{ template "apigwms.name" . }} | |||||
release: {{ .Release.Name }} | |||||
template: | |||||
metadata: | |||||
labels: | |||||
app: {{ template "apigwms.name" . }} | |||||
release: {{ .Release.Name }} | |||||
{{ if .Values.inf.mesh.enabled -}} | |||||
annotations: | |||||
linkerd.io/inject: enabled | |||||
{{- end }} | |||||
spec: | |||||
{{ if .Values.inf.registry -}} | |||||
imagePullSecrets: | |||||
- name: {{ .Values.inf.registry.secretName }} | |||||
{{- end }} | |||||
volumes: | |||||
- name: config | |||||
configMap: | |||||
name: {{ $envoycfgname }} | |||||
items: | |||||
- key: envoy.yaml | |||||
path: envoy.yaml | |||||
containers: | |||||
- name: {{ .Chart.Name }} | |||||
{{ if .Values.probes -}} | |||||
{{- if .Values.probes.liveness -}} | |||||
livenessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.liveness.port }} | |||||
path: {{ .Values.probes.liveness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.liveness.periodSeconds }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.probes -}} | |||||
{{- if .Values.probes.readiness }} | |||||
readinessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.readiness.port }} | |||||
path: {{ .Values.probes.readiness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.readiness.periodSeconds }} | |||||
timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" | |||||
imagePullPolicy: IfNotPresent | |||||
volumeMounts: | |||||
- name: config | |||||
mountPath: {{ .Values.envoy.configPath }} | |||||
env: | |||||
- name: PATH_BASE | |||||
value: {{ include "pathBase" . }} | |||||
- name: k8sname | |||||
value: {{ .Values.clusterName }} | |||||
{{- if .Values.env.values -}} | |||||
{{- range .Values.env.values }} | |||||
- name: {{ .name }} | |||||
value: {{ .value | quote }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.env.configmap -}} | |||||
{{- range .Values.env.configmap }} | |||||
- name: {{ .name }} | |||||
valueFrom: | |||||
configMapKeyRef: | |||||
name: {{ $cfgname }} | |||||
key: {{ .key }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
ports: | |||||
- name: http | |||||
containerPort: 80 | |||||
protocol: TCP | |||||
- name: admin | |||||
containerPort: 8001 | |||||
protocol: TCP | |||||
resources: | |||||
{{ toYaml .Values.resources | indent 12 }} | |||||
{{- with .Values.nodeSelector }} | |||||
nodeSelector: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.affinity }} | |||||
affinity: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.tolerations }} | |||||
tolerations: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
@ -0,0 +1,14 @@ | |||||
{{- $name := include "apigwms.fullname" . -}} | |||||
apiVersion: v1 | |||||
kind: ConfigMap | |||||
metadata: | |||||
name: "envoy-{{ $name }}" | |||||
labels: | |||||
app: {{ template "apigwms.name" . }} | |||||
chart: {{ template "apigwms.chart" .}} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
data: | |||||
{{ (.Files.Glob "envoy.yaml").AsConfig | indent 2 }} | |||||
@ -0,0 +1,47 @@ | |||||
{{- if .Values.ingress.enabled -}} | |||||
{{- $ingressPath := include "pathBase" . -}} | |||||
{{- $serviceName := .Values.app.svc.mobileshoppingapigw -}} | |||||
apiVersion: extensions/v1beta1 | |||||
kind: Ingress | |||||
metadata: | |||||
name: {{ template "apigwms.fullname" . }} | |||||
labels: | |||||
app: {{ template "apigwms.name" . }} | |||||
chart: {{ template "apigwms.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
{{- with .Values.ingress.annotations }} | |||||
annotations: | |||||
{{ toYaml . | indent 4 }} | |||||
{{- end }} | |||||
{{- if and .Values.inf.tls.enabled .Values.inf.tls.issuer }} | |||||
cert-manager.io/issuer: {{ .Values.inf.tls.issuer }} | |||||
{{- end }} | |||||
{{- if .Values.inf.mesh.enabled }} | |||||
{{- with .Values.ingress.mesh.annotations }} | |||||
{{ toYaml . | indent 4 }} | |||||
{{- end }} | |||||
{{- end }} | |||||
spec: | |||||
{{- if .Values.ingress.tls }} | |||||
tls: | |||||
{{- range .Values.ingress.tls }} | |||||
- hosts: | |||||
{{- range .hosts }} | |||||
- {{ . }} | |||||
{{- end }} | |||||
secretName: {{ .secretName }} | |||||
{{- end }} | |||||
{{- end }} | |||||
rules: | |||||
{{- range .Values.ingress.hosts }} | |||||
- host: {{ . }} | |||||
http: | |||||
paths: | |||||
- path: {{ $ingressPath }} | |||||
backend: | |||||
serviceName: {{ $serviceName }} | |||||
servicePort: http | |||||
{{- end }} | |||||
{{- end }} |
@ -0,0 +1,23 @@ | |||||
apiVersion: v1 | |||||
kind: Service | |||||
metadata: | |||||
name: {{ .Values.app.svc.mobileshoppingapigw }} | |||||
labels: | |||||
app: {{ template "apigwms.name" . }} | |||||
chart: {{ template "apigwms.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
type: {{ .Values.service.type }} | |||||
ports: | |||||
- port: {{ .Values.service.port }} | |||||
targetPort: http | |||||
protocol: TCP | |||||
name: http | |||||
- port: {{ .Values.service.adminPort }} | |||||
targetPort: admin | |||||
protocol: TCP | |||||
name: admin | |||||
selector: | |||||
app: {{ template "apigwms.name" . }} | |||||
release: {{ .Release.Name }} |
@ -0,0 +1,45 @@ | |||||
replicaCount: 1 | |||||
clusterName: eshop-aks | |||||
pathBase: /mobileshoppingapigw | |||||
image: | |||||
repository: envoyproxy/envoy | |||||
tag: v1.11.1 | |||||
service: | |||||
type: ClusterIP | |||||
port: 80 | |||||
adminPort: 8001 | |||||
ingress: | |||||
enabled: true | |||||
annotations: | |||||
nginx.ingress.kubernetes.io/rewrite-target: "/" | |||||
ingress.kubernetes.io/rewrite-target: "/" | |||||
tls: [] | |||||
resources: {} | |||||
nodeSelector: {} | |||||
tolerations: [] | |||||
affinity: {} | |||||
env: {} | |||||
envoy: | |||||
configPath: /etc/envoy | |||||
probes: | |||||
liveness: | |||||
path: /ready | |||||
initialDelaySeconds: 5 | |||||
periodSeconds: 15 | |||||
port: 8001 | |||||
readiness: | |||||
path: /ready | |||||
initialDelaySeconds: 5 | |||||
periodSeconds: 60 | |||||
port: 8001 |
@ -0,0 +1,21 @@ | |||||
# Patterns to ignore when building packages. | |||||
# This supports shell glob matching, relative path matching, and | |||||
# negation (prefixed with !). Only one pattern per line. | |||||
.DS_Store | |||||
# Common VCS dirs | |||||
.git/ | |||||
.gitignore | |||||
.bzr/ | |||||
.bzrignore | |||||
.hg/ | |||||
.hgignore | |||||
.svn/ | |||||
# Common backup files | |||||
*.swp | |||||
*.bak | |||||
*.tmp | |||||
*~ | |||||
# Various IDEs | |||||
.project | |||||
.idea/ | |||||
*.tmproj |
@ -0,0 +1,5 @@ | |||||
apiVersion: v1 | |||||
appVersion: "1.0" | |||||
description: A Helm chart for Kubernetes | |||||
name: apigwwm | |||||
version: 0.1.0 |
@ -0,0 +1,75 @@ | |||||
admin: | |||||
access_log_path: "/dev/null" | |||||
address: | |||||
socket_address: | |||||
address: 0.0.0.0 | |||||
port_value: 8001 | |||||
static_resources: | |||||
listeners: | |||||
- address: | |||||
socket_address: | |||||
address: 0.0.0.0 | |||||
port_value: 80 | |||||
filter_chains: | |||||
- filters: | |||||
- name: envoy.http_connection_manager | |||||
config: | |||||
codec_type: auto | |||||
stat_prefix: ingress_http | |||||
route_config: | |||||
name: eshop_backend_route | |||||
virtual_hosts: | |||||
- name: eshop_backend | |||||
domains: | |||||
- "*" | |||||
routes: | |||||
- name: "m-short" | |||||
match: | |||||
prefix: "/m/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
prefix_rewrite: "/marketing-api/" | |||||
cluster: marketing | |||||
- name: "m-long" | |||||
match: | |||||
prefix: "/marketing-api/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
cluster: marketing | |||||
http_filters: | |||||
- name: envoy.router | |||||
access_log: | |||||
- name: envoy.file_access_log | |||||
filter: | |||||
not_health_check_filter: {} | |||||
config: | |||||
json_format: | |||||
time: "%START_TIME%" | |||||
protocol: "%PROTOCOL%" | |||||
duration: "%DURATION%" | |||||
request_method: "%REQ(:METHOD)%" | |||||
request_host: "%REQ(HOST)%" | |||||
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" | |||||
response_flags: "%RESPONSE_FLAGS%" | |||||
route_name: "%ROUTE_NAME%" | |||||
upstream_host: "%UPSTREAM_HOST%" | |||||
upstream_cluster: "%UPSTREAM_CLUSTER%" | |||||
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%" | |||||
path: "/tmp/access.log" | |||||
clusters: | |||||
- name: marketing | |||||
connect_timeout: 0.25s | |||||
type: strict_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: marketing-api | |||||
port_value: 80 | |||||
- name: locations | |||||
connect_timeout: 0.25s | |||||
type: strict_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: locations-api | |||||
port_value: 80 |
@ -0,0 +1,2 @@ | |||||
eShop API Gateway for Web Marketing services installed | |||||
------------------------------------------------------ |
@ -0,0 +1,32 @@ | |||||
{{/* vim: set filetype=mustache: */}} | |||||
{{/* | |||||
Expand the name of the chart. | |||||
*/}} | |||||
{{- define "apigwwm.name" -}} | |||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create a default fully qualified app name. | |||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | |||||
If release name contains chart name it will be used as a full name. | |||||
*/}} | |||||
{{- define "apigwwm.fullname" -}} | |||||
{{- if .Values.fullnameOverride -}} | |||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- $name := default .Chart.Name .Values.nameOverride -}} | |||||
{{- if contains $name .Release.Name -}} | |||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create chart name and version as used by the chart label. | |||||
*/}} | |||||
{{- define "apigwwm.chart" -}} | |||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} |
@ -0,0 +1,52 @@ | |||||
{{- define "suffix-name" -}} | |||||
{{- if .Values.app.name -}} | |||||
{{- .Values.app.name -}} | |||||
{{- else -}} | |||||
{{- .Release.Name -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "sql-name" -}} | |||||
{{- if .Values.inf.sql.host -}} | |||||
{{- .Values.inf.sql.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "sql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "mongo-name" -}} | |||||
{{- if .Values.inf.mongo.host -}} | |||||
{{- .Values.inf.mongo.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "nosql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "url-of" -}} | |||||
{{- $name := first .}} | |||||
{{- $ctx := last .}} | |||||
{{- if eq $name "" -}} | |||||
{{- $ctx.Values.inf.k8s.dns -}} | |||||
{{- else -}} | |||||
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just <dns>/<name> */}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "pathBase" -}} | |||||
{{- if .Values.inf.k8s.suffix -}} | |||||
{{- $suffix := include "suffix-name" . -}} | |||||
{{- printf "%s-%s" .Values.pathBase $suffix -}} | |||||
{{- else -}} | |||||
{{- .Values.pathBase -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "fqdn-image" -}} | |||||
{{- if .Values.inf.registry -}} | |||||
{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} | |||||
{{- else -}} | |||||
{{- .Values.image.repository -}} | |||||
{{- end -}} | |||||
{{- end -}} |
@ -0,0 +1,110 @@ | |||||
{{- $name := include "apigwwm.fullname" . -}} | |||||
{{- $cfgname := printf "%s-%s" "cfg" $name -}} | |||||
{{- $envoycfgname := printf "%s-%s" "envoy" $name -}} | |||||
apiVersion: apps/v1beta2 | |||||
kind: Deployment | |||||
metadata: | |||||
name: {{ template "apigwwm.fullname" . }} | |||||
labels: | |||||
ufo: {{ $cfgname}} | |||||
app: {{ template "apigwwm.name" . }} | |||||
chart: {{ template "apigwwm.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
replicas: {{ .Values.replicaCount }} | |||||
selector: | |||||
matchLabels: | |||||
app: {{ template "apigwwm.name" . }} | |||||
release: {{ .Release.Name }} | |||||
template: | |||||
metadata: | |||||
labels: | |||||
app: {{ template "apigwwm.name" . }} | |||||
release: {{ .Release.Name }} | |||||
{{ if .Values.inf.mesh.enabled -}} | |||||
annotations: | |||||
linkerd.io/inject: enabled | |||||
{{- end }} | |||||
spec: | |||||
{{ if .Values.inf.registry -}} | |||||
imagePullSecrets: | |||||
- name: {{ .Values.inf.registry.secretName }} | |||||
{{- end }} | |||||
volumes: | |||||
- name: config | |||||
configMap: | |||||
name: {{ $envoycfgname }} | |||||
items: | |||||
- key: envoy.yaml | |||||
path: envoy.yaml | |||||
containers: | |||||
- name: {{ .Chart.Name }} | |||||
{{ if .Values.probes -}} | |||||
{{- if .Values.probes.liveness -}} | |||||
livenessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.liveness.port }} | |||||
path: {{ .Values.probes.liveness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.liveness.periodSeconds }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.probes -}} | |||||
{{- if .Values.probes.readiness }} | |||||
readinessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.readiness.port }} | |||||
path: {{ .Values.probes.readiness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.readiness.periodSeconds }} | |||||
timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" | |||||
imagePullPolicy: IfNotPresent | |||||
volumeMounts: | |||||
- name: config | |||||
mountPath: {{ .Values.envoy.configPath }} | |||||
env: | |||||
- name: PATH_BASE | |||||
value: {{ include "pathBase" . }} | |||||
- name: k8sname | |||||
value: {{ .Values.clusterName }} | |||||
{{- if .Values.env.values -}} | |||||
{{- range .Values.env.values }} | |||||
- name: {{ .name }} | |||||
value: {{ .value | quote }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.env.configmap -}} | |||||
{{- range .Values.env.configmap }} | |||||
- name: {{ .name }} | |||||
valueFrom: | |||||
configMapKeyRef: | |||||
name: {{ $cfgname }} | |||||
key: {{ .key }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
ports: | |||||
- name: http | |||||
containerPort: 80 | |||||
protocol: TCP | |||||
- name: admin | |||||
containerPort: 8001 | |||||
protocol: TCP | |||||
resources: | |||||
{{ toYaml .Values.resources | indent 12 }} | |||||
{{- with .Values.nodeSelector }} | |||||
nodeSelector: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.affinity }} | |||||
affinity: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.tolerations }} | |||||
tolerations: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
@ -0,0 +1,14 @@ | |||||
{{- $name := include "apigwwm.fullname" . -}} | |||||
apiVersion: v1 | |||||
kind: ConfigMap | |||||
metadata: | |||||
name: "envoy-{{ $name }}" | |||||
labels: | |||||
app: {{ template "apigwwm.name" . }} | |||||
chart: {{ template "apigwwm.chart" .}} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
data: | |||||
{{ (.Files.Glob "envoy.yaml").AsConfig | indent 2 -}} | |||||
@ -0,0 +1,47 @@ | |||||
{{- if .Values.ingress.enabled -}} | |||||
{{- $ingressPath := include "pathBase" . -}} | |||||
{{- $serviceName := .Values.app.svc.webmarketingapigw -}} | |||||
apiVersion: extensions/v1beta1 | |||||
kind: Ingress | |||||
metadata: | |||||
name: {{ template "apigwwm.fullname" . }} | |||||
labels: | |||||
app: {{ template "apigwwm.name" . }} | |||||
chart: {{ template "apigwwm.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
{{- with .Values.ingress.annotations }} | |||||
annotations: | |||||
{{ toYaml . | indent 4 }} | |||||
{{- end }} | |||||
{{- if and .Values.inf.tls.enabled .Values.inf.tls.issuer }} | |||||
cert-manager.io/issuer: {{ .Values.inf.tls.issuer }} | |||||
{{- end }} | |||||
{{- if .Values.inf.mesh.enabled }} | |||||
{{- with .Values.ingress.mesh.annotations }} | |||||
{{ toYaml . | indent 4 }} | |||||
{{- end }} | |||||
{{- end }} | |||||
spec: | |||||
{{- if .Values.ingress.tls }} | |||||
tls: | |||||
{{- range .Values.ingress.tls }} | |||||
- hosts: | |||||
{{- range .hosts }} | |||||
- {{ . }} | |||||
{{- end }} | |||||
secretName: {{ .secretName }} | |||||
{{- end }} | |||||
{{- end }} | |||||
rules: | |||||
{{- range .Values.ingress.hosts }} | |||||
- host: {{ . }} | |||||
http: | |||||
paths: | |||||
- path: {{ $ingressPath }} | |||||
backend: | |||||
serviceName: {{ $serviceName }} | |||||
servicePort: http | |||||
{{- end }} | |||||
{{- end }} |
@ -0,0 +1,23 @@ | |||||
apiVersion: v1 | |||||
kind: Service | |||||
metadata: | |||||
name: {{ .Values.app.svc.webmarketingapigw }} | |||||
labels: | |||||
app: {{ template "apigwwm.name" . }} | |||||
chart: {{ template "apigwwm.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
type: {{ .Values.service.type }} | |||||
ports: | |||||
- port: {{ .Values.service.port }} | |||||
targetPort: http | |||||
protocol: TCP | |||||
name: http | |||||
- port: {{ .Values.service.adminPort }} | |||||
targetPort: admin | |||||
protocol: TCP | |||||
name: admin | |||||
selector: | |||||
app: {{ template "apigwwm.name" . }} | |||||
release: {{ .Release.Name }} |
@ -0,0 +1,46 @@ | |||||
replicaCount: 1 | |||||
clusterName: eshop-aks | |||||
pathBase: /webmarketingapigw | |||||
image: | |||||
repository: envoyproxy/envoy | |||||
tag: v1.11.1 | |||||
service: | |||||
type: ClusterIP | |||||
port: 80 | |||||
adminPort: 8001 | |||||
ingress: | |||||
enabled: true | |||||
annotations: | |||||
nginx.ingress.kubernetes.io/rewrite-target: "/" | |||||
ingress.kubernetes.io/rewrite-target: "/" | |||||
tls: [] | |||||
resources: {} | |||||
nodeSelector: {} | |||||
tolerations: [] | |||||
affinity: {} | |||||
# env defines the environment variables that will be declared in the pod | |||||
env: {} | |||||
envoy: | |||||
configPath: /etc/envoy | |||||
probes: | |||||
liveness: | |||||
path: /ready | |||||
initialDelaySeconds: 5 | |||||
periodSeconds: 15 | |||||
port: 8001 | |||||
readiness: | |||||
path: /ready | |||||
initialDelaySeconds: 5 | |||||
periodSeconds: 60 | |||||
port: 8001 |
@ -0,0 +1,21 @@ | |||||
# Patterns to ignore when building packages. | |||||
# This supports shell glob matching, relative path matching, and | |||||
# negation (prefixed with !). Only one pattern per line. | |||||
.DS_Store | |||||
# Common VCS dirs | |||||
.git/ | |||||
.gitignore | |||||
.bzr/ | |||||
.bzrignore | |||||
.hg/ | |||||
.hgignore | |||||
.svn/ | |||||
# Common backup files | |||||
*.swp | |||||
*.bak | |||||
*.tmp | |||||
*~ | |||||
# Various IDEs | |||||
.project | |||||
.idea/ | |||||
*.tmproj |
@ -0,0 +1,5 @@ | |||||
apiVersion: v1 | |||||
appVersion: "1.0" | |||||
description: A Helm chart for Kubernetes | |||||
name: apigwws | |||||
version: 0.1.0 |
@ -0,0 +1,139 @@ | |||||
admin: | |||||
access_log_path: "/dev/null" | |||||
address: | |||||
socket_address: | |||||
address: 0.0.0.0 | |||||
port_value: 8001 | |||||
static_resources: | |||||
listeners: | |||||
- address: | |||||
socket_address: | |||||
address: 0.0.0.0 | |||||
port_value: 80 | |||||
filter_chains: | |||||
- filters: | |||||
- name: envoy.http_connection_manager | |||||
config: | |||||
codec_type: auto | |||||
stat_prefix: ingress_http | |||||
route_config: | |||||
name: eshop_backend_route | |||||
virtual_hosts: | |||||
- name: eshop_backend | |||||
domains: | |||||
- "*" | |||||
routes: | |||||
- name: "c-short" | |||||
match: | |||||
prefix: "/c/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
prefix_rewrite: "/catalog-api/" | |||||
cluster: catalog | |||||
- name: "c-long" | |||||
match: | |||||
prefix: "/catalog-api/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
cluster: catalog | |||||
- name: "o-short" | |||||
match: | |||||
prefix: "/o/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
prefix_rewrite: "/ordering-api/" | |||||
cluster: ordering | |||||
- name: "o-long" | |||||
match: | |||||
prefix: "/ordering-api/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
cluster: ordering | |||||
- name: "h-long" | |||||
match: | |||||
prefix: "/hub/notificationhub" | |||||
route: | |||||
auto_host_rewrite: true | |||||
cluster: signalr-hub | |||||
timeout: 300s | |||||
- name: "b-short" | |||||
match: | |||||
prefix: "/b/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
prefix_rewrite: "/basket-api/" | |||||
cluster: basket | |||||
- name: "b-long" | |||||
match: | |||||
prefix: "/basket-api/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
cluster: basket | |||||
- name: "agg" | |||||
match: | |||||
prefix: "/" | |||||
route: | |||||
auto_host_rewrite: true | |||||
prefix_rewrite: "/" | |||||
cluster: shoppingagg | |||||
http_filters: | |||||
- name: envoy.router | |||||
access_log: | |||||
- name: envoy.file_access_log | |||||
filter: | |||||
not_health_check_filter: {} | |||||
config: | |||||
json_format: | |||||
time: "%START_TIME%" | |||||
protocol: "%PROTOCOL%" | |||||
duration: "%DURATION%" | |||||
request_method: "%REQ(:METHOD)%" | |||||
request_host: "%REQ(HOST)%" | |||||
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" | |||||
response_flags: "%RESPONSE_FLAGS%" | |||||
route_name: "%ROUTE_NAME%" | |||||
upstream_host: "%UPSTREAM_HOST%" | |||||
upstream_cluster: "%UPSTREAM_CLUSTER%" | |||||
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%" | |||||
path: "/tmp/access.log" | |||||
clusters: | |||||
- name: shoppingagg | |||||
connect_timeout: 0.25s | |||||
type: strict_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: webshoppingagg | |||||
port_value: 80 | |||||
- name: catalog | |||||
connect_timeout: 0.25s | |||||
type: strict_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: catalog-api | |||||
port_value: 80 | |||||
- name: basket | |||||
connect_timeout: 0.25s | |||||
type: strict_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: basket-api | |||||
port_value: 80 | |||||
- name: ordering | |||||
connect_timeout: 0.25s | |||||
type: strict_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: ordering-api | |||||
port_value: 80 | |||||
- name: signalr-hub | |||||
connect_timeout: 0.25s | |||||
type: strict_dns | |||||
lb_policy: round_robin | |||||
hosts: | |||||
- socket_address: | |||||
address: ordering-signalrhub | |||||
port_value: 80 |
@ -0,0 +1,2 @@ | |||||
eShop API Gateway for Web Shopping services installed | |||||
----------------------------------------------------- |
@ -0,0 +1,32 @@ | |||||
{{/* vim: set filetype=mustache: */}} | |||||
{{/* | |||||
Expand the name of the chart. | |||||
*/}} | |||||
{{- define "apigwws.name" -}} | |||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create a default fully qualified app name. | |||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | |||||
If release name contains chart name it will be used as a full name. | |||||
*/}} | |||||
{{- define "apigwws.fullname" -}} | |||||
{{- if .Values.fullnameOverride -}} | |||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- $name := default .Chart.Name .Values.nameOverride -}} | |||||
{{- if contains $name .Release.Name -}} | |||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create chart name and version as used by the chart label. | |||||
*/}} | |||||
{{- define "apigwws.chart" -}} | |||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} |
@ -0,0 +1,52 @@ | |||||
{{- define "suffix-name" -}} | |||||
{{- if .Values.app.name -}} | |||||
{{- .Values.app.name -}} | |||||
{{- else -}} | |||||
{{- .Release.Name -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "sql-name" -}} | |||||
{{- if .Values.inf.sql.host -}} | |||||
{{- .Values.inf.sql.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "sql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "mongo-name" -}} | |||||
{{- if .Values.inf.mongo.host -}} | |||||
{{- .Values.inf.mongo.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "nosql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "url-of" -}} | |||||
{{- $name := first .}} | |||||
{{- $ctx := last .}} | |||||
{{- if eq $name "" -}} | |||||
{{- $ctx.Values.inf.k8s.dns -}} | |||||
{{- else -}} | |||||
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just <dns>/<name> */}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "pathBase" -}} | |||||
{{- if .Values.inf.k8s.suffix -}} | |||||
{{- $suffix := include "suffix-name" . -}} | |||||
{{- printf "%s-%s" .Values.pathBase $suffix -}} | |||||
{{- else -}} | |||||
{{- .Values.pathBase -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "fqdn-image" -}} | |||||
{{- if .Values.inf.registry -}} | |||||
{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} | |||||
{{- else -}} | |||||
{{- .Values.image.repository -}} | |||||
{{- end -}} | |||||
{{- end -}} |
@ -0,0 +1,109 @@ | |||||
{{- $name := include "apigwws.fullname" . -}} | |||||
{{- $cfgname := printf "%s-%s" "cfg" $name -}} | |||||
{{- $envoycfgname := printf "%s-%s" "envoy" $name -}} | |||||
apiVersion: apps/v1beta2 | |||||
kind: Deployment | |||||
metadata: | |||||
name: {{ template "apigwws.fullname" . }} | |||||
labels: | |||||
app: {{ template "apigwws.name" . }} | |||||
chart: {{ template "apigwws.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
replicas: {{ .Values.replicaCount }} | |||||
selector: | |||||
matchLabels: | |||||
app: {{ template "apigwws.name" . }} | |||||
release: {{ .Release.Name }} | |||||
template: | |||||
metadata: | |||||
labels: | |||||
app: {{ template "apigwws.name" . }} | |||||
release: {{ .Release.Name }} | |||||
{{ if .Values.inf.mesh.enabled -}} | |||||
annotations: | |||||
linkerd.io/inject: enabled | |||||
{{- end }} | |||||
spec: | |||||
{{ if .Values.inf.registry -}} | |||||
imagePullSecrets: | |||||
- name: {{ .Values.inf.registry.secretName }} | |||||
{{- end }} | |||||
volumes: | |||||
- name: config | |||||
configMap: | |||||
name: {{ $envoycfgname }} | |||||
items: | |||||
- key: envoy.yaml | |||||
path: envoy.yaml | |||||
containers: | |||||
- name: {{ .Chart.Name }} | |||||
{{ if .Values.probes -}} | |||||
{{- if .Values.probes.liveness -}} | |||||
livenessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.liveness.port }} | |||||
path: {{ .Values.probes.liveness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.liveness.periodSeconds }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.probes -}} | |||||
{{- if .Values.probes.readiness }} | |||||
readinessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.readiness.port }} | |||||
path: {{ .Values.probes.readiness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.readiness.periodSeconds }} | |||||
timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" | |||||
imagePullPolicy: {{ .Values.image.pullPolicy }} | |||||
volumeMounts: | |||||
- name: config | |||||
mountPath: {{ .Values.envoy.configPath }} | |||||
env: | |||||
- name: PATH_BASE | |||||
value: {{ include "pathBase" . }} | |||||
- name: k8sname | |||||
value: {{ .Values.clusterName }} | |||||
{{- if .Values.env.values -}} | |||||
{{- range .Values.env.values }} | |||||
- name: {{ .name }} | |||||
value: {{ .value | quote }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.env.configmap -}} | |||||
{{- range .Values.env.configmap }} | |||||
- name: {{ .name }} | |||||
valueFrom: | |||||
configMapKeyRef: | |||||
name: {{ $cfgname }} | |||||
key: {{ .key }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
ports: | |||||
- name: http | |||||
containerPort: 80 | |||||
protocol: TCP | |||||
- name: admin | |||||
containerPort: 8001 | |||||
protocol: TCP | |||||
resources: | |||||
{{ toYaml .Values.resources | indent 12 }} | |||||
{{- with .Values.nodeSelector }} | |||||
nodeSelector: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.affinity }} | |||||
affinity: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.tolerations }} | |||||
tolerations: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
@ -0,0 +1,14 @@ | |||||
{{- $name := include "apigwws.fullname" . -}} | |||||
apiVersion: v1 | |||||
kind: ConfigMap | |||||
metadata: | |||||
name: "envoy-{{ $name }}" | |||||
labels: | |||||
app: {{ template "apigwws.name" . }} | |||||
chart: {{ template "apigwws.chart" .}} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
data: | |||||
{{ (.Files.Glob "envoy.yaml").AsConfig | indent 2 }} | |||||
@ -0,0 +1,46 @@ | |||||
{{- if .Values.ingress.enabled -}} | |||||
{{- $ingressPath := include "pathBase" . -}} | |||||
{{- $serviceName := .Values.app.svc.webshoppingapigw -}} | |||||
apiVersion: extensions/v1beta1 | |||||
kind: Ingress | |||||
metadata: | |||||
name: {{ template "apigwws.fullname" . }} | |||||
labels: | |||||
app: {{ template "apigwws.name" . }} | |||||
chart: {{ template "apigwws.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
{{- with .Values.ingress.annotations }} | |||||
annotations: | |||||
{{ toYaml . | indent 4 }} | |||||
{{- end }} | |||||
{{- if and .Values.inf.tls.enabled .Values.inf.tls.issuer }} | |||||
cert-manager.io/issuer: {{ .Values.inf.tls.issuer }} | |||||
{{- end }} | |||||
{{- if .Values.inf.mesh.enabled }} | |||||
{{- with .Values.ingress.mesh.annotations }} | |||||
{{ toYaml . | indent 4 }} | |||||
{{- end }} | |||||
{{- end }} | |||||
spec: | |||||
{{- if .Values.ingress.tls }} | |||||
tls: | |||||
{{- range .Values.ingress.tls }} | |||||
- hosts: | |||||
{{- range .hosts }} | |||||
- {{ . }} | |||||
{{- end }} | |||||
secretName: {{ .secretName }} | |||||
{{- end }} | |||||
{{- end }} | |||||
rules: | |||||
{{- range .Values.ingress.hosts }} | |||||
- host: {{ . }} | |||||
http: | |||||
paths: | |||||
- path: {{ $ingressPath }} | |||||
backend: | |||||
serviceName: {{ $serviceName }} | |||||
servicePort: http | |||||
{{- end }} | |||||
{{- end }} |
@ -0,0 +1,23 @@ | |||||
apiVersion: v1 | |||||
kind: Service | |||||
metadata: | |||||
name: {{ .Values.app.svc.webshoppingapigw }} | |||||
labels: | |||||
app: {{ template "apigwws.name" . }} | |||||
chart: {{ template "apigwws.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
type: {{ .Values.service.type }} | |||||
ports: | |||||
- port: {{ .Values.service.port }} | |||||
targetPort: http | |||||
protocol: TCP | |||||
name: http | |||||
- port: {{ .Values.service.adminPort }} | |||||
targetPort: admin | |||||
protocol: TCP | |||||
name: admin | |||||
selector: | |||||
app: {{ template "apigwws.name" . }} | |||||
release: {{ .Release.Name }} |
@ -0,0 +1,46 @@ | |||||
replicaCount: 1 | |||||
clusterName: eshop-aks | |||||
pathBase: /webshoppingapigw | |||||
image: | |||||
repository: envoyproxy/envoy | |||||
tag: v1.11.1 | |||||
service: | |||||
type: ClusterIP | |||||
port: 80 | |||||
adminPort: 8001 | |||||
ingress: | |||||
enabled: true | |||||
annotations: | |||||
nginx.ingress.kubernetes.io/rewrite-target: "/" | |||||
ingress.kubernetes.io/rewrite-target: "/" | |||||
tls: [] | |||||
resources: {} | |||||
nodeSelector: {} | |||||
tolerations: [] | |||||
affinity: {} | |||||
# env defines the environment variables that will be declared in the pod | |||||
env: {} | |||||
envoy: | |||||
configPath: /etc/envoy | |||||
probes: | |||||
liveness: | |||||
path: /ready | |||||
initialDelaySeconds: 5 | |||||
periodSeconds: 15 | |||||
port: 8001 | |||||
readiness: | |||||
path: /ready | |||||
initialDelaySeconds: 5 | |||||
periodSeconds: 60 | |||||
port: 8001 |
@ -0,0 +1,46 @@ | |||||
# This helm values file defines app-based settings | |||||
# Charts use those values, so this file **MUST** be included in all chart releases | |||||
app: # app global settings | |||||
name: "my-eshop" # Override for custom app name | |||||
ingress: # ingress related settings | |||||
entries: | |||||
basket: basket-api # ingress entry for basket api | |||||
catalog: catalog-api # ingress entry for catalog api | |||||
ordering: ordering-api # ingress entry for ordering api | |||||
identity: identity # ingress entry for identity api | |||||
mvc: webmvc # ingress entry for web mvc | |||||
spa: "" # ingress entry for web spa | |||||
status: webstatus # ingress entry for web status | |||||
webshoppingapigw: webshoppingapigw # ingress entry for web shopping Agw | |||||
webmarketingapigw: webmarketingapigw # ingress entry for web mkg Agw | |||||
mobilemarketingapigw: mobilemarketingapigw # ingress entry for mobile mkg Agw | |||||
mobileshoppingapigw: mobileshoppingapigw # ingress entry for mobile shopping Agw | |||||
webshoppingagg: webshoppingagg # ingress entry for web shopping aggregator | |||||
mobileshoppingagg: mobileshoppingagg # ingress entry for mobile shopping aggregator | |||||
payment: payment-api # ingress entry for payment api | |||||
locations: locations-api # ingress entry for locations api | |||||
marketing: marketing-api # ingress entry for marketing api | |||||
webhooks: webhooks-api # ingress entry for webhooks api | |||||
webhooksweb: webhooks-web # ingress entry for webhooks web demo client | |||||
svc: | |||||
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 | |||||
orderingsignalrhub: ordering-signalrhub # service name for orderingsignalrhub | |||||
identity: identity-api # service name for identity api | |||||
mvc: webmvc # service name for web mvc | |||||
spa: webspa # service name for web spa | |||||
status: webstatus # service name for web status | |||||
webshoppingapigw: webshoppingapigw # service name for web shopping Agw | |||||
webmarketingapigw: webmarketingapigw # service name for web mkg Agw | |||||
mobilemarketingapigw: mobilemarketingapigw # service name for mobile mkg Agw | |||||
mobileshoppingapigw: mobileshoppingapigw # service name for mobile shopping Agw | |||||
webshoppingagg: webshoppingagg # service name for web shopping aggregator | |||||
mobileshoppingagg: mobileshoppingagg # service name for mobile shopping aggregator | |||||
payment: payment-api # service name for payment api | |||||
locations: locations-api # service name for locations api | |||||
marketing: marketing-api # service name for marketing ap | |||||
webhooks: webhooks-api # service name for webhooks api | |||||
webhooksweb: webhooks-client # service name for webhooks web |
@ -0,0 +1,21 @@ | |||||
# Patterns to ignore when building packages. | |||||
# This supports shell glob matching, relative path matching, and | |||||
# negation (prefixed with !). Only one pattern per line. | |||||
.DS_Store | |||||
# Common VCS dirs | |||||
.git/ | |||||
.gitignore | |||||
.bzr/ | |||||
.bzrignore | |||||
.hg/ | |||||
.hgignore | |||||
.svn/ | |||||
# Common backup files | |||||
*.swp | |||||
*.bak | |||||
*.tmp | |||||
*~ | |||||
# Various IDEs | |||||
.project | |||||
.idea/ | |||||
*.tmproj |
@ -0,0 +1,5 @@ | |||||
apiVersion: v1 | |||||
appVersion: "1.0" | |||||
description: A Helm chart for Kubernetes | |||||
name: basket-api | |||||
version: 0.1.0 |
@ -0,0 +1,8 @@ | |||||
eShop Basket API installed. | |||||
-------------------------- | |||||
This API is not directly exposed outside cluster. If need to access it use: | |||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "basket-api.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | |||||
echo "Visit http://127.0.0.1:8080 to use your application" | |||||
kubectl port-forward $POD_NAME 8080:80 |
@ -0,0 +1,32 @@ | |||||
{{/* vim: set filetype=mustache: */}} | |||||
{{/* | |||||
Expand the name of the chart. | |||||
*/}} | |||||
{{- define "basket-api.name" -}} | |||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create a default fully qualified app name. | |||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | |||||
If release name contains chart name it will be used as a full name. | |||||
*/}} | |||||
{{- define "basket-api.fullname" -}} | |||||
{{- if .Values.fullnameOverride -}} | |||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- $name := default .Chart.Name .Values.nameOverride -}} | |||||
{{- if contains $name .Release.Name -}} | |||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create chart name and version as used by the chart label. | |||||
*/}} | |||||
{{- define "basket-api.chart" -}} | |||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} |
@ -0,0 +1,52 @@ | |||||
{{- define "suffix-name" -}} | |||||
{{- if .Values.app.name -}} | |||||
{{- .Values.app.name -}} | |||||
{{- else -}} | |||||
{{- .Release.Name -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "sql-name" -}} | |||||
{{- if .Values.inf.sql.host -}} | |||||
{{- .Values.inf.sql.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "sql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "mongo-name" -}} | |||||
{{- if .Values.inf.mongo.host -}} | |||||
{{- .Values.inf.mongo.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "nosql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "url-of" -}} | |||||
{{- $name := first .}} | |||||
{{- $ctx := last .}} | |||||
{{- if eq $name "" -}} | |||||
{{- $ctx.Values.inf.k8s.dns -}} | |||||
{{- else -}} | |||||
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just <dns>/<name> */}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "pathBase" -}} | |||||
{{- if .Values.inf.k8s.suffix -}} | |||||
{{- $suffix := include "suffix-name" . -}} | |||||
{{- printf "%s-%s" .Values.pathBase $suffix -}} | |||||
{{- else -}} | |||||
{{- .Values.pathBase -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "fqdn-image" -}} | |||||
{{- if .Values.inf.registry -}} | |||||
{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} | |||||
{{- else -}} | |||||
{{- .Values.image.repository -}} | |||||
{{- end -}} | |||||
{{- end -}} |
@ -0,0 +1,18 @@ | |||||
{{- $name := include "basket-api.fullname" . -}} | |||||
apiVersion: v1 | |||||
kind: ConfigMap | |||||
metadata: | |||||
name: "cfg-{{ $name }}" | |||||
labels: | |||||
app: {{ template "basket-api.name" . }} | |||||
chart: {{ template "basket-api.chart" .}} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
data: | |||||
basket__ConnectionString: {{ .Values.inf.redis.basket.constr }} | |||||
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 }}" | |||||
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" |
@ -0,0 +1,99 @@ | |||||
{{- $name := include "basket-api.fullname" . -}} | |||||
{{- $cfgname := printf "%s-%s" "cfg" $name -}} | |||||
apiVersion: apps/v1beta2 | |||||
kind: Deployment | |||||
metadata: | |||||
name: {{ template "basket-api.fullname" . }} | |||||
labels: | |||||
ufo: {{ $cfgname}} | |||||
app: {{ template "basket-api.name" . }} | |||||
chart: {{ template "basket-api.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
replicas: {{ .Values.replicaCount }} | |||||
selector: | |||||
matchLabels: | |||||
app: {{ template "basket-api.name" . }} | |||||
release: {{ .Release.Name }} | |||||
template: | |||||
metadata: | |||||
labels: | |||||
app: {{ template "basket-api.name" . }} | |||||
release: {{ .Release.Name }} | |||||
{{ if .Values.inf.mesh.enabled -}} | |||||
annotations: | |||||
linkerd.io/inject: enabled | |||||
{{- end }} | |||||
spec: | |||||
{{ if .Values.inf.registry -}} | |||||
imagePullSecrets: | |||||
- name: {{ .Values.inf.registry.secretName }} | |||||
{{- end }} | |||||
containers: | |||||
- name: {{ .Chart.Name }} | |||||
{{ if .Values.probes -}} | |||||
{{- if .Values.probes.liveness -}} | |||||
livenessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.liveness.port }} | |||||
path: {{ .Values.probes.liveness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.liveness.periodSeconds }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.probes -}} | |||||
{{- if .Values.probes.readiness }} | |||||
readinessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.readiness.port }} | |||||
path: {{ .Values.probes.readiness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.readiness.periodSeconds }} | |||||
timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" | |||||
imagePullPolicy: {{ .Values.image.pullPolicy }} | |||||
env: | |||||
- name: PATH_BASE | |||||
value: {{ include "pathBase" . }} | |||||
- name: k8sname | |||||
value: {{ .Values.clusterName }} | |||||
{{- if .Values.env.values -}} | |||||
{{- range .Values.env.values }} | |||||
- name: {{ .name }} | |||||
value: {{ .value | quote }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.env.configmap -}} | |||||
{{- range .Values.env.configmap }} | |||||
- name: {{ .name }} | |||||
valueFrom: | |||||
configMapKeyRef: | |||||
name: {{ $cfgname }} | |||||
key: {{ .key }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
ports: | |||||
- name: http | |||||
containerPort: 80 | |||||
protocol: TCP | |||||
- name: grpc | |||||
containerPort: 81 | |||||
protocol: TCP | |||||
resources: | |||||
{{ toYaml .Values.resources | indent 12 }} | |||||
{{- with .Values.nodeSelector }} | |||||
nodeSelector: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.affinity }} | |||||
affinity: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.tolerations }} | |||||
tolerations: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
@ -0,0 +1,23 @@ | |||||
apiVersion: v1 | |||||
kind: Service | |||||
metadata: | |||||
name: {{ .Values.app.svc.basket }} | |||||
labels: | |||||
app: {{ template "basket-api.name" . }} | |||||
chart: {{ template "basket-api.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
type: {{ .Values.service.type }} | |||||
ports: | |||||
- port: {{ .Values.service.port }} | |||||
targetPort: http | |||||
protocol: TCP | |||||
name: http | |||||
- port: {{ .Values.service.grpcPort }} | |||||
targetPort: grpc | |||||
protocol: TCP | |||||
name: grpc | |||||
selector: | |||||
app: {{ template "basket-api.name" . }} | |||||
release: {{ .Release.Name }} |
@ -0,0 +1,63 @@ | |||||
replicaCount: 1 | |||||
clusterName: eshop-aks | |||||
pathBase: /basket-api | |||||
image: | |||||
repository: eshop/basket.api | |||||
tag: latest | |||||
pullPolicy: IfNotPresent | |||||
service: | |||||
type: ClusterIP | |||||
port: 80 | |||||
grpcPort: 81 | |||||
resources: {} | |||||
nodeSelector: {} | |||||
tolerations: [] | |||||
affinity: {} | |||||
# env defines the environment variables that will be declared in the pod | |||||
env: | |||||
urls: | |||||
# configmap declares variables which value is taken from the config map defined in template configmap.yaml (name is name of var and key the key in configmap). | |||||
configmap: | |||||
- name: ConnectionString | |||||
key: basket__ConnectionString | |||||
- name: EventBusConnection | |||||
key: all__EventBusConnection | |||||
- name: ApplicationInsights__InstrumentationKey | |||||
key: all__InstrumentationKey | |||||
- name: AzureServiceBusEnabled | |||||
key: all__UseAzureServiceBus | |||||
- name: IdentityUrl | |||||
key: urls__IdentityUrl | |||||
- name: UseLoadTest | |||||
key: basket__EnableLoadTest | |||||
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) | |||||
values: | |||||
- name: OrchestratorType | |||||
value: 'K8S' | |||||
- name: PORT | |||||
value: "80" | |||||
- name: GRPC_PORT | |||||
value: "81" | |||||
probes: | |||||
liveness: | |||||
path: /liveness | |||||
initialDelaySeconds: 10 | |||||
periodSeconds: 15 | |||||
port: 80 | |||||
readiness: | |||||
path: /hc | |||||
timeoutSeconds: 5 | |||||
initialDelaySeconds: 90 | |||||
periodSeconds: 60 | |||||
port: 80 | |||||
ingress: | |||||
enabled: false |
@ -0,0 +1,21 @@ | |||||
# Patterns to ignore when building packages. | |||||
# This supports shell glob matching, relative path matching, and | |||||
# negation (prefixed with !). Only one pattern per line. | |||||
.DS_Store | |||||
# Common VCS dirs | |||||
.git/ | |||||
.gitignore | |||||
.bzr/ | |||||
.bzrignore | |||||
.hg/ | |||||
.hgignore | |||||
.svn/ | |||||
# Common backup files | |||||
*.swp | |||||
*.bak | |||||
*.tmp | |||||
*~ | |||||
# Various IDEs | |||||
.project | |||||
.idea/ | |||||
*.tmproj |
@ -0,0 +1,5 @@ | |||||
apiVersion: v1 | |||||
appVersion: "1.0" | |||||
description: A Helm chart for Kubernetes | |||||
name: basket-data | |||||
version: 0.1.0 |
@ -0,0 +1,8 @@ | |||||
eShop Redis for keystore data installed | |||||
---------------------------------------- | |||||
Redis is not directly exposed outside cluster. If need to access it from outside use: | |||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "basket-data.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | |||||
echo "Visit http://127.0.0.1:8080 to use your application" | |||||
kubectl port-forward $POD_NAME 8080:80 |
@ -0,0 +1,32 @@ | |||||
{{/* vim: set filetype=mustache: */}} | |||||
{{/* | |||||
Expand the name of the chart. | |||||
*/}} | |||||
{{- define "basket-data.name" -}} | |||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create a default fully qualified app name. | |||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | |||||
If release name contains chart name it will be used as a full name. | |||||
*/}} | |||||
{{- define "basket-data.fullname" -}} | |||||
{{- if .Values.fullnameOverride -}} | |||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- $name := default .Chart.Name .Values.nameOverride -}} | |||||
{{- if contains $name .Release.Name -}} | |||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create chart name and version as used by the chart label. | |||||
*/}} | |||||
{{- define "basket-data.chart" -}} | |||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} |
@ -0,0 +1,43 @@ | |||||
apiVersion: apps/v1beta2 | |||||
kind: Deployment | |||||
metadata: | |||||
name: {{ template "basket-data.fullname" . }} | |||||
labels: | |||||
app: {{ template "basket-data.name" . }} | |||||
chart: {{ template "basket-data.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
replicas: {{ .Values.replicaCount }} | |||||
selector: | |||||
matchLabels: | |||||
app: {{ template "basket-data.name" . }} | |||||
release: {{ .Release.Name }} | |||||
template: | |||||
metadata: | |||||
labels: | |||||
app: {{ template "basket-data.name" . }} | |||||
release: {{ .Release.Name }} | |||||
spec: | |||||
containers: | |||||
- name: {{ .Chart.Name }} | |||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | |||||
imagePullPolicy: {{ .Values.image.pullPolicy }} | |||||
ports: | |||||
- name: http | |||||
containerPort: 6379 | |||||
protocol: TCP | |||||
resources: | |||||
{{ toYaml .Values.resources | indent 12 }} | |||||
{{- with .Values.nodeSelector }} | |||||
nodeSelector: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.affinity }} | |||||
affinity: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.tolerations }} | |||||
tolerations: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} |
@ -0,0 +1,19 @@ | |||||
apiVersion: v1 | |||||
kind: Service | |||||
metadata: | |||||
name: {{ .Values.inf.redis.basket.svc }} | |||||
labels: | |||||
app: {{ template "basket-data.name" . }} | |||||
chart: {{ template "basket-data.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
type: {{ .Values.service.type }} | |||||
ports: | |||||
- port: {{ .Values.service.port }} | |||||
targetPort: http | |||||
protocol: TCP | |||||
name: http | |||||
selector: | |||||
app: {{ template "basket-data.name" . }} | |||||
release: {{ .Release.Name }} |
@ -0,0 +1,19 @@ | |||||
replicaCount: 1 | |||||
image: | |||||
repository: redis | |||||
tag: 4.0.10 | |||||
pullPolicy: IfNotPresent | |||||
service: | |||||
type: ClusterIP | |||||
port: 6379 | |||||
resources: {} | |||||
nodeSelector: {} | |||||
tolerations: [] | |||||
affinity: {} |
@ -0,0 +1,21 @@ | |||||
# Patterns to ignore when building packages. | |||||
# This supports shell glob matching, relative path matching, and | |||||
# negation (prefixed with !). Only one pattern per line. | |||||
.DS_Store | |||||
# Common VCS dirs | |||||
.git/ | |||||
.gitignore | |||||
.bzr/ | |||||
.bzrignore | |||||
.hg/ | |||||
.hgignore | |||||
.svn/ | |||||
# Common backup files | |||||
*.swp | |||||
*.bak | |||||
*.tmp | |||||
*~ | |||||
# Various IDEs | |||||
.project | |||||
.idea/ | |||||
*.tmproj |
@ -0,0 +1,5 @@ | |||||
apiVersion: v1 | |||||
appVersion: "1.0" | |||||
description: A Helm chart for Kubernetes | |||||
name: catalog-api | |||||
version: 0.1.0 |
@ -0,0 +1,9 @@ | |||||
eShop Catalog API installed. | |||||
---------------------------- | |||||
This API is not directly exposed outside cluster. If need to access it use: | |||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "catalog-api.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | |||||
echo "Visit http://127.0.0.1:8080 to use your application" | |||||
kubectl port-forward $POD_NAME 8080:80 | |||||
@ -0,0 +1,32 @@ | |||||
{{/* vim: set filetype=mustache: */}} | |||||
{{/* | |||||
Expand the name of the chart. | |||||
*/}} | |||||
{{- define "catalog-api.name" -}} | |||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create a default fully qualified app name. | |||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | |||||
If release name contains chart name it will be used as a full name. | |||||
*/}} | |||||
{{- define "catalog-api.fullname" -}} | |||||
{{- if .Values.fullnameOverride -}} | |||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- $name := default .Chart.Name .Values.nameOverride -}} | |||||
{{- if contains $name .Release.Name -}} | |||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create chart name and version as used by the chart label. | |||||
*/}} | |||||
{{- define "catalog-api.chart" -}} | |||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} |
@ -0,0 +1,60 @@ | |||||
{{- define "suffix-name" -}} | |||||
{{- if .Values.app.name -}} | |||||
{{- .Values.app.name -}} | |||||
{{- else -}} | |||||
{{- .Release.Name -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "sql-name" -}} | |||||
{{- if .Values.inf.sql.host -}} | |||||
{{- .Values.inf.sql.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "sql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "mongo-name" -}} | |||||
{{- if .Values.inf.mongo.host -}} | |||||
{{- .Values.inf.mongo.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "nosql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "url-of" -}} | |||||
{{- $name := first .}} | |||||
{{- $ctx := last .}} | |||||
{{- if eq $name "" -}} | |||||
{{- $ctx.Values.inf.k8s.dns -}} | |||||
{{- else -}} | |||||
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just <dns>/<name> */}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "pathBase" -}} | |||||
{{- if .Values.inf.k8s.suffix -}} | |||||
{{- $suffix := include "suffix-name" . -}} | |||||
{{- printf "%s-%s" .Values.pathBase $suffix -}} | |||||
{{- else -}} | |||||
{{- .Values.pathBase -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "fqdn-image" -}} | |||||
{{- if .Values.inf.registry -}} | |||||
{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} | |||||
{{- else -}} | |||||
{{- .Values.image.repository -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "protocol" -}} | |||||
{{- if .Values.inf.tls.enabled -}} | |||||
{{- printf "%s" "https" -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "http" -}} | |||||
{{- end -}} | |||||
{{- end -}} |
@ -0,0 +1,21 @@ | |||||
{{- $name := include "catalog-api.fullname" . -}} | |||||
{{- $sqlsrv := include "sql-name" . -}} | |||||
{{- $webshoppingapigw := include "url-of" (list .Values.app.ingress.entries.webshoppingapigw .) -}} | |||||
{{- $protocol := include "protocol" . -}} | |||||
apiVersion: v1 | |||||
kind: ConfigMap | |||||
metadata: | |||||
name: "cfg-{{ $name }}" | |||||
labels: | |||||
app: {{ template "catalog-api.name" . }} | |||||
chart: {{ template "catalog-api.chart" .}} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
data: | |||||
catalog__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.catalog.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }}; | |||||
catalog__PicBaseUrl: {{ $protocol }}://{{ $webshoppingapigw }}/c/api/v1/catalog/items/[0]/pic/ | |||||
catalog__AzureStorageEnabled: "{{ .Values.inf.misc.useAzureStorage }}" | |||||
all__EventBusConnection: {{ .Values.inf.eventbus.constr }} | |||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | |||||
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" |
@ -0,0 +1,99 @@ | |||||
{{- $name := include "catalog-api.fullname" . -}} | |||||
{{- $cfgname := printf "%s-%s" "cfg" $name -}} | |||||
apiVersion: apps/v1beta2 | |||||
kind: Deployment | |||||
metadata: | |||||
name: {{ template "catalog-api.fullname" . }} | |||||
labels: | |||||
ufo: {{ $cfgname}} | |||||
app: {{ template "catalog-api.name" . }} | |||||
chart: {{ template "catalog-api.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
replicas: {{ .Values.replicaCount }} | |||||
selector: | |||||
matchLabels: | |||||
app: {{ template "catalog-api.name" . }} | |||||
release: {{ .Release.Name }} | |||||
template: | |||||
metadata: | |||||
labels: | |||||
app: {{ template "catalog-api.name" . }} | |||||
release: {{ .Release.Name }} | |||||
{{ if .Values.inf.mesh.enabled -}} | |||||
annotations: | |||||
linkerd.io/inject: enabled | |||||
{{- end }} | |||||
spec: | |||||
{{ if .Values.inf.registry -}} | |||||
imagePullSecrets: | |||||
- name: {{ .Values.inf.registry.secretName }} | |||||
{{- end }} | |||||
containers: | |||||
- name: {{ .Chart.Name }} | |||||
{{ if .Values.probes -}} | |||||
{{- if .Values.probes.liveness -}} | |||||
livenessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.liveness.port }} | |||||
path: {{ .Values.probes.liveness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.liveness.periodSeconds }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.probes -}} | |||||
{{- if .Values.probes.readiness }} | |||||
readinessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.readiness.port }} | |||||
path: {{ .Values.probes.readiness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.readiness.periodSeconds }} | |||||
timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" | |||||
imagePullPolicy: {{ .Values.image.pullPolicy }} | |||||
env: | |||||
- name: PATH_BASE | |||||
value: {{ include "pathBase" . }} | |||||
- name: k8sname | |||||
value: {{ .Values.clusterName }} | |||||
{{- if .Values.env.values -}} | |||||
{{- range .Values.env.values }} | |||||
- name: {{ .name }} | |||||
value: {{ .value | quote }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.env.configmap -}} | |||||
{{- range .Values.env.configmap }} | |||||
- name: {{ .name }} | |||||
valueFrom: | |||||
configMapKeyRef: | |||||
name: {{ $cfgname }} | |||||
key: {{ .key }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
ports: | |||||
- name: http | |||||
containerPort: 80 | |||||
protocol: TCP | |||||
- name: grpc | |||||
containerPort: 81 | |||||
protocol: TCP | |||||
resources: | |||||
{{ toYaml .Values.resources | indent 12 }} | |||||
{{- with .Values.nodeSelector }} | |||||
nodeSelector: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.affinity }} | |||||
affinity: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.tolerations }} | |||||
tolerations: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
@ -0,0 +1,23 @@ | |||||
apiVersion: v1 | |||||
kind: Service | |||||
metadata: | |||||
name: {{ .Values.app.svc.catalog }} | |||||
labels: | |||||
app: {{ template "catalog-api.name" . }} | |||||
chart: {{ template "catalog-api.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
type: {{ .Values.service.type }} | |||||
ports: | |||||
- port: {{ .Values.service.port }} | |||||
targetPort: http | |||||
protocol: TCP | |||||
name: http | |||||
- port: {{ .Values.service.grpcPort }} | |||||
targetPort: grpc | |||||
protocol: TCP | |||||
name: grpc | |||||
selector: | |||||
app: {{ template "catalog-api.name" . }} | |||||
release: {{ .Release.Name }} |
@ -0,0 +1,63 @@ | |||||
replicaCount: 1 | |||||
clusterName: eshop-aks | |||||
pathBase: /catalog-api | |||||
image: | |||||
repository: eshop/catalog.api | |||||
tag: latest | |||||
pullPolicy: IfNotPresent | |||||
service: | |||||
type: ClusterIP | |||||
port: 80 | |||||
grpcPort: 81 | |||||
resources: {} | |||||
nodeSelector: {} | |||||
tolerations: [] | |||||
affinity: {} | |||||
# env defines the environment variables that will be declared in the pod | |||||
env: | |||||
urls: | |||||
# configmap declares variables which value is taken from the config map defined in template configmap.yaml (name is name of var and key the key in configmap). | |||||
configmap: | |||||
- name: ConnectionString | |||||
key: catalog__ConnectionString | |||||
- name: PicBaseUrl | |||||
key: catalog__PicBaseUrl | |||||
- name: AzureStorageEnabled | |||||
key: catalog__AzureStorageEnabled | |||||
- name: ApplicationInsights__InstrumentationKey | |||||
key: all__InstrumentationKey | |||||
- name: EventBusConnection | |||||
key: all__EventBusConnection | |||||
- name: AzureServiceBusEnabled | |||||
key: all__UseAzureServiceBus | |||||
# 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 | |||||
value: Development | |||||
- name: OrchestratorType | |||||
value: 'K8S' | |||||
- name: PORT | |||||
value: "80" | |||||
- name: GRPC_PORT | |||||
value: "81" | |||||
probes: | |||||
liveness: | |||||
path: /liveness | |||||
initialDelaySeconds: 10 | |||||
periodSeconds: 15 | |||||
port: 80 | |||||
readiness: | |||||
path: /hc | |||||
timeoutSeconds: 5 | |||||
initialDelaySeconds: 90 | |||||
periodSeconds: 60 | |||||
port: 80 | |||||
@ -0,0 +1,149 @@ | |||||
Param( | |||||
[parameter(Mandatory=$false)][string]$registry, | |||||
[parameter(Mandatory=$false)][string]$dockerUser, | |||||
[parameter(Mandatory=$false)][string]$dockerPassword, | |||||
[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="", | |||||
[parameter(Mandatory=$false)][string]$imageTag="latest", | |||||
[parameter(Mandatory=$false)][bool]$useLocalk8s=$false, | |||||
[parameter(Mandatory=$false)][bool]$useMesh=$false, | |||||
[parameter(Mandatory=$false)][string][ValidateSet('Always','IfNotPresent','Never', IgnoreCase=$false)]$imagePullPolicy="Always", | |||||
[parameter(Mandatory=$false)][string][ValidateSet('prod','staging','none','custom', IgnoreCase=$false)]$sslSupport = "none", | |||||
[parameter(Mandatory=$false)][string]$tlsSecretName = "eshop-tls-custom", | |||||
[parameter(Mandatory=$false)][string]$chartsToDeploy="*", | |||||
[parameter(Mandatory=$false)][string]$ingressMeshAnnotationsFile="ingress_values_linkerd.yaml" | |||||
) | |||||
function Install-Chart { | |||||
Param([string]$chart,[string]$initialOptions, [bool]$customRegistry) | |||||
$options=$initialOptions | |||||
if ($sslEnabled) { | |||||
$options = "$options --set ingress.tls[0].secretName=$tlsSecretName --set ingress.tls[0].hosts={$dns}" | |||||
if ($sslSupport -ne "custom") { | |||||
$options = "$options --set inf.tls.issuer=$sslIssuer" | |||||
} | |||||
} | |||||
if ($customRegistry) { | |||||
$options = "$options --set inf.registry.server=$registry --set inf.registry.login=$dockerUser --set inf.registry.pwd=$dockerPassword --set inf.registry.secretName=eshop-docker-scret" | |||||
} | |||||
if ($chart -ne "eshop-common" -or $customRegistry) { # eshop-common is ignored when no secret must be deployed | |||||
$command = "install $options --name=$appName-$chart $chart" | |||||
Write-Host "Helm Command: helm $command" -ForegroundColor Gray | |||||
Invoke-Expression 'cmd /c "helm $command"' | |||||
} | |||||
} | |||||
$dns = $externalDns | |||||
$sslEnabled=$false | |||||
$sslIssuer="" | |||||
if ($sslSupport -eq "staging") { | |||||
$sslEnabled=$true | |||||
$tlsSecretName="eshop-letsencrypt-staging" | |||||
$sslIssuer="letsencrypt-staging" | |||||
} | |||||
elseif ($sslSupport -eq "prod") { | |||||
$sslEnabled=$true | |||||
$tlsSecretName="eshop-letsencrypt-prod" | |||||
$sslIssuer="letsencrypt-prod" | |||||
} | |||||
elseif ($sslSupport -eq "custom") { | |||||
$sslEnabled=$true | |||||
} | |||||
$ingressValuesFile="ingress_values.yaml" | |||||
if ($useLocalk8s -eq $true) { | |||||
$ingressValuesFile="ingress_values_dockerk8s.yaml" | |||||
$dns="localhost" | |||||
} | |||||
if ($externalDns -eq "aks") { | |||||
if ([string]::IsNullOrEmpty($aksName) -or [string]::IsNullOrEmpty($aksRg)) { | |||||
Write-Host "Error: When using -dns aks, MUST set -aksName and -aksRg too." -ForegroundColor Red | |||||
exit 1 | |||||
} | |||||
Write-Host "Getting DNS of AKS of AKS $aksName (in resource group $aksRg)..." -ForegroundColor Green | |||||
$dns = $(az aks show -n $aksName -g $aksRg --query addonProfiles.httpApplicationRouting.config.HTTPApplicationRoutingZoneName) | |||||
if ([string]::IsNullOrEmpty($dns)) { | |||||
Write-Host "Error getting DNS of AKS $aksName (in resource group $aksRg). Please ensure AKS has httpRouting enabled AND Azure CLI is logged & in version 2.0.37 or higher" -ForegroundColor Red | |||||
exit 1 | |||||
} | |||||
$dns = $dns -replace '[\"]' | |||||
Write-Host "DNS base found is $dns. Will use $appName.$dns for the app!" -ForegroundColor Green | |||||
$dns = "$appName.$dns" | |||||
} | |||||
# Initialization & check commands | |||||
if ([string]::IsNullOrEmpty($dns)) { | |||||
Write-Host "No DNS specified. Ingress resources will be bound to public ip" -ForegroundColor Yellow | |||||
if ($sslEnabled) { | |||||
Write-Host "Can't bound SSL to public IP. DNS is mandatory when using TLS" -ForegroundColor Red | |||||
exit 1 | |||||
} | |||||
} | |||||
if ($useLocalk8s -and $sslEnabled) { | |||||
Write-Host "SSL can'be enabled on local K8s." -ForegroundColor Red | |||||
exit 1 | |||||
} | |||||
if ($clean) { | |||||
Write-Host "Cleaning previous helm releases..." -ForegroundColor Green | |||||
helm delete --purge $(helm ls -q eshop) | |||||
Write-Host "Previous releases deleted" -ForegroundColor Green | |||||
} | |||||
$useCustomRegistry=$false | |||||
if (-not [string]::IsNullOrEmpty($registry)) { | |||||
$useCustomRegistry=$true | |||||
if ([string]::IsNullOrEmpty($dockerUser) -or [string]::IsNullOrEmpty($dockerPassword)) { | |||||
Write-Host "Error: Must use -dockerUser AND -dockerPassword if specifying custom registry" -ForegroundColor Red | |||||
exit 1 | |||||
} | |||||
} | |||||
Write-Host "Begin eShopOnContainers installation using Helm" -ForegroundColor Green | |||||
$infras = ("sql-data", "nosql-data", "rabbitmq", "keystore-data", "basket-data") | |||||
$charts = ("eshop-common", "basket-api","catalog-api", "identity-api", "locations-api", "marketing-api", "mobileshoppingagg","ordering-api","ordering-backgroundtasks","ordering-signalrhub", "payment-api", "webmvc", "webshoppingagg", "webspa", "webstatus", "webhooks-api", "webhooks-web") | |||||
$gateways = ("apigwmm", "apigwms", "apigwwm", "apigwws") | |||||
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 --set "ingress.hosts={$dns}" --name="$appName-$infra" $infra | |||||
} | |||||
} | |||||
else { | |||||
Write-Host "eShopOnContainers infrastructure (bbdd, redis, ...) charts aren't installed (-deployCharts is false)" -ForegroundColor Yellow | |||||
} | |||||
if ($deployCharts) { | |||||
foreach ($chart in $charts) { | |||||
if ($chartsToDeploy -eq "*" -or $chartsToDeploy.Contains($chart)) { | |||||
Write-Host "Installing: $chart" -ForegroundColor Green | |||||
Install-Chart $chart "-f app.yaml --values inf.yaml -f $ingressValuesFile -f $ingressMeshAnnotationsFile --set app.name=$appName --set inf.k8s.dns=$dns --set ingress.hosts={$dns} --set image.tag=$imageTag --set image.pullPolicy=$imagePullPolicy --set inf.tls.enabled=$sslEnabled --set inf.mesh.enabled=$useMesh --set inf.k8s.local=$useLocalk8s" $useCustomRegistry | |||||
} | |||||
} | |||||
foreach ($chart in $gateways) { | |||||
if ($chartsToDeploy -eq "*" -or $chartsToDeploy.Contains($chart)) { | |||||
Write-Host "Installing Api Gateway Chart: $chart" -ForegroundColor Green | |||||
Install-Chart $chart "-f app.yaml -f inf.yaml -f $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set image.pullPolicy=$imagePullPolicy --set inf.mesh.enabled=$useMesh --set ingress.hosts={$dns} --set inf.tls.enabled=$sslEnabled" $false | |||||
} | |||||
} | |||||
} | |||||
else { | |||||
Write-Host "eShopOnContainers non-infrastructure charts aren't installed (-deployCharts is false)" -ForegroundColor Yellow | |||||
} | |||||
Write-Host "helm charts installed." -ForegroundColor Green |
@ -0,0 +1,232 @@ | |||||
#!/usr/bin/env bash | |||||
# http://redsymbol.net/articles/unofficial-bash-strict-mode | |||||
set -euo pipefail | |||||
usage() | |||||
{ | |||||
cat <<END | |||||
deploy.sh: deploys the $app_name application to a Kubernetes cluster using Helm. | |||||
Parameters: | |||||
--aks-name <AKS cluster name> | |||||
The name of the AKS cluster. Required when the registry (using the -r parameter) is set to "aks". | |||||
--aks-rg <AKS resource group> | |||||
The resource group for the AKS cluster. Required when the registry (using the -r parameter) is set to "aks". | |||||
-b | --build-solution | |||||
Force a solution build before deployment (default: false). | |||||
-d | --dns <dns or ip address> | --dns aks | |||||
Specifies the external DNS/ IP address of the Kubernetes cluster. | |||||
If 'aks' is set as value, the DNS value is retrieved from the AKS. --aks-name and --aks-rg are needed. | |||||
When --use-local-k8s is specified the external DNS is automatically set to localhost. | |||||
-h | --help | |||||
Displays this help text and exits the script. | |||||
--image-build | |||||
Build images (default is to not build all images). | |||||
--image-push | |||||
Upload images to the container registry (default is not pushing to the custom registry) | |||||
-n | --app-name <the name of the app> | |||||
Specifies the name of the application (default: eshop). | |||||
--namespace <namespace name> | |||||
Specifies the namespace name to deploy the app. If it doesn't exists it will be created (default: eshop). | |||||
-p | --docker-password <docker password> | |||||
The Docker password used to logon to the custom registry, supplied using the -r parameter. | |||||
-r | --registry <container registry> | |||||
Specifies the container registry to use (required), e.g. myregistry.azurecr.io. | |||||
--skip-clean | |||||
Do not clean the Kubernetes cluster (default is to clean the cluster). | |||||
--skip-infrastructure | |||||
Do not deploy infrastructure resources (like sql-data, no-sql or redis). | |||||
This is useful for production environments where infrastructure is hosted outside the Kubernetes cluster. | |||||
-t | --tag <docker image tag> | |||||
The tag used for the newly created docker images. Default: latest. | |||||
-u | --docker-username <docker username> | |||||
The Docker username used to logon to the custom registry, supplied using the -r parameter. | |||||
--use-local-k8s | |||||
Deploy to a locally installed Kubernetes (default: false). | |||||
It is assumed that the Kubernetes cluster has been granted access to the container registry. | |||||
If using AKS and ACR see link for more info: | |||||
https://docs.microsoft.com/en-us/azure/container-registry/container-registry-auth-aks | |||||
WARNING! THE SCRIPT WILL COMPLETELY DESTROY ALL DEPLOYMENTS AND SERVICES VISIBLE | |||||
FROM THE CURRENT CONFIGURATION CONTEXT AND NAMESPACE. | |||||
It is recommended that you check your selected namespace, 'eshop' by default, is already in use. | |||||
Every deployment and service done in the namespace will be deleted. | |||||
For more information see https://kubernetes.io/docs/tasks/administer-cluster/namespaces/ | |||||
END | |||||
} | |||||
app_name='eshop' | |||||
aks_name='' | |||||
aks_rg='' | |||||
build_images='' | |||||
clean='yes' | |||||
build_solution='' | |||||
container_registry='' | |||||
docker_password='' | |||||
docker_username='' | |||||
dns='' | |||||
image_tag='latest' | |||||
push_images='' | |||||
skip_infrastructure='' | |||||
use_local_k8s='' | |||||
namespace='eshop' | |||||
while [[ $# -gt 0 ]]; do | |||||
case "$1" in | |||||
--aks-name ) | |||||
aks_name="$2"; shift 2;; | |||||
--aks-rg ) | |||||
aks_rg="$2"; shift 2;; | |||||
-b | --build-solution ) | |||||
build_solution='yes'; shift ;; | |||||
-d | --dns ) | |||||
dns="$2"; shift 2;; | |||||
-h | --help ) | |||||
usage; exit 1 ;; | |||||
-n | --app-name ) | |||||
app_name="$2"; shift 2;; | |||||
-p | --docker-password ) | |||||
docker_password="$2"; shift 2;; | |||||
-r | --registry ) | |||||
container_registry="$2"; shift 2;; | |||||
--skip-clean ) | |||||
clean=''; shift ;; | |||||
--image-build ) | |||||
build_images='yes'; shift ;; | |||||
--image-push ) | |||||
push_images='yes'; shift ;; | |||||
--skip-infrastructure ) | |||||
skip_infrastructure='yes'; shift ;; | |||||
-t | --tag ) | |||||
image_tag="$2"; shift 2;; | |||||
-u | --docker-username ) | |||||
docker_username="$2"; shift 2;; | |||||
--use-local-k8s ) | |||||
use_local_k8s='yes'; shift ;; | |||||
--namespace ) | |||||
namespace="$2"; shift 2;; | |||||
*) | |||||
echo "Unknown option $1" | |||||
usage; exit 2 ;; | |||||
esac | |||||
done | |||||
if [[ $build_solution ]]; then | |||||
echo "#################### Building $app_name solution ####################" | |||||
dotnet publish -o obj/Docker/publish ../../eShopOnContainers-ServicesAndWebApps.sln | |||||
fi | |||||
export TAG=$image_tag | |||||
if [[ $build_images ]]; then | |||||
echo "#################### Building the $app_name Docker images ####################" | |||||
docker-compose -p ../.. -f ../../docker-compose.yml build | |||||
# Remove temporary images | |||||
docker rmi $(docker images -qf "dangling=true") | |||||
fi | |||||
use_custom_registry='' | |||||
if [[ -n $container_registry ]]; then | |||||
echo "################ Log into custom registry $container_registry ##################" | |||||
use_custom_registry='yes' | |||||
if [[ -z $docker_username ]] || [[ -z $docker_password ]]; then | |||||
echo "Error: Must use -u (--docker-username) AND -p (--docker-password) if specifying custom registry" | |||||
exit 1 | |||||
fi | |||||
docker login -u $docker_username -p $docker_password $container_registry | |||||
fi | |||||
if [[ $push_images ]]; then | |||||
echo "#################### Pushing images to the container registry ####################" | |||||
services=(basket.api catalog.api identity.api ordering.api marketing.api payment.api locations.api webmvc webspa webstatus) | |||||
if [[ -z "$(docker image ls -q --filter=reference=eshop/$service:$image_tag)" ]]; then | |||||
image_tag=linux-$image_tag | |||||
fi | |||||
for service in "${services[@]}" | |||||
do | |||||
echo "Pushing image for service $service..." | |||||
docker tag "eshop/$service:$image_tag" "$container_registry/$service:$image_tag" | |||||
docker push "$container_registry/$service:$image_tag" | |||||
done | |||||
fi | |||||
ingress_values_file="ingress_values.yaml" | |||||
if [[ $use_local_k8s ]]; then | |||||
ingress_values_file="ingress_values_dockerk8s.yaml" | |||||
dns="localhost" | |||||
fi | |||||
if [[ $dns == "aks" ]]; then | |||||
echo "#################### Begin AKS discovery based on the --dns aks setting. ####################" | |||||
if [[ -z $aks_name ]] || [[ -z $aks_rg ]]; then | |||||
echo "Error: When using -dns aks, MUST set -aksName and -aksRg too." | |||||
echo '' | |||||
usage | |||||
exit 1 | |||||
fi | |||||
echo "Getting AKS cluster $aks_name AKS (in resource group $aks_rg)" | |||||
# JMESPath queries are case sensitive and httpapplicationrouting can be lowercase sometimes | |||||
jmespath_dnsqueries=(\ | |||||
addonProfiles.httpApplicationRouting.config.HTTPApplicationRoutingZoneName \ | |||||
addonProfiles.httpapplicationrouting.config.HTTPApplicationRoutingZoneName \ | |||||
) | |||||
for q in "${jmespath_dnsqueries[@]}" | |||||
do | |||||
dns="$(az aks show -n $aks_name -g $aks_rg --query $q -o tsv)" | |||||
if [[ -n $dns ]]; then break; fi | |||||
done | |||||
if [[ -z $dns ]]; then | |||||
echo "Error: when getting DNS of AKS $aks_name (in resource group $aks_rg). Please ensure AKS has httpRouting enabled AND Azure CLI is logged in and is of version 2.0.37 or higher." | |||||
exit 1 | |||||
fi | |||||
echo "DNS base found is $dns. Will use $aks_name.$dns for the app!" | |||||
dns="$aks_name.$dns" | |||||
fi | |||||
# Initialization & check commands | |||||
if [[ -z $dns ]]; then | |||||
echo "No DNS specified. Ingress resources will be bound to public IP." | |||||
fi | |||||
if [[ $clean ]]; then | |||||
echo "Cleaning previous helm releases..." | |||||
if [[ -z $(helm ls -q --namespace $namespace) ]]; then | |||||
echo "No previous releases found" | |||||
else | |||||
helm delete --purge $(helm ls -q --namespace $namespace) | |||||
echo "Previous releases deleted" | |||||
waitsecs=10; while [ $waitsecs -gt 0 ]; do echo -ne "$waitsecs\033[0K\r"; sleep 1; : $((waitsecs--)); done | |||||
fi | |||||
fi | |||||
echo "#################### Begin $app_name installation using Helm ####################" | |||||
infras=(sql-data nosql-data rabbitmq keystore-data basket-data) | |||||
charts=(eshop-common apigwmm apigwms apigwwm apigwws basket-api catalog-api identity-api locations-api marketing-api mobileshoppingagg ordering-api ordering-backgroundtasks ordering-signalrhub payment-api webmvc webshoppingagg webspa webstatus webhooks-api webhooks-web) | |||||
if [[ !$skip_infrastructure ]]; then | |||||
for infra in "${infras[@]}" | |||||
do | |||||
echo "Installing infrastructure: $infra" | |||||
helm install --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --name="$app_name-$infra" $infra | |||||
done | |||||
fi | |||||
for chart in "${charts[@]}" | |||||
do | |||||
echo "Installing: $chart" | |||||
if [[ $use_custom_registry ]]; then | |||||
helm install --namespace $namespace --set "ingress.hosts={$dns}" --set inf.registry.server=$container_registry --set inf.registry.login=$docker_username --set inf.registry.pwd=$docker_password --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=Always --name="$app_name-$chart" $chart | |||||
elif [[ $chart != "eshop-common" ]]; then # eshop-common is ignored when no secret must be deployed | |||||
helm install --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=Always --name="$app_name-$chart" $chart | |||||
fi | |||||
done | |||||
echo "FINISHED: Helm charts installed." |
@ -0,0 +1,21 @@ | |||||
# Patterns to ignore when building packages. | |||||
# This supports shell glob matching, relative path matching, and | |||||
# negation (prefixed with !). Only one pattern per line. | |||||
.DS_Store | |||||
# Common VCS dirs | |||||
.git/ | |||||
.gitignore | |||||
.bzr/ | |||||
.bzrignore | |||||
.hg/ | |||||
.hgignore | |||||
.svn/ | |||||
# Common backup files | |||||
*.swp | |||||
*.bak | |||||
*.tmp | |||||
*~ | |||||
# Various IDEs | |||||
.project | |||||
.idea/ | |||||
*.tmproj |
@ -0,0 +1,5 @@ | |||||
apiVersion: v1 | |||||
appVersion: "1.0" | |||||
description: A Helm chart for Kubernetes | |||||
name: eshop-common | |||||
version: 0.1.0 |
@ -0,0 +1,7 @@ | |||||
Common eShop resources installed: | |||||
{{- if .Values.inf.registry -}} | |||||
* Docker registry secret ({{ .Values.inf.registry.secretName }}) | |||||
{{- end -}} | |||||
+++ Done +++ |
@ -0,0 +1,32 @@ | |||||
{{/* vim: set filetype=mustache: */}} | |||||
{{/* | |||||
Expand the name of the chart. | |||||
*/}} | |||||
{{- define "eshop-common.name" -}} | |||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create a default fully qualified app name. | |||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | |||||
If release name contains chart name it will be used as a full name. | |||||
*/}} | |||||
{{- define "eshop-common.fullname" -}} | |||||
{{- if .Values.fullnameOverride -}} | |||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- $name := default .Chart.Name .Values.nameOverride -}} | |||||
{{- if contains $name .Release.Name -}} | |||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create chart name and version as used by the chart label. | |||||
*/}} | |||||
{{- define "eshop-common.chart" -}} | |||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} |
@ -0,0 +1,3 @@ | |||||
{{- define "imagePullSecret" }} | |||||
{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .Values.inf.registry.server (printf "%s:%s" .Values.inf.registry.login .Values.inf.registry.pwd | b64enc) | b64enc }} | |||||
{{- end }} |
@ -0,0 +1,9 @@ | |||||
{{- if .Values.inf.registry -}} | |||||
apiVersion: v1 | |||||
kind: Secret | |||||
metadata: | |||||
name: {{ .Values.inf.registry.secretName }} | |||||
type: kubernetes.io/dockerconfigjson | |||||
data: | |||||
.dockerconfigjson: {{ template "imagePullSecret" . }} | |||||
{{- end -}} |
@ -0,0 +1,21 @@ | |||||
# Patterns to ignore when building packages. | |||||
# This supports shell glob matching, relative path matching, and | |||||
# negation (prefixed with !). Only one pattern per line. | |||||
.DS_Store | |||||
# Common VCS dirs | |||||
.git/ | |||||
.gitignore | |||||
.bzr/ | |||||
.bzrignore | |||||
.hg/ | |||||
.hgignore | |||||
.svn/ | |||||
# Common backup files | |||||
*.swp | |||||
*.bak | |||||
*.tmp | |||||
*~ | |||||
# Various IDEs | |||||
.project | |||||
.idea/ | |||||
*.tmproj |
@ -0,0 +1,5 @@ | |||||
apiVersion: v1 | |||||
appVersion: "1.0" | |||||
description: A Helm chart for Kubernetes | |||||
name: identity-api | |||||
version: 0.1.0 |
@ -0,0 +1,4 @@ | |||||
eShop Identity API installed. | |||||
----------------------------- | |||||
Access this API through ingress. |
@ -0,0 +1,32 @@ | |||||
{{/* vim: set filetype=mustache: */}} | |||||
{{/* | |||||
Expand the name of the chart. | |||||
*/}} | |||||
{{- define "identity-api.name" -}} | |||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create a default fully qualified app name. | |||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | |||||
If release name contains chart name it will be used as a full name. | |||||
*/}} | |||||
{{- define "identity-api.fullname" -}} | |||||
{{- if .Values.fullnameOverride -}} | |||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- $name := default .Chart.Name .Values.nameOverride -}} | |||||
{{- if contains $name .Release.Name -}} | |||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | |||||
{{- else -}} | |||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{/* | |||||
Create chart name and version as used by the chart label. | |||||
*/}} | |||||
{{- define "identity-api.chart" -}} | |||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | |||||
{{- end -}} |
@ -0,0 +1,51 @@ | |||||
{{- define "suffix-name" -}} | |||||
{{- if .Values.app.name -}} | |||||
{{- .Values.app.name -}} | |||||
{{- else -}} | |||||
{{- .Release.Name -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "sql-name" -}} | |||||
{{- if .Values.inf.sql.host -}} | |||||
{{- .Values.inf.sql.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "sql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "mongo-name" -}} | |||||
{{- if .Values.inf.mongo.host -}} | |||||
{{- .Values.inf.mongo.host -}} | |||||
{{- else -}} | |||||
{{- printf "%s" "nosql-data" -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "url-of" -}} | |||||
{{- $name := first .}} | |||||
{{- $ctx := last .}} | |||||
{{- if eq $name "" -}} | |||||
{{- $ctx.Values.inf.k8s.dns -}} | |||||
{{- else -}} | |||||
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just <dns>/<name> */}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "pathBase" -}} | |||||
{{- if .Values.inf.k8s.suffix -}} | |||||
{{- $suffix := include "suffix-name" . -}} | |||||
{{- printf "%s-%s" .Values.pathBase $suffix -}} | |||||
{{- else -}} | |||||
{{- .Values.pathBase -}} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- define "fqdn-image" -}} | |||||
{{- if .Values.inf.registry -}} | |||||
{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} | |||||
{{- else -}} | |||||
{{- .Values.image.repository -}} | |||||
{{- end -}} | |||||
{{- end -}} |
@ -0,0 +1,39 @@ | |||||
{{- $name := include "identity-api.fullname" . -}} | |||||
{{- $sqlsrv := include "sql-name" . -}} | |||||
{{- $mvc_url := include "url-of" (list .Values.app.ingress.entries.mvc .) -}} | |||||
{{- $spa_url := include "url-of" (list .Values.app.ingress.entries.spa .) -}} | |||||
{{- $locations_url := include "url-of" (list .Values.app.ingress.entries.locations .) -}} | |||||
{{- $marketing_url := include "url-of" (list .Values.app.ingress.entries.marketing .) -}} | |||||
{{- $basket_url := include "url-of" (list .Values.app.ingress.entries.basket .) -}} | |||||
{{- $ordering_url := include "url-of" (list .Values.app.ingress.entries.ordering .) -}} | |||||
{{- $mobileshoppingagg := include "url-of" (list .Values.app.ingress.entries.mobileshoppingagg .) -}} | |||||
{{- $webhoppingagg := include "url-of" (list .Values.app.ingress.entries.webshoppingagg .) -}} | |||||
{{- $xamarincallback := include "url-of" (list "xamarincallback" .) -}} | |||||
{{- $webhooks_url := include "url-of" (list .Values.app.ingress.entries.webhooks .) -}} | |||||
{{- $webhooksweb_url := include "url-of" (list .Values.app.ingress.entries.webhooksweb .) -}} | |||||
apiVersion: v1 | |||||
kind: ConfigMap | |||||
metadata: | |||||
name: "cfg-{{ $name }}" | |||||
labels: | |||||
app: {{ template "identity-api.name" . }} | |||||
chart: {{ template "identity-api.chart" .}} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
data: | |||||
identity__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.identity.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }}; | |||||
identity__keystore: {{ .Values.inf.redis.keystore.constr }} | |||||
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | |||||
mvc_e: http://{{ $mvc_url }} | |||||
spa_e: http://{{ $spa_url }} | |||||
locations_e: http://{{ $locations_url }} | |||||
marketing_e: http://{{ $marketing_url }} | |||||
basket_e: http://{{ $basket_url }} | |||||
ordering_e: http://{{ $ordering_url }} | |||||
mobileshoppingagg_e: http://{{ $mobileshoppingagg }} | |||||
webshoppingagg_e: http://{{ $webhoppingagg }} | |||||
xamarin_callback_e: http://{{ $xamarincallback }} | |||||
webhooksapi_e: http://{{ $webhooks_url }} | |||||
webhooksweb_e: http://{{ $webhooksweb_url }} | |||||
enableDevspaces: "{{ .Values.enableDevspaces }}" |
@ -0,0 +1,96 @@ | |||||
{{- $name := include "identity-api.fullname" . -}} | |||||
{{- $cfgname := printf "%s-%s" "cfg" $name -}} | |||||
apiVersion: apps/v1beta2 | |||||
kind: Deployment | |||||
metadata: | |||||
name: {{ template "identity-api.fullname" . }} | |||||
labels: | |||||
ufo: {{ $cfgname}} | |||||
app: {{ template "identity-api.name" . }} | |||||
chart: {{ template "identity-api.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
replicas: {{ .Values.replicaCount }} | |||||
selector: | |||||
matchLabels: | |||||
app: {{ template "identity-api.name" . }} | |||||
release: {{ .Release.Name }} | |||||
template: | |||||
metadata: | |||||
labels: | |||||
app: {{ template "identity-api.name" . }} | |||||
release: {{ .Release.Name }} | |||||
{{ if .Values.inf.mesh.enabled -}} | |||||
annotations: | |||||
linkerd.io/inject: enabled | |||||
{{- end }} | |||||
spec: | |||||
{{ if .Values.inf.registry -}} | |||||
imagePullSecrets: | |||||
- name: {{ .Values.inf.registry.secretName }} | |||||
{{- end }} | |||||
containers: | |||||
- name: {{ .Chart.Name }} | |||||
{{ if .Values.probes -}} | |||||
{{- if .Values.probes.liveness -}} | |||||
livenessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.liveness.port }} | |||||
path: {{ .Values.probes.liveness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.liveness.periodSeconds }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.probes -}} | |||||
{{- if .Values.probes.readiness }} | |||||
readinessProbe: | |||||
httpGet: | |||||
port: {{ .Values.probes.readiness.port }} | |||||
path: {{ .Values.probes.readiness.path }} | |||||
initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} | |||||
periodSeconds: {{ .Values.probes.readiness.periodSeconds }} | |||||
timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" | |||||
imagePullPolicy: {{ .Values.image.pullPolicy }} | |||||
env: | |||||
- name: PATH_BASE | |||||
value: {{ include "pathBase" . }} | |||||
- name: k8sname | |||||
value: {{ .Values.clusterName }} | |||||
{{- if .Values.env.values -}} | |||||
{{- range .Values.env.values }} | |||||
- name: {{ .name }} | |||||
value: {{ .value | quote }} | |||||
{{- end -}} | |||||
{{- end -}} | |||||
{{- if .Values.env.configmap -}} | |||||
{{- range .Values.env.configmap }} | |||||
- name: {{ .name }} | |||||
valueFrom: | |||||
configMapKeyRef: | |||||
name: {{ $cfgname }} | |||||
key: {{ .key }} | |||||
{{- end -}} | |||||
{{- end }} | |||||
ports: | |||||
- name: http | |||||
containerPort: 80 | |||||
protocol: TCP | |||||
resources: | |||||
{{ toYaml .Values.resources | indent 12 }} | |||||
{{- with .Values.nodeSelector }} | |||||
nodeSelector: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.affinity }} | |||||
affinity: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
{{- with .Values.tolerations }} | |||||
tolerations: | |||||
{{ toYaml . | indent 8 }} | |||||
{{- end }} | |||||
@ -0,0 +1,33 @@ | |||||
{{- if .Values.ingress.enabled -}} | |||||
{{- if .Values.inf.k8s.local -}} | |||||
{{- $ingressPath := include "pathBase" . -}} | |||||
{{- $serviceName := .Values.app.svc.identity }} | |||||
{{- $name := include "identity-api.fullname" . -}} | |||||
apiVersion: extensions/v1beta1 | |||||
kind: Ingress | |||||
metadata: | |||||
name: {{ $name }}-local | |||||
labels: | |||||
app: {{ template "identity-api.name" . }} | |||||
chart: {{ template "identity-api.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
{{- with .Values.ingress.annotations }} | |||||
annotations: | |||||
{{ toYaml . | indent 4 }} | |||||
{{- end }} | |||||
{{- if .Values.inf.mesh.enabled }} | |||||
{{- with .Values.ingress.mesh.annotations }} | |||||
{{ toYaml . | indent 4 }} | |||||
{{- end }} | |||||
{{- end }} | |||||
spec: | |||||
rules: | |||||
- http: | |||||
paths: | |||||
- backend: | |||||
serviceName: {{ $serviceName }} | |||||
servicePort: http | |||||
path: {{ $ingressPath }} | |||||
{{- end -}} | |||||
{{- end -}} |
@ -0,0 +1,46 @@ | |||||
{{- if .Values.ingress.enabled -}} | |||||
{{- $ingressPath := include "pathBase" . -}} | |||||
{{- $serviceName := .Values.app.svc.identity }} | |||||
apiVersion: extensions/v1beta1 | |||||
kind: Ingress | |||||
metadata: | |||||
name: {{ template "identity-api.fullname" . }} | |||||
labels: | |||||
app: {{ template "identity-api.name" . }} | |||||
chart: {{ template "identity-api.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
{{- with .Values.ingress.annotations }} | |||||
annotations: | |||||
{{ toYaml . | indent 4 }} | |||||
{{- end }} | |||||
{{- if and .Values.inf.tls.enabled .Values.inf.tls.issuer }} | |||||
cert-manager.io/issuer: {{ .Values.inf.tls.issuer }} | |||||
{{- end }} | |||||
{{- if .Values.inf.mesh.enabled }} | |||||
{{- with .Values.ingress.mesh.annotations }} | |||||
{{ toYaml . | indent 4 }} | |||||
{{- end }} | |||||
{{- end }} | |||||
spec: | |||||
{{- if .Values.ingress.tls }} | |||||
tls: | |||||
{{- range .Values.ingress.tls }} | |||||
- hosts: | |||||
{{- range .hosts }} | |||||
- {{ . }} | |||||
{{- end }} | |||||
secretName: {{ .secretName }} | |||||
{{- end }} | |||||
{{- end }} | |||||
rules: | |||||
{{- range .Values.ingress.hosts }} | |||||
- host: {{ . }} | |||||
http: | |||||
paths: | |||||
- path: {{ $ingressPath }} | |||||
backend: | |||||
serviceName: {{ $serviceName }} | |||||
servicePort: http | |||||
{{- end }} | |||||
{{- end }} |
@ -0,0 +1,19 @@ | |||||
apiVersion: v1 | |||||
kind: Service | |||||
metadata: | |||||
name: {{ .Values.app.svc.identity }} | |||||
labels: | |||||
app: {{ template "identity-api.name" . }} | |||||
chart: {{ template "identity-api.chart" . }} | |||||
release: {{ .Release.Name }} | |||||
heritage: {{ .Release.Service }} | |||||
spec: | |||||
type: {{ .Values.service.type }} | |||||
ports: | |||||
- port: {{ .Values.service.port }} | |||||
targetPort: http | |||||
protocol: TCP | |||||
name: http | |||||
selector: | |||||
app: {{ template "identity-api.name" . }} | |||||
release: {{ .Release.Name }} |
@ -0,0 +1,84 @@ | |||||
replicaCount: 1 | |||||
clusterName: eshop-aks | |||||
pathBase: /identity | |||||
image: | |||||
repository: eshop/identity.api | |||||
tag: latest | |||||
pullPolicy: IfNotPresent | |||||
service: | |||||
type: ClusterIP | |||||
port: 80 | |||||
ingress: | |||||
enabled: true | |||||
annotations: {} | |||||
hosts: | |||||
- chart-example.local | |||||
tls: [] | |||||
resources: {} | |||||
nodeSelector: {} | |||||
tolerations: [] | |||||
affinity: {} | |||||
env: | |||||
urls: | |||||
configmap: | |||||
- name: ConnectionString | |||||
key: identity__ConnectionString | |||||
- name: DPConnectionString | |||||
key: identity__keystore | |||||
- name: ApplicationInsights__InstrumentationKey | |||||
key: all__InstrumentationKey | |||||
- name: MvcClient | |||||
key: mvc_e | |||||
- name: SpaClient | |||||
key: spa_e | |||||
- name: LocationApiClient | |||||
key: locations_e | |||||
- name: MarketingApiClient | |||||
key: marketing_e | |||||
- name: BasketApiClient | |||||
key: basket_e | |||||
- name: OrderingApiClient | |||||
key: ordering_e | |||||
- name: MobileShoppingAggClient | |||||
key: mobileshoppingagg_e | |||||
- name: WebShoppingAggClient | |||||
key: webshoppingagg_e | |||||
- name: XamarinCallback | |||||
key: xamarin_callback_e | |||||
- name: WebhooksApiClient | |||||
key: webhooksapi_e | |||||
- name: WebhooksWebClient | |||||
key: webhooksweb_e | |||||
- name: EnableDevspaces | |||||
key: enableDevspaces | |||||
values: | |||||
- name: ASPNETCORE_ENVIRONMENT | |||||
value: Development | |||||
- name: OrchestratorType | |||||
value: 'K8S' | |||||
- name: IsClusterEnv | |||||
value: 'True' | |||||
probes: | |||||
liveness: | |||||
path: /liveness | |||||
initialDelaySeconds: 10 | |||||
periodSeconds: 15 | |||||
port: 80 | |||||
readiness: | |||||
path: /hc | |||||
timeoutSeconds: 5 | |||||
initialDelaySeconds: 90 | |||||
periodSeconds: 60 | |||||
port: 80 | |||||
enableDevspaces: "false" |
@ -0,0 +1,56 @@ | |||||
# This helm values file defines all infrastructure used by eShopOnContainers. | |||||
# It is used on all charts, so ** MUST BE INCLUDED ** on every deployment | |||||
inf: | |||||
mesh: | |||||
enabled: false # True to enable Linkerd (set by deploy-all.ps1) | |||||
tls: | |||||
enabled: false # True to enable TLS (set by deploy-all.ps1) | |||||
issuer: "" # cert-manager issuer to use for retrieving certs (set by deploy-all.ps1) | |||||
sql: # inf.sql defines the sql server databases & logins | |||||
# host: my-sql-server # Uncomment to specify a custom sql-server to be used. By default "sql-data-<appname>" will be used | |||||
common: | |||||
user: sa # SQL user | |||||
pwd: Pass@word # SQL pwd | |||||
pid: Developer | |||||
catalog: # inf.sql.catalog: settings for the catalog-api sql (user, pwd, db) | |||||
db: CatalogDb # Catalog API SQL db name | |||||
ordering: # inf.sql.ordering: settings for the ordering-api sql (user, pwd, db) | |||||
db: OrderingDb # Ordering API SQL db name | |||||
identity: | |||||
db: IdentityDb # Ordering API SQL db name | |||||
marketing: | |||||
db: MarketingDb # Marketing API SQL db name | |||||
webhooks: | |||||
db: WebhooksDb # Webhooks DB | |||||
mongo: | |||||
# host: my-nosql-data # Uncomment to use specify custom mongo host. By default nosql-data is used | |||||
locations: | |||||
database: LocationsDb | |||||
marketing: | |||||
database: MarketingDb | |||||
redis: # inf.redis defines the redis' connection strings | |||||
basket: | |||||
svc: basket-data # Name of k8s svc for basket redis | |||||
constr: basket-data # Connection string to Redis used by Basket API | |||||
keystore: | |||||
svc: keystore-data # Name of k8s svc for keystore-data redis | |||||
constr: keystore-data # Connection string to Redis used as a Keystore (by Identity API) | |||||
eventbus: | |||||
svc: rabbitmq # Name of k8s svc for rabbitmq | |||||
constr: rabbitmq # Event bus connection string | |||||
useAzure: false # true if use Azure Service Bus. False if RabbitMQ | |||||
appinsights: | |||||
key: "" # App insights to use | |||||
k8s: # inf.k8s defines Kubernetes cluster global config | |||||
dns: "" # k8s external DNS. This value or ip value MUST BE PROVIDED | |||||
local: false # True when deploying on "local K8s" provided by Docker Desktop. | |||||
misc: # inf.misc contains miscellaneous configuration related to infrastructure | |||||
useLoadTest: false # If running under loading test or not | |||||
useAzureStorage: false # If catalog api uses azure storage or not | |||||
# registry: # Uncomment "registry" to specify registry secret | |||||
# secretName: # secretName is the name of the secret inside k8s | |||||
# server: # Registry login server | |||||
# login: # User login | |||||
# pwd: # User pwd | |||||
@ -0,0 +1,8 @@ | |||||
# This file contains common ingress annotations when using AKS with Http Application Routing | |||||
ingress: | |||||
annotations: | |||||
kubernetes.io/ingress.class: addon-http-application-routing | |||||
ingress.kubernetes.io/ssl-redirect: "false" | |||||
nginx.ingress.kubernetes.io/ssl-redirect: "false" | |||||
@ -0,0 +1,7 @@ | |||||
# This file contains common ingress annotations when using Kubernetes included in Docker Desktop | |||||
ingress: | |||||
annotations: | |||||
kubernetes.io/ingress.class: "nginx" | |||||
ingress.kubernetes.io/ssl-redirect: "false" | |||||
nginx.ingress.kubernetes.io/ssl-redirect: "false" |