Skip to content

Commit e2b335e

Browse files
authored
feat: add shoppingassitant service (#4)
* feat: add shoppingassitant service * chore: update alloy values
1 parent ac0ed54 commit e2b335e

File tree

5 files changed

+257
-74
lines changed

5 files changed

+257
-74
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{{- if .Values.shoppingAssistantService.create }}
2+
{{- if .Values.serviceAccounts.create }}
3+
apiVersion: v1
4+
kind: ServiceAccount
5+
metadata:
6+
name: {{ .Values.shoppingAssistantService.name }}
7+
namespace: {{ .Release.Namespace }}
8+
{{- if not .Values.serviceAccounts.annotationsOnlyForCartservice }}
9+
{{- with .Values.serviceAccounts.annotations }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
{{- end }}
14+
15+
---
16+
{{- end }}
17+
18+
apiVersion: apps/v1
19+
kind: Deployment
20+
metadata:
21+
name: {{ .Values.shoppingAssistantService.name }}
22+
namespace: {{ .Release.Namespace }}
23+
labels:
24+
app: {{ .Values.shoppingAssistantService.name }}
25+
spec:
26+
selector:
27+
matchLabels:
28+
app: {{ .Values.shoppingAssistantService.name }}
29+
template:
30+
metadata:
31+
labels:
32+
app: {{ .Values.shoppingAssistantService.name }}
33+
spec:
34+
{{- if .Values.serviceAccounts.create }}
35+
serviceAccountName: {{ .Values.shoppingAssistantService.name }}
36+
{{- else }}
37+
serviceAccountName: default
38+
{{- end }}
39+
terminationGracePeriodSeconds: 5
40+
{{- if .Values.securityContext.enable }}
41+
securityContext:
42+
fsGroup: 1000
43+
runAsGroup: 1000
44+
runAsNonRoot: true
45+
runAsUser: 1000
46+
{{- if .Values.seccompProfile.enable }}
47+
seccompProfile:
48+
type: {{ .Values.seccompProfile.type }}
49+
{{- end }}
50+
{{- end }}
51+
containers:
52+
- name: server
53+
securityContext:
54+
allowPrivilegeEscalation: false
55+
capabilities:
56+
drop:
57+
- ALL
58+
privileged: false
59+
image: {{ .Values.images.repository }}/{{ .Values.shoppingAssistantService.name }}:{{ .Values.images.tag | default .Chart.AppVersion }}
60+
ports:
61+
- containerPort: 8080
62+
env:
63+
- name: PORT
64+
value: "8080"
65+
- name: GOOGLE_APPLICATION_CREDENTIALS
66+
value: "/var/secrets/google/key.json"
67+
- name: ALLOYDB_CLUSTER_NAME
68+
value: {{ .Values.shoppingAssistantService.alloydbClusterName | quote }}
69+
- name: ALLOYDB_INSTANCE_NAME
70+
value: {{ .Values.shoppingAssistantService.alloydbInstanceName | quote }}
71+
- name: ALLOYDB_DATABASE_NAME
72+
value: {{ .Values.shoppingAssistantService.alloydbDatabaseName | quote }}
73+
- name: ALLOYDB_TABLE_NAME
74+
value: {{ .Values.shoppingAssistantService.alloydbTableName | quote }}
75+
- name: ALLOYDB_SECRET_NAME
76+
value: {{ .Values.shoppingAssistantService.alloydbSecretName | quote }}
77+
- name: PROJECT_ID
78+
value: {{ .Values.shoppingAssistantService.projectId | quote }}
79+
- name: REGION
80+
value: {{ .Values.shoppingAssistantService.region | quote }}
81+
{{- if .Values.opentelemetryCollector.create }}
82+
- name: COLLECTOR_SERVICE_ADDR
83+
value: "{{ .Values.opentelemetryCollector.name }}:4317"
84+
- name: OTEL_SERVICE_NAME
85+
value: "{{ .Values.shoppingAssistantService.name }}"
86+
{{- end }}
87+
{{- if .Values.googleCloudOperations.tracing }}
88+
- name: ENABLE_TRACING
89+
value: "1"
90+
{{- end }}
91+
{{- if not .Values.googleCloudOperations.profiler }}
92+
- name: DISABLE_PROFILER
93+
value: "1"
94+
{{- end }}
95+
volumeMounts:
96+
- name: gcp-key
97+
mountPath: /var/secrets/google
98+
readOnly: true
99+
volumes:
100+
- name: gcp-key
101+
secret:
102+
secretName: {{ .Values.shoppingAssistantService.name }}-gcp-key
103+
resources:
104+
{{- toYaml .Values.shoppingAssistantService.resources | nindent 10 }}
105+
106+
---
107+
108+
apiVersion: v1
109+
kind: Service
110+
metadata:
111+
name: {{ .Values.shoppingAssistantService.name }}
112+
namespace: {{ .Release.Namespace }}
113+
labels:
114+
app: {{ .Values.shoppingAssistantService.name }}
115+
spec:
116+
type: ClusterIP
117+
selector:
118+
app: {{ .Values.shoppingAssistantService.name }}
119+
ports:
120+
- name: http
121+
port: 80
122+
targetPort: 8080
123+
124+
125+
# Make sure to create a secret like this one with the GCP credentials
126+
# apiVersion: v1
127+
# kind: Secret
128+
# metadata:
129+
# name: {{ .Values.shoppingAssistantService.name }}-gcp-key
130+
# namespace: {{ .Release.Namespace }}
131+
# type: Opaque
132+
# data:
133+
# key.json: ""
134+
135+
{{ end -}}

helm-chart/values.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# Declare variables to be passed into your templates.
1818

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

@@ -213,8 +213,20 @@ cartDatabase:
213213
endpointPort: ""
214214
certificate: ""
215215

216-
# @TODO: This service is not currently available in Helm.
217-
# https://github.com/GoogleCloudPlatform/microservices-demo/tree/main/kustomize/components/shopping-assistant
218216
shoppingAssistantService:
219-
create: false
217+
create: true
220218
name: shoppingassistantservice
219+
alloydbClusterName: microservices-demo
220+
alloydbInstanceName: microservices-demo-primary
221+
alloydbDatabaseName: shoppingassistant
222+
alloydbTableName: catalog_items
223+
projectId: ""
224+
region: europe-west1
225+
resources:
226+
requests:
227+
cpu: 100m
228+
memory: 64Mi
229+
limits:
230+
cpu: 200m
231+
memory: 128Mi
232+

src/shoppingassistantservice/requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ langchain==0.3.21
44
pillow==11.1.0
55
langchain-google-alloydb-pg==0.10.0
66
google-cloud-secret-manager==2.23.2
7+
langgraph==0.5.2

0 commit comments

Comments
 (0)