-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(executors/helm): Move executor to use gitlab base
- Loading branch information
Showing
19 changed files
with
401 additions
and
185 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
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 @@ | ||
charts/* |
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,19 @@ | ||
image: registry.gitlab.com/charts/alpine-helm | ||
|
||
stages: | ||
- test | ||
- release | ||
|
||
lint: | ||
stage: test | ||
script: | ||
- helm lint . | ||
except: | ||
- master | ||
|
||
release-chart: | ||
stage: release | ||
script: | ||
- curl --fail --request POST --form "token=$CI_JOB_TOKEN" --form ref=master https://gitlab.com/api/v4/projects/2860651/trigger/pipeline | ||
only: | ||
- master |
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 |
---|---|---|
|
@@ -19,4 +19,3 @@ | |
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
apiVersion: v1 | ||
appVersion: "1.0" | ||
description: A Helm chart for Kubernetes | ||
name: default | ||
version: 0.1.0 | ||
description: Deliverybot Helm Chart | ||
name: deliverybot-default | ||
version: 0.2.9 |
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,50 @@ | ||
# Default Helm Chart | ||
|
||
## Requirements | ||
|
||
- Helm `2.9.0` and above is required in order support `"helm.sh/hook-delete-policy": before-hook-creation` for migrations | ||
|
||
## Configuration | ||
|
||
| Parameter | Description | Default | | ||
| --- | --- | --- | | ||
| replicaCount | | `1` | | ||
| image.repository | | `""` | | ||
| image.tag | | `""` | | ||
| image.pullPolicy | | `Always` | | ||
| image.secrets | | `[]` | | ||
| podAnnotations | Pod annotations | `{}` | | ||
| application.track | | `stable` | | ||
| application.tier | | `web` | | ||
| application.migrateCommand | If present, this variable will run as a shell command within an application Container as a Helm pre-upgrade Hook. Intended to run migration commands. | `nil` | | ||
| application.initializeCommand | If present, this variable will run as shall command within an application Container as a Helm post-install Hook. Intended to run database initialization commands. | `nil` | | ||
| application.secretName | Pass in the name of a Secret which the deployment will [load all key-value pairs from the Secret as environment variables](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables) in the application container. | `nil` | | ||
| application.secretChecksum | Pass in the checksum of the secrets referenced by `application.secretName`. | `nil` | | ||
| hpa.enabled | If true, enables horizontal pod autoscaler. A resource request is also required to be set, such as `resources.requests.cpu: 200m`.| `false` | | ||
| hpa.minReplicas | | `1` | | ||
| hpa.maxReplicas | | `5` | | ||
| hpa.targetCPUUtilizationPercentage | Percentage threshold when HPA begins scaling out pods | `80` | | ||
| service.enabled | | `true` | | ||
| service.annotations | Service annotations | `{}` | | ||
| service.name | | `web` | | ||
| service.type | | `ClusterIP` | | ||
| service.url | | `http://my.host.com/` | | ||
| service.additionalHosts | If present, this list will add additional hostnames to the server configuration. | `nil` | | ||
| service.commonName | If present, this will define the ssl certificate common name to be used by CertManager. `service.url` and `service.additionalHosts` will be added as Subject Alternative Names (SANs) | `nil` | | ||
| service.externalPort | | `5000` | | ||
| service.internalPort | | `5000` | | ||
| ingress.tls.enabled | If true, enables SSL | `true` | | ||
| ingress.tls.secretName | Name of the secret used to terminate SSL traffic | `""` | | ||
| ingress.annotations | Ingress annotations | `{kubernetes.io/tls-acme: "true", kubernetes.io/ingress.class: "nginx"}` | | ||
| livenessProbe.path | Path to access on the HTTP server on periodic probe of container liveness. | `/` | | ||
| livenessProbe.scheme | Scheme to access the HTTP server (HTTP or HTTPS). | `HTTP` | | ||
| livenessProbe.initialDelaySeconds | # of seconds after the container has started before liveness probes are initiated. | `15` | | ||
| livenessProbe.timeoutSeconds | # of seconds after which the liveness probe times out. | `15` | | ||
| readinessProbe.path | Path to access on the HTTP server on periodic probe of container readiness. | `/` | | ||
| readinessProbe.scheme | Scheme to access the HTTP server (HTTP or HTTPS). | `HTTP` | | ||
| readinessProbe.initialDelaySeconds | # of seconds after the container has started before readiness probes are initiated. | `5` | | ||
| readinessProbe.timeoutSeconds | # of seconds after which the readiness probe times out. | `3` | | ||
| postgresql.enabled | | `true` | | ||
| podDisruptionBudget.enabled | | `false` | | ||
| podDisruptionBudget.maxUnavailable | | `1` | | ||
| podDisruptionBudget.minAvailable | If present, this variable will configure minAvailable in the PodDisruptionBudget. :warning: if you have `replicaCount: 1` and `podDisruptionBudget.minAvailable: 1` `kubectl drain` will be blocked. | `nil` | |
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,6 @@ | ||
dependencies: | ||
- name: postgresql | ||
repository: https://kubernetes-charts.storage.googleapis.com/ | ||
version: 0.7.1 | ||
digest: sha256:358ce85fe4d3461ea6bb96713470a80de9c1324214a2e6f97d800298c02530e2 | ||
generated: 2017-08-28T15:22:30.690341342-05:00 |
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,5 @@ | ||
dependencies: | ||
- name: postgresql | ||
version: "0.7.1" | ||
repository: "https://kubernetes-charts.storage.googleapis.com/" | ||
condition: postgresql.enabled |
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 |
---|---|---|
@@ -1,21 +1,5 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- 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 }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "default.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo 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. | ||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "default.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "default.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "default.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:80 | ||
{{- end }} | ||
{{- if .Values.service.enabled -}} | ||
Application should be accessible at: {{ .Values.service.url }} | ||
{{- else -}} | ||
Application will be accessible at: {{ .Values.service.url }} when you deploy stable track. | ||
{{- end -}} |
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
39 changes: 39 additions & 0 deletions
39
executors/helm/charts/default/templates/db-initialize-job.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,39 @@ | ||
{{- if .Values.application.initializeCommand -}} | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ template "trackableappname" . }}-db-initialize | ||
labels: | ||
app: {{ template "appname" . }} | ||
chart: "{{ .Chart.Name }}-{{ .Chart.Version| replace "+" "_" }}" | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
annotations: | ||
"helm.sh/hook": post-install | ||
"helm.sh/hook-delete-policy": before-hook-creation | ||
"helm.sh/hook-weight": "0" | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ template "appname" . }} | ||
release: {{ .Release.Name }} | ||
spec: | ||
restartPolicy: Never | ||
imagePullSecrets: | ||
{{ toYaml .Values.image.secrets | indent 10 }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
command: ["/bin/sh"] | ||
args: ["-c", "{{ .Values.application.initializeCommand }}"] | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
{{- if .Values.application.secretName }} | ||
envFrom: | ||
- secretRef: | ||
name: {{ .Values.application.secretName }} | ||
{{- end }} | ||
env: | ||
- name: DATABASE_URL | ||
value: {{ .Values.application.database_url | quote }} | ||
{{- end -}} |
39 changes: 39 additions & 0 deletions
39
executors/helm/charts/default/templates/db-migrate-hook.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,39 @@ | ||
{{- if .Values.application.migrateCommand -}} | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ template "trackableappname" . }}-db-migrate | ||
labels: | ||
app: {{ template "appname" . }} | ||
chart: "{{ .Chart.Name }}-{{ .Chart.Version| replace "+" "_" }}" | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
annotations: | ||
"helm.sh/hook": pre-upgrade | ||
"helm.sh/hook-delete-policy": before-hook-creation | ||
"helm.sh/hook-weight": "0" | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ template "appname" . }} | ||
release: {{ .Release.Name }} | ||
spec: | ||
restartPolicy: Never | ||
imagePullSecrets: | ||
{{ toYaml .Values.image.secrets | indent 10 }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
command: ["/bin/sh"] | ||
args: ["-c", "{{ .Values.application.migrateCommand }}"] | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
{{- if .Values.application.secretName }} | ||
envFrom: | ||
- secretRef: | ||
name: {{ .Values.application.secretName }} | ||
{{- end }} | ||
env: | ||
- name: DATABASE_URL | ||
value: {{ .Values.application.database_url | quote }} | ||
{{- end -}} |
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 |
---|---|---|
@@ -1,52 +1,61 @@ | ||
apiVersion: apps/v1 | ||
{{- if not .Values.application.initializeCommand -}} | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "default.fullname" . }} | ||
name: {{ template "trackableappname" . }} | ||
labels: | ||
{{ include "default.labels" . | indent 4 }} | ||
app: {{ template "appname" . }} | ||
track: "{{ .Values.application.track }}" | ||
tier: "{{ .Values.application.tier }}" | ||
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ include "default.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
annotations: | ||
checksum/application-secrets: "{{ .Values.application.secretChecksum }}" | ||
{{- if .Values.podAnnotations }} | ||
{{ toYaml .Values.podAnnotations | indent 8 }} | ||
{{- end }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "default.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app: {{ template "appname" . }} | ||
track: "{{ .Values.application.track }}" | ||
tier: "{{ .Values.application.tier }}" | ||
release: {{ .Release.Name }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{ toYaml .Values.image.secrets | indent 10 }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
- name: http | ||
containerPort: 80 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
{{- if .Values.application.secretName }} | ||
envFrom: | ||
- secretRef: | ||
name: {{ .Values.application.secretName }} | ||
{{- end }} | ||
env: | ||
- name: DATABASE_URL | ||
value: {{ .Values.application.database_url | quote }} | ||
ports: | ||
- name: "{{ .Values.service.name }}" | ||
containerPort: {{ .Values.service.internalPort }} | ||
livenessProbe: | ||
httpGet: | ||
path: {{ .Values.livenessProbe.path }} | ||
port: {{ .Values.service.internalPort }} | ||
scheme: {{ .Values.livenessProbe.scheme }} | ||
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} | ||
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} | ||
readinessProbe: | ||
httpGet: | ||
path: {{ .Values.readinessProbe.path }} | ||
port: {{ .Values.service.internalPort }} | ||
scheme: {{ .Values.readinessProbe.scheme }} | ||
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} | ||
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} | ||
resources: | ||
{{ toYaml .Values.resources | indent 12 }} | ||
{{- end -}} |
Oops, something went wrong.