Skip to content

Commit

Permalink
rma - Initial Chart (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
markjrouse authored Jun 21, 2023
1 parent b3826d6 commit 7ff8697
Show file tree
Hide file tree
Showing 10 changed files with 272 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ A collection of [helm](https://helm.sh) charts created by Digital Catapult for i
* [casemanager](charts/casemanager/Chart.yaml) - Deploy the Case Manager microservice
* [testmanager](charts/testmanager/Chart.yaml) - Deploy the Test Manager microservice
* [deploymanager](charts/deploymanager/Chart.yaml) - Deploy the Deploy Manager microservice
* [resultsmanager](charts/resultsmanager/Chart.yaml) - Deploy the Results Manager microservice
6 changes: 6 additions & 0 deletions charts/resultsmanager/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 12.5.7
digest: sha256:1b88720b28cd097236ebb696fc76a6fccabe0fe46fa72050cfd56657b0d1c686
generated: "2023-06-13T11:48:37.838701+01:00"
14 changes: 14 additions & 0 deletions charts/resultsmanager/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v2
name: resultsmanager
appVersion: 0.1.1
description: A generated Helm Chart for Soniclabs T&M resultsmanager
version: 0.0.1
type: application
maintainers:
- name: cdecatapult
url: cdecatapult.github.io/soniclabs-helmcharts
dependencies:
- name: postgresql
version: '^12.1.14'
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
91 changes: 91 additions & 0 deletions charts/resultsmanager/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "resultsmanager.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 "resultsmanager.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 "resultsmanager.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "resultsmanager.labels" -}}
helm.sh/chart: {{ include "resultsmanager.chart" . }}
{{ include "resultsmanager.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "resultsmanager.selectorLabels" -}}
app.kubernetes.io/name: {{ include "resultsmanager.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "resultsmanager.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "resultsmanager.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create a default fully qualified postgresql name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "resultsmanager.postgresql.fullname" -}}
{{- if .Values.config.externalPostgresql -}}
{{ .Values.config.externalPostgresql | trunc 63 | trimSuffix "-" -}}
{{- else if not ( .Values.postgresql.enabled ) -}}
{{ fail "Postgresql must either be enabled or passed via config.externalPostgresql" }}
{{- else if .Values.postgresql.fullnameOverride -}}
{{- .Values.postgresql.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default "postgresql" .Values.postgresql.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}

{{/*
Conditionally populate imagePullSecrets if present in the context
*/}}
{{- define "resultsmanager.imagePullSecrets" -}}
{{- if (not (empty .Values.image.pullSecrets)) }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
{{- end -}}
25 changes: 25 additions & 0 deletions charts/resultsmanager/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "resultsmanager.fullname" . }}-config
labels:
{{- include "resultsmanager.labels" . | nindent 4 }}
data:
APP_DEBUG: {{ .Values.config.debug | quote }}
APP_LOG_LEVEL: {{ .Values.config.logLevel | quote }}
POSTGRES_HOST: {{ include "resultsmanager.postgresql.fullname" . }}
POSTGRES_DB: {{ .Values.postgresql.auth.database | quote }}
TAM_GUI_HOST: {{ .Values.config.guiHost | quote }}
TAM_GUI_PORT: {{ .Values.config.guiPort | quote }}
TAM_CONFIG_MANAGER_HOST: {{ .Values.config.cmaHost | quote }}
TAM_CONFIG_MANAGER_PORT: {{ .Values.config.cmaPort | quote }}
TAM_CASE_MANAGER_HOST: {{ .Values.config.camHost | quote }}
TAM_CASE_MANAGER_PORT: {{ .Values.config.camPort | quote }}
TAM_TEST_MANAGER_HOST: {{ .Values.config.tmaHost | quote }}
TAM_TEST_MANAGER_PORT: {{ .Values.config.tmaPort | quote }}
TAM_RESULTS_MANAGER_HOST: {{ .Values.config.rmaHost | quote }}
TAM_RESULTS_MANAGER_PORT: {{ .Values.config.rmaPort | quote }}
TAM_API_GATEWAY_HOST: {{ .Values.config.apgHost | quote }}
TAM_API_GATEWAY_PORT: {{ .Values.config.apgPort | quote }}
TAM_DEPLOY_MANAGER_HOST: {{ .Values.config.dmaHost | quote }}
TAM_DEPLOY_MANAGER_PORT: {{ .Values.config.dmaPort | quote }}
51 changes: 51 additions & 0 deletions charts/resultsmanager/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "resultsmanager.fullname" . }}-app
labels:
{{- include "resultsmanager.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.config.replicaCount }}
selector:
matchLabels:
name: {{ include "resultsmanager.fullname" . }}-app
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
labels:
name: {{ include "resultsmanager.fullname" . }}-app
spec:
{{- include "resultsmanager.imagePullSecrets" . | indent 6 }}
initContainers:
- name: {{ include "resultsmanager.fullname" . }}-init
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
command: ['sleep', '60']
containers:
- name: {{ include "resultsmanager.fullname" . }}-app
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
ports:
- containerPort: {{ .Values.config.appPort }}
livenessProbe:
httpGet:
path: /api/rma/healthchecks/readiness
port: {{ .Values.config.appPort }}
initialDelaySeconds: 15
timeoutSeconds: 15
periodSeconds: 15
envFrom:
- configMapRef:
name: {{ include "resultsmanager.fullname" . }}-config
- secretRef:
name: {{ include "resultsmanager.fullname" . }}-secret
env:
- name: HOST_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
10 changes: 10 additions & 0 deletions charts/resultsmanager/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "resultsmanager.fullname" . }}-secret
labels:
{{- include "resultsmanager.labels" . | nindent 4 }}
type: Opaque
data:
POSTGRES_PASSWORD: {{ .Values.postgresql.auth.password | b64enc | quote }}
POSTGRES_USER: {{ .Values.postgresql.auth.username | b64enc | quote }}
17 changes: 17 additions & 0 deletions charts/resultsmanager/templates/svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- $fullName := include "resultsmanager.fullname" . -}}
apiVersion: v1
kind: Service
metadata:
name: {{ $fullName }}
labels:
{{- include "resultsmanager.labels" . | nindent 4 }}
spec:
type: {{ .Values.config.type }}
ports:
- port: {{ .Values.config.appPort }}
targetPort: {{ .Values.config.appPort }}
nodePort: {{ .Values.config.nodePort }}
protocol: TCP
name: http
selector:
name: {{ include "resultsmanager.fullname" . }}-app
12 changes: 12 additions & 0 deletions charts/resultsmanager/templates/svcaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "resultsmanager.serviceAccountName" . }}
labels:
{{- include "resultsmanager.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
45 changes: 45 additions & 0 deletions charts/resultsmanager/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
postgresql:
enabled: true
auth:
username: tamuser
password: tampassword
database: resultsmanager

config:
replicaCount: 1
appPort: 8000
type: LoadBalancer
nodePort: 30314
debug: "True"
logLevel: DEBUG
guiHost: portal
guiPort: 8000
cmaHost: configmanager
cmaPort: 8000
camHost: casemanager
camPort: 8000
tmaHost: testmanager
tmaPort: 8000
rmaHost: resultsmanager
rmaPort: 8000
apgHost: apigateway
apgPort: 8000
dmaHost: deploymanager
dmaPort: 8000

image:
repository: ghcr.io/cdecatapult/soniclabs-resultsmanager
pullPolicy: Always
tag: latest
pullSecrets: ['soniclabs']

autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80

serviceAccount:
create: false
annotations: {}
name: ""

0 comments on commit 7ff8697

Please sign in to comment.