Skip to content

Commit

Permalink
Add preliminary helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
wkoot committed Jun 19, 2024
1 parent 53561ef commit 74d2c0b
Show file tree
Hide file tree
Showing 11 changed files with 638 additions and 0 deletions.
9 changes: 9 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: v2
name: Quality-time
version: 1.0.0
appVersion: "v5.11.0"
description: Helm chart for Quality-time, an automated quality system for software development and maintenance
type: application
home: https://github.com/ICTU/Quality-time
icon: https://raw.githubusercontent.com/ICTU/quality-time/master/docs/src/_static/Quality-time.png
35 changes: 35 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{/* Returns the name of the api_server component service */}}
{{/* Abbreviated to "api", because this string may not contain underscores */}}
{{- define "api_server_name" -}}
api
{{- end -}}

{{/* Returns the name of the collector component service */}}
{{- define "collector_name" -}}
collector
{{- end -}}

{{/* Returns the name of the database component service */}}
{{- define "database_name" -}}
database
{{- end -}}

{{/* Returns the name of the frontend component service */}}
{{- define "frontend_name" -}}
frontend
{{- end -}}

{{/* Returns the name of the notifier component service */}}
{{- define "notifier_name" -}}
notifier
{{- end -}}

{{/* Returns the name of the renderer component service */}}
{{- define "renderer_name" -}}
renderer
{{- end -}}

{{/* Returns the name of the www service running the proxy component */}}
{{- define "www_name" -}}
www
{{- end -}}
87 changes: 87 additions & 0 deletions helm/templates/api_server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ template "api_server_name" . }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "api_server_name" . }}
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "api_server_name" . }}
strategy: {}
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "api_server_name" . }}
spec:
containers:
- name: {{ template "api_server_name" . }}
image: "{{ .Values.api_server.image.repository }}:{{ .Values.api_server.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: Always
envFrom:
- configMapRef:
name: {{ .Release.Name }}-{{ template "api_server_name" . }}-env
- configMapRef:
name: {{ .Release.Name }}-shared-env
env:
- name: DATABASE_URL
value: "mongodb://root:root@{{ .Release.Name }}-{{ template "database_name" . }}:27017"
{{- if .Values.ldap }}
- name: LDAP_LOOKUP_USER_DN
value: "{{ .Values.ldap.lookupUserDN }}"
- name: LDAP_LOOKUP_USER_PASSWORD
value: "{{ .Values.ldap.lookupUserPassword }}"
- name: LDAP_ROOT_DN
value: "{{ .Values.ldap.rootDN }}"
- name: LDAP_SEARCH_FILTER
value: "{{ .Values.ldap.search }}"
- name: LDAP_URL
value: "{{ .Values.ldap.url }}"
{{- end }}
resources: {}
securityContext:
capabilities:
drop:
- ALL
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-{{ template "api_server_name" . }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "api_server_name" . }}
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "api_server_name" . }}
ports:
- protocol: TCP
port: 5001
targetPort: 5001
sessionAffinity: None
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-{{ template "api_server_name" . }}-env
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "api_server_name" . }}
data:
{{- range $key, $val := .Values.api_server.env }}
{{ $key }}: "{{ $val }}"
{{- end }}
53 changes: 53 additions & 0 deletions helm/templates/collector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ template "collector_name" . }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "collector_name" . }}
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "collector_name" . }}
strategy: {}
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "collector_name" . }}
spec:
containers:
- name: {{ template "collector_name" . }}
image: "{{ .Values.collector.image.repository }}:{{ .Values.collector.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: Always
envFrom:
- configMapRef:
name: {{ .Release.Name }}-{{ template "collector_name" . }}-env
env:
- name: DATABASE_URL
value: "mongodb://root:root@{{ .Release.Name }}-{{ template "database_name" . }}:27017"
resources: {}
securityContext:
capabilities:
drop:
- ALL
restartPolicy: Always
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-{{ template "collector_name" . }}-env
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "collector_name" . }}
data:
{{- range $key, $val := .Values.collector.env }}
{{ $key }}: "{{ $val }}"
{{- end }}
114 changes: 114 additions & 0 deletions helm/templates/database.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ template "database_name" . }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "database_name" }}
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "database_name" . }}
strategy:
type: Recreate
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "database_name" . }}
spec:
volumes:
- name: {{ .Release.Name }}-{{ template "database_name" . }}
persistentVolumeClaim:
claimName: {{ .Release.Name }}-{{ template "database_name" . }}
containers:
- name: {{ template "database_name" . }}
image: "{{ .Values.database.image.repository }}:{{ .Values.database.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: Always
envFrom:
- configMapRef:
name: {{ .Release.Name }}-{{ template "database_name" . }}-env
env:
- name: MONGO_INITDB_ROOT_PASSWORD
value: "root"
- name: MONGO_INITDB_ROOT_USERNAME
value: "root"
resources:
limits:
cpu: "2"
memory: "2Gi"
requests:
cpu: "1"
memory: "1Gi"
securityContext:
capabilities:
add:
- CHOWN
- DAC_OVERRIDE
- SETGID
- SETUID
drop:
- ALL
volumeMounts:
- mountPath: /data/db
name: {{ .Release.Name }}-{{ template "database_name" . }}
restartPolicy: Always
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Release.Name }}-{{ template "database_name" . }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "database_name" }}
annotations:
helm.sh/resource-policy: "keep"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.database.storageSize | default "1Gi" | quote }}
{{- if .Values.database.storageClassName }}
storageClassName: {{ .Values.database.storageClassName | quote }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-{{ template "database_name" . }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "database_name" }}
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "database_name" . }}
ports:
- protocol: TCP
port: 27017
targetPort: 27017
sessionAffinity: None
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-{{ template "database_name" . }}-env
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "database_name" . }}
data:
{{- range $key, $val := .Values.database.env }}
{{ $key }}: "{{ $val }}"
{{- end }}
72 changes: 72 additions & 0 deletions helm/templates/frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ template "frontend_name" . }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "frontend_name" . }}
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "frontend_name" . }}
strategy: {}
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "frontend_name" . }}
spec:
containers:
- name: {{ template "frontend_name" . }}
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: Always
envFrom:
- configMapRef:
name: {{ .Release.Name }}-{{ template "frontend_name" . }}-env
- configMapRef:
name: {{ .Release.Name }}-shared-env
resources: {}
securityContext:
capabilities:
drop:
- ALL
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-{{ template "frontend_name" . }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "frontend_name" . }}
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "frontend_name" . }}
ports:
- protocol: TCP
port: 5000
targetPort: 5000
sessionAffinity: None
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-{{ template "frontend_name" . }}-env
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: {{ template "frontend_name" . }}
data:
{{- range $key, $val := .Values.frontend.env }}
{{ $key }}: "{{ $val }}"
{{- end }}
Loading

0 comments on commit 74d2c0b

Please sign in to comment.