-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from WSMathias/ezontent-chart
Add helm charts
- Loading branch information
Showing
55 changed files
with
4,020 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
starterkits/drupal8-php-fpm-apache/charts/drupal/Chart.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
name: drupal | ||
version: 1.0.0 | ||
appVersion: 1.0.0 | ||
description: drupal helm charts . | ||
keywords: | ||
- drupal | ||
- php | ||
home: https://drupal.org/ | ||
sources: | ||
- https://github.com/srijanone/vega/ | ||
maintainers: | ||
- name: Srijan | ||
email: support@srijan.net | ||
engine: gotpl |
151 changes: 151 additions & 0 deletions
151
starterkits/drupal8-php-fpm-apache/charts/drupal/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
# Drupal Helm Charts | ||
|
||
## Introduction | ||
|
||
This chart bootstraps a drupal-proxy deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. | ||
|
||
It deploys a drupal application. Optionally, you can set up an Ingress resource to access your application. | ||
|
||
## Prerequisites | ||
|
||
- Kubernetes 1.12+ | ||
- Helm 2.11+ or Helm 3.0-beta3+ | ||
|
||
## Installing the Chart | ||
|
||
To install the chart with the release name `my-release`: | ||
|
||
```console | ||
$ git clone https://github.com/srijanone/helm-chart | ||
$ helm install --name my-release ./helm-chart/stable/drupal | ||
``` | ||
|
||
These commands deploy drupal on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation. Also includes support for MariaDB chart out of the box. | ||
|
||
Due that the Helm Chart clones the application on the /app volume while the container is initializing, a persistent volume is not required. | ||
|
||
> **Tip**: List all releases using `helm list` | ||
## Uninstalling the Chart | ||
|
||
To uninstall/delete the `my-release` deployment: | ||
|
||
```console | ||
$ helm delete my-release | ||
``` | ||
|
||
The command removes all the Kubernetes components associated with the chart and deletes the release. | ||
|
||
## Parameters | ||
|
||
The following table lists the configurable parameters of the drupal chart and their default values. | ||
|
||
| Parameter | Description | Default | | ||
| --------------------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------- | | ||
| `global.imageRegistry` | Global Docker image registry | `docker.io` | | ||
| `phpfpm.registry` | PHP-FPM image registry | `nil` | | ||
| `phpfpm.repository` | PHP-FPM image name | `drupal:8` | | ||
| `phpfpm.pullPolicy` | PHP-FPM image pull policy | `IfNotPresent` | | ||
| `phpfpm.extraEnv` | PHP-FPM container environment variables | `nill` | | ||
| `phpfpm.command` | PHP-FPM container entry point | from image | | ||
| `phpfpm.arg` | PHP-FPM container arguments | from image | | ||
| `phpfpm.port` | PHP-FPM container listing port | 9000 | | ||
| `webserver.registry` | Web Server image registry | `nil` | | ||
| `webserver.repository` | Web Server image name | `drupal:8` | | ||
| `webserver.pullPolicy` | Web Server image pull policy | `IfNotPresent` | | ||
| `webserver.extraEnv` | Web Server container environment variables | `nill` | | ||
| `webserver.command` | Web Server container entry point | from image | | ||
| `webserver.arg` | Web Server container arguments | from image | | ||
| `webserver.port` | Web Server container listing port | 8080 | | ||
| `nameOverride` | String to partially override drupal.fullname template | `nil` | | ||
| `fullnameOverride` | String to fully override drupal.fullname template | `nil` | | ||
| `applicationKind` | Deployment or ReplicaSet | `Deployment` | | ||
| `replicas` | Number of replicas for the application | `1` | | ||
| `extraEnv` | Any extra environment variables to be pass to the pods | `{}` | | ||
| `affinity` | Map of drupal/pod affinities | `{}` (The value is evaluated as a template) | | ||
| `drupalSelector` | drupal labels for pod assignment | `{}` (The value is evaluated as a template) | | ||
| `tolerations` | Tolerations for pod assignment | `[]` (The value is evaluated as a template) | | ||
| `securityContext.enabled` | Enable security context | `true` | | ||
| `securityContext.fsGroup` | Group ID for the container | `1001` | | ||
| `securityContext.runAsUser` | User ID for the container | `1001` | | ||
| `resources` | Resource requests and limits | `{}` | | ||
| `service.type` | Kubernetes Service type | `ClusterIP` | | ||
| `service.port` | Kubernetes Service port | `80` | | ||
| `service.annotations` | Annotations for the Service | {} | | ||
| `service.loadBalancerIP` | LoadBalancer IP if Service type is `LoadBalancer` | `nil` | | ||
| `service.drupalPort` | drupalPort if Service type is `LoadBalancer` or `drupalPort` | `nil` | | ||
| `ingress.enabled` | Enable ingress controller resource | `false` | | ||
| `ingress.hosts[0].name` | Hostname to your drupal installation | `drupal.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) | `drupal.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` | | ||
|
||
|
||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, | ||
|
||
```console | ||
$ helm install --name my-release \ | ||
--set replicas=2 \ | ||
./helm-chart/stable/drupal | ||
``` | ||
|
||
The above command clones the remote git repository to the `/app/` directory of the container. Additionally it sets the number of `replicas` to `2`. | ||
|
||
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, | ||
|
||
```console | ||
$ helm install --name my-release -f values.yaml ./charts/drupal | ||
``` | ||
|
||
> **Tip**: You can use the default [values.yaml](values.yaml) | ||
## Configuration and installation details | ||
|
||
### Set up an Ingress controller | ||
|
||
First install the nginx-ingress controller and then deploy the drupal helm chart with the following parameters: | ||
|
||
```console | ||
ingress.enabled=true | ||
ingress.host=example.com | ||
service.type=ClusterIP | ||
``` | ||
|
||
### Configure TLS termination for your ingress controller | ||
|
||
You must manually create a secret containing the certificate and key for your domain. Then ensure you deploy the Helm chart with the following ingress configuration: | ||
|
||
```yaml | ||
ingress: | ||
enabled: false | ||
path: / | ||
host: example.com | ||
annotations: | ||
kubernetes.io/ingress.class: nginx | ||
tls: | ||
hosts: | ||
- example.com | ||
``` | ||
|
||
### Steps to manually put the helm charts and values.yaml to S3 bucket | ||
|
||
- Put the helm charts folder and values.yaml to Bastion host (or to a place from where s3 bucket is accessible). | ||
- Make sure that current directory is having `charts.yaml`. | ||
- Run below command to create a helm package | ||
``` | ||
helm package . | ||
``` | ||
- You should see a helm package named - `drupal-1.0.0.tgz`. | ||
- Upload the `drupal-1.0.0.tgz` helm package to s3 bucket : | ||
``` | ||
aws s3 cp drupal-1.0.0.tgz s3://s3-st-helm-dev/drupal/drupal-1.0.0.tgz --sse=AES256 --region=ap-southeast-1 | ||
``` | ||
- Upload the `values.yaml` to s3 bucket : | ||
``` | ||
aws s3 cp values-<env>.yaml s3://s3-st-helm-dev/drupal/values/st-<env>-values.yaml --sse=AES256 --region=ap-southeast-1 | ||
``` |
23 changes: 23 additions & 0 deletions
23
starterkits/drupal8-php-fpm-apache/charts/drupal/templates/NOTES.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
1. Get the URL of your Node app by running: | ||
|
||
{{- if contains "NodePort" .Values.service.type }} | ||
|
||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "drupal.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo "Node app URL: http://$NODE_IP:$NODE_PORT/" | ||
|
||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
|
||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
Watch the status with: 'kubectl get svc -w {{ template "drupal.fullname" . }} --namespace {{ .Release.Namespace }}' | ||
|
||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "drupal.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo "Node app URL: http://$SERVICE_IP/" | ||
|
||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
|
||
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "drupal.fullname" . }} {{ .Values.service.port }}:{{ .Values.service.port }} | ||
echo "Node app URL: http://127.0.0.1:{{ .Values.service.port }}/" | ||
|
||
{{- end }} |
120 changes: 120 additions & 0 deletions
120
starterkits/drupal8-php-fpm-apache/charts/drupal/templates/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "drupal.appName" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
*/}} | ||
{{- define "drupal.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "drupal.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "drupal.labels" -}} | ||
app: {{ include "drupal.appName" . }} | ||
chart: {{ include "drupal.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels for cron-jobs to be used for deletion | ||
*/}} | ||
{{- define "drupal.cronLabels" -}} | ||
app: {{ include "drupal.appName" . }} | ||
chart: {{ include "drupal.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
workload: cronjob | ||
{{- end -}} | ||
|
||
{{/* | ||
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector | ||
*/}} | ||
{{- define "drupal.matchLabels" -}} | ||
app: {{ include "drupal.appName" . }} | ||
release: {{ .Release.Name }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the proper Web Server image name | ||
*/}} | ||
{{- define "webserver.image" -}} | ||
{{- $registryName := .Values.webserver.image.registry -}} | ||
{{- $repositoryName := .Values.webserver.image.repository -}} | ||
{{/* | ||
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" .Values.global.imageRegistry $repositoryName -}} | ||
{{- else -}} | ||
{{- printf "%s/%s" $registryName $repositoryName -}} | ||
{{- end -}} | ||
{{- else -}} | ||
{{- printf "%s/%s" $registryName $repositoryName -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the proper php-fpm image name | ||
*/}} | ||
{{- define "phpfpm.image" -}} | ||
{{- $registryName := .Values.phpfpm.image.registry -}} | ||
{{- $repositoryName := .Values.phpfpm.image.repository -}} | ||
{{- $tag := .Values.phpfpm.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" .Values.global.imageRegistry $repositoryName -}} | ||
{{- else -}} | ||
{{- printf "%s/%s" $registryName $repositoryName -}} | ||
{{- end -}} | ||
{{- else -}} | ||
{{- printf "%s/%s" $registryName $repositoryName -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
|
||
|
||
{{/* | ||
Renders a value that contains template. | ||
Usage: | ||
{{ include "drupal.tplValue" (dict "value" .Values.path.to.the.Value "context" $) }} | ||
*/}} | ||
{{- define "drupal.tplValue" -}} | ||
{{- if typeIs "string" .value }} | ||
{{- tpl .value .context }} | ||
{{- else }} | ||
{{- tpl (.value | toYaml) .context }} | ||
{{- end }} | ||
{{- end -}} |
72 changes: 72 additions & 0 deletions
72
starterkits/drupal8-php-fpm-apache/charts/drupal/templates/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
apiVersion: apps/v1 | ||
kind: {{ .Values.applicationKind }} | ||
metadata: | ||
name: {{ template "drupal.fullname" . }} | ||
labels: {{- include "drupal.labels" . | nindent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: {{- include "drupal.matchLabels" . | nindent 6 }} | ||
replicas: {{ .Values.replicas }} | ||
template: | ||
metadata: | ||
labels: {{- include "drupal.labels" . | nindent 8 }} | ||
spec: | ||
{{- if .Values.affinity }} | ||
affinity: {{- include "drupal.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.nodeSelector }} | ||
nodeSelector: {{- include "drupal.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.tolerations }} | ||
tolerations: {{- include "drupal.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.securityContext.enabled }} | ||
securityContext: | ||
fsGroup: {{ .Values.securityContext.fsGroup }} | ||
runAsUser: {{ .Values.securityContext.runAsUser }} | ||
{{- end }} | ||
containers: | ||
- name: webserver | ||
image: {{ template "webserver.image" . }} | ||
imagePullPolicy: {{ .Values.webserver.image.pullPolicy | quote }} | ||
{{- if .Values.webserver.command }} | ||
command: {{- toYaml .Values.webserver.command | nindent 12 }} | ||
{{- end }} | ||
{{- if .Values.webserver.args }} | ||
args: {{- toYaml .Values.webserver.args | nindent 12 }} | ||
{{- end }} | ||
ports: | ||
- name: webserver | ||
containerPort: {{ .Values.webserver.port }} | ||
livenessProbe: | ||
{{ toYaml .Values.webserver.livenessProbe | indent 12 }} | ||
readinessProbe: | ||
{{ toYaml .Values.webserver.readinessProbe | indent 12 }} | ||
{{- if .Values.webserver.resources }} | ||
resources: {{- toYaml .Values.webserver.resources | nindent 12 }} | ||
{{- end }} | ||
- name: php | ||
image: {{ template "phpfpm.image" . }} | ||
imagePullPolicy: {{ .Values.phpfpm.image.pullPolicy | quote }} | ||
envFrom: | ||
- secretRef: | ||
name: {{ template "drupal.fullname" . }} | ||
{{- if .Values.phpfpm.extraEnv }} | ||
env: {{- toYaml .Values.phpfpm.extraEnv | nindent 12 }} | ||
{{- end }} | ||
{{- if .Values.phpfpm.command }} | ||
command: {{- toYaml .Values.phpfpm.command | nindent 12 }} | ||
{{- end }} | ||
{{- if .Values.phpfpm.args }} | ||
args: {{- toYaml .Values.phpfpm.args | nindent 12 }} | ||
{{- end }} | ||
ports: | ||
- name: phpfpm | ||
containerPort: {{ .Values.phpfpm.port }} | ||
livenessProbe: | ||
{{ toYaml .Values.phpfpm.livenessProbe | indent 12 }} | ||
readinessProbe: | ||
{{ toYaml .Values.phpfpm.readinessProbe | indent 12 }} | ||
{{- if .Values.phpfpm.resources }} | ||
resources: {{- toYaml .Values.phpfpm.resources | nindent 12 }} | ||
{{- end }} |
Oops, something went wrong.