Skip to content

Commit

Permalink
Add persistence support in Agent
Browse files Browse the repository at this point in the history
  • Loading branch information
akash4sh committed Dec 11, 2023
1 parent dd49023 commit 59568dc
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 8 deletions.
1 change: 0 additions & 1 deletion .github/workflows/helm_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
- name: Add Helm repos
run: |
helm repo add tools https://kube-tarian.github.io/helmrepo-supporting-tools
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-releaser
uses: helm/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion charts/agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.1.7
version: 1.1.8

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
60 changes: 57 additions & 3 deletions charts/agent/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,24 @@ spec:
value: "{{ .Values.schedule.kubepreupgradeInterval }}"
- name: TRIVY_INTERVAL
value: "{{ .Values.schedule.trivyInterval }}"
{{- if .Values.persistence.enabled }}
volumeMounts:
- name: data
mountPath: {{ .Values.persistence.mountPath }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
limits:
cpu: {{ .Values.resources.limits.cpu }}
memory: {{ .Values.resources.limits.memory }}
{{- if not .Values.persistence.enabled }}
ephemeral-storage: {{ .Values.resources.limits.ephemeralstorage }}
{{- end }}
requests:
cpu: {{ .Values.resources.requests.cpu }}
memory: {{ .Values.resources.requests.memory }}
{{- if not .Values.persistence.enabled }}
ephemeral-storage: {{ .Values.resources.requests.ephemeralstorage }}
{{- end }}
{{- if .Values.git_bridge.enabled }}
- name: git-bridge
image: "{{ .Values.git_bridge.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand All @@ -99,8 +115,24 @@ spec:
{{- end }}
- name: NATS_ADDRESS
value: {{ .Values.nats.host }}
{{- if .Values.git_bridge.persistence.enabled }}
volumeMounts:
- name: data
mountPath: {{ .Values.git_bridge.persistence.mountPath }}
{{- end }}
resources:
{{- toYaml .Values.git_bridge.resources | nindent 12 }}
limits:
cpu: {{ .Values.git_bridge.resources.limits.cpu }}
memory: {{ .Values.git_bridge.resources.limits.memory }}
{{- if not .Values.git_bridge.persistence.enabled }}
ephemeral-storage: {{ .Values.git_bridge.resources.limits.ephemeralstorage }}
{{- end }}
requests:
cpu: {{ .Values.git_bridge.resources.requests.cpu }}
memory: {{ .Values.git_bridge.resources.requests.memory }}
{{- if not .Values.git_bridge.persistence.enabled }}
ephemeral-storage: {{ .Values.git_bridge.resources.requests.ephemeralstorage }}
{{- end }}
{{- end }}
{{- if .Values.container_bridge.enabled }}
- name: container-bridge
Expand All @@ -124,9 +156,31 @@ spec:
{{- end }}
- name: NATS_ADDRESS
value: {{ .Values.nats.host }}
{{- if .Values.container_bridge.persistence.enabled }}
volumeMounts:
- name: data
mountPath: {{ .Values.container_bridge.persistence.mountPath }}
{{- end }}
resources:
{{- toYaml .Values.container_bridge.resources | nindent 12 }}
limits:
cpu: {{ .Values.container_bridge.resources.limits.cpu }}
memory: {{ .Values.container_bridge.resources.limits.memory }}
{{- if not .Values.container_bridge.persistence.enabled }}
ephemeral-storage: {{ .Values.container_bridge.resources.limits.ephemeralstorage }}
{{- end }}
requests:
cpu: {{ .Values.container_bridge.resources.requests.cpu }}
memory: {{ .Values.container_bridge.resources.requests.memory }}
{{- if not .Values.container_bridge.persistence.enabled }}
ephemeral-storage: {{ .Values.container_bridge.resources.requests.ephemeralstorage }}
{{- end }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumes:
- name: data
persistentVolumeClaim:
claimName: {{ include "agent.fullname" . }}-data
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
13 changes: 13 additions & 0 deletions charts/agent/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.persistence.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "agent.fullname" . }}-data
spec:
accessModes:
- {{ .Values.persistence.accessMode }}
storageClassName: {{ .Values.persistence.storageClass | default "" }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- end }}
31 changes: 28 additions & 3 deletions charts/agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,18 @@ git_bridge:
limits:
cpu: 200m
memory: 256Mi
ephemeral-storage: 100Mi
ephemeralstorage: 100Mi
requests:
cpu: 200m
memory: 256Mi
ephemeralstorage: 100Mi
persistence:
enabled: true
existingClaim: ""
storageClass: ""
mountPath: /mnt/agent/gb
accessMode: ReadWriteOnce
size: 5Gi
ingress:
enabled: true
annotations:
Expand Down Expand Up @@ -87,10 +95,18 @@ container_bridge:
limits:
cpu: 200m
memory: 256Mi
ephemeral-storage: 100Mi
ephemeralstorage: 100Mi
requests:
cpu: 200m
memory: 256Mi
ephemeralstorage: 100Mi
persistence:
enabled: true
existingClaim: ""
storageClass: ""
mountPath: /mnt/agent/cb
accessMode: ReadWriteOnce
size: 5Gi
ingress:
enabled: true
annotations:
Expand Down Expand Up @@ -127,10 +143,19 @@ resources:
limits:
cpu: 2
memory: 2Gi
ephemeral-storage: 1Gi
ephemeralstorage: 1Gi
requests:
cpu: 200m
memory: 256Mi
ephemeralstorage: 256Mi

persistence:
enabled: true
existingClaim: ""
storageClass: ""
mountPath: /mnt/agent/kbz
accessMode: ReadWriteOnce
size: 5Gi

autoscaling:
enabled: false
Expand Down

0 comments on commit 59568dc

Please sign in to comment.