Skip to content

Commit

Permalink
add kubernetes specific graceful shutdown (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoisPoinsot authored Dec 8, 2020
1 parent bd162bf commit e2445d7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion charts/imaginary/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "1.2.4"
description: Deploy imaginary to process pictures on the fly
name: imaginary
version: 0.1.0
version: 0.1.1
home: https://github.com/h2non/imaginary
sources:
- https://github.com/ricardo-ch/helm-charts/tree/main/charts/imaginary
Expand Down
5 changes: 3 additions & 2 deletions charts/imaginary/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PromLens
# Imaginary

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![AppVersion: 1.2.4](https://img.shields.io/badge/AppVersion-1.2.4-informational?style=flat-square) ![Release Status](https://github.com/ricardo-ch/helm-charts/workflows/Release%20Charts/badge.svg) [![License](https://img.shields.io/github/license/ricardo-ch/helm-charts)](https://github.com/ricardo-ch/helm-charts/blob/main/LICENSE)
![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![AppVersion: 1.2.4](https://img.shields.io/badge/AppVersion-1.2.4-informational?style=flat-square) ![Release Status](https://github.com/ricardo-ch/helm-charts/workflows/Release%20Charts/badge.svg) [![License](https://img.shields.io/github/license/ricardo-ch/helm-charts)](https://github.com/ricardo-ch/helm-charts/blob/main/LICENSE)

This chart installs [Imaginary](https://github.com/h2non/imaginary).

Expand Down Expand Up @@ -28,6 +28,7 @@ Simply add this Chart repository to Helm:
| additionalLabels | object | `{}` | append labels to both the deployment, pdb, hpa and the pods label list |
| apikey | string | `""` | Define API key for authorization |
| config | object | `{}` | Imaginary arguments. use the same hyphen separated synthax for the key. use strings for the value or you might get a bad formatting. |
| gracefulShutdownDelaySeconds | int | `10` | estimated time to propagate the information the pod is not part of the service anymore |
| hpa | object | `{"maxReplicas":2,"minReplicas":2}` | Horizontal pod autoscaling configuration |
| httpPort | int | `8080` | Which port should Imaginary and its Kubernetes service listen |
| image | string | `"h2non/imaginary:1.2.4"` | Docker image repository to pull it. |
Expand Down
2 changes: 1 addition & 1 deletion charts/imaginary/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PromLens
# Imaginary

{{ template "chart.deprecationWarning" . }}

Expand Down
4 changes: 4 additions & 0 deletions charts/imaginary/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ spec:
value: {{ print .Values.apiKey | quote }}
{{- end }}
initialDelaySeconds: 10
lifecycle:
preStop:
exec:
command: ["sleep","{{ .Values.gracefulShutdownDelaySeconds }}"]
{{- if and .Values.tls.certificate .Values.tls.privateKey }}
volumes:
- name: certificates
Expand Down
15 changes: 9 additions & 6 deletions charts/imaginary/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ tls:
# -- Base64 encoded TLS certificate file
certificate: ""

# -- Horizontal pod autoscaling configuration
hpa:
minReplicas: 2
maxReplicas: 2


# -- Define API key for authorization
apikey: ""

Expand All @@ -64,6 +58,15 @@ additionalLabels: {}
additionalAnnotations: {}
# sumologic.com/exclude: "true"

# -- estimated time to propagate the information the pod is not part of the service anymore
gracefulShutdownDelaySeconds:
10

pdb:
# -- minAvailable field from k8s pdb
minAvailable: 50%

# -- Horizontal pod autoscaling configuration
hpa:
minReplicas: 2
maxReplicas: 2

0 comments on commit e2445d7

Please sign in to comment.