Skip to content

Commit

Permalink
#1135 - Revise helm charts and update k8s deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
nashtech-diepnguyenngoc1 committed Nov 7, 2024
1 parent db997a9 commit bb863b2
Show file tree
Hide file tree
Showing 32 changed files with 489 additions and 50 deletions.
4 changes: 1 addition & 3 deletions k8s/charts/cart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ backend:
fullnameOverride: cart
databaseName: cart
ingress:
enabled: true
host: api.yas.local.com
path: /cart
enabled: false
extraVolumes:
- name: cart-application-config
configMap:
Expand Down
4 changes: 1 addition & 3 deletions k8s/charts/customer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ backend:
fullnameOverride: customer
databaseName: customer
ingress:
enabled: true
host: api.yas.local.com
path: /customer
enabled: false
extraEnvFroms:
- secretRef:
name: yas-keycloak-credentials-secret
Expand Down
4 changes: 1 addition & 3 deletions k8s/charts/inventory/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ backend:
fullnameOverride: inventory
databaseName: inventory
ingress:
enabled: true
host: api.yas.local.com
path: /inventory
enabled: false
4 changes: 1 addition & 3 deletions k8s/charts/location/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ backend:
fullnameOverride: location
databaseName: location
ingress:
enabled: true
host: api.yas.local.com
path: /location
enabled: false
4 changes: 1 addition & 3 deletions k8s/charts/media/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ backend:
fullnameOverride: media
databaseName: media
ingress:
enabled: true
host: api.yas.local.com
path: /media
enabled: false
extraVolumes:
- name: media-application
configMap:
Expand Down
4 changes: 1 addition & 3 deletions k8s/charts/order/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ backend:
fullnameOverride: order
databaseName: order
ingress:
enabled: true
host: api.yas.local.com
path: /order
enabled: false
extraVolumes:
- name: order-application-config
configMap:
Expand Down
4 changes: 1 addition & 3 deletions k8s/charts/payment-paypal/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ backend:
fullnameOverride: payment-paypal
databaseName: payment-paypal
ingress:
enabled: true
host: api.yas.local.com
path: /payment-paypal
enabled: false
extraVolumes:
- name: payment-paypal-application-config
configMap:
Expand Down
4 changes: 1 addition & 3 deletions k8s/charts/payment/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ backend:
fullnameOverride: payment
databaseName: payment
ingress:
enabled: true
host: api.yas.local.com
path: /payment
enabled: false
extraVolumes:
- name: payment-application-config
configMap:
Expand Down
4 changes: 1 addition & 3 deletions k8s/charts/product/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ backend:
fullnameOverride: product
databaseName: product
ingress:
enabled: true
host: api.yas.local.com
path: /product
enabled: false
extraVolumes:
- name: product-application-config
configMap:
Expand Down
4 changes: 1 addition & 3 deletions k8s/charts/promotion/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ backend:
fullnameOverride: promotion
databaseName: promotion
ingress:
enabled: true
host: api.yas.local.com
path: /promotion
enabled: false
4 changes: 1 addition & 3 deletions k8s/charts/rating/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ backend:
fullnameOverride: rating
databaseName: rating
ingress:
enabled: true
host: api.yas.local.com
path: /rating
enabled: false
23 changes: 23 additions & 0 deletions k8s/charts/recommendation/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
29 changes: 29 additions & 0 deletions k8s/charts/recommendation/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: v2
name: recommendation
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "latest"

dependencies:
- name: backend
version: 0.1.0
repository: file://../backend
62 changes: 62 additions & 0 deletions k8s/charts/recommendation/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "recommendation.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 "recommendation.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 "recommendation.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "recommendation.labels" -}}
helm.sh/chart: {{ include "recommendation.chart" . }}
{{ include "recommendation.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "recommendation.selectorLabels" -}}
app.kubernetes.io/name: {{ include "recommendation.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "recommendation.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "recommendation.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
22 changes: 22 additions & 0 deletions k8s/charts/recommendation/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
backend:
image:
repository: ghcr.io/nashtech-garage/yas-recommendation
tag: latest

nameOverride: recommendation
fullnameOverride: recommendation
databaseName: recommendation
ingress:
enabled: false
extraEnvFroms:
- secretRef:
name: yas-openai-api-key-secret
extraVolumes:
- name: recommendation-application
configMap:
name: recommendation-application-configmap
extraVolumeMounts:
- name: recommendation-application
mountPath: /opt/yas/recommendation
extraApplicationConfigPaths:
- /opt/yas/recommendation/recommendation-application.yaml
23 changes: 23 additions & 0 deletions k8s/charts/sampledata/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
29 changes: 29 additions & 0 deletions k8s/charts/sampledata/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: v2
name: sampledata
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "latest"

dependencies:
- name: backend
version: 0.1.0
repository: file://../backend
62 changes: 62 additions & 0 deletions k8s/charts/sampledata/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "sampledata.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 "sampledata.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 "sampledata.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "sampledata.labels" -}}
helm.sh/chart: {{ include "sampledata.chart" . }}
{{ include "sampledata.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "sampledata.selectorLabels" -}}
app.kubernetes.io/name: {{ include "sampledata.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "sampledata.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "sampledata.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions k8s/charts/sampledata/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
backend:
image:
repository: ghcr.io/nashtech-garage/yas-sampledata
tag: latest

nameOverride: sampledata
fullnameOverride: sampledata
databaseName: sampledata
ingress:
enabled: false
extraVolumes:
- name: sampledata-application
configMap:
name: sampledata-application-configmap
extraVolumeMounts:
- name: sampledata-application
mountPath: /opt/yas/sampledata
extraApplicationConfigPaths:
- /opt/yas/sampledata/sampledata-application.yaml
4 changes: 1 addition & 3 deletions k8s/charts/search/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ backend:
fullnameOverride: search
databaseName: search
ingress:
enabled: true
host: api.yas.local.com
path: /search
enabled: false
extraEnvFroms:
- secretRef:
name: yas-elasticsearch-credentials-secret
Expand Down
Loading

0 comments on commit bb863b2

Please sign in to comment.