Skip to content

Commit

Permalink
Add Helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
janheinrichmerker committed Nov 3, 2020
1 parent 6382d12 commit 25de6bf
Show file tree
Hide file tree
Showing 15 changed files with 235 additions and 0 deletions.
3 changes: 3 additions & 0 deletions helm/cam/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/requirements.lock
**/requirements.yaml.bak
**/*.tgz
23 changes: 23 additions & 0 deletions helm/cam/.helmignore
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/
21 changes: 21 additions & 0 deletions helm/cam/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v2
name: cam
description: "CAM: The Comparative Argument Machine"
type: application
home: https://demo.webis.de/cam/
sources:
- https://github.com/webis-de/cam
icon: https://assets.webis.de/img/webis-logo-gray.svg
maintainers: # (optional)
- name: Jan Heinrich Reimer
email: [email protected]
- name: Alexander Bondarenko
email: [email protected]

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 0.1.0

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 0.1.0
3 changes: 3 additions & 0 deletions helm/cam/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CAM: The Comparative Argument Machine

Helm chart for installing CAM on a Kubernetes cluster.
4 changes: 4 additions & 0 deletions helm/cam/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# TODO: Add instructions on how to get service IP addresses.

# You may overwrite the `{{ .Release.Name }}-elasticsearch-login` secret:
kubectl create secret generic {{ .Release.Name }}-elasticsearch-login --from-literal=username=USERNAME --from-literal=password=PASSWORD
14 changes: 14 additions & 0 deletions helm/cam/templates/backend-config-map.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-backend-config-map
data:
config.json: |
{
"use_heuristics": {{ .Values.backend.useHeuristics }},
"elasticsearch": {
"url": "https://{{ .Values.elasticsearch.host }}:{{ .Values.elasticsearch.port }}",
"index_arguments": "{{ .Values.elasticsearch.indices.arguments }}"
"index_suggestions": "{{ .Values.elasticsearch.indices.suggestions }}"
}
}
54 changes: 54 additions & 0 deletions helm/cam/templates/backend-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: {{ .Release.Name }}-backend
name: {{ .Release.Name }}-backend
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-backend
replicas: {{ .Values.backend.replicas }}
template:
metadata:
labels:
app: {{ .Release.Name }}-backend
spec:
containers:
- name: {{ .Release.Name }}-backend
image: {{ .Values.backend.image }}
resources:
requests:
memory: 15Gi
env:
- name: ES_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-elasticsearch-login
key: username
- name: ES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-elasticsearch-login
key: password
volumeMounts:
- name: {{ .Release.Name }}-backend-models
mountPath: /app/data/glove.840B.300d.txt
subPath: glove.840B.300d.txt
readOnly: true
- name: {{ .Release.Name }}-backend-models
mountPath: /app/data/infersent.allnli.pickle
subPath: infersent.allnli.pickle
readOnly: true
- name: {{ .Release.Name }}-backend-config
mountPath: /app/config.json
subPath: config.json
restartPolicy: Always
volumes:
- name: {{ .Release.Name }}-backend-models
hostPath:
path: {{ .Values.backend.modelsPath }}
type: Directory
- name: {{ .Release.Name }}-backend-config
configMap:
name: {{ .Release.Name }}-backend-config-map
12 changes: 12 additions & 0 deletions helm/cam/templates/backend-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-backend
spec:
type: NodePort
selector:
app: {{ .Release.Name }}-backend
ports:
- nodePort: {{ .Values.backend.port }}
port: 5000
targetPort: 5000
8 changes: 8 additions & 0 deletions helm/cam/templates/elasticsearch-login.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-elasticsearch-login
type: Opaque
data:
username: {{ b64enc .Values.elasticsearch.username }}
password: {{ b64enc .Values.elasticsearch.password }}
11 changes: 11 additions & 0 deletions helm/cam/templates/frontend-config-map.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-frontend-config-map
data:
environment.ts: |
export const environment = {
production: true,
apiUrl: '{{ .Values.backend.url }}cam',
suggestionsElasticsearchUrl: '{{ .Values.backend.url }}suggestions'
};
28 changes: 28 additions & 0 deletions helm/cam/templates/frontend-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
service: {{ .Release.Name }}-frontend
name: {{ .Release.Name }}-frontend
spec:
selector:
matchLabels:
app: {{ .Release.Name }}-frontend
replicas: {{ .Values.frontend.replicas }}
template:
metadata:
labels:
app: {{ .Release.Name }}-frontend
spec:
containers:
- name: {{ .Release.Name }}-frontend
image: {{ .Values.frontend.image }}
volumeMounts:
- name: {{ .Release.Name }}-frontend-config
mountPath: /usr/src/app/src/environments/environment.ts
subPath: environment.ts
restartPolicy: Always
volumes:
- name: {{ .Release.Name }}-frontend-config
configMap:
name: {{ .Release.Name }}-frontend-config-map
12 changes: 12 additions & 0 deletions helm/cam/templates/frontend-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-frontend
spec:
type: NodePort
selector:
app: {{ .Release.Name }}-frontend
ports:
- nodePort: {{ .Values.frontend.port }}
port: 4200
targetPort: 4200
8 changes: 8 additions & 0 deletions helm/cam/todo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ToDo's for Kubernetes/Helm deployment

- [x] Fix Docker images locally.
- [x] Frontend
- [x] Backend
- [x] Publish Docker images (e.g. to the [GitHub Package registry](https://github.com/features/packages) or [Docker Hub](https://hub.docker.com)).
- [ ] Improve Kubernetes configurability
- [ ] Setup [GitHub Actions](https://github.com/features/actions) for automatic deployments.
27 changes: 27 additions & 0 deletions helm/cam/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Default values for CAM.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

frontend:
# url: https://demo.webis.de/cam/
port: 30294
image: webis/cam-frontend:0.1.3
replicas: 3

backend:
url: https://demo.webis.de/cam-api/
port: 30293
image: webis/cam-backend:0.1.3
replicas: 3
# Paths of models on each host's file system.
modelsPath: /mnt/ceph/storage/data-in-progress/cam/models/
useHeuristics: true

elasticsearch:
host: betaweb001.bw.webis.de
port: 30920
username: "" # Override username with `--set elasticsearch.username=EXAMPLE` Helm option.
password: "" # Override username with `--set elasticsearch.password=EXAMPLE` Helm option.
indices:
arguments: depcc
suggestions: suggestions-index
7 changes: 7 additions & 0 deletions helm/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Print Helm template.
helm template cam cam --set elasticsearch.username=reader --set elasticsearch.password=reader

# Install Helm chart.
helm install cam cam --set elasticsearch.username=reader --set elasticsearch.password=reader

0 comments on commit 25de6bf

Please sign in to comment.