From e795b1b48b40105ea2102d6455520618102a6f58 Mon Sep 17 00:00:00 2001 From: prom3theu5 Date: Mon, 24 Jul 2023 09:52:37 +0100 Subject: [PATCH] Rework octopus storage to be optional, as well as provide existing claim names Also up the version of the container to latest v2023.2.13113 --- charts/octopus-deploy/Chart.yaml | 4 +- charts/octopus-deploy/templates/pvc.yaml | 33 ++++++++++++++- .../octopus-deploy/templates/statefulset.yaml | 40 +++++++++++-------- charts/octopus-deploy/values.yaml | 13 +++++- 4 files changed, 68 insertions(+), 22 deletions(-) diff --git a/charts/octopus-deploy/Chart.yaml b/charts/octopus-deploy/Chart.yaml index 11bdfdc..d76d71b 100644 --- a/charts/octopus-deploy/Chart.yaml +++ b/charts/octopus-deploy/Chart.yaml @@ -15,9 +15,9 @@ 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.0.18 +version: 1.0.19 # 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 # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: "2023.2.13100" \ No newline at end of file +appVersion: "2023.2.13113" \ No newline at end of file diff --git a/charts/octopus-deploy/templates/pvc.yaml b/charts/octopus-deploy/templates/pvc.yaml index 15ee4e9..450855c 100644 --- a/charts/octopus-deploy/templates/pvc.yaml +++ b/charts/octopus-deploy/templates/pvc.yaml @@ -1,3 +1,4 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingRepositoryClaim) }} kind: PersistentVolumeClaim apiVersion: v1 metadata: @@ -18,6 +19,9 @@ spec: requests: storage: {{.Values.persistence.repositoryVolumeSize}} --- +{{- end }} + +{{- if and .Values.persistence.enabled (not .Values.persistence.existingArtifactsClaim) }} kind: PersistentVolumeClaim apiVersion: v1 metadata: @@ -38,6 +42,9 @@ spec: requests: storage: {{.Values.persistence.artifactVolumeSize}} --- +{{- end }} + +{{- if and .Values.persistence.enabled (not .Values.persistence.existingTaskLogClaim) }} kind: PersistentVolumeClaim apiVersion: v1 metadata: @@ -56,4 +63,28 @@ spec: {{- end }} resources: requests: - storage: {{.Values.persistence.taskVolumeSize}} \ No newline at end of file + storage: {{.Values.persistence.taskLogVolumeSize}} +--- +{{- end }} + +{{- if and .Values.persistence.enabled (not .Values.persistence.existingServerLogClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: server-logs-claim +spec: + accessModes: + {{- if (gt (.Values.octopus.replicaCount | int) 1)}} + - ReadWriteMany + {{- else }} + - {{.Values.persistence.storageAccessMode}} + {{- end }} + {{- if (eq "-" (.Values.persistence.storageClassName | toString)) }} + storageClassName: "" + {{- else if .Values.persistence.storageClassName }} + storageClassName: "{{ .Values.persistence.storageClassName }}" + {{- end }} + resources: + requests: + storage: {{.Values.persistence.serverLogVolumeSize}} +{{- end }} \ No newline at end of file diff --git a/charts/octopus-deploy/templates/statefulset.yaml b/charts/octopus-deploy/templates/statefulset.yaml index 1515fc2..132f4d9 100644 --- a/charts/octopus-deploy/templates/statefulset.yaml +++ b/charts/octopus-deploy/templates/statefulset.yaml @@ -62,14 +62,33 @@ spec: terminationGracePeriodSeconds: 10 volumes: - name: repository-vol + {{- if .Values.persistence.enabled }} persistentVolumeClaim: - claimName: repository-claim + claimName: {{ .Values.persistence.existingRepositoryClaim | default "repository-claim" }} + {{- else }} + emptyDir: {} + {{- end }} - name: artifacts-vol + {{- if .Values.persistence.enabled }} persistentVolumeClaim: - claimName: artifacts-claim + claimName: {{ .Values.persistence.existingArtifactsClaim | default "artifacts-claim" }} + {{- else }} + emptyDir: {} + {{- end }} - name: task-logs-vol + {{- if .Values.persistence.enabled }} persistentVolumeClaim: - claimName: task-logs-claim + claimName: {{ .Values.persistence.existingTaskLogClaim | default "task-logs-claim" }} + {{- else }} + emptyDir: {} + {{- end }} + - name: server-logs-vol + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingServerLogClaim | default "server-logs-claim" }} + {{- else }} + emptyDir: {} + {{- end }} {{- if .Values.dockerHub.login }} imagePullSecrets: - name: dockerhubcreds @@ -181,17 +200,4 @@ spec: - -c - URL=http://localhost:8080; response=$(/usr/bin/curl -k $URL/api/octopusservernodes/ping --write-out %{http_code} --silent --output /dev/null); /usr/bin/test "$response" -ge 200 && /usr/bin/test "$response" -le 299 || /usr/bin/test "$response" -eq 418 failureThreshold: 30 - periodSeconds: 60 - volumeClaimTemplates: - - metadata: - name: server-logs-vol - spec: - accessModes: [ "ReadWriteOnce" ] - {{- if (eq "-" (.Values.persistence.storageClassName | toString)) }} - storageClassName: "" - {{- else if .Values.persistence.storageClassName }} - storageClassName: "{{ .Values.persistence.storageClassName }}" - {{- end }} - resources: - requests: - storage: {{.Values.persistence.logVolumeSize}} \ No newline at end of file + periodSeconds: 60 \ No newline at end of file diff --git a/charts/octopus-deploy/values.yaml b/charts/octopus-deploy/values.yaml index 225c8cf..2fa9028 100644 --- a/charts/octopus-deploy/values.yaml +++ b/charts/octopus-deploy/values.yaml @@ -60,6 +60,7 @@ octopus: exposeServices: false persistence: + enabled: true storageClassName: "" # When replica count is 1, this value defines the storage access type. When replica count is greater than 1, the # storage more is always ReadWriteMany. @@ -69,10 +70,18 @@ persistence: # The size of the artifact volume artifactVolumeSize: 1Gi # The size of the task log volume - taskVolumeSize: 1Gi + taskLogVolumeSize: 1Gi # The size of the server log volume. Each Octopus node mounts its own server log volume to ensure server logs # persist across restarts. - logVolumeSize: 200Mi + serverLogVolumeSize: 200Mi + # The name of the existing Task Logs PVC + existingTaskLogClaim: "" + # The name of the existing Server Logs PVC + existingServerLogClaim: "" + # The name of the existing Repository PVC + existingRepositoryClaim: "" + # The name of the existing artifacts PVC + existingArtifactsClaim: "" ingress: enabled: false