|
| 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 -}} |
0 commit comments