-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b451956
commit a5035a2
Showing
5 changed files
with
95 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v2 | ||
name: maykin-utils-lib | ||
description: A Library Helm chart containing code shared between Maykin helm charts | ||
|
||
type: library | ||
version: 0.1.0 | ||
|
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,9 @@ | ||
{{- define "maykinhelmlib.celeryEnvConfigmap" -}} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "project.fullname" . }}-worker-{{ .Values.worker.label | default "celery" }} | ||
data: | ||
CELERY_WORKER_QUEUE: {{ .Values.worker.queueName | default "" }} | ||
CELERY_WORKER_NAME: {{ .Values.worker.name | default "" }} | ||
{{- end -}} |
31 changes: 31 additions & 0 deletions
31
charts/maykin-utils-lib/templates/_celery-liveness-configmap.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,31 @@ | ||
{{- define "maykinhelmlib.celeryLivenessConfigmap" -}} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "project.fullname" . }}-celery-liveness | ||
data: | ||
liveness-probe.sh: | | ||
#!/bin/bash | ||
|
||
# Exit immediately if a non-zero exit code is returned | ||
set -e | ||
|
||
QUEUE_NAME=${CELERY_WORKER_QUEUE:-celery} | ||
|
||
# Check if CELERY_WORKER_NAME is set | ||
if [ -z "$CELERY_WORKER_NAME" ]; then | ||
# If not set | ||
WORKER_NAME="${QUEUE_NAME}@${HOSTNAME}" | ||
else | ||
# If set and contains the '@' symbol | ||
if [[ "$CELERY_WORKER_NAME" != *"@"* ]]; then | ||
# If not, update CELERY_WORKER_NAME to celery@${CELERY_WORKER_NAME} | ||
WORKER_NAME="celery@${CELERY_WORKER_NAME}" | ||
else | ||
WORKER_NAME="${CELERY_WORKER_NAME}" | ||
fi | ||
fi | ||
|
||
# Use CELERY_WORKER_NAME to set the --destination flag | ||
celery --workdir src --app {{ include "application.name" . }}.celery inspect --destination "$WORKER_NAME" active | ||
{{- 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{{- define "application.name" -}} | ||
{{- default .Values.pythonAppName }} | ||
{{- end }} | ||
|
||
{{- define "project.name" -}} | ||
{{- 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). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "project.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 }} |