Merge branch 'helm' into dev
This commit is contained in:
commit
9b4ab032a2
12
k8s/helm/aks-httpaddon-cfg.yaml
Normal file
12
k8s/helm/aks-httpaddon-cfg.yaml
Normal file
@ -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"
|
21
k8s/helm/apigwmm/.helmignore
Normal file
21
k8s/helm/apigwmm/.helmignore
Normal file
@ -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
|
5
k8s/helm/apigwmm/Chart.yaml
Normal file
5
k8s/helm/apigwmm/Chart.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for Kubernetes
|
||||
name: apigwmm
|
||||
version: 0.1.0
|
34
k8s/helm/apigwmm/configuration-mobile-marketing.json
Normal file
34
k8s/helm/apigwmm/configuration-mobile-marketing.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"ReRoutes": [
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "marketing",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "locations",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
}
|
||||
|
||||
],
|
||||
"GlobalConfiguration": {
|
||||
"RequestIdKey": "OcRequestId",
|
||||
"AdministrationPath": "/administration"
|
||||
}
|
||||
}
|
||||
|
2
k8s/helm/apigwmm/templates/NOTES.txt
Normal file
2
k8s/helm/apigwmm/templates/NOTES.txt
Normal file
@ -0,0 +1,2 @@
|
||||
eShop API Gateway for Mobile Marketing services installed
|
||||
----------------------------------------------------------
|
32
k8s/helm/apigwmm/templates/_helpers.tpl
Normal file
32
k8s/helm/apigwmm/templates/_helpers.tpl
Normal file
@ -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 -}}
|
53
k8s/helm/apigwmm/templates/_names.tpl
Normal file
53
k8s/helm/apigwmm/templates/_names.tpl
Normal file
@ -0,0 +1,53 @@
|
||||
{{- 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" -}}
|
||||
{{- $name := first .}}
|
||||
{{- $ctx := last .}}
|
||||
{{- if $ctx.Values.inf.k8s.suffix -}}
|
||||
{{- $suffix := include "suffix-name" $ctx -}}
|
||||
{{- printf "/%s-%s" $name $suffix -}}
|
||||
{{- else -}}
|
||||
{{- printf "/%s" $name -}}
|
||||
{{- 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 -}}
|
14
k8s/helm/apigwmm/templates/configmap.yaml
Normal file
14
k8s/helm/apigwmm/templates/configmap.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
{{- $name := include "apigwmm.fullname" . -}}
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: "cfg-{{ $name }}"
|
||||
labels:
|
||||
app: {{ template "apigwmm.name" . }}
|
||||
chart: {{ template "apigwmm.chart" .}}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
internalurls__identity: http://{{ .Values.app.svc.identity }}
|
||||
|
82
k8s/helm/apigwmm/templates/deployment.yaml
Normal file
82
k8s/helm/apigwmm/templates/deployment.yaml
Normal file
@ -0,0 +1,82 @@
|
||||
{{- $name := include "apigwmm.fullname" . -}}
|
||||
{{- $cfgname := printf "%s-%s" "cfg" $name -}}
|
||||
{{- $ocelotcfgname := printf "%s-%s" "ocelot" $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 }}
|
||||
spec:
|
||||
{{ if .Values.inf.registry -}}
|
||||
imagePullSecrets:
|
||||
- name: {{ .Values.inf.registry.secretName }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ $ocelotcfgname }}
|
||||
items:
|
||||
- key: configuration-mobile-marketing.json
|
||||
path: configuration.json
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /app/configuration
|
||||
env:
|
||||
- name: PATH_BASE
|
||||
value: {{ include "pathBase" (list .Values.app.ingress.entries.mobilemarketingapigw .) }}
|
||||
- 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 }}
|
||||
|
33
k8s/helm/apigwmm/templates/ingress.yaml
Normal file
33
k8s/helm/apigwmm/templates/ingress.yaml
Normal file
@ -0,0 +1,33 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $ingressPath := include "pathBase" (list .Values.app.ingress.entries.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 }}
|
||||
spec:
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
- {{ .Values.inf.k8s.dns }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.inf.k8s.dns }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $ingressPath }}
|
||||
backend:
|
||||
serviceName: {{ .Values.app.svc.mobilemarketingapigw }}
|
||||
servicePort: http
|
||||
{{- end }}
|
14
k8s/helm/apigwmm/templates/ocelot-cm.yaml
Normal file
14
k8s/helm/apigwmm/templates/ocelot-cm.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
{{- $name := include "apigwmm.fullname" . -}}
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: "ocelot-{{ $name }}"
|
||||
labels:
|
||||
app: {{ template "apigwmm.name" . }}
|
||||
chart: {{ template "apigwmm.chart" .}}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
{{ (.Files.Glob "configuration-mobile-marketing.json").AsConfig | indent 2 }}
|
||||
|
19
k8s/helm/apigwmm/templates/service.yaml
Normal file
19
k8s/helm/apigwmm/templates/service.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
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
|
||||
selector:
|
||||
app: {{ template "apigwmm.name" . }}
|
||||
release: {{ .Release.Name }}
|
39
k8s/helm/apigwmm/values.yaml
Normal file
39
k8s/helm/apigwmm/values.yaml
Normal file
@ -0,0 +1,39 @@
|
||||
replicaCount: 1
|
||||
clusterName: eshop-aks
|
||||
pathBase: /mobilemarketingapigw
|
||||
|
||||
image:
|
||||
repository: eshop/ocelotapigw
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
annotations: {}
|
||||
tls: []
|
||||
|
||||
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: urls__identity
|
||||
key: internalurls__identity
|
||||
# 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
|
||||
|
21
k8s/helm/apigwms/.helmignore
Normal file
21
k8s/helm/apigwms/.helmignore
Normal file
@ -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
|
5
k8s/helm/apigwms/Chart.yaml
Normal file
5
k8s/helm/apigwms/Chart.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for Kubernetes
|
||||
name: apigwms
|
||||
version: 0.1.0
|
142
k8s/helm/apigwms/configuration-mobile-shopping.json
Normal file
142
k8s/helm/apigwms/configuration-mobile-shopping.json
Normal file
@ -0,0 +1,142 @@
|
||||
{
|
||||
"ReRoutes": [
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "catalog",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
|
||||
"UpstreamHttpMethod": [ "GET" ]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "basket",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
|
||||
"UpstreamHttpMethod": [],
|
||||
"AuthenticationOptions": {
|
||||
"AuthenticationProviderKey": "IdentityApiKey",
|
||||
"AllowedScopes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "ordering",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
|
||||
"UpstreamHttpMethod": [],
|
||||
"AuthenticationOptions": {
|
||||
"AuthenticationProviderKey": "IdentityApiKey",
|
||||
"AllowedScopes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "mobileshoppingagg",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/{everything}",
|
||||
"UpstreamHttpMethod": [ "POST", "PUT", "GET" ],
|
||||
"AuthenticationOptions": {
|
||||
"AuthenticationProviderKey": "IdentityApiKey",
|
||||
"AllowedScopes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "ordering",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/orders-api/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "basket",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/basket-api/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "catalog",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/catalog-api/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "marketing",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/marketing-api/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "payment",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/payment-api/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "locations.api",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/location-api/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
}
|
||||
|
||||
],
|
||||
"GlobalConfiguration": {
|
||||
"RequestIdKey": "OcRequestId",
|
||||
"AdministrationPath": "/administration"
|
||||
}
|
||||
}
|
||||
|
2
k8s/helm/apigwms/templates/NOTES.txt
Normal file
2
k8s/helm/apigwms/templates/NOTES.txt
Normal file
@ -0,0 +1,2 @@
|
||||
eShop API Gateway for Mobile Shopping services installed
|
||||
--------------------------------------------------------
|
32
k8s/helm/apigwms/templates/_helpers.tpl
Normal file
32
k8s/helm/apigwms/templates/_helpers.tpl
Normal file
@ -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 -}}
|
54
k8s/helm/apigwms/templates/_names.tpl
Normal file
54
k8s/helm/apigwms/templates/_names.tpl
Normal file
@ -0,0 +1,54 @@
|
||||
{{- 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" -}}
|
||||
{{- $name := first .}}
|
||||
{{- $ctx := last .}}
|
||||
{{- if $ctx.Values.inf.k8s.suffix -}}
|
||||
{{- $suffix := include "suffix-name" $ctx -}}
|
||||
{{- printf "/%s-%s" $name $suffix -}}
|
||||
{{- else -}}
|
||||
{{- printf "/%s" $name -}}
|
||||
{{- 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 -}}
|
14
k8s/helm/apigwms/templates/configmap.yaml
Normal file
14
k8s/helm/apigwms/templates/configmap.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
{{- $name := include "apigwms.fullname" . -}}
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: "cfg-{{ $name }}"
|
||||
labels:
|
||||
app: {{ template "apigwms.name" . }}
|
||||
chart: {{ template "apigwms.chart" .}}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
internalurls__identity: http://{{ .Values.app.svc.identity }}
|
||||
|
82
k8s/helm/apigwms/templates/deployment.yaml
Normal file
82
k8s/helm/apigwms/templates/deployment.yaml
Normal file
@ -0,0 +1,82 @@
|
||||
{{- $name := include "apigwms.fullname" . -}}
|
||||
{{- $cfgname := printf "%s-%s" "cfg" $name -}}
|
||||
{{- $ocelotcfgname := printf "%s-%s" "ocelot" $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 }}
|
||||
spec:
|
||||
{{ if .Values.inf.registry -}}
|
||||
imagePullSecrets:
|
||||
- name: {{ .Values.inf.registry.secretName }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ $ocelotcfgname }}
|
||||
items:
|
||||
- key: configuration-mobile-shopping.json
|
||||
path: configuration.json
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /app/configuration
|
||||
env:
|
||||
- name: PATH_BASE
|
||||
value: {{ include "pathBase" (list .Values.app.ingress.entries.mobileshoppingapigw .) }}
|
||||
- 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 }}
|
||||
|
33
k8s/helm/apigwms/templates/ingress.yaml
Normal file
33
k8s/helm/apigwms/templates/ingress.yaml
Normal file
@ -0,0 +1,33 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $ingressPath := include "pathBase" (list .Values.app.ingress.entries.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 }}
|
||||
spec:
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
- {{ .Values.inf.k8s.dns }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.inf.k8s.dns }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $ingressPath }}
|
||||
backend:
|
||||
serviceName: {{ .Values.app.svc.mobileshoppingapigw }}
|
||||
servicePort: http
|
||||
{{- end }}
|
14
k8s/helm/apigwms/templates/ocelot-cm.yaml
Normal file
14
k8s/helm/apigwms/templates/ocelot-cm.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
{{- $name := include "apigwms.fullname" . -}}
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: "ocelot-{{ $name }}"
|
||||
labels:
|
||||
app: {{ template "apigwms.name" . }}
|
||||
chart: {{ template "apigwms.chart" .}}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
{{ (.Files.Glob "configuration-mobile-shopping.json").AsConfig | indent 2 }}
|
||||
|
19
k8s/helm/apigwms/templates/service.yaml
Normal file
19
k8s/helm/apigwms/templates/service.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
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
|
||||
selector:
|
||||
app: {{ template "apigwms.name" . }}
|
||||
release: {{ .Release.Name }}
|
39
k8s/helm/apigwms/values.yaml
Normal file
39
k8s/helm/apigwms/values.yaml
Normal file
@ -0,0 +1,39 @@
|
||||
replicaCount: 1
|
||||
clusterName: eshop-aks
|
||||
pathBase: /mobileshoppingapigw
|
||||
|
||||
image:
|
||||
repository: eshop/ocelotapigw
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
annotations: {}
|
||||
tls: []
|
||||
|
||||
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: urls__identity
|
||||
key: internalurls__identity
|
||||
# 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
|
||||
|
21
k8s/helm/apigwwm/.helmignore
Normal file
21
k8s/helm/apigwwm/.helmignore
Normal file
@ -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
|
5
k8s/helm/apigwwm/Chart.yaml
Normal file
5
k8s/helm/apigwwm/Chart.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for Kubernetes
|
||||
name: apigwwm
|
||||
version: 0.1.0
|
34
k8s/helm/apigwwm/configuration-web-marketing.json
Normal file
34
k8s/helm/apigwwm/configuration-web-marketing.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"ReRoutes": [
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "marketing",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{version}/m/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "locations",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{version}/l/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
}
|
||||
|
||||
],
|
||||
"GlobalConfiguration": {
|
||||
"RequestIdKey": "OcRequestId",
|
||||
"AdministrationPath": "/administration"
|
||||
}
|
||||
}
|
||||
|
2
k8s/helm/apigwwm/templates/NOTES.txt
Normal file
2
k8s/helm/apigwwm/templates/NOTES.txt
Normal file
@ -0,0 +1,2 @@
|
||||
eShop API Gateway for Web Marketing services installed
|
||||
------------------------------------------------------
|
32
k8s/helm/apigwwm/templates/_helpers.tpl
Normal file
32
k8s/helm/apigwwm/templates/_helpers.tpl
Normal file
@ -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 -}}
|
54
k8s/helm/apigwwm/templates/_names.tpl
Normal file
54
k8s/helm/apigwwm/templates/_names.tpl
Normal file
@ -0,0 +1,54 @@
|
||||
{{- 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" -}}
|
||||
{{- $name := first .}}
|
||||
{{- $ctx := last .}}
|
||||
{{- if $ctx.Values.inf.k8s.suffix -}}
|
||||
{{- $suffix := include "suffix-name" $ctx -}}
|
||||
{{- printf "/%s-%s" $name $suffix -}}
|
||||
{{- else -}}
|
||||
{{- printf "/%s" $name -}}
|
||||
{{- 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 -}}
|
14
k8s/helm/apigwwm/templates/configmap.yaml
Normal file
14
k8s/helm/apigwwm/templates/configmap.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
{{- $name := include "apigwwm.fullname" . -}}
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: "cfg-{{ $name }}"
|
||||
labels:
|
||||
app: {{ template "apigwwm.name" . }}
|
||||
chart: {{ template "apigwwm.chart" .}}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
internalurls__identity: http://{{ .Values.app.svc.identity }}
|
||||
|
82
k8s/helm/apigwwm/templates/deployment.yaml
Normal file
82
k8s/helm/apigwwm/templates/deployment.yaml
Normal file
@ -0,0 +1,82 @@
|
||||
{{- $name := include "apigwwm.fullname" . -}}
|
||||
{{- $cfgname := printf "%s-%s" "cfg" $name -}}
|
||||
{{- $ocelotcfgname := printf "%s-%s" "ocelot" $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 }}
|
||||
spec:
|
||||
{{ if .Values.inf.registry -}}
|
||||
imagePullSecrets:
|
||||
- name: {{ .Values.inf.registry.secretName }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ $ocelotcfgname }}
|
||||
items:
|
||||
- key: configuration-web-marketing.json
|
||||
path: configuration.json
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /app/configuration
|
||||
env:
|
||||
- name: PATH_BASE
|
||||
value: {{ include "pathBase" (list .Values.app.ingress.entries.webmarketingapigw .) }}
|
||||
- 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 }}
|
||||
|
33
k8s/helm/apigwwm/templates/ingress.yaml
Normal file
33
k8s/helm/apigwwm/templates/ingress.yaml
Normal file
@ -0,0 +1,33 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $ingressPath := include "pathBase" (list .Values.app.ingress.entries.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 }}
|
||||
spec:
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
- {{ .Values.inf.k8s.dns }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.inf.k8s.dns }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $ingressPath }}
|
||||
backend:
|
||||
serviceName: {{ .Values.app.svc.webmarketingapigw }}
|
||||
servicePort: http
|
||||
{{- end }}
|
14
k8s/helm/apigwwm/templates/ocelot-cm.yaml
Normal file
14
k8s/helm/apigwwm/templates/ocelot-cm.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
{{- $name := include "apigwwm.fullname" . -}}
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: "ocelot-{{ $name }}"
|
||||
labels:
|
||||
app: {{ template "apigwwm.name" . }}
|
||||
chart: {{ template "apigwwm.chart" .}}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
{{ (.Files.Glob "configuration-web-marketing.json").AsConfig | indent 2 -}}
|
||||
|
19
k8s/helm/apigwwm/templates/service.yaml
Normal file
19
k8s/helm/apigwwm/templates/service.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
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
|
||||
selector:
|
||||
app: {{ template "apigwwm.name" . }}
|
||||
release: {{ .Release.Name }}
|
39
k8s/helm/apigwwm/values.yaml
Normal file
39
k8s/helm/apigwwm/values.yaml
Normal file
@ -0,0 +1,39 @@
|
||||
replicaCount: 1
|
||||
clusterName: eshop-aks
|
||||
pathBase: /webmarketingapigw
|
||||
|
||||
image:
|
||||
repository: eshop/ocelotapigw
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
annotations: {}
|
||||
tls: []
|
||||
|
||||
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: urls__identity
|
||||
key: internalurls__identity
|
||||
# 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
|
||||
|
21
k8s/helm/apigwws/.helmignore
Normal file
21
k8s/helm/apigwws/.helmignore
Normal file
@ -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
|
5
k8s/helm/apigwws/Chart.yaml
Normal file
5
k8s/helm/apigwws/Chart.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for Kubernetes
|
||||
name: apigwws
|
||||
version: 0.1.0
|
154
k8s/helm/apigwws/configuration-web-shopping.json
Normal file
154
k8s/helm/apigwws/configuration-web-shopping.json
Normal file
@ -0,0 +1,154 @@
|
||||
{
|
||||
"ReRoutes": [
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "catalog",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{version}/c/{everything}",
|
||||
"UpstreamHttpMethod": [ "GET" ]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "basket",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
|
||||
"UpstreamHttpMethod": [],
|
||||
"AuthenticationOptions": {
|
||||
"AuthenticationProviderKey": "IdentityApiKey",
|
||||
"AllowedScopes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{version}/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "ordering",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{version}/o/{everything}",
|
||||
"UpstreamHttpMethod": [],
|
||||
"AuthenticationOptions": {
|
||||
"AuthenticationProviderKey": "IdentityApiKey",
|
||||
"AllowedScopes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "webshoppingagg",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/{everything}",
|
||||
"UpstreamHttpMethod": [ "POST", "PUT", "GET" ],
|
||||
"AuthenticationOptions": {
|
||||
"AuthenticationProviderKey": "IdentityApiKey",
|
||||
"AllowedScopes": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "ordering",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/orders-api/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "ordering-signalrhub",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/hub/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "basket",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/basket-api/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "catalog",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/catalog-api/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "marketing",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/marketing-api/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "payment",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/payment-api/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "locations.api",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/location-api/{everything}",
|
||||
"UpstreamHttpMethod": []
|
||||
}
|
||||
|
||||
],
|
||||
"GlobalConfiguration": {
|
||||
"RequestIdKey": "OcRequestId",
|
||||
"AdministrationPath": "/administration"
|
||||
}
|
||||
}
|
||||
|
2
k8s/helm/apigwws/templates/NOTES.txt
Normal file
2
k8s/helm/apigwws/templates/NOTES.txt
Normal file
@ -0,0 +1,2 @@
|
||||
eShop API Gateway for Web Shopping services installed
|
||||
-----------------------------------------------------
|
32
k8s/helm/apigwws/templates/_helpers.tpl
Normal file
32
k8s/helm/apigwws/templates/_helpers.tpl
Normal file
@ -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 -}}
|
53
k8s/helm/apigwws/templates/_names.tpl
Normal file
53
k8s/helm/apigwws/templates/_names.tpl
Normal file
@ -0,0 +1,53 @@
|
||||
{{- 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" -}}
|
||||
{{- $name := first .}}
|
||||
{{- $ctx := last .}}
|
||||
{{- if $ctx.Values.inf.k8s.suffix -}}
|
||||
{{- $suffix := include "suffix-name" $ctx -}}
|
||||
{{- printf "/%s-%s" $name $suffix -}}
|
||||
{{- else -}}
|
||||
{{- printf "/%s" $name -}}
|
||||
{{- 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 -}}
|
14
k8s/helm/apigwws/templates/configmap.yaml
Normal file
14
k8s/helm/apigwws/templates/configmap.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
{{- $name := include "apigwws.fullname" . -}}
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: "cfg-{{ $name }}"
|
||||
labels:
|
||||
app: {{ template "apigwws.name" . }}
|
||||
chart: {{ template "apigwws.chart" .}}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
internalurls__identity: http://{{ .Values.app.svc.identity }}
|
||||
|
82
k8s/helm/apigwws/templates/deployment.yaml
Normal file
82
k8s/helm/apigwws/templates/deployment.yaml
Normal file
@ -0,0 +1,82 @@
|
||||
{{- $name := include "apigwws.fullname" . -}}
|
||||
{{- $cfgname := printf "%s-%s" "cfg" $name -}}
|
||||
{{- $ocelotcfgname := printf "%s-%s" "ocelot" $name -}}
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "apigwws.fullname" . }}
|
||||
labels:
|
||||
ufo: {{ $cfgname}}
|
||||
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 }}
|
||||
spec:
|
||||
{{ if .Values.inf.registry -}}
|
||||
imagePullSecrets:
|
||||
- name: {{ .Values.inf.registry.secretName }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ $ocelotcfgname }}
|
||||
items:
|
||||
- key: configuration-web-shopping.json
|
||||
path: configuration.json
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /app/configuration
|
||||
env:
|
||||
- name: PATH_BASE
|
||||
value: {{ include "pathBase" (list .Values.app.ingress.entries.webshoppingapigw .) }}
|
||||
- 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 }}
|
||||
|
33
k8s/helm/apigwws/templates/ingress.yaml
Normal file
33
k8s/helm/apigwws/templates/ingress.yaml
Normal file
@ -0,0 +1,33 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $ingressPath := include "pathBase" (list .Values.app.ingress.entries.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 }}
|
||||
spec:
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
- {{ .Values.inf.k8s.dns }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.inf.k8s.dns }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $ingressPath }}
|
||||
backend:
|
||||
serviceName: {{ .Values.app.svc.webshoppingapigw }}
|
||||
servicePort: http
|
||||
{{- end }}
|
14
k8s/helm/apigwws/templates/ocelot-cm.yaml
Normal file
14
k8s/helm/apigwws/templates/ocelot-cm.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
{{- $name := include "apigwws.fullname" . -}}
|
||||
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: "ocelot-{{ $name }}"
|
||||
labels:
|
||||
app: {{ template "apigwws.name" . }}
|
||||
chart: {{ template "apigwws.chart" .}}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
data:
|
||||
{{ (.Files.Glob "configuration-web-shopping.json").AsConfig | indent 2 }}
|
||||
|
19
k8s/helm/apigwws/templates/service.yaml
Normal file
19
k8s/helm/apigwws/templates/service.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
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
|
||||
selector:
|
||||
app: {{ template "apigwws.name" . }}
|
||||
release: {{ .Release.Name }}
|
39
k8s/helm/apigwws/values.yaml
Normal file
39
k8s/helm/apigwws/values.yaml
Normal file
@ -0,0 +1,39 @@
|
||||
replicaCount: 1
|
||||
clusterName: eshop-aks
|
||||
pathBase: /webshoppingapigw
|
||||
|
||||
image:
|
||||
repository: eshop/ocelotapigw
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
annotations: {}
|
||||
tls: []
|
||||
|
||||
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: urls__identity
|
||||
key: internalurls__identity
|
||||
# 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
|
||||
|
43
k8s/helm/app.yaml
Normal file
43
k8s/helm/app.yaml
Normal file
@ -0,0 +1,43 @@
|
||||
# This heml 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
|
||||
svc:
|
||||
basket: basket # service name for basket api
|
||||
catalog: catalog # service name for catalog api
|
||||
ordering: ordering # service name for ordering api
|
||||
orderingbackgroundtasks: orderingbackgroundtasks # service name for orderingbackgroundtasks
|
||||
orderingsignalrhub: orderingsignalrhub # service name for orderingsignalrhub
|
||||
identity: identity # 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 # service name for payment api
|
||||
locations: locations # service name for locations api
|
||||
marketing: marketing # service name for marketing ap
|
21
k8s/helm/basket-api/.helmignore
Normal file
21
k8s/helm/basket-api/.helmignore
Normal file
@ -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
|
5
k8s/helm/basket-api/Chart.yaml
Normal file
5
k8s/helm/basket-api/Chart.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for Kubernetes
|
||||
name: basket-api
|
||||
version: 0.1.0
|
8
k8s/helm/basket-api/templates/NOTES.txt
Normal file
8
k8s/helm/basket-api/templates/NOTES.txt
Normal file
@ -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
|
32
k8s/helm/basket-api/templates/_helpers.tpl
Normal file
32
k8s/helm/basket-api/templates/_helpers.tpl
Normal file
@ -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 -}}
|
52
k8s/helm/basket-api/templates/_names.tpl
Normal file
52
k8s/helm/basket-api/templates/_names.tpl
Normal file
@ -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 -}}
|
19
k8s/helm/basket-api/templates/configmap.yaml
Normal file
19
k8s/helm/basket-api/templates/configmap.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
{{- $name := include "basket-api.fullname" . -}}
|
||||
{{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}}
|
||||
|
||||
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://{{ $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 }}"
|
71
k8s/helm/basket-api/templates/deployment.yaml
Normal file
71
k8s/helm/basket-api/templates/deployment.yaml
Normal file
@ -0,0 +1,71 @@
|
||||
{{- $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 }}
|
||||
spec:
|
||||
{{ if .Values.inf.registry -}}
|
||||
imagePullSecrets:
|
||||
- name: {{ .Values.inf.registry.secretName }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
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 }}
|
||||
|
19
k8s/helm/basket-api/templates/service.yaml
Normal file
19
k8s/helm/basket-api/templates/service.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
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
|
||||
selector:
|
||||
app: {{ template "basket-api.name" . }}
|
||||
release: {{ .Release.Name }}
|
43
k8s/helm/basket-api/values.yaml
Normal file
43
k8s/helm/basket-api/values.yaml
Normal file
@ -0,0 +1,43 @@
|
||||
replicaCount: 1
|
||||
clusterName: eshop-aks
|
||||
pathBase: /basket-api
|
||||
|
||||
image:
|
||||
repository: eshop/basket.api
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
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'
|
21
k8s/helm/basket-data/.helmignore
Normal file
21
k8s/helm/basket-data/.helmignore
Normal file
@ -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
|
5
k8s/helm/basket-data/Chart.yaml
Normal file
5
k8s/helm/basket-data/Chart.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for Kubernetes
|
||||
name: basket-data
|
||||
version: 0.1.0
|
8
k8s/helm/basket-data/templates/NOTES.txt
Normal file
8
k8s/helm/basket-data/templates/NOTES.txt
Normal file
@ -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
|
32
k8s/helm/basket-data/templates/_helpers.tpl
Normal file
32
k8s/helm/basket-data/templates/_helpers.tpl
Normal file
@ -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 -}}
|
43
k8s/helm/basket-data/templates/deployment.yaml
Normal file
43
k8s/helm/basket-data/templates/deployment.yaml
Normal file
@ -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 }}
|
19
k8s/helm/basket-data/templates/service.yaml
Normal file
19
k8s/helm/basket-data/templates/service.yaml
Normal file
@ -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 }}
|
19
k8s/helm/basket-data/values.yaml
Normal file
19
k8s/helm/basket-data/values.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: redis
|
||||
tag: 4.0.10
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 6379
|
||||
|
||||
|
||||
resources: {}
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
21
k8s/helm/catalog-api/.helmignore
Normal file
21
k8s/helm/catalog-api/.helmignore
Normal file
@ -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
|
5
k8s/helm/catalog-api/Chart.yaml
Normal file
5
k8s/helm/catalog-api/Chart.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for Kubernetes
|
||||
name: catalog-api
|
||||
version: 0.1.0
|
9
k8s/helm/catalog-api/templates/NOTES.txt
Normal file
9
k8s/helm/catalog-api/templates/NOTES.txt
Normal file
@ -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
|
||||
|
32
k8s/helm/catalog-api/templates/_helpers.tpl
Normal file
32
k8s/helm/catalog-api/templates/_helpers.tpl
Normal file
@ -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 -}}
|
52
k8s/helm/catalog-api/templates/_names.tpl
Normal file
52
k8s/helm/catalog-api/templates/_names.tpl
Normal file
@ -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 -}}
|
20
k8s/helm/catalog-api/templates/configmap.yaml
Normal file
20
k8s/helm/catalog-api/templates/configmap.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
{{- $name := include "catalog-api.fullname" . -}}
|
||||
{{- $sqlsrv := include "sql-name" . -}}
|
||||
{{- $webshoppingapigw := include "url-of" (list .Values.app.ingress.entries.webshoppingapigw .) -}}
|
||||
|
||||
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: http://{{ $webshoppingapigw }}/api/v1/c/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 }}"
|
71
k8s/helm/catalog-api/templates/deployment.yaml
Normal file
71
k8s/helm/catalog-api/templates/deployment.yaml
Normal file
@ -0,0 +1,71 @@
|
||||
{{- $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 }}
|
||||
spec:
|
||||
{{ if .Values.inf.registry -}}
|
||||
imagePullSecrets:
|
||||
- name: {{ .Values.inf.registry.secretName }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
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 }}
|
||||
|
19
k8s/helm/catalog-api/templates/service.yaml
Normal file
19
k8s/helm/catalog-api/templates/service.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
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
|
||||
selector:
|
||||
app: {{ template "catalog-api.name" . }}
|
||||
release: {{ .Release.Name }}
|
47
k8s/helm/catalog-api/values.yaml
Normal file
47
k8s/helm/catalog-api/values.yaml
Normal file
@ -0,0 +1,47 @@
|
||||
replicaCount: 1
|
||||
clusterName: eshop-aks
|
||||
pathBase: /catalog-api
|
||||
|
||||
image:
|
||||
repository: eshop/catalog.api
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
|
||||
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'
|
||||
|
81
k8s/helm/deploy-all.ps1
Normal file
81
k8s/helm/deploy-all.ps1
Normal file
@ -0,0 +1,81 @@
|
||||
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]$clean=$true,
|
||||
[parameter(Mandatory=$false)][string]$aksName="",
|
||||
[parameter(Mandatory=$false)][string]$aksRg="",
|
||||
[parameter(Mandatory=$false)][string]$imageTag="latest"
|
||||
)
|
||||
|
||||
$dns = $externalDns
|
||||
|
||||
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 ($clean) {
|
||||
Write-Host "Cleaning previous helm releases..." -ForegroundColor Green
|
||||
helm delete --purge $(helm ls -q)
|
||||
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", "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")
|
||||
|
||||
if ($deployInfrastructure) {
|
||||
foreach ($infra in $infras) {
|
||||
Write-Host "Installing infrastructure: $infra" -ForegroundColor Green
|
||||
helm install --values app.yaml --values inf.yaml --values ingress_values.yaml --set app.name=$appName --set inf.k8s.dns=$dns --name="$appName-$infra" $infra
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($chart in $charts) {
|
||||
Write-Host "Installing: $chart" -ForegroundColor Green
|
||||
if ($useCustomRegistry) {
|
||||
helm install --set inf.registry.server=$registry --set inf.registry.login=$dockerUser --set inf.registry.pwd=$dockerPassword --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values ingress_values.yaml --set app.name=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart
|
||||
}
|
||||
else {
|
||||
if ($chart -ne "eshop-common") { # eshop-common is ignored when no secret must be deployed
|
||||
helm install --values app.yaml --values inf.yaml --values ingress_values.yaml --set app.name=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "helm charts installed." -ForegroundColor Green
|
||||
|
||||
|
||||
|
||||
|
21
k8s/helm/eshop-common/.helmignore
Normal file
21
k8s/helm/eshop-common/.helmignore
Normal file
@ -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
|
5
k8s/helm/eshop-common/Chart.yaml
Normal file
5
k8s/helm/eshop-common/Chart.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for Kubernetes
|
||||
name: eshop-common
|
||||
version: 0.1.0
|
7
k8s/helm/eshop-common/templates/NOTES.txt
Normal file
7
k8s/helm/eshop-common/templates/NOTES.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Common eShop resources installed:
|
||||
|
||||
{{- if .Values.inf.registry -}}
|
||||
* Docker registry secret ({{ .Values.inf.registry.secretName }})
|
||||
{{- end -}}
|
||||
|
||||
+++ Done +++
|
32
k8s/helm/eshop-common/templates/_helpers.tpl
Normal file
32
k8s/helm/eshop-common/templates/_helpers.tpl
Normal file
@ -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 -}}
|
3
k8s/helm/eshop-common/templates/_names.tpl
Normal file
3
k8s/helm/eshop-common/templates/_names.tpl
Normal file
@ -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 }}
|
9
k8s/helm/eshop-common/templates/secret.yaml
Normal file
9
k8s/helm/eshop-common/templates/secret.yaml
Normal file
@ -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
k8s/helm/eshop-common/values.yaml
Normal file
0
k8s/helm/eshop-common/values.yaml
Normal file
21
k8s/helm/identity-api/.helmignore
Normal file
21
k8s/helm/identity-api/.helmignore
Normal file
@ -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
|
5
k8s/helm/identity-api/Chart.yaml
Normal file
5
k8s/helm/identity-api/Chart.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for Kubernetes
|
||||
name: identity-api
|
||||
version: 0.1.0
|
4
k8s/helm/identity-api/templates/NOTES.txt
Normal file
4
k8s/helm/identity-api/templates/NOTES.txt
Normal file
@ -0,0 +1,4 @@
|
||||
eShop Identity API installed.
|
||||
-----------------------------
|
||||
|
||||
Access this API through ingress.
|
32
k8s/helm/identity-api/templates/_helpers.tpl
Normal file
32
k8s/helm/identity-api/templates/_helpers.tpl
Normal file
@ -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 -}}
|
51
k8s/helm/identity-api/templates/_names.tpl
Normal file
51
k8s/helm/identity-api/templates/_names.tpl
Normal file
@ -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 -}}
|
35
k8s/helm/identity-api/templates/configmap.yaml
Normal file
35
k8s/helm/identity-api/templates/configmap.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
{{- $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" .) -}}
|
||||
|
||||
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 }}
|
||||
|
71
k8s/helm/identity-api/templates/deployment.yaml
Normal file
71
k8s/helm/identity-api/templates/deployment.yaml
Normal file
@ -0,0 +1,71 @@
|
||||
{{- $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 }}
|
||||
spec:
|
||||
{{ if .Values.inf.registry -}}
|
||||
imagePullSecrets:
|
||||
- name: {{ .Values.inf.registry.secretName }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
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 }}
|
||||
|
33
k8s/helm/identity-api/templates/ingress.yaml
Normal file
33
k8s/helm/identity-api/templates/ingress.yaml
Normal file
@ -0,0 +1,33 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $ingressPath := include "pathBase" . -}}
|
||||
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 }}
|
||||
spec:
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
- {{ .Values.inf.k8s.dns }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.inf.k8s.dns }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $ingressPath }}
|
||||
backend:
|
||||
serviceName: {{ .Values.app.svc.identity }}
|
||||
servicePort: http
|
||||
{{- end }}
|
19
k8s/helm/identity-api/templates/service.yaml
Normal file
19
k8s/helm/identity-api/templates/service.yaml
Normal file
@ -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 }}
|
64
k8s/helm/identity-api/values.yaml
Normal file
64
k8s/helm/identity-api/values.yaml
Normal file
@ -0,0 +1,64 @@
|
||||
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
|
||||
values:
|
||||
- name: ASPNETCORE_ENVIRONMENT
|
||||
value: Development
|
||||
- name: OrchestratorType
|
||||
value: 'K8S'
|
||||
- name: IsClusterEnv
|
||||
value: 'True'
|
||||
|
46
k8s/helm/inf.yaml
Normal file
46
k8s/helm/inf.yaml
Normal file
@ -0,0 +1,46 @@
|
||||
# This heml values file defines all infrastructure used by eShopOnContainers.
|
||||
# It is used on all charts, so ** MUST BE INCLUDED ** on every deployment
|
||||
|
||||
inf:
|
||||
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
|
||||
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
|
||||
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
|
||||
|
5
k8s/helm/ingress_values.yaml
Normal file
5
k8s/helm/ingress_values.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
ingress:
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: addon-http-application-routing
|
||||
ingress.kubernetes.io/ssl-redirect: "false"
|
||||
nginx.ingress.kubernetes.io/ssl-redirect: "false"
|
21
k8s/helm/keystore-data/.helmignore
Normal file
21
k8s/helm/keystore-data/.helmignore
Normal file
@ -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
|
5
k8s/helm/keystore-data/Chart.yaml
Normal file
5
k8s/helm/keystore-data/Chart.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for Kubernetes
|
||||
name: keystore-data
|
||||
version: 0.1.0
|
8
k8s/helm/keystore-data/templates/NOTES.txt
Normal file
8
k8s/helm/keystore-data/templates/NOTES.txt
Normal file
@ -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 "keystore-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
|
32
k8s/helm/keystore-data/templates/_helpers.tpl
Normal file
32
k8s/helm/keystore-data/templates/_helpers.tpl
Normal file
@ -0,0 +1,32 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "keystore-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 "keystore-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 "keystore-data.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
43
k8s/helm/keystore-data/templates/deployment.yaml
Normal file
43
k8s/helm/keystore-data/templates/deployment.yaml
Normal file
@ -0,0 +1,43 @@
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "keystore-data.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "keystore-data.name" . }}
|
||||
chart: {{ template "keystore-data.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ template "keystore-data.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "keystore-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 }}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user