From d822769b79ea4d00e1305790e3fbd752237dbb75 Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Mon, 17 Mar 2025 12:06:38 +0530 Subject: [PATCH 01/20] added shopgpt backend charts --- shopgpt_backend/Chart.yaml | 7 ++ shopgpt_backend/templates/_helpers.tpl | 32 +++++++++ shopgpt_backend/templates/deployment.yaml | 84 +++++++++++++++++++++++ shopgpt_backend/templates/hpa.yaml | 33 +++++++++ shopgpt_backend/templates/ingress.yaml | 51 ++++++++++++++ shopgpt_backend/templates/service.yaml | 30 ++++++++ shopgpt_backend/values.yaml | 69 +++++++++++++++++++ 7 files changed, 306 insertions(+) create mode 100644 shopgpt_backend/Chart.yaml create mode 100644 shopgpt_backend/templates/_helpers.tpl create mode 100644 shopgpt_backend/templates/deployment.yaml create mode 100644 shopgpt_backend/templates/hpa.yaml create mode 100644 shopgpt_backend/templates/ingress.yaml create mode 100644 shopgpt_backend/templates/service.yaml create mode 100644 shopgpt_backend/values.yaml diff --git a/shopgpt_backend/Chart.yaml b/shopgpt_backend/Chart.yaml new file mode 100644 index 00000000..74547cfb --- /dev/null +++ b/shopgpt_backend/Chart.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +appVersion: 0.1.1 +description: A Helm chart for App, a declarative, GitOps continuous delivery helm chart for Kubernetes. +keywords: +- shoptgpt-backend +name: shopgpt-backend +version: "0.1.1" diff --git a/shopgpt_backend/templates/_helpers.tpl b/shopgpt_backend/templates/_helpers.tpl new file mode 100644 index 00000000..ead1c2a9 --- /dev/null +++ b/shopgpt_backend/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "app.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 "app.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 "app.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/shopgpt_backend/templates/deployment.yaml b/shopgpt_backend/templates/deployment.yaml new file mode 100644 index 00000000..70bc29e6 --- /dev/null +++ b/shopgpt_backend/templates/deployment.yaml @@ -0,0 +1,84 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "app.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} + helm.sh/chart: {{ include "app.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: application + app.kubernetes.io/component: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Values.image.tag | quote }} +spec: + replicas: {{ .Values.replicas }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + revisionHistoryLimit: 5 + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} + helm.sh/chart: {{ include "app.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: application + app.kubernetes.io/component: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Values.image.tag | quote }} + spec: + {{- with .Values.image.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.securityContext }} + securityContext: {{- toYaml .Values.image.securityContext | nindent 8 }} + {{- end }} + containers: + - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.imagePullPolicy }} + name: {{ .Release.Name }} + env: + {{- range $conf, $value := .Values.env }} + - name: {{ $conf | quote }} + value: {{ $value | quote }} + {{- end }} + envFrom: + - configMapRef: + name: shopgpt-configmap + {{- if .Values.containerSecurityContext }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 10 }} + {{- end }} + ports: + - name: {{ .Release.Name }} + containerPort: {{ .Values.service.containerPort }} + protocol: TCP + resources: +{{- toYaml .Values.resources | nindent 10 }} + livenessProbe: + httpGet: + path: {{ .Values.livenessProbe.path }} + port: {{ .Values.service.containerPort }} + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + readinessProbe: + httpGet: + path: {{ .Values.readinessProbe.path }} + port: {{ .Values.service.containerPort }} + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + terminationMessagePath: /dev/termination-log + restartPolicy: Always + terminationGracePeriodSeconds: 30 \ No newline at end of file diff --git a/shopgpt_backend/templates/hpa.yaml b/shopgpt_backend/templates/hpa.yaml new file mode 100644 index 00000000..4e42bf88 --- /dev/null +++ b/shopgpt_backend/templates/hpa.yaml @@ -0,0 +1,33 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta2 +kind: HorizontalPodAutoscaler +metadata: + labels: + app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} + helm.sh/chart: {{ include "app.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: application + app.kubernetes.io/component: {{ .Release.Name }} + name: {{ .Release.Name }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ template "app.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} +{{- end }} diff --git a/shopgpt_backend/templates/ingress.yaml b/shopgpt_backend/templates/ingress.yaml new file mode 100644 index 00000000..68b3c41d --- /dev/null +++ b/shopgpt_backend/templates/ingress.yaml @@ -0,0 +1,51 @@ +{{- if .Values.ingress.enabled -}} +{{- $serviceName := include "app.fullname" . -}} +{{- $servicePort := .Values.service.containerPort -}} +{{- $paths := .Values.ingress.paths -}} +{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }} +apiVersion: networking.k8s.io/v1 +{{ else }} +apiVersion: extensions/v1beta1 +{{ end -}} +kind: Ingress +metadata: + name: {{ template "app.fullname" . }} +{{- if .Values.ingress.annotations }} + annotations: + kubernetes.io/ingress.class: nginx + nginx.ingress.kubernetes.io/use-regex: 'true' + nginx.ingress.kubernetes.io/rewrite-target: /api/$2 + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +{{- end }} + labels: + app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} + helm.sh/chart: {{ include "app.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: application + app.kubernetes.io/component: {{ .Release.Name }} +{{- if .Values.ingress.labels }} +{{- toYaml .Values.ingress.labels | nindent 4 }} +{{- end }} +spec: + ingressClassName: nginx + rules: + {{- if .Values.ingress.hosts }} + {{- range $host := .Values.ingress.hosts }} + - host: {{ $host }} + http: + paths: + {{- range $p := $paths }} + - path: {{ $p}} + pathType: ImplementationSpecific + backend: + service: + name: {{ $serviceName }} + port: + number: {{ $servicePort }} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} \ No newline at end of file diff --git a/shopgpt_backend/templates/service.yaml b/shopgpt_backend/templates/service.yaml new file mode 100644 index 00000000..ec67f7e5 --- /dev/null +++ b/shopgpt_backend/templates/service.yaml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: Service +metadata: +{{- if .Values.service.annotations }} + annotations: + {{- range $key, $value := .Values.service.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +{{- end }} + name: {{ template "app.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} + helm.sh/chart: {{ include "app.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: application + app.kubernetes.io/component: {{ .Release.Name }} +{{- if .Values.service.labels }} +{{- toYaml .Values.service.labels | nindent 4 }} +{{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - name: {{ .Release.Name }} + protocol: TCP + port: {{ .Values.service.containerPort }} + targetPort: {{ .Values.service.containerPort }} + selector: + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} diff --git a/shopgpt_backend/values.yaml b/shopgpt_backend/values.yaml new file mode 100644 index 00000000..e4d74362 --- /dev/null +++ b/shopgpt_backend/values.yaml @@ -0,0 +1,69 @@ +nameOverride: "" + +replicas: 1 + +image: + repository: blotout/shogpt-backend + tag: + imagePullPolicy: IfNotPresent + imagePullSecrets: [] + securityContext: {} + # runAsUser: 999 + # runAsGroup: 999 + # fsGroup: 999 + +env: {} + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 2 + targetCPUUtilizationPercentage: 50 + targetMemoryUtilizationPercentage: 50 + +resources: {} +# limits: +# cpu: 1000m +# memory: 4Gi +# requests: +# cpu: 250m +# memory: 100Mi + +readinessProbe: + path: + failureThreshold: 4 + initialDelaySeconds: 120 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 +livenessProbe: + path: + failureThreshold: 4 + initialDelaySeconds: 160 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + +service: + type: ClusterIP + containerPort: 3000 + annotations: {} + labels: {} + +ingress: + enabled: false + annotations: {} + labels: {} + hosts: + - example.com + paths: + - / + + +## Labels to set container specific security contexts +containerSecurityContext: + {} + # capabilities: + # drop: + # - all + # readOnlyRootFilesystem: true From e655d8892edeefb2dffc64987553102c3f422f8b Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Wed, 9 Apr 2025 11:11:40 +0530 Subject: [PATCH 02/20] added release branch --- .github/workflows/release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e8b9245d..6353ee51 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,6 +3,7 @@ on: push: branches: - main + - shopgt_backend paths: - 'helm/**' release: From 41eda4f4146b1cd08cb58c6171f76bb0b00d83ed Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Wed, 9 Apr 2025 11:14:17 +0530 Subject: [PATCH 03/20] change in shopgpt chart version --- shopgpt_backend/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shopgpt_backend/Chart.yaml b/shopgpt_backend/Chart.yaml index 74547cfb..346594ee 100644 --- a/shopgpt_backend/Chart.yaml +++ b/shopgpt_backend/Chart.yaml @@ -4,4 +4,4 @@ description: A Helm chart for App, a declarative, GitOps continuous delivery hel keywords: - shoptgpt-backend name: shopgpt-backend -version: "0.1.1" +version: "0.1.2" From 572b2aded3323cbed75988ce6eede943a3184a06 Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Wed, 9 Apr 2025 11:15:34 +0530 Subject: [PATCH 04/20] move shopgpt to helm --- {shopgpt_backend => helm/shopgpt_backend}/Chart.yaml | 0 {shopgpt_backend => helm/shopgpt_backend}/templates/_helpers.tpl | 0 .../shopgpt_backend}/templates/deployment.yaml | 0 {shopgpt_backend => helm/shopgpt_backend}/templates/hpa.yaml | 0 {shopgpt_backend => helm/shopgpt_backend}/templates/ingress.yaml | 0 {shopgpt_backend => helm/shopgpt_backend}/templates/service.yaml | 0 {shopgpt_backend => helm/shopgpt_backend}/values.yaml | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename {shopgpt_backend => helm/shopgpt_backend}/Chart.yaml (100%) rename {shopgpt_backend => helm/shopgpt_backend}/templates/_helpers.tpl (100%) rename {shopgpt_backend => helm/shopgpt_backend}/templates/deployment.yaml (100%) rename {shopgpt_backend => helm/shopgpt_backend}/templates/hpa.yaml (100%) rename {shopgpt_backend => helm/shopgpt_backend}/templates/ingress.yaml (100%) rename {shopgpt_backend => helm/shopgpt_backend}/templates/service.yaml (100%) rename {shopgpt_backend => helm/shopgpt_backend}/values.yaml (100%) diff --git a/shopgpt_backend/Chart.yaml b/helm/shopgpt_backend/Chart.yaml similarity index 100% rename from shopgpt_backend/Chart.yaml rename to helm/shopgpt_backend/Chart.yaml diff --git a/shopgpt_backend/templates/_helpers.tpl b/helm/shopgpt_backend/templates/_helpers.tpl similarity index 100% rename from shopgpt_backend/templates/_helpers.tpl rename to helm/shopgpt_backend/templates/_helpers.tpl diff --git a/shopgpt_backend/templates/deployment.yaml b/helm/shopgpt_backend/templates/deployment.yaml similarity index 100% rename from shopgpt_backend/templates/deployment.yaml rename to helm/shopgpt_backend/templates/deployment.yaml diff --git a/shopgpt_backend/templates/hpa.yaml b/helm/shopgpt_backend/templates/hpa.yaml similarity index 100% rename from shopgpt_backend/templates/hpa.yaml rename to helm/shopgpt_backend/templates/hpa.yaml diff --git a/shopgpt_backend/templates/ingress.yaml b/helm/shopgpt_backend/templates/ingress.yaml similarity index 100% rename from shopgpt_backend/templates/ingress.yaml rename to helm/shopgpt_backend/templates/ingress.yaml diff --git a/shopgpt_backend/templates/service.yaml b/helm/shopgpt_backend/templates/service.yaml similarity index 100% rename from shopgpt_backend/templates/service.yaml rename to helm/shopgpt_backend/templates/service.yaml diff --git a/shopgpt_backend/values.yaml b/helm/shopgpt_backend/values.yaml similarity index 100% rename from shopgpt_backend/values.yaml rename to helm/shopgpt_backend/values.yaml From e2aa7989660537264b26858a0a5a26d20e527aa2 Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Thu, 10 Apr 2025 11:54:06 +0530 Subject: [PATCH 05/20] change in shopgpt chart version --- helm/shopgpt_backend/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/shopgpt_backend/Chart.yaml b/helm/shopgpt_backend/Chart.yaml index 346594ee..21df9870 100644 --- a/helm/shopgpt_backend/Chart.yaml +++ b/helm/shopgpt_backend/Chart.yaml @@ -2,6 +2,6 @@ apiVersion: v1 appVersion: 0.1.1 description: A Helm chart for App, a declarative, GitOps continuous delivery helm chart for Kubernetes. keywords: -- shoptgpt-backend +- shopgpt-backend name: shopgpt-backend -version: "0.1.2" +version: "v0.1.2" From 7c99338934718ae4866d442ba116d2e57b1ffe07 Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Thu, 10 Apr 2025 12:38:00 +0530 Subject: [PATCH 06/20] change in shopgpt autoscalling --- helm/shopgpt_backend/Chart.yaml | 2 +- helm/shopgpt_backend/templates/hpa.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/shopgpt_backend/Chart.yaml b/helm/shopgpt_backend/Chart.yaml index 21df9870..26fb3413 100644 --- a/helm/shopgpt_backend/Chart.yaml +++ b/helm/shopgpt_backend/Chart.yaml @@ -4,4 +4,4 @@ description: A Helm chart for App, a declarative, GitOps continuous delivery hel keywords: - shopgpt-backend name: shopgpt-backend -version: "v0.1.2" +version: "v0.1.3" diff --git a/helm/shopgpt_backend/templates/hpa.yaml b/helm/shopgpt_backend/templates/hpa.yaml index 4e42bf88..2108a886 100644 --- a/helm/shopgpt_backend/templates/hpa.yaml +++ b/helm/shopgpt_backend/templates/hpa.yaml @@ -1,5 +1,5 @@ {{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta2 +apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: labels: From 41cf5d60ad9a98e6d3becfbffa9d1d6cb7341328 Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Thu, 10 Apr 2025 17:47:02 +0530 Subject: [PATCH 07/20] updated shopgpt to latest version --- helm/shopgpt_backend/Chart.yaml | 6 +- helm/shopgpt_backend/templates/_helpers.tpl | 68 +++++++--- .../shopgpt_backend/templates/deployment.yaml | 111 +++++++--------- helm/shopgpt_backend/templates/hpa.yaml | 25 ++-- helm/shopgpt_backend/templates/ingress.yaml | 82 +++++++----- helm/shopgpt_backend/templates/service.yaml | 29 +---- .../templates/serviceaccount.yaml | 12 ++ helm/shopgpt_backend/values.yaml | 123 ++++++++++++------ 8 files changed, 253 insertions(+), 203 deletions(-) create mode 100644 helm/shopgpt_backend/templates/serviceaccount.yaml diff --git a/helm/shopgpt_backend/Chart.yaml b/helm/shopgpt_backend/Chart.yaml index 26fb3413..a5719b53 100644 --- a/helm/shopgpt_backend/Chart.yaml +++ b/helm/shopgpt_backend/Chart.yaml @@ -1,7 +1,7 @@ -apiVersion: v1 -appVersion: 0.1.1 +apiVersion: v2 +appVersion: 0.1.2 description: A Helm chart for App, a declarative, GitOps continuous delivery helm chart for Kubernetes. keywords: - shopgpt-backend name: shopgpt-backend -version: "v0.1.3" +version: "v0.1.4" diff --git a/helm/shopgpt_backend/templates/_helpers.tpl b/helm/shopgpt_backend/templates/_helpers.tpl index ead1c2a9..e45c97c6 100644 --- a/helm/shopgpt_backend/templates/_helpers.tpl +++ b/helm/shopgpt_backend/templates/_helpers.tpl @@ -1,32 +1,62 @@ -{{/* vim: set filetype=mustache: */}} {{/* Expand the name of the chart. */}} -{{- define "app.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} +{{- define "shopgpt-backend.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 "app.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 -}} +{{- define "shopgpt-backend.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 "app.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} +{{- define "shopgpt-backend.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "shopgpt-backend.labels" -}} +helm.sh/chart: {{ include "shopgpt-backend.chart" . }} +{{ include "shopgpt-backend.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "shopgpt-backend.selectorLabels" -}} +app.kubernetes.io/name: {{ include "shopgpt-backend.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "shopgpt-backend.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "shopgpt-backend.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/shopgpt_backend/templates/deployment.yaml b/helm/shopgpt_backend/templates/deployment.yaml index 70bc29e6..d337ea63 100644 --- a/helm/shopgpt_backend/templates/deployment.yaml +++ b/helm/shopgpt_backend/templates/deployment.yaml @@ -1,84 +1,61 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ template "app.fullname" . }} + name: {{ include "shopgpt-backend.fullname" . }} labels: - app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} - helm.sh/chart: {{ include "app.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/part-of: application - app.kubernetes.io/component: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Values.image.tag | quote }} + {{- include "shopgpt-backend.labels" . | nindent 4 }} spec: - replicas: {{ .Values.replicas }} + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} selector: matchLabels: - app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} - app.kubernetes.io/instance: {{ .Release.Name }} - revisionHistoryLimit: 5 - strategy: - rollingUpdate: - maxSurge: 25% - maxUnavailable: 25% - type: RollingUpdate + {{- include "shopgpt-backend.selectorLabels" . | nindent 6 }} template: metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} labels: - app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} - helm.sh/chart: {{ include "app.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/part-of: application - app.kubernetes.io/component: {{ .Release.Name }} - app.kubernetes.io/version: {{ .Values.image.tag | quote }} + {{- include "shopgpt-backend.selectorLabels" . | nindent 8 }} spec: - {{- with .Values.image.imagePullSecrets }} + {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - {{- if .Values.securityContext }} - securityContext: {{- toYaml .Values.image.securityContext | nindent 8 }} - {{- end }} + serviceAccountName: {{ include "shopgpt-backend.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.imagePullPolicy }} - name: {{ .Release.Name }} - env: - {{- range $conf, $value := .Values.env }} - - name: {{ $conf | quote }} - value: {{ $value | quote }} - {{- end }} - envFrom: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- range $conf, $value := .Values.env }} + - name: {{ $conf | quote }} + value: {{ $value | quote }} + {{- end }} + envFrom: - configMapRef: name: shopgpt-configmap - {{- if .Values.containerSecurityContext }} - securityContext: {{- toYaml .Values.containerSecurityContext | nindent 10 }} - {{- end }} - ports: - - name: {{ .Release.Name }} - containerPort: {{ .Values.service.containerPort }} - protocol: TCP - resources: -{{- toYaml .Values.resources | nindent 10 }} - livenessProbe: - httpGet: - path: {{ .Values.livenessProbe.path }} - port: {{ .Values.service.containerPort }} - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - successThreshold: {{ .Values.livenessProbe.successThreshold }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - readinessProbe: - httpGet: - path: {{ .Values.readinessProbe.path }} - port: {{ .Values.service.containerPort }} - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - successThreshold: {{ .Values.readinessProbe.successThreshold }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - terminationMessagePath: /dev/termination-log - restartPolicy: Always - terminationGracePeriodSeconds: 30 \ No newline at end of file + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} \ No newline at end of file diff --git a/helm/shopgpt_backend/templates/hpa.yaml b/helm/shopgpt_backend/templates/hpa.yaml index 2108a886..7b0b1fcb 100644 --- a/helm/shopgpt_backend/templates/hpa.yaml +++ b/helm/shopgpt_backend/templates/hpa.yaml @@ -2,32 +2,31 @@ apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: + name: {{ include "shopgpt-backend.fullname" . }} labels: - app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} - helm.sh/chart: {{ include "app.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/part-of: application - app.kubernetes.io/component: {{ .Release.Name }} - name: {{ .Release.Name }} + {{- include "shopgpt-backend.labels" . | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ template "app.fullname" . }} + name: {{ include "shopgpt-backend.fullname" . }} minReplicas: {{ .Values.autoscaling.minReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }} metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - type: Resource resource: - name: memory + name: cpu target: type: Utilization - averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - type: Resource resource: - name: cpu + name: memory target: type: Utilization - averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} -{{- end }} + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/shopgpt_backend/templates/ingress.yaml b/helm/shopgpt_backend/templates/ingress.yaml index 68b3c41d..e36ca0ed 100644 --- a/helm/shopgpt_backend/templates/ingress.yaml +++ b/helm/shopgpt_backend/templates/ingress.yaml @@ -1,51 +1,61 @@ {{- if .Values.ingress.enabled -}} -{{- $serviceName := include "app.fullname" . -}} -{{- $servicePort := .Values.service.containerPort -}} -{{- $paths := .Values.ingress.paths -}} -{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }} +{{- $fullName := include "shopgpt-backend.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1 -{{ else }} +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} apiVersion: extensions/v1beta1 -{{ end -}} +{{- end }} kind: Ingress metadata: - name: {{ template "app.fullname" . }} -{{- if .Values.ingress.annotations }} + name: {{ $fullName }} + labels: + {{- include "shopgpt-backend.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} annotations: - kubernetes.io/ingress.class: nginx - nginx.ingress.kubernetes.io/use-regex: 'true' - nginx.ingress.kubernetes.io/rewrite-target: /api/$2 - {{- range $key, $value := .Values.ingress.annotations }} - {{ $key }}: {{ $value | quote }} + {{- toYaml . | nindent 4 }} {{- end }} -{{- end }} - labels: - app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} - helm.sh/chart: {{ include "app.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/part-of: application - app.kubernetes.io/component: {{ .Release.Name }} -{{- if .Values.ingress.labels }} -{{- toYaml .Values.ingress.labels | nindent 4 }} -{{- end }} spec: - ingressClassName: nginx + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} rules: - {{- if .Values.ingress.hosts }} - {{- range $host := .Values.ingress.hosts }} - - host: {{ $host }} + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} http: paths: - {{- range $p := $paths }} - - path: {{ $p}} + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} pathType: ImplementationSpecific + {{- end }} backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: - name: {{ $serviceName }} + name: {{ $fullName }} port: - number: {{ $servicePort }} - {{- end -}} - {{- end -}} - {{- end -}} - {{- end -}} \ No newline at end of file + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/shopgpt_backend/templates/service.yaml b/helm/shopgpt_backend/templates/service.yaml index ec67f7e5..11d28702 100644 --- a/helm/shopgpt_backend/templates/service.yaml +++ b/helm/shopgpt_backend/templates/service.yaml @@ -1,30 +1,15 @@ apiVersion: v1 kind: Service metadata: -{{- if .Values.service.annotations }} - annotations: - {{- range $key, $value := .Values.service.annotations }} - {{ $key }}: {{ $value | quote }} - {{- end }} -{{- end }} - name: {{ template "app.fullname" . }} + name: {{ include "shopgpt-backend.fullname" . }} labels: - app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} - helm.sh/chart: {{ include "app.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/part-of: application - app.kubernetes.io/component: {{ .Release.Name }} -{{- if .Values.service.labels }} -{{- toYaml .Values.service.labels | nindent 4 }} -{{- end }} + {{- include "shopgpt-backend.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: - - name: {{ .Release.Name }} - protocol: TCP - port: {{ .Values.service.containerPort }} - targetPort: {{ .Values.service.containerPort }} + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http selector: - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/name: {{ include "app.name" . }}-{{ .Release.Name }} + {{- include "shopgpt-backend.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/helm/shopgpt_backend/templates/serviceaccount.yaml b/helm/shopgpt_backend/templates/serviceaccount.yaml new file mode 100644 index 00000000..21d93672 --- /dev/null +++ b/helm/shopgpt_backend/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "shopgpt-backend.serviceAccountName" . }} + labels: + {{- include "shopgpt-backend.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/shopgpt_backend/values.yaml b/helm/shopgpt_backend/values.yaml index e4d74362..0bcbe464 100644 --- a/helm/shopgpt_backend/values.yaml +++ b/helm/shopgpt_backend/values.yaml @@ -1,69 +1,106 @@ -nameOverride: "" +# Default values for shopgpt-backend. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. -replicas: 1 +replicaCount: 1 image: - repository: blotout/shogpt-backend - tag: - imagePullPolicy: IfNotPresent - imagePullSecrets: [] - securityContext: {} - # runAsUser: 999 - # runAsGroup: 999 - # fsGroup: 999 + repository: blotout/shopgpt-backend + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "0.20.4" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" env: {} -autoscaling: +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +swagger: enabled: false - minReplicas: 1 - maxReplicas: 2 - targetCPUUtilizationPercentage: 50 - targetMemoryUtilizationPercentage: 50 resources: {} -# limits: -# cpu: 1000m -# memory: 4Gi -# requests: -# cpu: 250m -# memory: 100Mi + # 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 readinessProbe: - path: + httpGet: + path: "" + port: failureThreshold: 4 initialDelaySeconds: 120 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 livenessProbe: - path: + httpGet: + path: "" + port: failureThreshold: 4 initialDelaySeconds: 160 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 -service: - type: ClusterIP - containerPort: 3000 - annotations: {} - labels: {} - -ingress: +autoscaling: enabled: false - annotations: {} - labels: {} - hosts: - - example.com - paths: - - / + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 +nodeSelector: {} -## Labels to set container specific security contexts -containerSecurityContext: - {} - # capabilities: - # drop: - # - all - # readOnlyRootFilesystem: true +tolerations: [] + +affinity: {} \ No newline at end of file From 06ae0ae496304501f14d2db2a0ece99e99ae259a Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Fri, 11 Apr 2025 11:12:28 +0530 Subject: [PATCH 08/20] change in service port --- helm/shopgpt_backend/Chart.yaml | 2 +- helm/shopgpt_backend/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/shopgpt_backend/Chart.yaml b/helm/shopgpt_backend/Chart.yaml index a5719b53..a4583f91 100644 --- a/helm/shopgpt_backend/Chart.yaml +++ b/helm/shopgpt_backend/Chart.yaml @@ -4,4 +4,4 @@ description: A Helm chart for App, a declarative, GitOps continuous delivery hel keywords: - shopgpt-backend name: shopgpt-backend -version: "v0.1.4" +version: "v0.1.5" diff --git a/helm/shopgpt_backend/values.yaml b/helm/shopgpt_backend/values.yaml index 0bcbe464..0ae34a25 100644 --- a/helm/shopgpt_backend/values.yaml +++ b/helm/shopgpt_backend/values.yaml @@ -40,7 +40,7 @@ securityContext: {} service: type: ClusterIP - port: 80 + port: 8082 ingress: enabled: false From 505bbde38c01bc1678a60cac702e67a507d9bbf8 Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Tue, 15 Apr 2025 18:48:57 +0530 Subject: [PATCH 09/20] change in hpa apiversion --- helm/shopgpt_backend/Chart.yaml | 2 +- helm/shopgpt_backend/templates/hpa.yaml | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/helm/shopgpt_backend/Chart.yaml b/helm/shopgpt_backend/Chart.yaml index a4583f91..f517c0ed 100644 --- a/helm/shopgpt_backend/Chart.yaml +++ b/helm/shopgpt_backend/Chart.yaml @@ -4,4 +4,4 @@ description: A Helm chart for App, a declarative, GitOps continuous delivery hel keywords: - shopgpt-backend name: shopgpt-backend -version: "v0.1.5" +version: "v0.1.6" diff --git a/helm/shopgpt_backend/templates/hpa.yaml b/helm/shopgpt_backend/templates/hpa.yaml index 7b0b1fcb..48db6356 100644 --- a/helm/shopgpt_backend/templates/hpa.yaml +++ b/helm/shopgpt_backend/templates/hpa.yaml @@ -1,4 +1,9 @@ -{{- if .Values.autoscaling.enabled }} +{{- if (and .Values.autoscaling.enabled (or (eq .Values.deployment "deployment") (eq .Values.deployment "statefulset"))) }} +{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }} +apiVersion: autoscaling/v2 +{{- else }} +apiVersion: autoscaling/v2beta2 +{{- end }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: From f10b147faca4b2fb480e5020c44e78dcb01d04de Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Tue, 15 Apr 2025 18:51:57 +0530 Subject: [PATCH 10/20] change in shopgpt hpa --- helm/shopgpt_backend/templates/hpa.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/shopgpt_backend/templates/hpa.yaml b/helm/shopgpt_backend/templates/hpa.yaml index 48db6356..f794d5c5 100644 --- a/helm/shopgpt_backend/templates/hpa.yaml +++ b/helm/shopgpt_backend/templates/hpa.yaml @@ -1,4 +1,4 @@ -{{- if (and .Values.autoscaling.enabled (or (eq .Values.deployment "deployment") (eq .Values.deployment "statefulset"))) }} +{{- if .Values.autoscaling.enabled }} {{- if .Capabilities.APIVersions.Has "autoscaling/v2" }} apiVersion: autoscaling/v2 {{- else }} From c4d0b2c114ef4a669355c2fac066070d55edf124 Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Thu, 8 May 2025 15:32:48 +0530 Subject: [PATCH 11/20] change in shopgpt hpa --- helm/shopgpt_backend/Chart.yaml | 4 ++-- helm/shopgpt_backend/templates/hpa.yaml | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/helm/shopgpt_backend/Chart.yaml b/helm/shopgpt_backend/Chart.yaml index f517c0ed..616d4ef1 100644 --- a/helm/shopgpt_backend/Chart.yaml +++ b/helm/shopgpt_backend/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 -appVersion: 0.1.2 +appVersion: 0.1.3 description: A Helm chart for App, a declarative, GitOps continuous delivery helm chart for Kubernetes. keywords: - shopgpt-backend name: shopgpt-backend -version: "v0.1.6" +version: "v0.1.7" diff --git a/helm/shopgpt_backend/templates/hpa.yaml b/helm/shopgpt_backend/templates/hpa.yaml index f794d5c5..7b0b1fcb 100644 --- a/helm/shopgpt_backend/templates/hpa.yaml +++ b/helm/shopgpt_backend/templates/hpa.yaml @@ -1,9 +1,4 @@ {{- if .Values.autoscaling.enabled }} -{{- if .Capabilities.APIVersions.Has "autoscaling/v2" }} -apiVersion: autoscaling/v2 -{{- else }} -apiVersion: autoscaling/v2beta2 -{{- end }} apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: From b9faf88a1f94e7a3cfae133f6243cbfa4990df0f Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Mon, 12 May 2025 13:21:02 +0530 Subject: [PATCH 12/20] change in hpa shopgpt --- helm/shopgpt_backend/Chart.yaml | 2 +- helm/shopgpt_backend/templates/hpa.yaml | 6 ++++-- helm/shopgpt_backend/values.yaml | 3 --- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/helm/shopgpt_backend/Chart.yaml b/helm/shopgpt_backend/Chart.yaml index 616d4ef1..104776c8 100644 --- a/helm/shopgpt_backend/Chart.yaml +++ b/helm/shopgpt_backend/Chart.yaml @@ -4,4 +4,4 @@ description: A Helm chart for App, a declarative, GitOps continuous delivery hel keywords: - shopgpt-backend name: shopgpt-backend -version: "v0.1.7" +version: "v0.1.8" diff --git a/helm/shopgpt_backend/templates/hpa.yaml b/helm/shopgpt_backend/templates/hpa.yaml index 7b0b1fcb..f3bb5cc8 100644 --- a/helm/shopgpt_backend/templates/hpa.yaml +++ b/helm/shopgpt_backend/templates/hpa.yaml @@ -10,8 +10,9 @@ spec: apiVersion: apps/v1 kind: Deployment name: {{ include "shopgpt-backend.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} + minReplicas: {{ .Values.autoscaling.minReplicas | default 1 }} + maxReplicas: {{ .Values.autoscaling.maxReplicas | default 2 }} + {{- if or .Values.autoscaling.targetCPUUtilizationPercentage .Values.autoscaling.targetMemoryUtilizationPercentage }} metrics: {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - type: Resource @@ -29,4 +30,5 @@ spec: type: Utilization averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} {{- end }} + {{- end }} {{- end }} \ No newline at end of file diff --git a/helm/shopgpt_backend/values.yaml b/helm/shopgpt_backend/values.yaml index 0ae34a25..d60c6fae 100644 --- a/helm/shopgpt_backend/values.yaml +++ b/helm/shopgpt_backend/values.yaml @@ -58,9 +58,6 @@ ingress: # hosts: # - chart-example.local -swagger: - enabled: false - 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 From c54af755edb6ccb8f676be7f3efec1f4c53ba18d Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Tue, 13 May 2025 11:12:12 +0530 Subject: [PATCH 13/20] removed hpa --- helm/shopgpt_backend/Chart.yaml | 2 +- helm/shopgpt_backend/templates/hpa.yaml | 34 ----------------------- helm/shopgpt_backend/values.yaml | 36 ++++++++++++------------- 3 files changed, 19 insertions(+), 53 deletions(-) delete mode 100644 helm/shopgpt_backend/templates/hpa.yaml diff --git a/helm/shopgpt_backend/Chart.yaml b/helm/shopgpt_backend/Chart.yaml index 104776c8..d577eb37 100644 --- a/helm/shopgpt_backend/Chart.yaml +++ b/helm/shopgpt_backend/Chart.yaml @@ -4,4 +4,4 @@ description: A Helm chart for App, a declarative, GitOps continuous delivery hel keywords: - shopgpt-backend name: shopgpt-backend -version: "v0.1.8" +version: "v0.1.9" diff --git a/helm/shopgpt_backend/templates/hpa.yaml b/helm/shopgpt_backend/templates/hpa.yaml deleted file mode 100644 index f3bb5cc8..00000000 --- a/helm/shopgpt_backend/templates/hpa.yaml +++ /dev/null @@ -1,34 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "shopgpt-backend.fullname" . }} - labels: - {{- include "shopgpt-backend.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "shopgpt-backend.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas | default 1 }} - maxReplicas: {{ .Values.autoscaling.maxReplicas | default 2 }} - {{- if or .Values.autoscaling.targetCPUUtilizationPercentage .Values.autoscaling.targetMemoryUtilizationPercentage }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - target: - type: Utilization - averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} - {{- end }} -{{- end }} \ No newline at end of file diff --git a/helm/shopgpt_backend/values.yaml b/helm/shopgpt_backend/values.yaml index d60c6fae..97276920 100644 --- a/helm/shopgpt_backend/values.yaml +++ b/helm/shopgpt_backend/values.yaml @@ -70,24 +70,24 @@ resources: {} # cpu: 100m # memory: 128Mi -readinessProbe: - httpGet: - path: "" - port: - failureThreshold: 4 - initialDelaySeconds: 120 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 5 -livenessProbe: - httpGet: - path: "" - port: - failureThreshold: 4 - initialDelaySeconds: 160 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 5 +# readinessProbe: +# httpGet: +# path: "" +# port: +# failureThreshold: 4 +# initialDelaySeconds: 120 +# periodSeconds: 10 +# successThreshold: 1 +# timeoutSeconds: 5 +# livenessProbe: +# httpGet: +# path: "" +# port: +# failureThreshold: 4 +# initialDelaySeconds: 160 +# periodSeconds: 10 +# successThreshold: 1 +# timeoutSeconds: 5 autoscaling: enabled: false From 8fc300d3f58d0ee369ef18ce50231483a4d05239 Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Thu, 19 Jun 2025 15:35:42 +0530 Subject: [PATCH 14/20] added shopgpt hpa --- helm/shopgpt_backend/Chart.yaml | 4 +-- helm/shopgpt_backend/templates/hpa.yaml | 32 ++++++++++++++++++++++ helm/shopgpt_backend/values.yaml | 36 ++++++++++++------------- 3 files changed, 52 insertions(+), 20 deletions(-) create mode 100644 helm/shopgpt_backend/templates/hpa.yaml diff --git a/helm/shopgpt_backend/Chart.yaml b/helm/shopgpt_backend/Chart.yaml index d577eb37..c7011fce 100644 --- a/helm/shopgpt_backend/Chart.yaml +++ b/helm/shopgpt_backend/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 -appVersion: 0.1.3 +appVersion: 0.1.4 description: A Helm chart for App, a declarative, GitOps continuous delivery helm chart for Kubernetes. keywords: - shopgpt-backend name: shopgpt-backend -version: "v0.1.9" +version: "v0.2.0" diff --git a/helm/shopgpt_backend/templates/hpa.yaml b/helm/shopgpt_backend/templates/hpa.yaml new file mode 100644 index 00000000..7b0b1fcb --- /dev/null +++ b/helm/shopgpt_backend/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "shopgpt-backend.fullname" . }} + labels: + {{- include "shopgpt-backend.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "shopgpt-backend.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/shopgpt_backend/values.yaml b/helm/shopgpt_backend/values.yaml index 97276920..d60c6fae 100644 --- a/helm/shopgpt_backend/values.yaml +++ b/helm/shopgpt_backend/values.yaml @@ -70,24 +70,24 @@ resources: {} # cpu: 100m # memory: 128Mi -# readinessProbe: -# httpGet: -# path: "" -# port: -# failureThreshold: 4 -# initialDelaySeconds: 120 -# periodSeconds: 10 -# successThreshold: 1 -# timeoutSeconds: 5 -# livenessProbe: -# httpGet: -# path: "" -# port: -# failureThreshold: 4 -# initialDelaySeconds: 160 -# periodSeconds: 10 -# successThreshold: 1 -# timeoutSeconds: 5 +readinessProbe: + httpGet: + path: "" + port: + failureThreshold: 4 + initialDelaySeconds: 120 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 +livenessProbe: + httpGet: + path: "" + port: + failureThreshold: 4 + initialDelaySeconds: 160 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 autoscaling: enabled: false From 2a408935f4d58c80ea71f19c2d4fc571c96697ed Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Thu, 7 Aug 2025 18:46:07 +0530 Subject: [PATCH 15/20] change in service target port --- helm/shopgpt_backend/Chart.yaml | 2 +- helm/shopgpt_backend/templates/service.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/shopgpt_backend/Chart.yaml b/helm/shopgpt_backend/Chart.yaml index c7011fce..c1bc8394 100644 --- a/helm/shopgpt_backend/Chart.yaml +++ b/helm/shopgpt_backend/Chart.yaml @@ -4,4 +4,4 @@ description: A Helm chart for App, a declarative, GitOps continuous delivery hel keywords: - shopgpt-backend name: shopgpt-backend -version: "v0.2.0" +version: "v0.2.1" diff --git a/helm/shopgpt_backend/templates/service.yaml b/helm/shopgpt_backend/templates/service.yaml index 11d28702..d361dbc6 100644 --- a/helm/shopgpt_backend/templates/service.yaml +++ b/helm/shopgpt_backend/templates/service.yaml @@ -8,7 +8,7 @@ spec: type: {{ .Values.service.type }} ports: - port: {{ .Values.service.port }} - targetPort: http + targetPort: {{ .Values.service.port }} protocol: TCP name: http selector: From e31ced91f2281e901496d9a5913afef2f66026b0 Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Mon, 18 Aug 2025 15:10:26 +0530 Subject: [PATCH 16/20] added mcp helm charts --- .../Chart.yaml | 8 +++---- .../templates/_helpers.tpl | 20 ++++++++--------- .../templates/deployment.yaml | 22 ++++++++++++++----- .../templates/hpa.yaml | 6 ++--- .../templates/ingress.yaml | 4 ++-- .../templates/service.yaml | 6 ++--- .../templates/serviceaccount.yaml | 4 ++-- .../values.yaml | 4 ++-- 8 files changed, 42 insertions(+), 32 deletions(-) rename helm/{shopgpt_backend => mcp_backend}/Chart.yaml (62%) rename helm/{shopgpt_backend => mcp_backend}/templates/_helpers.tpl (72%) rename helm/{shopgpt_backend => mcp_backend}/templates/deployment.yaml (73%) rename helm/{shopgpt_backend => mcp_backend}/templates/hpa.yaml (84%) rename helm/{shopgpt_backend => mcp_backend}/templates/ingress.yaml (94%) rename helm/{shopgpt_backend => mcp_backend}/templates/service.yaml (57%) rename helm/{shopgpt_backend => mcp_backend}/templates/serviceaccount.yaml (64%) rename helm/{shopgpt_backend => mcp_backend}/values.yaml (96%) diff --git a/helm/shopgpt_backend/Chart.yaml b/helm/mcp_backend/Chart.yaml similarity index 62% rename from helm/shopgpt_backend/Chart.yaml rename to helm/mcp_backend/Chart.yaml index c1bc8394..43c2f391 100644 --- a/helm/shopgpt_backend/Chart.yaml +++ b/helm/mcp_backend/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 -appVersion: 0.1.4 +appVersion: 0.1.0 description: A Helm chart for App, a declarative, GitOps continuous delivery helm chart for Kubernetes. keywords: -- shopgpt-backend -name: shopgpt-backend -version: "v0.2.1" +- mcp-backend +name: mcp-backend +version: "v0.0.1" diff --git a/helm/shopgpt_backend/templates/_helpers.tpl b/helm/mcp_backend/templates/_helpers.tpl similarity index 72% rename from helm/shopgpt_backend/templates/_helpers.tpl rename to helm/mcp_backend/templates/_helpers.tpl index e45c97c6..a179b50c 100644 --- a/helm/shopgpt_backend/templates/_helpers.tpl +++ b/helm/mcp_backend/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "shopgpt-backend.name" -}} +{{- define "mcp-backend.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ 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 "shopgpt-backend.fullname" -}} +{{- define "mcp-backend.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "shopgpt-backend.chart" -}} +{{- define "mcp-backend.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "shopgpt-backend.labels" -}} -helm.sh/chart: {{ include "shopgpt-backend.chart" . }} -{{ include "shopgpt-backend.selectorLabels" . }} +{{- define "mcp-backend.labels" -}} +helm.sh/chart: {{ include "mcp-backend.chart" . }} +{{ include "mcp-backend.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "shopgpt-backend.selectorLabels" -}} -app.kubernetes.io/name: {{ include "shopgpt-backend.name" . }} +{{- define "mcp-backend.selectorLabels" -}} +app.kubernetes.io/name: {{ include "mcp-backend.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "shopgpt-backend.serviceAccountName" -}} +{{- define "mcp-backend.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "shopgpt-backend.fullname" .) .Values.serviceAccount.name }} +{{- default (include "mcp-backend.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} diff --git a/helm/shopgpt_backend/templates/deployment.yaml b/helm/mcp_backend/templates/deployment.yaml similarity index 73% rename from helm/shopgpt_backend/templates/deployment.yaml rename to helm/mcp_backend/templates/deployment.yaml index d337ea63..73cb9089 100644 --- a/helm/shopgpt_backend/templates/deployment.yaml +++ b/helm/mcp_backend/templates/deployment.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "shopgpt-backend.fullname" . }} + name: {{ include "mcp-backend.fullname" . }} labels: - {{- include "shopgpt-backend.labels" . | nindent 4 }} + {{- include "mcp-backend.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: matchLabels: - {{- include "shopgpt-backend.selectorLabels" . | nindent 6 }} + {{- include "mcp-backend.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} @@ -18,13 +18,13 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "shopgpt-backend.selectorLabels" . | nindent 8 }} + {{- include "mcp-backend.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "shopgpt-backend.serviceAccountName" . }} + serviceAccountName: {{ include "mcp-backend.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: @@ -33,6 +33,16 @@ spec: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + command: + - java + args: + - -Xms512m + - -Xmx3024m + - -XX:MetaspaceSize=64m + - -XX:MaxMetaspaceSize=500m + - -Xss1024k + - -jar + - mcp-service-0.0.1-SNAPSHOT.jar env: {{- range $conf, $value := .Values.env }} - name: {{ $conf | quote }} @@ -40,7 +50,7 @@ spec: {{- end }} envFrom: - configMapRef: - name: shopgpt-configmap + name: mcp-configmap ports: - name: http containerPort: {{ .Values.service.port }} diff --git a/helm/shopgpt_backend/templates/hpa.yaml b/helm/mcp_backend/templates/hpa.yaml similarity index 84% rename from helm/shopgpt_backend/templates/hpa.yaml rename to helm/mcp_backend/templates/hpa.yaml index 7b0b1fcb..632c92af 100644 --- a/helm/shopgpt_backend/templates/hpa.yaml +++ b/helm/mcp_backend/templates/hpa.yaml @@ -2,14 +2,14 @@ apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: - name: {{ include "shopgpt-backend.fullname" . }} + name: {{ include "mcp-backend.fullname" . }} labels: - {{- include "shopgpt-backend.labels" . | nindent 4 }} + {{- include "mcp-backend.labels" . | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ include "shopgpt-backend.fullname" . }} + name: {{ include "mcp-backend.fullname" . }} minReplicas: {{ .Values.autoscaling.minReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }} metrics: diff --git a/helm/shopgpt_backend/templates/ingress.yaml b/helm/mcp_backend/templates/ingress.yaml similarity index 94% rename from helm/shopgpt_backend/templates/ingress.yaml rename to helm/mcp_backend/templates/ingress.yaml index e36ca0ed..36d9fc22 100644 --- a/helm/shopgpt_backend/templates/ingress.yaml +++ b/helm/mcp_backend/templates/ingress.yaml @@ -1,5 +1,5 @@ {{- if .Values.ingress.enabled -}} -{{- $fullName := include "shopgpt-backend.fullname" . -}} +{{- $fullName := include "mcp-backend.fullname" . -}} {{- $svcPort := .Values.service.port -}} {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} @@ -17,7 +17,7 @@ kind: Ingress metadata: name: {{ $fullName }} labels: - {{- include "shopgpt-backend.labels" . | nindent 4 }} + {{- include "mcp-backend.labels" . | nindent 4 }} {{- with .Values.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/helm/shopgpt_backend/templates/service.yaml b/helm/mcp_backend/templates/service.yaml similarity index 57% rename from helm/shopgpt_backend/templates/service.yaml rename to helm/mcp_backend/templates/service.yaml index d361dbc6..41c23f6c 100644 --- a/helm/shopgpt_backend/templates/service.yaml +++ b/helm/mcp_backend/templates/service.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "shopgpt-backend.fullname" . }} + name: {{ include "mcp-backend.fullname" . }} labels: - {{- include "shopgpt-backend.labels" . | nindent 4 }} + {{- include "mcp-backend.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: @@ -12,4 +12,4 @@ spec: protocol: TCP name: http selector: - {{- include "shopgpt-backend.selectorLabels" . | nindent 4 }} \ No newline at end of file + {{- include "mcp-backend.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/helm/shopgpt_backend/templates/serviceaccount.yaml b/helm/mcp_backend/templates/serviceaccount.yaml similarity index 64% rename from helm/shopgpt_backend/templates/serviceaccount.yaml rename to helm/mcp_backend/templates/serviceaccount.yaml index 21d93672..450bdd15 100644 --- a/helm/shopgpt_backend/templates/serviceaccount.yaml +++ b/helm/mcp_backend/templates/serviceaccount.yaml @@ -2,9 +2,9 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "shopgpt-backend.serviceAccountName" . }} + name: {{ include "mcp-backend.serviceAccountName" . }} labels: - {{- include "shopgpt-backend.labels" . | nindent 4 }} + {{- include "mcp-backend.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/helm/shopgpt_backend/values.yaml b/helm/mcp_backend/values.yaml similarity index 96% rename from helm/shopgpt_backend/values.yaml rename to helm/mcp_backend/values.yaml index d60c6fae..268a2b75 100644 --- a/helm/shopgpt_backend/values.yaml +++ b/helm/mcp_backend/values.yaml @@ -1,11 +1,11 @@ -# Default values for shopgpt-backend. +# Default values for mcp-backend. # This is a YAML-formatted file. # Declare variables to be passed into your templates. replicaCount: 1 image: - repository: blotout/shopgpt-backend + repository: blotout/mcp-service pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. tag: "0.20.4" From 675baeacf3b0d425d11eb5ed4a09126b3df8dd70 Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Mon, 18 Aug 2025 15:32:58 +0530 Subject: [PATCH 17/20] revert shopgpt helm charts --- helm/shopgpt_backend/Chart.yaml | 7 ++ helm/shopgpt_backend/templates/_helpers.tpl | 62 +++++++++++ .../shopgpt_backend/templates/deployment.yaml | 61 +++++++++++ helm/shopgpt_backend/templates/hpa.yaml | 32 ++++++ helm/shopgpt_backend/templates/ingress.yaml | 61 +++++++++++ helm/shopgpt_backend/templates/service.yaml | 15 +++ .../templates/serviceaccount.yaml | 12 ++ helm/shopgpt_backend/values.yaml | 103 ++++++++++++++++++ 8 files changed, 353 insertions(+) create mode 100644 helm/shopgpt_backend/Chart.yaml create mode 100644 helm/shopgpt_backend/templates/_helpers.tpl create mode 100644 helm/shopgpt_backend/templates/deployment.yaml create mode 100644 helm/shopgpt_backend/templates/hpa.yaml create mode 100644 helm/shopgpt_backend/templates/ingress.yaml create mode 100644 helm/shopgpt_backend/templates/service.yaml create mode 100644 helm/shopgpt_backend/templates/serviceaccount.yaml create mode 100644 helm/shopgpt_backend/values.yaml diff --git a/helm/shopgpt_backend/Chart.yaml b/helm/shopgpt_backend/Chart.yaml new file mode 100644 index 00000000..245fdad6 --- /dev/null +++ b/helm/shopgpt_backend/Chart.yaml @@ -0,0 +1,7 @@ +apiVersion: v2 +appVersion: 0.1.4 +description: A Helm chart for App, a declarative, GitOps continuous delivery helm chart for Kubernetes. +keywords: +- shopgpt-backend +name: shopgpt-backend +version: "v0.2.2" \ No newline at end of file diff --git a/helm/shopgpt_backend/templates/_helpers.tpl b/helm/shopgpt_backend/templates/_helpers.tpl new file mode 100644 index 00000000..e45c97c6 --- /dev/null +++ b/helm/shopgpt_backend/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "shopgpt-backend.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 "shopgpt-backend.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 "shopgpt-backend.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "shopgpt-backend.labels" -}} +helm.sh/chart: {{ include "shopgpt-backend.chart" . }} +{{ include "shopgpt-backend.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "shopgpt-backend.selectorLabels" -}} +app.kubernetes.io/name: {{ include "shopgpt-backend.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "shopgpt-backend.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "shopgpt-backend.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/shopgpt_backend/templates/deployment.yaml b/helm/shopgpt_backend/templates/deployment.yaml new file mode 100644 index 00000000..d337ea63 --- /dev/null +++ b/helm/shopgpt_backend/templates/deployment.yaml @@ -0,0 +1,61 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "shopgpt-backend.fullname" . }} + labels: + {{- include "shopgpt-backend.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "shopgpt-backend.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "shopgpt-backend.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "shopgpt-backend.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- range $conf, $value := .Values.env }} + - name: {{ $conf | quote }} + value: {{ $value | quote }} + {{- end }} + envFrom: + - configMapRef: + name: shopgpt-configmap + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} \ No newline at end of file diff --git a/helm/shopgpt_backend/templates/hpa.yaml b/helm/shopgpt_backend/templates/hpa.yaml new file mode 100644 index 00000000..7b0b1fcb --- /dev/null +++ b/helm/shopgpt_backend/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "shopgpt-backend.fullname" . }} + labels: + {{- include "shopgpt-backend.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "shopgpt-backend.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/shopgpt_backend/templates/ingress.yaml b/helm/shopgpt_backend/templates/ingress.yaml new file mode 100644 index 00000000..e36ca0ed --- /dev/null +++ b/helm/shopgpt_backend/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "shopgpt-backend.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "shopgpt-backend.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: ImplementationSpecific + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/shopgpt_backend/templates/service.yaml b/helm/shopgpt_backend/templates/service.yaml new file mode 100644 index 00000000..d361dbc6 --- /dev/null +++ b/helm/shopgpt_backend/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "shopgpt-backend.fullname" . }} + labels: + {{- include "shopgpt-backend.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + protocol: TCP + name: http + selector: + {{- include "shopgpt-backend.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/helm/shopgpt_backend/templates/serviceaccount.yaml b/helm/shopgpt_backend/templates/serviceaccount.yaml new file mode 100644 index 00000000..21d93672 --- /dev/null +++ b/helm/shopgpt_backend/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "shopgpt-backend.serviceAccountName" . }} + labels: + {{- include "shopgpt-backend.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/shopgpt_backend/values.yaml b/helm/shopgpt_backend/values.yaml new file mode 100644 index 00000000..d60c6fae --- /dev/null +++ b/helm/shopgpt_backend/values.yaml @@ -0,0 +1,103 @@ +# Default values for shopgpt-backend. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: blotout/shopgpt-backend + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "0.20.4" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +env: {} + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 8082 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + 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 + +readinessProbe: + httpGet: + path: "" + port: + failureThreshold: 4 + initialDelaySeconds: 120 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 +livenessProbe: + httpGet: + path: "" + port: + failureThreshold: 4 + initialDelaySeconds: 160 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} \ No newline at end of file From a8446418f87454c9a9766949da1c6bb72bb2e1a0 Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Mon, 18 Aug 2025 18:47:45 +0530 Subject: [PATCH 18/20] change in mcp command --- helm/mcp_backend/templates/deployment.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/helm/mcp_backend/templates/deployment.yaml b/helm/mcp_backend/templates/deployment.yaml index 73cb9089..b42aba01 100644 --- a/helm/mcp_backend/templates/deployment.yaml +++ b/helm/mcp_backend/templates/deployment.yaml @@ -36,13 +36,8 @@ spec: command: - java args: - - -Xms512m - - -Xmx3024m - - -XX:MetaspaceSize=64m - - -XX:MaxMetaspaceSize=500m - - -Xss1024k - -jar - - mcp-service-0.0.1-SNAPSHOT.jar + - /app/mcp-service/target/mcp-service-0.0.1-SNAPSHOT.jar env: {{- range $conf, $value := .Values.env }} - name: {{ $conf | quote }} From bb29ee9b25643bd5a85cc2971b2df1245816cc14 Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Mon, 18 Aug 2025 18:49:44 +0530 Subject: [PATCH 19/20] updated mcp app version --- helm/mcp_backend/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/mcp_backend/Chart.yaml b/helm/mcp_backend/Chart.yaml index 43c2f391..84a02a90 100644 --- a/helm/mcp_backend/Chart.yaml +++ b/helm/mcp_backend/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 -appVersion: 0.1.0 +appVersion: 0.2.0 description: A Helm chart for App, a declarative, GitOps continuous delivery helm chart for Kubernetes. keywords: - mcp-backend name: mcp-backend -version: "v0.0.1" +version: "v0.0.2" From 23a369dbc83971c818d22a9bc413e28882a39265 Mon Sep 17 00:00:00 2001 From: manojsaikumar Date: Mon, 18 Aug 2025 19:18:00 +0530 Subject: [PATCH 20/20] removed mcp command --- helm/mcp_backend/Chart.yaml | 2 +- helm/mcp_backend/templates/deployment.yaml | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/helm/mcp_backend/Chart.yaml b/helm/mcp_backend/Chart.yaml index 84a02a90..2315de6b 100644 --- a/helm/mcp_backend/Chart.yaml +++ b/helm/mcp_backend/Chart.yaml @@ -4,4 +4,4 @@ description: A Helm chart for App, a declarative, GitOps continuous delivery hel keywords: - mcp-backend name: mcp-backend -version: "v0.0.2" +version: "v0.0.3" diff --git a/helm/mcp_backend/templates/deployment.yaml b/helm/mcp_backend/templates/deployment.yaml index b42aba01..3005806f 100644 --- a/helm/mcp_backend/templates/deployment.yaml +++ b/helm/mcp_backend/templates/deployment.yaml @@ -33,11 +33,6 @@ spec: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} - command: - - java - args: - - -jar - - /app/mcp-service/target/mcp-service-0.0.1-SNAPSHOT.jar env: {{- range $conf, $value := .Values.env }} - name: {{ $conf | quote }}