mirror of
https://github.com/truenas/charts.git
synced 2026-11-21 07:09:06 +00:00
Upgraded catalog item(s)
This commit upgrades chia, minio, nextcloud catalog item(s).
This commit is contained in:
1 parent
2d75a1a94f
commit
fb3edd8569
59 files changed
+75
-99
No files matched your search
@@ -0,0 +1,3 @@
|
||||
1. Get the nextcloud URL by running:
|
||||
|
||||
echo http://{{ .Values.nextcloud.host }}:{{ .Values.service.nodePort }}/
|
||||
@@ -0,0 +1,49 @@
|
||||
{{/*
|
||||
Get Nextloud Postgres Database Name
|
||||
*/}}
|
||||
{{- define "postgres.DatabaseName" -}}
|
||||
{{- print "nextcloud" -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{- define "postgres.imageName" -}}
|
||||
{{- print "postgres:13.1" -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Retrieve postgres backup name
|
||||
This will return a unique name based on revision and chart numbers specified.
|
||||
*/}}
|
||||
{{- define "postgres.backupName" -}}
|
||||
{{- $upgradeDict := .Values.ixChartContext.upgradeMetadata -}}
|
||||
{{- printf "postgres-backup-from-%s-to-%s-revision-%d" $upgradeDict.oldChartVersion $upgradeDict.newChartVersion (int64 $upgradeDict.preUpgradeRevision) -}}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{/*
|
||||
Retrieve postgres credentials for environment variables configuration
|
||||
*/}}
|
||||
{{- define "postgres.envVariableConfiguration" -}}
|
||||
{{ $envList := list }}
|
||||
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_USER" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-user") }}
|
||||
{{ $envList = mustAppend $envList (dict "name" "POSTGRES_PASSWORD" "valueFromSecret" true "secretName" "db-details" "secretKey" "db-password") }}
|
||||
{{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Retrieve postgres volume configuration
|
||||
*/}}
|
||||
{{- define "postgres.volumeConfiguration" -}}
|
||||
{{ include "common.storage.configureAppVolumes" (dict "appVolumeMounts" .Values.postgresAppVolumeMounts "emptyDirVolumes" .Values.emptyDirVolumes "ixVolumes" .Values.ixVolumes) | nindent 0 }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/*
|
||||
Retrieve postgres volume mounts configuration
|
||||
*/}}
|
||||
{{- define "postgres.volumeMountsConfiguration" -}}
|
||||
{{ include "common.storage.configureAppVolumeMountsInContainer" (dict "appVolumeMounts" .Values.postgresAppVolumeMounts ) | nindent 0 }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: "postgres-backup-hook-config-map"
|
||||
annotations:
|
||||
rollme: {{ randAlphaNum 5 | quote }}
|
||||
data:
|
||||
entrypoint.sh: |-
|
||||
#!/bin/sh
|
||||
cmd="/docker-entrypoint.sh postgres"
|
||||
eval "${cmd}" & disown;
|
||||
until pg_isready; do
|
||||
sleep 5;
|
||||
done;
|
||||
pg_dump -U $POSTGRES_USER -d {{ template "postgres.DatabaseName" . }} > /postgres_backups/$BACKUP_NAME;
|
||||
@@ -0,0 +1,39 @@
|
||||
{{- if .Values.ixChartContext.isUpgrade -}}
|
||||
{{ $values := (. | mustDeepCopy) }}
|
||||
{{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: "pre-upgrade-hook2"
|
||||
annotations:
|
||||
"helm.sh/hook": pre-upgrade
|
||||
"helm.sh/hook-weight": "1"
|
||||
"helm.sh/hook-delete-policy": hook-succeeded
|
||||
rollme: {{ randAlphaNum 5 | quote }}
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
name: "pre-upgrade-hook2"
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
serviceAccountName: "{{ template "common.names.serviceAccountName" . }}"
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}-postgres-backup
|
||||
image: {{ template "postgres.imageName" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
env: {{ include "postgres.envVariableConfiguration" $values | nindent 10 }}
|
||||
- name: BACKUP_NAME
|
||||
value: {{ template "postgres.backupName" . }}
|
||||
volumeMounts: {{ include "postgres.volumeMountsConfiguration" $values | nindent 10 }}
|
||||
- name: backup-script-configmap
|
||||
mountPath: /bin/backup_entrypoint.sh
|
||||
readOnly: true
|
||||
subPath: entrypoint.sh
|
||||
command:
|
||||
- "/bin/backup_entrypoint.sh"
|
||||
volumes: {{ include "postgres.volumeConfiguration" $values | nindent 8 }}
|
||||
- name: backup-script-configmap
|
||||
configMap:
|
||||
defaultMode: 0700
|
||||
name: "postgres-backup-hook-config-map"
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,64 @@
|
||||
{{ $postgres_values := (. | mustDeepCopy) }}
|
||||
{{ $_ := set $postgres_values "common" (dict "nameSuffix" "postgres") }}
|
||||
{{ include "common.deployment.common_config" . | nindent 0 }}
|
||||
spec: {{ include "common.deployment.common_spec" . | nindent 2 }}
|
||||
template: {{ include "common.deployment.pod.metadata" . | nindent 4 }}
|
||||
spec:
|
||||
initContainers:
|
||||
- name: init-postgresdb
|
||||
image: {{ template "postgres.imageName" . }}
|
||||
command: ['sh', '-c', "until pg_isready -h {{ template "common.names.fullname" $postgres_values }}; do echo waiting for postgres; sleep 2; done"]
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
{{ include "common.containers.imageConfig" .Values.image | nindent 8 }}
|
||||
env: {{ include "postgres.envVariableConfiguration" $postgres_values | nindent 10 }}
|
||||
{{ $envList := list }}
|
||||
{{ $secretName := (include "common.names.fullname" .) }}
|
||||
{{ $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) }}
|
||||
{{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_TRUSTED_DOMAINS" "value" .Values.nextcloud.host) }}
|
||||
{{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_ADMIN_USER" "valueFromSecret" true "secretName" $secretName "secretKey" "nextcloud-username") }}
|
||||
{{ $envList = mustAppend $envList (dict "name" "NEXTCLOUD_ADMIN_PASSWORD" "valueFromSecret" true "secretName" $secretName "secretKey" "nextcloud-password") }}
|
||||
{{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 10 }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- name: nextcloud-data
|
||||
mountPath: /var/www/
|
||||
subPath: "root"
|
||||
- name: nextcloud-data
|
||||
mountPath: /var/www/html
|
||||
subPath: "html"
|
||||
- name: nextcloud-data
|
||||
mountPath: {{ .Values.nextcloud.datadir }}
|
||||
subPath: "data"
|
||||
- name: nextcloud-data
|
||||
mountPath: /var/www/html/config
|
||||
subPath: "config"
|
||||
- name: nextcloud-data
|
||||
mountPath: /var/www/html/custom_apps
|
||||
subPath: "custom_apps"
|
||||
- name: nextcloud-data
|
||||
mountPath: /var/www/tmp
|
||||
subPath: "tmp"
|
||||
- name: nextcloud-data
|
||||
mountPath: /var/www/html/themes
|
||||
subPath: "themes"
|
||||
{{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
|
||||
- name: extrappvolume-{{ $index }}
|
||||
mountPath: {{ $hostPathConfiguration.mountPath }}
|
||||
{{ end }}
|
||||
{{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
|
||||
{{ include "common.storage.allAppVolumes" .Values | nindent 6 }}
|
||||
{{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
|
||||
- name: extrappvolume-{{ $index }}
|
||||
hostPath:
|
||||
path: {{ $hostPathConfiguration.hostPath }}
|
||||
{{ end }}
|
||||
# Will mount configuration files as www-data (id: 33) for nextcloud
|
||||
securityContext:
|
||||
fsGroup: 33
|
||||
@@ -0,0 +1,24 @@
|
||||
{{- if .Values.ixChartContext.isUpgrade -}}
|
||||
{{ $values := (. | mustDeepCopy) }}
|
||||
{{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: "pre-upgrade-hook1"
|
||||
annotations:
|
||||
"helm.sh/hook": pre-upgrade
|
||||
"helm.sh/hook-weight": "-1"
|
||||
"helm.sh/hook-delete-policy": hook-succeeded
|
||||
rollme: {{ randAlphaNum 5 | quote }}
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
name: "pre-upgrade-hook1"
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
serviceAccountName: "{{ template "common.names.serviceAccountName" . }}"
|
||||
containers:
|
||||
- name: kubectl
|
||||
image: "bitnami/kubectl:1.19"
|
||||
command: ["kubectl", "delete" , "deployment", "{{ template "common.names.fullname" . }}", "{{ template "common.names.fullname" $values }}"]
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{ $values := (. | mustDeepCopy) }}
|
||||
{{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
|
||||
{{ include "common.deployment.common_config" $values | nindent 0 }}
|
||||
spec: {{ include "common.deployment.common_spec" $values | nindent 2 }}
|
||||
template: {{ include "common.deployment.pod.metadata" $values | nindent 4 }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}-postgres
|
||||
image: {{ template "postgres.imageName" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
env: {{ include "postgres.envVariableConfiguration" $values | nindent 10 }}
|
||||
volumeMounts: {{ include "postgres.volumeMountsConfiguration" $values | nindent 10 }}
|
||||
ports:
|
||||
- name: postgres-tcp
|
||||
containerPort: 5432
|
||||
protocol: TCP
|
||||
volumes: {{ include "postgres.volumeConfiguration" $values | nindent 8 }}
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: db-details
|
||||
data:
|
||||
db-user: postgres
|
||||
{{- if .Release.IsInstall }}
|
||||
db-password: {{ randAlphaNum 15 | b64enc | quote }}
|
||||
{{ else }}
|
||||
# `index` function is necessary because the property name contains a dash.
|
||||
# Otherwise (...).data.db_password would have worked too.
|
||||
db-password: {{ index (lookup "v1" "Secret" .Release.Namespace "db-details").data "db-password" }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,6 @@
|
||||
{{ $ports := list }}
|
||||
{{ $ports = mustAppend $ports (dict "name" "postgres-tcp" "port" 5432 "targetPort" 5432) }}
|
||||
{{ $values := (. | mustDeepCopy) }}
|
||||
{{ $_ := set $values "common" (dict "nameSuffix" "postgres") }}
|
||||
{{ $_1 := set $values "commonService" (dict "type" "ClusterIP" "ports" $ports ) }}
|
||||
{{ include "common.classes.service" $values }}
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "common.names.fullname" . }}
|
||||
labels: {{ include "common.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
nextcloud-username: {{ .Values.nextcloud.username | b64enc | quote }}
|
||||
{{ if .Values.nextcloud.password }}
|
||||
nextcloud-password: {{ .Values.nextcloud.password | b64enc | quote }}
|
||||
{{ else }}
|
||||
nextcloud-password: {{ randAlphaNum 10 | b64enc | quote }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,6 @@
|
||||
{{ $svc := .Values.service }}
|
||||
{{ $ports := list }}
|
||||
{{ $ports = mustAppend $ports (dict "name" "http" "port" 80 "nodePort" $svc.nodePort) }}
|
||||
{{ $params := . }}
|
||||
{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
|
||||
{{ include "common.classes.service" $params }}
|
||||
@@ -0,0 +1,35 @@
|
||||
{{ include "common.serviceaccount" . | nindent 0 }}
|
||||
|
||||
---
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: "{{ .Release.Name }}-service-account-role-binding"
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: "{{ template "common.names.serviceAccountName" . }}"
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
kind: Role
|
||||
name: "{{ .Release.Name }}-service-account-role"
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
|
||||
---
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: "{{ .Release.Name }}-service-account-role"
|
||||
namespace: {{ .Release.Namespace }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
- "apps"
|
||||
resources:
|
||||
- pods
|
||||
- deployments
|
||||
verbs:
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
Reference in new issue
Block a user