Skip to content

Commit

Permalink
Append production guidelines to NOTES
Browse files Browse the repository at this point in the history
Fixes #187
  • Loading branch information
LeoColomb authored Sep 6, 2024
1 parent f6f1f80 commit 173c81b
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 11 deletions.
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,9 @@ To install the chart with the release name `my-release` and default configuratio
helm install my-release --devel oci://ghcr.io/netbox-community/netbox-chart/netbox
```

The default configuration includes the required PostgreSQL and Redis database
services, but both should be managed externally in production deployments; see below.

### Production Usage

Always [use an existing Secret](#using-an-existing-secret) and supply all
passwords and secret keys yourself to avoid Helm re-generating any of them for
you.

We recommend setting both `postgresql.enabled` and `redis.enabled` to
`false` and using a separate external PostgreSQL and Redis instance. This
We recommend using separate external PostgreSQL and Redis instances. This
de-couples those services from the chart's bundled versions which may have
complex upgrade requirements. A clustered PostgreSQL server (e.g. using Zalando's
[Postgres Operator](https://github.com/zalando/postgres-operator)) and Redis
Expand Down
2 changes: 1 addition & 1 deletion charts/netbox/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: netbox
version: 5.0.0-beta.86
version: 5.0.0-beta.87
appVersion: "v4.0.11"
type: application
kubeVersion: ^1.25.0-0
Expand Down
28 changes: 27 additions & 1 deletion charts/netbox/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,57 @@ CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}

** Please be patient while the chart is being deployed **

Netbox can be accessed through the following DNS name from within the cluster:

{{ include "common.names.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} (port {{ .Values.service.port }})

To access Netbox site from outside the cluster follow the steps below.

{{- if .Values.ingress.enabled }}
NetBox should be available at the following URL(s) shortly:

{{ range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
{{- end }}
{{- end }}

{{- else if contains "NodePort" .Values.service.type }}

Get the application URL by running these commands:

export NODE_PORT=$(kubectl get --namespace {{ include "common.names.namespace" . | quote }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.names.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ include "common.names.namespace" . | quote }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT

{{- else if contains "LoadBalancer" .Values.service.type }}

Get the application URL by running these commands:

export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.names.namespace" . | quote }} {{ include "common.names.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}

NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ include "common.names.namespace" . | quote }} svc -w {{ include "common.names.fullname" . }}'

{{- else if contains "ClusterIP" .Values.service.type }}

Get the application URL by running these commands:

export POD_NAME=$(kubectl get pods --namespace {{ include "common.names.namespace" . | quote }} -l "app.kubernetes.io/name={{ include "common.names.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:8080

{{- end }}

{{- include "netbox.validateValues" . }}
{{- include "common.warnings.rollingTag" .Values.image }}
{{- include "common.warnings.rollingTag" .Values.init.image }}
{{- include "common.warnings.resources" (dict "sections" (list "metrics" "." "worker" "volumePermissions") "context" $) }}
{{- $passwordValidationErrors := list -}}
{{- if not .Values.superuser.existingSecret -}}
{{- $superuserPasswordValidationErrors := include "common.validations.values.single.empty" (dict "valueKey" "superuser.password" "secret" (include "common.secrets.name" (dict "defaultNameSuffix" "superuser" "context" .)) "field" "password" "context" $) -}}
{{- $passwordValidationErrors = append $passwordValidationErrors $superuserPasswordValidationErrors -}}
{{- end }}
{{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $) -}}
28 changes: 28 additions & 0 deletions charts/netbox/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,31 @@ Volume mounts for .Values.extraConfig entries
readOnly: true
{{ end -}}
{{- end }}

{{/*
Compile all warnings into a single message.
*/}}
{{- define "netbox.validateValues" -}}
{{- $messages := list -}}
{{- $messages := append $messages (include "netbox.validateValues.postgresql" .) -}}
{{- $messages := without $messages "" -}}
{{- $message := join "\n" $messages -}}
{{- if $message -}}
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
{{- end -}}
{{- end -}}

{{/*
Validate values of Netbox Chart - PostgreSQL
*/}}
{{- define "netbox.validateValues.postgresql" -}}
{{- if and (not .Values.postgresql.enabled) (or (empty .Values.externalDatabase.host) (empty .Values.externalDatabase.port) (empty .Values.externalDatabase.database)) -}}
netbox: postgresql
PostgreSQL installation has been disabled but without the required parameters
to use an external database. To use an external database, please ensure you provide
(at least) the following values:
externalDatabase.host=DB_SERVER_HOST
externalDatabase.database=DB_NAME
externalDatabase.port=DB_SERVER_PORT
{{- end -}}
{{- end -}}

0 comments on commit 173c81b

Please sign in to comment.