diff --git a/helm/Chart.yaml b/helm/Chart.yaml new file mode 100644 index 0000000000..e01ebcc661 --- /dev/null +++ b/helm/Chart.yaml @@ -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 diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl new file mode 100644 index 0000000000..b52e0f767d --- /dev/null +++ b/helm/templates/_helpers.tpl @@ -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 -}} diff --git a/helm/templates/api_server.yaml b/helm/templates/api_server.yaml new file mode 100644 index 0000000000..0716908022 --- /dev/null +++ b/helm/templates/api_server.yaml @@ -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 }} diff --git a/helm/templates/collector.yaml b/helm/templates/collector.yaml new file mode 100644 index 0000000000..363bc0830f --- /dev/null +++ b/helm/templates/collector.yaml @@ -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 }} diff --git a/helm/templates/database.yaml b/helm/templates/database.yaml new file mode 100644 index 0000000000..a321daf852 --- /dev/null +++ b/helm/templates/database.yaml @@ -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 }} diff --git a/helm/templates/frontend.yaml b/helm/templates/frontend.yaml new file mode 100644 index 0000000000..7edd8c201c --- /dev/null +++ b/helm/templates/frontend.yaml @@ -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 }} diff --git a/helm/templates/notifier.yaml b/helm/templates/notifier.yaml new file mode 100644 index 0000000000..1913a01935 --- /dev/null +++ b/helm/templates/notifier.yaml @@ -0,0 +1,53 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-{{ template "notifier_name" . }} + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "notifier_name" . }} +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "notifier_name" . }} + strategy: {} + template: + metadata: + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "notifier_name" . }} + spec: + containers: + - name: {{ template "notifier_name" . }} + image: "{{ .Values.notifier.image.repository }}:{{ .Values.notifier.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: Always + envFrom: + - configMapRef: + name: {{ .Release.Name }}-{{ template "notifier_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 "notifier_name" . }}-env + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "notifier_name" . }} +data: +{{- range $key, $val := .Values.notifier.env }} + {{ $key }}: "{{ $val }}" +{{- end }} diff --git a/helm/templates/renderer.yaml b/helm/templates/renderer.yaml new file mode 100644 index 0000000000..3689f8fb29 --- /dev/null +++ b/helm/templates/renderer.yaml @@ -0,0 +1,57 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-{{ template "renderer_name" . }} + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "renderer_name" . }} +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "renderer_name" . }} + strategy: {} + template: + metadata: + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "renderer_name" . }} + spec: + containers: + - name: {{ template "renderer_name" . }} + image: "{{ .Values.renderer.image.repository }}:{{ .Values.renderer.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: Always + envFrom: + - configMapRef: + name: {{ .Release.Name }}-{{ template "renderer_name" . }}-env + env: + - name: LC_ALL + value: "en_GB.UTF-8" + - name: PROXY_HOST + value: "{{ .Release.Name }}-{{ template "www_name" . }}" + - name: TZ + value: "Europe/Amsterdam" + resources: {} + securityContext: + capabilities: + drop: + - ALL + restartPolicy: Always +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-{{ template "renderer_name" . }}-env + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "renderer_name" . }} +data: +{{- range $key, $val := .Values.renderer.env }} + {{ $key }}: "{{ $val }}" +{{- end }} diff --git a/helm/templates/shared.yaml b/helm/templates/shared.yaml new file mode 100644 index 0000000000..55afd116c5 --- /dev/null +++ b/helm/templates/shared.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-shared-env + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: "shared" +data: +{{- range $key, $val := .Values.shared.env }} + {{ $key }}: "{{ $val }}" +{{- end }} diff --git a/helm/templates/www.yaml b/helm/templates/www.yaml new file mode 100644 index 0000000000..57eec5d64e --- /dev/null +++ b/helm/templates/www.yaml @@ -0,0 +1,111 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }}-{{ template "www_name" . }} + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "www_name" . }} +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "www_name" . }} + strategy: {} + template: + metadata: + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "www_name" . }} + spec: + containers: + - name: {{ template "www_name" . }} + image: "{{ .Values.www.image.repository }}:{{ .Values.www.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: Always + envFrom: + - configMapRef: + name: {{ .Release.Name }}-{{ template "www_name" . }}-env + - configMapRef: + name: {{ .Release.Name }}-shared-env + env: + - name: API_SERVER_HOST + value: "{{ .Release.Name }}-{{ template "api_server_name" . }}" + - name: FRONTEND_HOST + value: "{{ .Release.Name }}-{{ template "frontend_name" . }}" + ports: + - containerPort: 80 + resources: {} + securityContext: + capabilities: + add: + - CHOWN + drop: + - ALL + restartPolicy: Always +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-{{ template "www_name" . }} + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "www_name" . }} +spec: + type: ClusterIP + selector: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "www_name" . }} + ports: + - protocol: TCP + port: 80 + targetPort: 80 + sessionAffinity: None +--- +{{- if .Values.www.ingress -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Release.Name }}-{{ template "www_name" . }} + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "www_name" . }} + annotations: + {{- range $key, $value := .Values.www.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + ingressClassName: {{ .Values.www.ingress.ingressClassName }} + rules: + - host: {{ printf "%s" $.Values.www.ingress.hostname }} + http: + paths: + - backend: + service: + name: {{ .Release.Name }}-{{ template "www_name" . }} + port: + number: 80 + path: / + pathType: ImplementationSpecific + tls: +{{ toYaml .Values.www.ingress.tls | indent 4 }} +{{- end }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-{{ template "www_name" . }}-env + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: {{ template "www_name" . }} +data: +{{- range $key, $val := .Values.www.env }} + {{ $key }}: "{{ $val }}" +{{- end }} diff --git a/helm/values.yaml b/helm/values.yaml new file mode 100644 index 0000000000..34f6749f95 --- /dev/null +++ b/helm/values.yaml @@ -0,0 +1,34 @@ +--- +api_server: + image: + repository: "ictu/quality-time_api_server" + +collector: + image: + repository: "ictu/quality-time_collector" + +database: + image: + repository: "ictu/quality-time_database" + +frontend: + image: + repository: "ictu/quality-time_frontend" + +notifier: + image: + repository: "ictu/quality-time_notifier" + +renderer: + image: + repository: "ictu/quality-time_renderer" + +shared: + env: + API_SERVER_PORT: "5001" + FRONTEND_PORT: "5000" + PROXY_PORT: "80" + +www: + image: + repository: "ictu/quality-time_proxy"