diff --git a/k8s/helm/app.yaml b/k8s/helm/app.yaml new file mode 100644 index 000000000..92a878363 --- /dev/null +++ b/k8s/helm/app.yaml @@ -0,0 +1,7 @@ +# This heml values file defines app-based settings +# Charts use those values, so this file must be included in all chart releases + +app: + name: "my-eshop" # Override for custom application names. + ingress: + suffix: false # if true ingress endpoints are suffixed with .Values.appName value (or .Release.Name if the 1st do not exist) \ No newline at end of file diff --git a/k8s/helm/basket-api/.helmignore b/k8s/helm/basket-api/.helmignore new file mode 100644 index 000000000..f0c131944 --- /dev/null +++ b/k8s/helm/basket-api/.helmignore @@ -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 diff --git a/k8s/helm/basket-api/Chart.yaml b/k8s/helm/basket-api/Chart.yaml new file mode 100644 index 000000000..fd3e01486 --- /dev/null +++ b/k8s/helm/basket-api/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for Kubernetes +name: basket-api +version: 0.1.0 diff --git a/k8s/helm/basket-api/templates/NOTES.txt b/k8s/helm/basket-api/templates/NOTES.txt new file mode 100644 index 000000000..ea08df066 --- /dev/null +++ b/k8s/helm/basket-api/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "basket-api.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ template "basket-api.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "basket-api.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + 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 +{{- end }} diff --git a/k8s/helm/basket-api/templates/_helpers.tpl b/k8s/helm/basket-api/templates/_helpers.tpl new file mode 100644 index 000000000..550eb2e6c --- /dev/null +++ b/k8s/helm/basket-api/templates/_helpers.tpl @@ -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 -}} diff --git a/k8s/helm/basket-api/templates/_names.tpl b/k8s/helm/basket-api/templates/_names.tpl new file mode 100644 index 000000000..56d0cac88 --- /dev/null +++ b/k8s/helm/basket-api/templates/_names.tpl @@ -0,0 +1,33 @@ +{{- 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 "url-identity" -}} +{{- if .Values.app.ingress.suffix -}} +{{- $suffix := include "suffix-name" . -}} +{{- printf "%s/identity-api-%s" .Values.inf.k8s.dns $suffix -}} +{{- else -}} +{{- printf "%s/identity-api" .Values.inf.k8s.dns -}} +{{- end -}} +{{- end -}} + +{{ define "pathBase" -}} +{{- if .Values.app.ingress.suffix -}} +{{- $suffix := include "suffix-name" . -}} +{{- printf "%s-%s" .Values.pathBase $suffix -}} +{{- else -}} +{{- .Values.pathBase -}} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/k8s/helm/basket-api/templates/configmap.yaml b/k8s/helm/basket-api/templates/configmap.yaml new file mode 100644 index 000000000..ae2f0d241 --- /dev/null +++ b/k8s/helm/basket-api/templates/configmap.yaml @@ -0,0 +1,19 @@ +{{- $name := include "basket-api.fullname" . -}} +{{- $identity := include "url-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 }}" \ No newline at end of file diff --git a/k8s/helm/basket-api/templates/deployment.yaml b/k8s/helm/basket-api/templates/deployment.yaml new file mode 100644 index 000000000..911818231 --- /dev/null +++ b/k8s/helm/basket-api/templates/deployment.yaml @@ -0,0 +1,73 @@ +{{- $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.imagePullSecrets -}} + imagePullSecrets: + {{ range .Values.imagePullSecrets -}} + - name: {{ .name }} + {{- end -}} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .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 }} + diff --git a/k8s/helm/basket-api/templates/ingress.yaml b/k8s/helm/basket-api/templates/ingress.yaml new file mode 100644 index 000000000..9a47bb33f --- /dev/null +++ b/k8s/helm/basket-api/templates/ingress.yaml @@ -0,0 +1,38 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "basket-api.fullname" . -}} +{{- $ingressPath := include "pathBase" . -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + app: {{ template "basket-api.name" . }} + chart: {{ template "basket-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: + {{- range .hosts }} + - {{ . }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $fullName }} + servicePort: http + {{- end }} +{{- end }} diff --git a/k8s/helm/basket-api/templates/service.yaml b/k8s/helm/basket-api/templates/service.yaml new file mode 100644 index 000000000..c3b4be3e3 --- /dev/null +++ b/k8s/helm/basket-api/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "basket-api.fullname" . }} + 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 }} diff --git a/k8s/helm/basket-api/values.yaml b/k8s/helm/basket-api/values.yaml new file mode 100644 index 000000000..c5d8ab1d8 --- /dev/null +++ b/k8s/helm/basket-api/values.yaml @@ -0,0 +1,64 @@ +replicaCount: 1 +clusterName: eshop-aks +pathBase: /basket-api + +image: + repository: eshop/basket.api + tag: latest + pullPolicy: IfNotPresent + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + annotations: {} + hosts: + - chart-example.local + tls: [] + +inf: # inf - see comments in ../inf.yaml file for info + redis: + basket: + constr: basket-data + eventbus: + constr: rabbitmq + useAzure: false + appinsights: + key: "" + k8s: + dns: "" + misc: + useLoadTest: false + +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' diff --git a/k8s/helm/catalog-api/.helmignore b/k8s/helm/catalog-api/.helmignore new file mode 100644 index 000000000..f0c131944 --- /dev/null +++ b/k8s/helm/catalog-api/.helmignore @@ -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 diff --git a/k8s/helm/catalog-api/Chart.yaml b/k8s/helm/catalog-api/Chart.yaml new file mode 100644 index 000000000..a143a0afe --- /dev/null +++ b/k8s/helm/catalog-api/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for Kubernetes +name: catalog-api +version: 0.1.0 diff --git a/k8s/helm/catalog-api/templates/NOTES.txt b/k8s/helm/catalog-api/templates/NOTES.txt new file mode 100644 index 000000000..a44a24644 --- /dev/null +++ b/k8s/helm/catalog-api/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "catalog-api.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ template "catalog-api.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "catalog-api.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + 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 +{{- end }} diff --git a/k8s/helm/catalog-api/templates/_helpers.tpl b/k8s/helm/catalog-api/templates/_helpers.tpl new file mode 100644 index 000000000..6fd128e77 --- /dev/null +++ b/k8s/helm/catalog-api/templates/_helpers.tpl @@ -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 -}} diff --git a/k8s/helm/catalog-api/templates/_names.tpl b/k8s/helm/catalog-api/templates/_names.tpl new file mode 100644 index 000000000..56d0cac88 --- /dev/null +++ b/k8s/helm/catalog-api/templates/_names.tpl @@ -0,0 +1,33 @@ +{{- 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 "url-identity" -}} +{{- if .Values.app.ingress.suffix -}} +{{- $suffix := include "suffix-name" . -}} +{{- printf "%s/identity-api-%s" .Values.inf.k8s.dns $suffix -}} +{{- else -}} +{{- printf "%s/identity-api" .Values.inf.k8s.dns -}} +{{- end -}} +{{- end -}} + +{{ define "pathBase" -}} +{{- if .Values.app.ingress.suffix -}} +{{- $suffix := include "suffix-name" . -}} +{{- printf "%s-%s" .Values.pathBase $suffix -}} +{{- else -}} +{{- .Values.pathBase -}} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/k8s/helm/catalog-api/templates/configmap.yaml b/k8s/helm/catalog-api/templates/configmap.yaml new file mode 100644 index 000000000..75cf686f9 --- /dev/null +++ b/k8s/helm/catalog-api/templates/configmap.yaml @@ -0,0 +1,19 @@ +{{- $name := include "catalog-api.fullname" . -}} +{{- $sqlsrv := include "sql-name" . -}} + +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.catalog.user }};Password={{ .Values.inf.sql.catalog.pwd }}; + catalog__PicBaseUrl: http://{{ .Values.inf.k8s.dns }}/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 }}" \ No newline at end of file diff --git a/k8s/helm/catalog-api/templates/deployment.yaml b/k8s/helm/catalog-api/templates/deployment.yaml new file mode 100644 index 000000000..d508cd3ae --- /dev/null +++ b/k8s/helm/catalog-api/templates/deployment.yaml @@ -0,0 +1,73 @@ +{{- $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.imagePullSecrets -}} + imagePullSecrets: + {{ range .Values.imagePullSecrets -}} + - name: {{ .name }} + {{- end -}} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .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 }} + diff --git a/k8s/helm/catalog-api/templates/ingress.yaml b/k8s/helm/catalog-api/templates/ingress.yaml new file mode 100644 index 000000000..0833fb717 --- /dev/null +++ b/k8s/helm/catalog-api/templates/ingress.yaml @@ -0,0 +1,38 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "catalog-api.fullname" . -}} +{{- $ingressPath := include "pathBase" . -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + app: {{ template "catalog-api.name" . }} + chart: {{ template "catalog-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: + {{- range .hosts }} + - {{ . }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . }} + http: + paths: + - path: {{ $ingressPath }} + backend: + serviceName: {{ $fullName }} + servicePort: http + {{- end }} +{{- end }} diff --git a/k8s/helm/catalog-api/templates/service.yaml b/k8s/helm/catalog-api/templates/service.yaml new file mode 100644 index 000000000..0291e6fac --- /dev/null +++ b/k8s/helm/catalog-api/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "catalog-api.fullname" . }} + 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 }} diff --git a/k8s/helm/catalog-api/values.yaml b/k8s/helm/catalog-api/values.yaml new file mode 100644 index 000000000..77fe93d19 --- /dev/null +++ b/k8s/helm/catalog-api/values.yaml @@ -0,0 +1,60 @@ +replicaCount: 1 +clusterName: eshop-aks +pathBase: /catalog-api + +image: + repository: eshop/catalog.api + tag: latest + pullPolicy: IfNotPresent + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + annotations: {} + hosts: + - chart-example.local + tls: [] + +inf: + sql: + catalog: + user: sa + pwd: Pass@word + db: CatalogDb + +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' + diff --git a/k8s/helm/inf.yaml b/k8s/helm/inf.yaml new file mode 100644 index 000000000..00be37261 --- /dev/null +++ b/k8s/helm/inf.yaml @@ -0,0 +1,23 @@ +# This heml values file defines all infrastructure used by eShopOnContainers. +# Any chart redefines its needed part, but this file allows an easy override of the whole infrastructure settings + +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-" will be used + catalog: # sql settings for the catalog-api sql (user, pwd, db) + user: sa # Catalog API SQL user + pwd: Pass@word # Catalog API SQL pwd + db: CatalogDb # Catalog API SQL db name + redis: # inf.redis defines the redis' connection strings + basket: + constr: basket-data # Connection string to Redis used by Basket API + eventbus: + constr: rabbitmq # Event bus connection strin g + 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 IP or DNS. Value MUST BE PROVIDED using --set (--set inf.k8s.dns=my-cluster-dns) + 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