Skip to content

Commit

Permalink
Merge pull request #406 from nautobot/develop
Browse files Browse the repository at this point in the history
Release v2.1.2
  • Loading branch information
gertzakis authored May 31, 2024
2 parents 53184a0 + 213f9bb commit e584e23
Show file tree
Hide file tree
Showing 17 changed files with 519 additions and 391 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
- "docs/"

- repo: "https://github.com/streetsidesoftware/cspell-cli"
rev: "v8.7.0"
rev: "v8.8.2"
hooks:
- id: "cspell"

Expand Down
6 changes: 3 additions & 3 deletions charts/nautobot/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ dependencies:
version: 12.15.0
- name: common
repository: oci://registry-1.docker.io/bitnamicharts
version: 2.19.1
digest: sha256:71657c3a97bd7d14cc7bf6ef8f861808c13ddc5dc53320503f7d2652d87448e6
generated: "2024-04-24T14:31:40.391068+02:00"
version: 2.19.2
digest: sha256:cf14954d4eece195f0719a1b919964d2d70dd39ac8c0ae2e6d4629c94499fe44
generated: "2024-05-13T13:03:35.824684885+03:00"
20 changes: 9 additions & 11 deletions charts/nautobot/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ annotations:
artifacthub.io/prerelease: "false"
artifacthub.io/images: |
- name: nautobot
image: ghcr.io/nautobot/nautobot:2.2.2-py3.11
image: ghcr.io/nautobot/nautobot:2.2.5-py3.11
artifacthub.io/links: |
- name: Nautobot Documentation
url: https://docs.nautobot.com/
Expand All @@ -31,22 +31,20 @@ annotations:
url: https://raw.githubusercontent.com/nautobot/nautobot/develop/nautobot/docs/media/ss_plugin_chatops.png
artifacthub.io/changes: |
- kind: added
description: Added #379 Option to define harakiri uwsgi timeout
description: Added #391 option for persistent volume claim for media files
- kind: fixed
description: Fixed #381 DB and Redis secrets
- kind: fixed
description: Fixed #374 Correct secret keys for Django passwords
description: Fixed #398 documentation to include Persistent volume changes
- kind: changed
description: Upgraded Nautobot from 2.1.9 to 2.2.2
description: Upgraded Nautobot from 2.2.2 to 2.2.5
- kind: changed
description: Upgraded Bitnami Common subchart from 2.13.3 to 2.19.1
description: Upgraded nginx-prometheus-exporter image from 0.11.0 to 1.1.0
- kind: changed
description: Upgraded RabbitMQ subchart from 12.5.4 to 12.15.0
description: Upgraded Bitnami Common subchart from 2.19.1 to 2.19.2
- kind: changed
description: Upgraded Redis subchart from 18.4.0 to 18.19.4
description: Upgraded dependency mkdocs-material from 9.5.18 to 9.5.22
apiVersion: "v2"
appVersion: "2.2.2"
version: "2.1.1"
appVersion: "2.2.5"
version: "2.1.2"
dependencies:
- condition: "redis.enabled"
name: "redis"
Expand Down
371 changes: 188 additions & 183 deletions charts/nautobot/README.md

Large diffs are not rendered by default.

Binary file removed charts/nautobot/charts/common-2.19.1.tgz
Binary file not shown.
Binary file added charts/nautobot/charts/common-2.19.2.tgz
Binary file not shown.
9 changes: 9 additions & 0 deletions charts/nautobot/templates/nautobot-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ spec:
volumeMounts:
- name: "nautobot-static"
mountPath: "/opt/nautobot/static"
- name: "nautobot-media"
mountPath: "/opt/nautobot/media"
- name: "git-repos"
mountPath: "/opt/nautobot/git"
- name: "nautobot-config"
Expand Down Expand Up @@ -420,6 +422,13 @@ spec:
{{- else }}
emptyDir: {}
{{- end }}
- name: "nautobot-media"
{{- if $nautobot.persistenceMediaFiles.enabled }}
persistentVolumeClaim:
claimName: {{ include "common.names.fullname" $ }}-media
{{- else }}
emptyDir: {}
{{- end }}
- name: "git-repos"
emptyDir: {}
- name: "nautobot-config"
Expand Down
35 changes: 35 additions & 0 deletions charts/nautobot/templates/pvc-media.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{- if .Values.nautobot.enabled -}}
{{- if .Values.nautobot.persistenceMediaFiles.enabled -}}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "common.names.fullname" $ }}-media
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" $ | nindent 4 }}
app.kubernetes.io/component: nautobot-media-pvc
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.nautobot.persistenceMediaFiles.storageClassName }}
{{- if (eq "-" .Values.nautobot.persistenceMediaFiles.storageClassName) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.nautobot.persistenceMediaFiles.storageClassName | quote }}
{{- end }}
{{- end }}
accessModes:
- {{ .Values.nautobot.persistenceMediaFiles.accessMode | quote }}
resources:
requests:
storage: {{ .Values.nautobot.persistenceMediaFiles.size | quote }}
{{- with .Values.nautobot.persistenceMediaFiles.selector }}
selector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{ end -}}
{{ end -}}
29 changes: 29 additions & 0 deletions charts/nautobot/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,35 @@
],
"title": "Persistence"
},
"persistenceMediaFiles": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean"
},
"storageClassName": {
"type": "string"
},
"accessMode": {
"type": "string"
},
"size": {
"type": "string"
},
"selector": {
"type": "object"
}
},
"required": [
"accessMode",
"enabled",
"selector",
"size",
"storageClassName"
],
"title": "Persistence"
},
"command": {
"type": "array",
"items": {
Expand Down
21 changes: 19 additions & 2 deletions charts/nautobot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ nautobot:
# -- Nautobot image name, common to all deployments
repository: "nautobot/nautobot"
# -- Nautobot image tag, common to all deployments
tag: "2.2.2-py3.11"
tag: "2.2.5-py3.11"
# -- [Kubernetes image pull policy](https://kubernetes.io/docs/concepts/containers/images/), common to all deployments valid values: `Always`, `Never`, or `IfNotPresent`
pullPolicy: "Always"
# -- ([]string) List of secret names to be used as image [pull secrets](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/), common to all deployments
Expand Down Expand Up @@ -254,6 +254,23 @@ nautobot:
# matchLabel:
# nautobot-storage: static

# Add a Persistent Volume Claim for Nautobot media files
persistenceMediaFiles:
# --- 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
storageClassName: ""
# --- [Kubernetes Volumes AccessMode](https://kubernetes.io/docs/concepts/storage/storage-classes/)
accessMode: "ReadWriteOnce"
# --- Persistent storage size request
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:
# matchLabel:
# nautobot-storage: media

# Nautobot NGINX configuration
nginx:
# -- Enable an nginx sidecar to proxy Nautobot traffic (can be useful for large deployments)
Expand Down Expand Up @@ -813,7 +830,7 @@ metrics:
# -- NGINX Exporter image name
repository: "nginx/nginx-prometheus-exporter"
# -- NGINX Exporter image tag
tag: "0.11.0"
tag: "1.1.0"
# -- [Kubernetes image pull policy](https://kubernetes.io/docs/concepts/containers/images/) valid values: `Always`, `Never`, or `IfNotPresent`
pullPolicy: "Always"
# -- ([]string) List of secret names to be used as image [pull secrets](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/), common to all deployments
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 for Static Files](persistence/)
* [Persistent Volumes for Files](persistence/)
* [PostgreSQL High Availability](postgresql-ha/)
* [PostgreSQL TLS](postgresql-tls/)
* [Prometheus Operator Metrics](prometheus-metrics/)
Expand Down
23 changes: 18 additions & 5 deletions docs/advanced-features/persistence.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
# Persistence for Static files
# Persistence for Static and Media files

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.
The recommended way to store static and media 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:
persistenceStaticFiles:
enabled: true
storageClass: "your-storage-class"
accessMode: "ReadWriteMany"
size: "1Gi"
```
There is also a setting for Media files mounted at `/opt/nautobot/media` of Nautobot's Pods, similar to the static one, as shown below.

```yaml
nautobot:
persistence:
persistenceMediaFiles:
enabled: true
storageClass: "your-storage-class"
accessMode: "ReadWriteMany"
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.
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 Volumes. Below there is an example using Node labels as selector to create the PVC for static files and schedule the Pods in the same node.

```yaml
nautobot:
persistence:
persistenceStaticFiles:
enabled: true
storageClass: "your-storage-class"
size: "1Gi"
Expand Down
Loading

0 comments on commit e584e23

Please sign in to comment.