Commit 7f3b0bf5 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added simple helm chart for rawapi.

parent 70c9311d
ref/
\ No newline at end of file
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: rawapi
version: 0.1.0
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "rawapi.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 "rawapi.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 "rawapi.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "rawapi.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "rawapi.name" . }}
helm.sh/chart: {{ include "rawapi.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: {{ include "rawapi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "rawapi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: nomad-rawapi
image: "{{ .Values.image.name }}:{{ .Values.image.tag }}"
volumeMounts:
- mountPath: /raw
name: raw-volume
imagePullSecrets:
- name: {{ .Values.image.secret }}
volumes:
- name: raw-volume
hostPath:
path: {{ .Values.volumes.raw }}
type: Directory
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: {{ include "rawapi.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "rawapi.name" . }}
helm.sh/chart: {{ include "rawapi.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
selector:
app.kubernetes.io/name: {{ include "rawapi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
ports:
- protocol: TCP
port: 8000
targetPort: 8000
nodePort: {{ .Values.service.nodePort }}
type: NodePort
## Default values for the nomad@FAIRDI rawapi
## Everything concerning the container image to be used
image:
## The kubernetes docker-registry secret that can be used to access the registry
# with the container image in it.
# It can be created via:
# kubectl create secret docker-registry gitlab-mpcdf --docker-server=gitlab-registry.mpcdf.mpg.de --docker-username=<your-user-name > --docker-password=<yourpass> --docker-email=<email>
secret: gitlab-mpcdf
## The docker container image name without tag
name: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair/rawapi
## The docker container image tag
tag: latest
pullPolicy: IfNotPresent
## Everthing concerning the service operation
service:
## Currenty rawapi is configured to expose the service via a kubernetes NodePort
nodePort: 30001
## Everthing concerning the data that is used by the service
volumes:
## The hostPath that contains the raw file archives. This directory must have a
# subdirectory called 'data' with the actual files in it. The files must be situated
# in 3-digit prefix sub directories; example: data/H3j/H3ju22kjHkls18l.zip
raw: /nomad/nomadlab/raw-files
\ No newline at end of file
apiVersion: apps/v1
kind: Deployment
metadata:
name: nomad-postgres-deployment
labels:
app: nomad-postgres
spec:
replicas: 1
selector:
matchLabels:
app: nomad-postgres
template:
metadata:
labels:
app: nomad-postgres
spec:
containers:
- name: nomad-postgres
image: postgres:9.4
environment:
POSTGRES_PASSWORD: 'nomad'
POSTGRES_USER: 'postgres'
POSTGRES_DB: 'nomad'
ports:
- containerPort: 5432
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: data-volume
volumes:
- name: data-volume
hostPath:
path: /scratch/nomad-fair/postgres
type: Directory
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nomad-api-deployment
labels:
app: nomad-api
spec:
replicas: 1
selector:
matchLabels:
app: nomad-api
template:
metadata:
labels:
app: nomad-api
spec:
containers:
- name: nomad-api
image: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair:latest
ports:
- containerPort: 8000
volumeMounts:
- mountPath: /app/.volumes/fs
name: files-volume
command: python -m gunicorn.app.wsgiapp -w 4 -b 0.0.0.0:8000 --timeout 300 nomad.api:app
imagePullSecrets:
- name: gitlab-mpcdf # this is not in the git (.gitignore)
volumes:
- name: files-volume
hostPath:
path: /scratch/nomad-fair/fs
type: Directory
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nomad-worker-deployment
labels:
app: nomad-worker
spec:
replicas: 1
selector:
matchLabels:
app: nomad-worker
template:
metadata:
labels:
app: nomad-worker
spec:
containers:
- name: nomad-worker
image: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair:latest
volumeMounts:
- mountPath: /app/.volumes/fs
name: files-volume
command: python -m celery worker -l info -A nomad.processing
imagePullSecrets:
- name: gitlab-mpcdf # this is not in the git (.gitignore)
volumes:
- name: files-volume
hostPath:
path: /scratch/nomad-fair/fs
type: Directory
\ No newline at end of file
Deployment requires a secret to log into gitlab's docker registry:
```
kubectl create secret docker-registry gitlab-mpcdf --docker-server=gitlab-registry.mpcdf.mpg.de --docker-username=<your-user-name > --docker-password=<yourpass> --docker-email=<email>
```
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment