NAS-122722 / 24.04 / nextcloud - display db details on NOTES.txt (#1484)

* display db details on NOTES.txt

* typo
This commit is contained in:
Stavros Kois
2023-08-29 15:53:58 +03:00
committed by GitHub
parent 4b45098fc6
commit bdea2a6f8f
4 changed files with 31 additions and 13 deletions

View File

@@ -4,7 +4,7 @@ description: A file sharing server that puts the control and security of your ow
annotations:
title: Nextcloud
type: application
version: 1.6.40
version: 1.6.41
apiVersion: v2
appVersion: 27.0.2
kubeVersion: '>=1.16.0-0'

View File

@@ -1,3 +1,16 @@
1. Get the nextcloud URL by running:
## Database
You can connect to the database using the pgAdmin App from the catalog
echo http://{{ .Values.nextcloud.host }}:{{ .Values.service.nodePort }}/
<details>
<summary>Database Details</summary>
- Database: `nextcloud`
- Username: `{{ .Values.nextcloudDbUser | b64dec }}`
- Password: `{{ .Values.nextcloudDbPass | b64dec }}`
- Host: `{{ .Values.nextcloudDbHost }}.{{ .Release.Namespace }}.svc.cluster.local`
- Port: `5432`
</details>
{{- $_ := unset .Values "nextcloudDbUser" }}
{{- $_ := unset .Values "nextcloudDbPass" }}
{{- $_ := unset .Values "nextcloudDbHost" }}

View File

@@ -74,6 +74,7 @@ spec: {{ include "common.deployment.common_spec" . | nindent 2 }}
env: {{ include "postgres.envVariableConfiguration" $postgres_values | nindent 10 }}
{{ $secretName := (include "common.names.fullname" .) }}
{{ $envList := (default list .Values.environmentVariables) }}
{{- $_ := set .Values "nextcloudDbHost" (include "common.names.fullname" $postgres_values) -}} {{/* Temprary store it on values to display it on NOTES */}}
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_HOST" "value" (printf "%s:5432" (include "common.names.fullname" $postgres_values))) }}
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_DB" "value" (include "postgres.DatabaseName" .)) }}
{{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_DATA_DIR" "value" .Values.nextcloud.datadir) }}

View File

@@ -10,13 +10,17 @@ data:
characters. So to keep that user for existing installations we retrieve
it from the existing secret.
*/}}
{{ with (lookup "v1" "Secret" .Release.Namespace $secretName)}}
db-user: {{ index .data "db-user" }}
{{ else }}
db-user: {{ (include "postgres.DatabaseName" .Values ) | b64enc }}
{{ end }}
{{ with (lookup "v1" "Secret" .Release.Namespace $secretName) }}
db-password: {{ index .data "db-password" }}
{{ else }}
db-password: {{ randAlphaNum 15 | b64enc }}
{{ end }}
{{/* Init values */}}
{{- $dbUser := ((include "postgres.DatabaseName" .Values) | b64enc) -}}
{{- $dbPass := (randAlphaNum 15 | b64enc) -}}
{{- with (lookup "v1" "Secret" .Release.Namespace $secretName) -}}
{{/* If there is a previous secret, use that */}}
{{- $dbUser = (index .data "db-user") -}}
{{- $dbPass = (index .data "db-password") -}}
{{- end }}
db-user: {{ $dbUser }}
db-password: {{ $dbPass }}
{{/* Temprary store them on values to display it on NOTES */}}
{{ $_ := set .Values "nextcloudDbPass" $dbPass }}
{{ $_ := set .Values "nextcloudDbUser" $dbUser }}