[stable/ghost] Use minideb as initContainer to change volumes permissions (#9003)

Signed-off-by: tompizmor <tompizmor@gmail.com>
This commit is contained in:
Tomas Pizarro
2018-11-05 08:04:11 -08:00
committed by k8s-ci-robot
parent 258376818f
commit e2e6ba65e7
5 changed files with 84 additions and 54 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: ghost
version: 5.3.6
version: 5.4.0
appVersion: 2.4.0
description: A simple, powerful publishing platform that allows you to share your
stories with the world
+51 -47
View File
@@ -47,53 +47,57 @@ The command removes all the Kubernetes components associated with the chart and
The following table lists the configurable parameters of the Ghost chart and their default values.
| Parameter | Description | Default |
|----------------------------------|---------------------------------------------------------------|----------------------------------------------------------|
| `global.imageRegistry` | Global Docker image registry | `nil` |
| `image.registry` | Ghost image registry | `docker.io` |
| `image.repository` | Ghost Image name | `bitnami/ghost` |
| `image.tag` | Ghost Image tag | `{VERSION}` |
| `image.pullPolicy` | Image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent` |
| `image.pullSecrets` | Specify image pull secrets | `nil` |
| `ghostHost` | Ghost host to create application URLs | `nil` |
| `ghostPath` | Ghost path to create application URLs | `nil` |
| `ghostPort` | Ghost port to create application URLs along with host | `80` |
| `ghostLoadBalancerIP` | `loadBalancerIP` for the Ghost Service | `nil` |
| `ghostUsername` | User of the application | `user@example.com` |
| `ghostPassword` | Application password | Randomly generated |
| `ghostEmail` | Admin email | `user@example.com` |
| `ghostBlogTitle` | Ghost Blog name | `User's Blog` |
| `allowEmptyPassword` | Allow DB blank passwords | `yes` |
| `serviceType` | Kubernetes Service type | `LoadBalancer` |
| `securityContext.enabled` | Enable security context | `true` |
| `securityContext.fsGroup` | Group ID for the container | `1001` |
| `securityContext.runAsUser` | User ID for the container | `1001` |
| `ingress.enabled` | Enable ingress controller resource | `false` |
| `ingress.hosts[0].name` | Hostname to your Ghost installation | `ghost.local` |
| `ingress.hosts[0].path` | Path within the url structure | `/` |
| `ingress.hosts[0].tls` | Utilize TLS backend in ingress | `false` |
| `ingress.hosts[0].certManager` | Add annotations for cert-manager | `false` |
| `ingress.hosts[0].tlsSecret` | TLS Secret (certificates) | `ghost.local-tls-secret` |
| `ingress.hosts[0].annotations` | Annotations for this host's ingress record | `[]` |
| `ingress.secrets[0].name` | TLS Secret Name | `nil` |
| `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` |
| `ingress.secrets[0].key` | TLS Secret Key | `nil` |
| `externalDatabase.host` | Host of the external database | `nil` |
| `externalDatabase.port` | Port of the external database | `nil` |
| `externalDatabase.user` | Existing username in the external db | `bn_ghost` |
| `externalDatabase.password` | Password for the above username | `nil` |
| `externalDatabase.database` | Name of the existing database | `bitnami_ghost` |
| `mariadb.enabled` | Whether or not to install MariaDB (disable if using external) | `true` |
| `mariadb.rootUser.password` | MariaDB admin password | `nil` |
| `mariadb.db.name` | MariaDB Database name to create | `bitnami_ghost` |
| `mariadb.db.user` | MariaDB Database user to create | `bn_ghost` |
| `mariadb.db.password` | MariaDB Password for user | _random 10 character long alphanumeric string_ |
| `persistence.enabled` | Enable persistence using PVC | `true` |
| `persistence.storageClass` | PVC Storage Class for Ghost volume | `nil` (uses alpha storage annotation) |
| `persistence.accessMode` | PVC Access Mode for Ghost volume | `ReadWriteOnce` |
| `persistence.size` | PVC Storage Request for Ghost volume | `8Gi` |
| `persistence.path` | Path to mount the volume at, to use other images | `/bitnami` |
| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
| Parameter | Description | Default |
|-------------------------------------|---------------------------------------------------------------|----------------------------------------------------------|
| `global.imageRegistry` | Global Docker image registry | `nil` |
| `image.registry` | Ghost image registry | `docker.io` |
| `image.repository` | Ghost Image name | `bitnami/ghost` |
| `image.tag` | Ghost Image tag | `{VERSION}` |
| `image.pullPolicy` | Image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent` |
| `image.pullSecrets` | Specify image pull secrets | `nil` |
| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` |
| `volumePermissions.image.repository`| Init container volume-permissions image name | `bitnami/minideb` |
| `volumePermissions.image.tag` | Init container volume-permissions image tag | `latest` |
| `volumePermissions.image.pullPolicy`| Init container volume-permissions image pull policy | `Always` |
| `ghostHost` | Ghost host to create application URLs | `nil` |
| `ghostPath` | Ghost path to create application URLs | `nil` |
| `ghostPort` | Ghost port to create application URLs along with host | `80` |
| `ghostLoadBalancerIP` | `loadBalancerIP` for the Ghost Service | `nil` |
| `ghostUsername` | User of the application | `user@example.com` |
| `ghostPassword` | Application password | Randomly generated |
| `ghostEmail` | Admin email | `user@example.com` |
| `ghostBlogTitle` | Ghost Blog name | `User's Blog` |
| `allowEmptyPassword` | Allow DB blank passwords | `yes` |
| `serviceType` | Kubernetes Service type | `LoadBalancer` |
| `securityContext.enabled` | Enable security context | `true` |
| `securityContext.fsGroup` | Group ID for the container | `1001` |
| `securityContext.runAsUser` | User ID for the container | `1001` |
| `ingress.enabled` | Enable ingress controller resource | `false` |
| `ingress.hosts[0].name` | Hostname to your Ghost installation | `ghost.local` |
| `ingress.hosts[0].path` | Path within the url structure | `/` |
| `ingress.hosts[0].tls` | Utilize TLS backend in ingress | `false` |
| `ingress.hosts[0].certManager` | Add annotations for cert-manager | `false` |
| `ingress.hosts[0].tlsSecret` | TLS Secret (certificates) | `ghost.local-tls-secret` |
| `ingress.hosts[0].annotations` | Annotations for this host's ingress record | `[]` |
| `ingress.secrets[0].name` | TLS Secret Name | `nil` |
| `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` |
| `ingress.secrets[0].key` | TLS Secret Key | `nil` |
| `externalDatabase.host` | Host of the external database | `nil` |
| `externalDatabase.port` | Port of the external database | `nil` |
| `externalDatabase.user` | Existing username in the external db | `bn_ghost` |
| `externalDatabase.password` | Password for the above username | `nil` |
| `externalDatabase.database` | Name of the existing database | `bitnami_ghost` |
| `mariadb.enabled` | Whether or not to install MariaDB (disable if using external) | `true` |
| `mariadb.rootUser.password` | MariaDB admin password | `nil` |
| `mariadb.db.name` | MariaDB Database name to create | `bitnami_ghost` |
| `mariadb.db.user` | MariaDB Database user to create | `bn_ghost` |
| `mariadb.db.password` | MariaDB Password for user | _random 10 character long alphanumeric string_ |
| `persistence.enabled` | Enable persistence using PVC | `true` |
| `persistence.storageClass` | PVC Storage Class for Ghost volume | `nil` (uses alpha storage annotation) |
| `persistence.accessMode` | PVC Access Mode for Ghost volume | `ReadWriteOnce` |
| `persistence.size` | PVC Storage Request for Ghost volume | `8Gi` |
| `persistence.path` | Path to mount the volume at, to use other images | `/bitnami` |
| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
The above parameters map to the env variables defined in [bitnami/ghost](http://github.com/bitnami/bitnami-docker-ghost). For more information please refer to the [bitnami/ghost](http://github.com/bitnami/bitnami-docker-ghost) image documentation.
+23
View File
@@ -86,3 +86,26 @@ Also, we can't use a single if because lazy evaluation is not an option
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- end -}}
{{/*
Return the proper image name to change the volume permissions
*/}}
{{- define "ghost.volumePermissions.image" -}}
{{- $registryName := .Values.volumePermissions.image.registry -}}
{{- $repositoryName := .Values.volumePermissions.image.repository -}}
{{- $tag := .Values.volumePermissions.image.tag | toString -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
Also, we can't use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imageRegistry }}
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- end -}}
+2 -2
View File
@@ -28,8 +28,8 @@ spec:
{{- else }}
initContainers:
- name: volume-permissions
image: "{{ .Values.volumePermissions.image.name }}:{{ .Values.volumePermissions.image.tag }}"
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
image: {{ template "ghost.volumePermissions.image" . }}
imagePullPolicy: "{{ .Values.volumePermissions.image.pullPolicy }}"
command: ['sh', '-c', 'chmod -R g+rwX {{ .Values.persistence.path }}']
volumeMounts:
- mountPath: {{ .Values.persistence.path }}
+7 -4
View File
@@ -23,13 +23,16 @@ image:
# pullSecrets:
# - myRegistrKeySecretName
## Busybox image used to configure volume permissions
##
## Init containers parameters:
## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup
##
volumePermissions:
image:
name: busybox
tag: 1.28.3
# pullPolicy:
registry: docker.io
repository: bitnami/minideb
tag: latest
pullPolicy: Always
## Ghost host and path to create application URLs
## ref: https://github.com/bitnami/bitnami-docker-ghost#configuration