From b4c7a0386d83679d57df52b7ca1e0876a00673be Mon Sep 17 00:00:00 2001 From: log101 Date: Sun, 9 Mar 2025 02:11:57 +0300 Subject: [PATCH] ci: add go service to charts --- chart/templates/deployment.yaml | 24 ++++++++++++++++++++++ chart/templates/pvc.yaml | 18 +++++++++++++++++ chart/templates/service.yaml | 3 +++ chart/values.yaml | 35 ++++++++++++++++++++++----------- 4 files changed, 69 insertions(+), 11 deletions(-) create mode 100644 chart/templates/pvc.yaml diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index 1dd9b0b..9ebcc3e 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -61,6 +61,30 @@ spec: volumeMounts: {{- toYaml . | nindent 12 }} {{- end }} + - name: {{ .Chart.Name }}-secondary + ports: + - name: secondary + containerPort: 8000 + protocol: TCP + image: "{{ .Values.secondaryApp.image.repository }}:{{ .Values.secondaryApp.image.tag }}" + imagePullPolicy: {{ .Values.secondaryApp.image.pullPolicy }} + {{- with .Values.secondaryApp.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + {{- if .Values.persistence.enabled }} + - name: data + mountPath: {{ .Values.persistence.mountPath }} + {{- end }} + {{- with .Values.secondaryApp.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- if .Values.secondaryApp.command }} + command: + {{- toYaml .Values.secondaryApp.command | nindent 12 }} + {{- end }} {{- with .Values.volumes }} volumes: {{- toYaml . | nindent 8 }} diff --git a/chart/templates/pvc.yaml b/chart/templates/pvc.yaml new file mode 100644 index 0000000..a1c5717 --- /dev/null +++ b/chart/templates/pvc.yaml @@ -0,0 +1,18 @@ +# templates/pvc.yaml +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "common.names.fullname" . }} + labels: + {{- include "common.labels.standard" . | nindent 4 }} +spec: + accessModes: + {{- toYaml .Values.persistence.accessModes | nindent 4 }} + resources: + requests: + storage: {{ .Values.persistence.size }} + {{- if .Values.persistence.storageClass }} + storageClassName: {{ .Values.persistence.storageClass | quote }} + {{- end }} +{{- end }} diff --git a/chart/templates/service.yaml b/chart/templates/service.yaml index daaca10..ba24e74 100644 --- a/chart/templates/service.yaml +++ b/chart/templates/service.yaml @@ -10,4 +10,7 @@ spec: targetPort: http protocol: TCP name: http + - name: secondary + port: 8000 + targetPort: 8000 selector: {{- include "chart.selectorLabels" . | nindent 4 }} diff --git a/chart/values.yaml b/chart/values.yaml index 55a0546..8f322a4 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -112,21 +112,34 @@ autoscaling: targetCPUUtilizationPercentage: 80 # targetMemoryUtilizationPercentage: 80 -# Additional volumes on the output Deployment definition. -volumes: [] -# - name: foo -# secret: -# secretName: mysecret -# optional: false +volumes: + - name: data + persistentVolumeClaim: + claimName: blog-service-claim -# Additional volumeMounts on the output Deployment definition. -volumeMounts: [] -# - name: foo -# mountPath: "/etc/foo" -# readOnly: true +volumeMounts: + - name: data + mountPath: /data + +secondaryApp: + image: + repository: registry.acayip.dev/blog-services + tag: "latest" + pullPolicy: IfNotPresent + securityContext: {} + resources: {} nodeSelector: {} tolerations: [] affinity: {} + +persistence: + enabled: true + existingClaim: "" # Use existing PVC (optional) + storageClass: "" + accessModes: + - ReadWriteOnce + size: 1Gi + mountPath: /data # Directory where SQLite file is stored