Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions helm-chart/templates/shoppingassistantservice.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{{- if .Values.shoppingAssistantService.create }}
{{- if .Values.serviceAccounts.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.shoppingAssistantService.name }}
namespace: {{ .Release.Namespace }}
{{- if not .Values.serviceAccounts.annotationsOnlyForCartservice }}
{{- with .Values.serviceAccounts.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

---
{{- end }}

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.shoppingAssistantService.name }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Values.shoppingAssistantService.name }}
spec:
selector:
matchLabels:
app: {{ .Values.shoppingAssistantService.name }}
template:
metadata:
labels:
app: {{ .Values.shoppingAssistantService.name }}
spec:
{{- if .Values.serviceAccounts.create }}
serviceAccountName: {{ .Values.shoppingAssistantService.name }}
{{- else }}
serviceAccountName: default
{{- end }}
terminationGracePeriodSeconds: 5
{{- if .Values.securityContext.enable }}
securityContext:
fsGroup: 1000
runAsGroup: 1000
runAsNonRoot: true
runAsUser: 1000
{{- if .Values.seccompProfile.enable }}
seccompProfile:
type: {{ .Values.seccompProfile.type }}
{{- end }}
{{- end }}
containers:
- name: server
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
privileged: false
image: {{ .Values.images.repository }}/{{ .Values.shoppingAssistantService.name }}:{{ .Values.images.tag | default .Chart.AppVersion }}
ports:
- containerPort: 8080
env:
- name: PORT
value: "8080"
- name: GOOGLE_APPLICATION_CREDENTIALS
value: "/var/secrets/google/key.json"
- name: ALLOYDB_CLUSTER_NAME
value: {{ .Values.shoppingAssistantService.alloydbClusterName | quote }}
- name: ALLOYDB_INSTANCE_NAME
value: {{ .Values.shoppingAssistantService.alloydbInstanceName | quote }}
- name: ALLOYDB_DATABASE_NAME
value: {{ .Values.shoppingAssistantService.alloydbDatabaseName | quote }}
- name: ALLOYDB_TABLE_NAME
value: {{ .Values.shoppingAssistantService.alloydbTableName | quote }}
- name: ALLOYDB_SECRET_NAME
value: {{ .Values.shoppingAssistantService.alloydbSecretName | quote }}
- name: PROJECT_ID
value: {{ .Values.shoppingAssistantService.projectId | quote }}
- name: REGION
value: {{ .Values.shoppingAssistantService.region | quote }}
{{- if .Values.opentelemetryCollector.create }}
- name: COLLECTOR_SERVICE_ADDR
value: "{{ .Values.opentelemetryCollector.name }}:4317"
- name: OTEL_SERVICE_NAME
value: "{{ .Values.shoppingAssistantService.name }}"
{{- end }}
{{- if .Values.googleCloudOperations.tracing }}
- name: ENABLE_TRACING
value: "1"
{{- end }}
{{- if not .Values.googleCloudOperations.profiler }}
- name: DISABLE_PROFILER
value: "1"
{{- end }}
volumeMounts:
- name: gcp-key
mountPath: /var/secrets/google
readOnly: true
volumes:
- name: gcp-key
secret:
secretName: {{ .Values.shoppingAssistantService.name }}-gcp-key
resources:
{{- toYaml .Values.shoppingAssistantService.resources | nindent 10 }}

---

apiVersion: v1
kind: Service
metadata:
name: {{ .Values.shoppingAssistantService.name }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Values.shoppingAssistantService.name }}
spec:
type: ClusterIP
selector:
app: {{ .Values.shoppingAssistantService.name }}
ports:
- name: http
port: 80
targetPort: 8080


# Make sure to create a secret like this one with the GCP credentials
# apiVersion: v1
# kind: Secret
# metadata:
# name: {{ .Values.shoppingAssistantService.name }}-gcp-key
# namespace: {{ .Release.Namespace }}
# type: Opaque
# data:
# key.json: ""

{{ end -}}
20 changes: 16 additions & 4 deletions helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Declare variables to be passed into your templates.

images:
repository: us-central1-docker.pkg.dev/google-samples/microservices-demo
repository: ghcr.io/riptideslabs/microservice-demo
# Overrides the image tag whose default is the chart appVersion.
tag: ""

Expand Down Expand Up @@ -213,8 +213,20 @@ cartDatabase:
endpointPort: ""
certificate: ""

# @TODO: This service is not currently available in Helm.
# https://github.com/GoogleCloudPlatform/microservices-demo/tree/main/kustomize/components/shopping-assistant
shoppingAssistantService:
create: false
create: true
name: shoppingassistantservice
alloydbClusterName: microservices-demo
alloydbInstanceName: microservices-demo-primary
alloydbDatabaseName: shoppingassistant
alloydbTableName: catalog_items
projectId: ""
region: europe-west1
resources:
requests:
cpu: 100m
memory: 64Mi
limits:
cpu: 200m
memory: 128Mi

1 change: 1 addition & 0 deletions src/shoppingassistantservice/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ langchain==0.3.21
pillow==11.1.0
langchain-google-alloydb-pg==0.10.0
google-cloud-secret-manager==2.23.2
langgraph==0.5.2
Loading