diff --git a/k8s/helm/basket-api/templates/_names.tpl b/k8s/helm/basket-api/templates/_names.tpl index 56d0cac88..bbf3888d5 100644 --- a/k8s/helm/basket-api/templates/_names.tpl +++ b/k8s/helm/basket-api/templates/_names.tpl @@ -14,15 +14,19 @@ {{- end -}} {{- end -}} -{{- define "url-identity" -}} -{{- if .Values.app.ingress.suffix -}} -{{- $suffix := include "suffix-name" . -}} -{{- printf "%s/identity-api-%s" .Values.inf.k8s.dns $suffix -}} +{{- define "url-of" -}} +{{- $name := first .}} +{{- $ctx := last .}} +{{- if $ctx.Values.app.ingress.suffix -}} +{{- $suffix := include "suffix-name" $ctx -}} +{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{- else -}} -{{- printf "%s/identity-api" .Values.inf.k8s.dns -}} +{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{- end -}} {{- end -}} + + {{ define "pathBase" -}} {{- if .Values.app.ingress.suffix -}} {{- $suffix := include "suffix-name" . -}} diff --git a/k8s/helm/basket-api/templates/configmap.yaml b/k8s/helm/basket-api/templates/configmap.yaml index ae2f0d241..c851de359 100644 --- a/k8s/helm/basket-api/templates/configmap.yaml +++ b/k8s/helm/basket-api/templates/configmap.yaml @@ -1,5 +1,5 @@ {{- $name := include "basket-api.fullname" . -}} -{{- $identity := include "url-identity" . -}} +{{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}} apiVersion: v1 kind: ConfigMap diff --git a/k8s/helm/basket-api/values.yaml b/k8s/helm/basket-api/values.yaml index c5d8ab1d8..95ba3a9d9 100644 --- a/k8s/helm/basket-api/values.yaml +++ b/k8s/helm/basket-api/values.yaml @@ -18,20 +18,6 @@ ingress: - 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: {} diff --git a/k8s/helm/catalog-api/templates/_names.tpl b/k8s/helm/catalog-api/templates/_names.tpl index 56d0cac88..bbf3888d5 100644 --- a/k8s/helm/catalog-api/templates/_names.tpl +++ b/k8s/helm/catalog-api/templates/_names.tpl @@ -14,15 +14,19 @@ {{- end -}} {{- end -}} -{{- define "url-identity" -}} -{{- if .Values.app.ingress.suffix -}} -{{- $suffix := include "suffix-name" . -}} -{{- printf "%s/identity-api-%s" .Values.inf.k8s.dns $suffix -}} +{{- define "url-of" -}} +{{- $name := first .}} +{{- $ctx := last .}} +{{- if $ctx.Values.app.ingress.suffix -}} +{{- $suffix := include "suffix-name" $ctx -}} +{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{- else -}} -{{- printf "%s/identity-api" .Values.inf.k8s.dns -}} +{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{- end -}} {{- end -}} + + {{ define "pathBase" -}} {{- if .Values.app.ingress.suffix -}} {{- $suffix := include "suffix-name" . -}} diff --git a/k8s/helm/catalog-api/values.yaml b/k8s/helm/catalog-api/values.yaml index c2f164ce6..28d5c6521 100644 --- a/k8s/helm/catalog-api/values.yaml +++ b/k8s/helm/catalog-api/values.yaml @@ -18,23 +18,6 @@ ingress: - chart-example.local tls: [] -inf: - sql: - catalog: - user: sa - pwd: Pass@word - db: CatalogDb - eventbus: - constr: rabbitmq - useAzure: false - appinsights: - key: "" - k8s: - dns: "" - misc: - useAzureStorage: false - - resources: {} diff --git a/k8s/helm/eshoponcontainers/.helmignore b/k8s/helm/eshoponcontainers/.helmignore new file mode 100644 index 000000000..f0c131944 --- /dev/null +++ b/k8s/helm/eshoponcontainers/.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/eshoponcontainers/Chart.yaml b/k8s/helm/eshoponcontainers/Chart.yaml new file mode 100644 index 000000000..50190946e --- /dev/null +++ b/k8s/helm/eshoponcontainers/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: Umbrella Chart for eShopOnContainers +name: eshoponcontainers +version: 0.1.0 diff --git a/k8s/helm/eshoponcontainers/templates/NOTES.txt b/k8s/helm/eshoponcontainers/templates/NOTES.txt new file mode 100644 index 000000000..80822d767 --- /dev/null +++ b/k8s/helm/eshoponcontainers/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 "eshoponcontainers.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 "eshoponcontainers.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "eshoponcontainers.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 "eshoponcontainers.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/eshoponcontainers/templates/_helpers.tpl b/k8s/helm/eshoponcontainers/templates/_helpers.tpl new file mode 100644 index 000000000..e3175d5c1 --- /dev/null +++ b/k8s/helm/eshoponcontainers/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "eshoponcontainers.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 "eshoponcontainers.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 "eshoponcontainers.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/k8s/helm/eshoponcontainers/templates/_names.tpl b/k8s/helm/eshoponcontainers/templates/_names.tpl new file mode 100644 index 000000000..bbf3888d5 --- /dev/null +++ b/k8s/helm/eshoponcontainers/templates/_names.tpl @@ -0,0 +1,37 @@ +{{- 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-of" -}} +{{- $name := first .}} +{{- $ctx := last .}} +{{- if $ctx.Values.app.ingress.suffix -}} +{{- $suffix := include "suffix-name" $ctx -}} +{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} +{{- else -}} +{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} +{{- 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/eshoponcontainers/values.yaml b/k8s/helm/eshoponcontainers/values.yaml new file mode 100644 index 000000000..e931cf463 --- /dev/null +++ b/k8s/helm/eshoponcontainers/values.yaml @@ -0,0 +1,98 @@ +# Default values for eshoponcontainers. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + tag: stable + pullPolicy: IfNotPresent + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + path: / + hosts: + - chart-example.local + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +global: + app: # app global settings + name: "my-eshop" # Override for custom app name + ingress: # ingress related settings + suffix: false # if true ingress endpoints are suffixed with .Values.appName value (or .Release.Name if the 1st do not exist) + 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: webspa # 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 + 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: # inf.sql.catalog: 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 + ordering: # inf.sql.ordering: settings for the ordering-api sql (user, pwd, db) + user: sa # Ordering API SQL user + pwd: Pass@word # Ordering API SQL pwd + db: OrderingDb # Ordering API SQL db name + identity: + user: sa # Ordering API SQL user + pwd: Pass@word # Ordering API SQL pwd + db: IdentityDb # Ordering API SQL db name + redis: # inf.redis defines the redis' connection strings + basket: + constr: basket-data # Connection string to Redis used by Basket API + keystore: + constr: keystore-data # Connection string to Redis used as a Keystore (by Identity 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 diff --git a/k8s/helm/identity-api/templates/configmap.yaml b/k8s/helm/identity-api/templates/configmap.yaml index d3dd2b9a7..f0ad8de3f 100644 --- a/k8s/helm/identity-api/templates/configmap.yaml +++ b/k8s/helm/identity-api/templates/configmap.yaml @@ -10,7 +10,6 @@ {{- $webhoppingagg := include "url-of" (list .Values.app.ingress.entries.webshoppingagg .) -}} {{- $xamarincallback := include "url-of" (list "xamarincallback" .) -}} - apiVersion: v1 kind: ConfigMap metadata: diff --git a/k8s/helm/ordering-api/templates/_names.tpl b/k8s/helm/ordering-api/templates/_names.tpl index 56d0cac88..bbf3888d5 100644 --- a/k8s/helm/ordering-api/templates/_names.tpl +++ b/k8s/helm/ordering-api/templates/_names.tpl @@ -14,15 +14,19 @@ {{- end -}} {{- end -}} -{{- define "url-identity" -}} -{{- if .Values.app.ingress.suffix -}} -{{- $suffix := include "suffix-name" . -}} -{{- printf "%s/identity-api-%s" .Values.inf.k8s.dns $suffix -}} +{{- define "url-of" -}} +{{- $name := first .}} +{{- $ctx := last .}} +{{- if $ctx.Values.app.ingress.suffix -}} +{{- $suffix := include "suffix-name" $ctx -}} +{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{- else -}} -{{- printf "%s/identity-api" .Values.inf.k8s.dns -}} +{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{- end -}} {{- end -}} + + {{ define "pathBase" -}} {{- if .Values.app.ingress.suffix -}} {{- $suffix := include "suffix-name" . -}} diff --git a/k8s/helm/ordering-api/templates/configmap.yaml b/k8s/helm/ordering-api/templates/configmap.yaml index b59e1c934..a43663308 100644 --- a/k8s/helm/ordering-api/templates/configmap.yaml +++ b/k8s/helm/ordering-api/templates/configmap.yaml @@ -1,6 +1,6 @@ {{- $name := include "ordering-api.fullname" . -}} {{- $sqlsrv := include "sql-name" . -}} -{{- $identity := include "url-identity" . -}} +{{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}} apiVersion: v1 kind: ConfigMap diff --git a/k8s/helm/ordering-api/values.yaml b/k8s/helm/ordering-api/values.yaml index ee2bb2bb6..c4a7cdf99 100644 --- a/k8s/helm/ordering-api/values.yaml +++ b/k8s/helm/ordering-api/values.yaml @@ -18,22 +18,6 @@ ingress: - chart-example.local tls: [] -inf: - sql: - ordering: - user: sa - pwd: Pass@word - db: CatalogDb - eventbus: - constr: rabbitmq - useAzure: false - appinsights: - key: "" - k8s: - dns: "" - misc: - useLoadTest: false - resources: {} diff --git a/k8s/helm/ordering-backgroundtasks/templates/NOTES.txt b/k8s/helm/ordering-backgroundtasks/templates/NOTES.txt index 7dbe60ba0..b8efad3d8 100644 --- a/k8s/helm/ordering-backgroundtasks/templates/NOTES.txt +++ b/k8s/helm/ordering-backgroundtasks/templates/NOTES.txt @@ -4,16 +4,16 @@ 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 "ordering-graceperiod.fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "ordering-backgroundtasks.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 "ordering-graceperiod.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "ordering-graceperiod.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + You can watch the status of by running 'kubectl get svc -w {{ template "ordering-backgroundtasks.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "ordering-backgroundtasks.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 "ordering-graceperiod.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "ordering-backgroundtasks.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/ordering-backgroundtasks/templates/_names.tpl b/k8s/helm/ordering-backgroundtasks/templates/_names.tpl index 56d0cac88..bbf3888d5 100644 --- a/k8s/helm/ordering-backgroundtasks/templates/_names.tpl +++ b/k8s/helm/ordering-backgroundtasks/templates/_names.tpl @@ -14,15 +14,19 @@ {{- end -}} {{- end -}} -{{- define "url-identity" -}} -{{- if .Values.app.ingress.suffix -}} -{{- $suffix := include "suffix-name" . -}} -{{- printf "%s/identity-api-%s" .Values.inf.k8s.dns $suffix -}} +{{- define "url-of" -}} +{{- $name := first .}} +{{- $ctx := last .}} +{{- if $ctx.Values.app.ingress.suffix -}} +{{- $suffix := include "suffix-name" $ctx -}} +{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{- else -}} -{{- printf "%s/identity-api" .Values.inf.k8s.dns -}} +{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{- end -}} {{- end -}} + + {{ define "pathBase" -}} {{- if .Values.app.ingress.suffix -}} {{- $suffix := include "suffix-name" . -}} diff --git a/k8s/helm/ordering-backgroundtasks/values.yaml b/k8s/helm/ordering-backgroundtasks/values.yaml index fdb297940..e1b97daf9 100644 --- a/k8s/helm/ordering-backgroundtasks/values.yaml +++ b/k8s/helm/ordering-backgroundtasks/values.yaml @@ -22,22 +22,6 @@ cfg: checkUpdateTime: "15000" gracePeriodTime: "1" -inf: - sql: - ordering: - user: sa - pwd: Pass@word - db: CatalogDb - eventbus: - constr: rabbitmq - useAzure: false - appinsights: - key: "" - k8s: - dns: "" - misc: - useLoadTest: false - resources: {}