Skip to content

Commit

Permalink
Merge branch 'develop' into renovate/ghcr.io-nautobot-nautobot-2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ubajze committed Apr 24, 2024
2 parents f93fddb + 3cf9e83 commit a9de7db
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
# review when someone opens a pull request. Once approved, PR creators
# are encouraged to merge their own PRs.
# spell-checker: disable
* @nniehoff @ubajze
* @gertzakis @ubajze
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- run: "echo $HOME/go/bin >> $GITHUB_PATH"

- name: "Setup Helm"
uses: "azure/setup-helm@v3"
uses: "azure/setup-helm@v4"
- run: "mkdir template_output"
- run: "helm repo add bitnami https://charts.bitnami.com/bitnami"
- run: "helm dependency update charts/nautobot"
Expand All @@ -36,7 +36,7 @@ jobs:
env:
GO111MODULE: "on"

- uses: "dorny/paths-filter@v2"
- uses: "dorny/paths-filter@v3"
id: "filter"
with:
list-files: "shell"
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- uses: "azure/setup-helm@v3"
- uses: "azure/setup-helm@v4"
- run: "mkdir template_output"
- run: "helm repo add bitnami https://charts.bitnami.com/bitnami"
- run: "helm dependency update charts/nautobot"
Expand All @@ -94,7 +94,7 @@ jobs:
# or `main.tf` for a Terraform configuration file
file: "./template_output"
- name: "Upload result to GitHub Code Scanning"
uses: "github/codeql-action/upload-sarif@v2"
uses: "github/codeql-action/upload-sarif@v3"
with:
sarif_file: "snyk.sarif"

Expand All @@ -107,7 +107,7 @@ jobs:
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- uses: "azure/setup-helm@v3"
- uses: "azure/setup-helm@v4"
- name: "Install Kubescape"
run: "curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash"
- run: 'echo "${HOME}/.kubescape/bin" >> $GITHUB_PATH' # yamllint disable-line rule:quoted-strings
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ repos:
# - "console,checkov.sarif"

- repo: "https://github.com/norwoodj/helm-docs"
rev: "v1.11.3"
rev: "v1.13.1"
hooks:
- id: "helm-docs"
args:
Expand All @@ -84,7 +84,7 @@ repos:
- "--template-files=README.md.gotmpl"

- repo: "https://github.com/norwoodj/helm-docs"
rev: "v1.11.3"
rev: "v1.13.1"
hooks:
- id: "helm-docs"
args:
Expand Down
6 changes: 3 additions & 3 deletions charts/nautobot/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The secret key where the nautobot secret_key used by django will exist.
Retrieve existing django/nautobot secret key, use one provided via values or generate a random one
*/}}
{{- define "nautobot.django.secretKey" -}}
{{- include "common.secrets.passwords.manage" (dict "secret" (include "nautobot.django.secretName" .) "key" (include "nautobot.django.existingSecretSecretKeyKey" .) "providedValues" (list .Values.nautobot.django.secretKey .Values.nautobot.secretKey) "length" 64 "strong" true "context" $) -}}
{{- include "common.secrets.passwords.manage" (dict "secret" (include "nautobot.django.secretName" .) "key" (include "nautobot.django.existingSecretSecretKeyKey" .) "providedValues" (list "nautobot.django.secretKey" "nautobot.secretKey") "length" 64 "strong" true "context" $) -}}
{{- end -}}

{{- define "nautobot.superUser.secretName" -}}
Expand All @@ -91,11 +91,11 @@ Retrieve existing django/nautobot secret key, use one provided via values or gen
{{- end -}}

{{- define "nautobot.superUser.apiToken" -}}
{{- include "common.secrets.passwords.manage" (dict "secret" (include "nautobot.superUser.secretName" . ) "key" (include "nautobot.superUser.existingSecretApiTokenKey" .) "providedValues" (list .Values.nautobot.superUser.apitoken) "length" 40 "strong" false "context" $) -}}
{{- include "common.secrets.passwords.manage" (dict "secret" (include "nautobot.superUser.secretName" . ) "key" (include "nautobot.superUser.existingSecretApiTokenKey" .) "providedValues" (list "nautobot.superUser.apitoken") "length" 40 "strong" false "context" $) -}}
{{- end -}}

{{- define "nautobot.superUser.password" -}}
{{- include "common.secrets.passwords.manage" (dict "secret" (include "nautobot.superUser.secretName" . ) "key" (include "nautobot.superUser.existingSecretPasswordKey" .) "providedValues" (list .Values.nautobot.superUser.password) "length" 64 "strong" true "context" $) -}}
{{- include "common.secrets.passwords.manage" (dict "secret" (include "nautobot.superUser.secretName" . ) "key" (include "nautobot.superUser.existingSecretPasswordKey" .) "providedValues" (list "nautobot.superUser.password") "length" 64 "strong" true "context" $) -}}
{{- end -}}

{{/*
Expand Down
17 changes: 8 additions & 9 deletions docs/operations/backup-restore.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,29 @@
The recommended method of backing up Nautobot is simply to get a database dump from PostgreSQL:

```no-highlight
export NAMESPACE=nautobot # Be sure to use the correct namespace here
export POSTGRES_SECRET_NAME=nautobot-postgresql # If you have changed the default make sure you change it here
export POSTGRES_PASSWORD=$(kubectl get secret --namespace $NAMESPACE $POSTGRES_SECRET_NAME -o jsonpath="{.data.postgresql-password}" | base64 --decode)
echo $POSTGRES_PASSWORD | kubectl exec -itn $NAMESPACE statefulset.apps/nautobot-postgresql -- pg_dump --username nautobot --clean --if-exists nautobot > backup.sql
export POSTGRES_PASSWORD=$(kubectl get secret --namespace <my namespace> $POSTGRES_SECRET_NAME -o jsonpath="{.data.password}" | base64 --decode)
echo $POSTGRES_PASSWORD | kubectl exec -it --namespace <my namespace> statefulset.apps/nautobot-postgresql -- pg_dump --username nautobot --clean --if-exists nautobot > backup.sql
```

NOTE: The name of the secret is dependent on the helm release name and may be different in your environment.

Make sure to save your `NAUTOBOT_SECRET_KEY` in a safe place as well:

```no-highlight
kubectl get secret nautobot-env -o jsonpath="{.data.NAUTOBOT_SECRET_KEY}" | base64 --decode
kubectl get secret --namespace <my namespace> nautobot-env -o jsonpath="{.data.NAUTOBOT_SECRET_KEY}" | base64 --decode
```

These commands specific to your deployment can be found by inspecting the notes provided after the install:

```no-highlight
helm status nautobot
helm status --namespace <my namespace> nautobot
```

In addition please make sure to note ALL values used to deploy this helm chart:

```no-highlight
helm get values -o yaml nautobot > nautobot.values.yaml
helm get values --namespace <my namespace> -o yaml nautobot > nautobot.values.yaml
```

As with any backup procedure, these steps should be validated in your environment before relying on them in production.
Expand All @@ -40,13 +39,13 @@ This procedure assumes the [Backup Nautobot](#backup-nautobot) procedure was fol
Install Nautobot using the previous helm values:

```no-highlight
helm install nautobot nautobot/nautobot -f nautobot.values.yaml
helm install --namespace <my namespace> nautobot nautobot/nautobot -f nautobot.values.yaml
```

Upload the backup and restore:

```no-highlight
kubectl cp backup.sql nautobot-postgresql-0:/tmp
export POSTGRES_PASSWORD=$(kubectl get secret --namespace nautobot nautobot-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)
echo $POSTGRES_PASSWORD | kubectl exec -itn default statefulset.apps/nautobot-postgresql -- psql -U nautobot -f /tmp/backup.sql
export POSTGRES_PASSWORD=$(kubectl get secret --namespace <my namespace> nautobot-postgresql -o jsonpath="{.data.password}" | base64 --decode)
echo $POSTGRES_PASSWORD | kubectl exec -it --namespace <my namespace> statefulset.apps/nautobot-postgresql -- psql -U nautobot -f /tmp/backup.sql
```
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mkdocs==1.5.3
mkdocs==1.6.0
mkdocs-material==9.5.18
mkdocs-version-annotations==1.0.0
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readme = "README.md"
python = "^3.8"
invoke = "*"
# Rendering docs to HTML
mkdocs = "~1.5.3"
mkdocs = "~1.6.0"
# Material for MkDocs theme
mkdocs-material = "9.5.18"
# Render custom markdown for version added/changed/remove notes
Expand Down

0 comments on commit a9de7db

Please sign in to comment.