Skip to content

Commit

Permalink
update based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
gertzakis committed Jan 15, 2024
1 parent e56fee9 commit 866ca8b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion charts/nautobot/templates/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ spec:
{{- end }}
volumes:
- name: "nautobot-static"
{{- if $.Values.nautobot.persistence.enabled }}
{{- if $.Values.nautobot.persistenceStaticFiles.enabled }}
persistentVolumeClaim:
claimName: {{ include "common.names.fullname" $ }}-static
{{- else }}
Expand Down
2 changes: 1 addition & 1 deletion charts/nautobot/templates/nautobot-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ spec:
terminationGracePeriodSeconds: {{ $nautobot.terminationGracePeriodSeconds }}
volumes:
- name: "nautobot-static"
{{- if $nautobot.persistence.enabled }}
{{- if $nautobot.persistenceStaticFiles.enabled }}
persistentVolumeClaim:
claimName: {{ include "common.names.fullname" $ }}-static
{{- else }}
Expand Down
14 changes: 7 additions & 7 deletions charts/nautobot/templates/pvc-static.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.nautobot.enabled -}}
{{- if and .Values.nautobot.persistence.enabled -}}
{{- if .Values.nautobot.persistenceStaticFiles.enabled -}}
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -15,19 +15,19 @@ metadata:
annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.nautobot.persistence.storageClass }}
{{- if (eq "-" .Values.nautobot.persistence.storageClass) }}
{{- if .Values.nautobot.persistenceStaticFiles.storageClassName }}
{{- if (eq "-" .Values.nautobot.persistenceStaticFiles.storageClassName) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.nautobot.persistence.storageClass | quote }}
storageClassName: {{ .Values.nautobot.persistenceStaticFiles.storageClassName | quote }}
{{- end }}
{{- end }}
accessModes:
- {{ .Values.nautobot.persistence.accessMode | quote }}
- {{ .Values.nautobot.persistenceStaticFiles.accessMode | quote }}
resources:
requests:
storage: {{ .Values.nautobot.persistence.size | quote }}
{{- with .Values.nautobot.persistence.selector }}
storage: {{ .Values.nautobot.persistenceStaticFiles.size | quote }}
{{- with .Values.nautobot.persistenceStaticFiles.selector }}
selector:
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down
10 changes: 5 additions & 5 deletions charts/nautobot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,17 @@ nautobot:
value: 2
periodSeconds: 15

# Add a Persistent Volume Claim for /static files of Nautobot
persistence:
# Add a Persistent Volume Claim for Nautobot static files
persistenceStaticFiles:
# --- Enable PVC and the relevant volumes
enabled: false
# --- [Kubernetes StorageClass Name](https://kubernetes.io/docs/concepts/storage/storage-classes/), for the creation of Persistent Volume Claim
storageClass: ""
storageClassName: ""
# --- [Kubernetes Volumes AccessMode](https://kubernetes.io/docs/concepts/storage/storage-classes/)
accessMode: "ReadWriteOnce"
# --- Persistent storage size request
size: "2Gi"
# ---
size: "1Gi"
# --- [Kubernetes PVC Selectors](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#selector) to specify volume for Persistent Volume Claim
selector: {}
# e.g.
# selector:
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced-features/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ With [Kubernetes](https://kubernetes.io/), public clouds, and the [dependency su
* [Ingress](ingress/)
* [MySQL Support](mysql/)
* [Nautobot as a Subchart](nautobot-as-subchart/)
* [Persistent Volume](persistence/)
* [Persistent Volume for Static Files](persistence/)
* [PostgreSQL High Availability](postgresql-ha/)
* [PostgreSQL TLS](postgresql-tls/)
* [Prometheus Operator Metrics](prometheus-metrics/)
Expand Down
6 changes: 3 additions & 3 deletions docs/advanced-features/persistence.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Persistence for Static files

Besides using an external shared storage (e.g. S3) for storing static files, it is also possible to leverage Kubernetes persistence. The following configuration creates a Persistent Volume Claim called `nautobot-static` and mounts it at the `/opt/nautobot/static` path of the Pods.
The recommended way to store static files is to use an external shared storage such as [using S3 for Django storage](https://docs.nautobot.com/projects/core/en/stable/user-guide/administration/guides/s3-django-storage/). That said, it is also possible to leverage Kubernetes Persistent Volumes, following the below setting a Persistent Volume Claim is created and mounted it at the `/opt/nautobot/static` path of the Pods.

```yaml
nautobot:
persistence:
enabled: true
storageClass: "your-storage-class"
accessMode: "ReadWriteMany"
size: "2Gi"
size: "1Gi"
```
Unfortunately, if the underlying storage solution does not support the `ReadWriteMany` option, you have to use node affinity in order for the Pods of the deployment to be scheduled on the same node as the Persistent Volume. Below there is an example using Node labels as selector to create the PVC and schedule the Pods in the same node.
Expand All @@ -18,7 +18,7 @@ nautobot:
persistence:
enabled: true
storageClass: "your-storage-class"
size: "2Gi"
size: "1Gi"
selector:
matchLabel:
nautobot-storage: static
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ nav:
- Ingress: "advanced-features/ingress.md"
- MySQL Support: "advanced-features/mysql.md"
- Nautobot as a Subchart: "advanced-features/nautobot-as-subchart.md"
- Persistent Volume: "advanced-features/persistence.md"
- Persistent Volume for Static Files: "advanced-features/persistence.md"
- PostgreSQL High Availability: "advanced-features/postgresql-ha.md"
- PostgreSQL TLS: "advanced-features/postgresql-tls.md"
- Prometheus Operator Metrics: "advanced-features/prometheus-metrics.md"
Expand Down

0 comments on commit 866ca8b

Please sign in to comment.