Skip to content

Commit

Permalink
Merge pull request #506 from solliancenet/jrc-mgt-ui-helm
Browse files Browse the repository at this point in the history
Add Helm Chart for Management UI
  • Loading branch information
ciprianjichici authored Jan 28, 2024
2 parents a5fd7cd + 44fef26 commit 9aaf7cd
Show file tree
Hide file tree
Showing 11 changed files with 291 additions and 1 deletion.
2 changes: 1 addition & 1 deletion deploy/helm/chat-ui/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1
serviceAccountName: chat-ui
image:
repository: ghcr.io/solliancenet/foundationallm/chat-ui
repository: ghcr.io/solliancenet/foundationallm
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: latest
Expand Down
23 changes: 23 additions & 0 deletions deploy/helm/management-ui/.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/
5 changes: 5 additions & 0 deletions deploy/helm/management-ui/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: management-ui
version: 0.0.0
40 changes: 40 additions & 0 deletions deploy/helm/management-ui/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "management-ui.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 "management.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 "management-ui.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "management-ui.apihost" -}}
{{- if .Values.apihost -}}
{{- printf "%s" .Values.apihost -}}
{{- else -}}
{{- printf "%s" (index .Values.ingress.hosts 0) -}}
{{- end -}}
{{- end -}}
14 changes: 14 additions & 0 deletions deploy/helm/management-ui/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- $name := include "management-ui.fullname" . -}}
{{- $apihost := include "management-ui.apihost" . -}}

apiVersion: v1
kind: ConfigMap
metadata:
name: "cfg-{{ $name }}"
labels:
app: {{ template "management-ui.name" . }}
chart: {{ template "management-ui.chart" .}}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
AZURE_CLIENT_ID: {{ .Values.azureWorkloadIdentity.managementUiClientId }}
88 changes: 88 additions & 0 deletions deploy/helm/management-ui/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{{- $name := include "management-ui.fullname" . -}}
{{- $cfgname := printf "%s-%s" "cfg" $name -}}
{{- $secretName := printf "%s-%s" "secret" $name -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "management-ui.fullname" . }}
labels:
app: {{ template "management-ui.name" . }}
chart: {{ template "management-ui.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "management-ui.name" . }}
release: {{ .Release.Name }}
template:
metadata:
annotations:
rollme: {{ randAlphaNum 5 | quote }}
labels:
app: {{ template "management-ui.name" . }}
release: {{ .Release.Name }}
azure.workload.identity/use: "true"
spec:
serviceAccountName: {{ .Values.serviceAccountName }}
{{ if .Values.imagePullSecrets -}}
imagePullSecrets:
{{ range .Values.imagePullSecrets -}}
- name: {{ .name }}
{{- end -}}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- if .Values.env.values -}}
{{- range .Values.env.values }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end -}}
{{- end -}}
{{- if .Values.env.configmap -}}
{{- range .Values.env.configmap }}
- name: {{ .name }}
valueFrom:
configMapKeyRef:
name: {{ $cfgname }}
key: {{ .name }}
{{- end -}}
{{- end }}
{{- if .Values.env.secret -}}
{{- range .Values.env.secret }}
- name: {{ .name }}
valueFrom:
secretKeyRef:
name: {{ $secretName }}
key: {{ .name }}
{{- end -}}
{{- end }}
ports:
- name: http
containerPort: 3000
protocol: TCP
readinessProbe:
httpGet:
path: /status
port: 3000
periodSeconds: 3
timeoutSeconds: 1
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}

41 changes: 41 additions & 0 deletions deploy/helm/management-ui/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "management-ui.fullname" . -}}

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app: {{ template "management-ui.name" . }}
chart: {{ template "management-ui.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ $fullName }}
port:
number: 80
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions deploy/helm/management-ui/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- $name := include "management-ui.fullname" . -}}

apiVersion: v1
kind: Secret
metadata:
name: "secret-{{ $name }}"
labels:
app: {{ template "management-ui.name" . }}
chart: {{ template "management-ui.chart" .}}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
type: Opaque
data:
NUXT_APP_CONFIG_ENDPOINT: {{ .Values.appConfig.connectionString | b64enc }}
19 changes: 19 additions & 0 deletions deploy/helm/management-ui/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "management-ui.fullname" . }}
labels:
app: {{ template "management-ui.name" . }}
chart: {{ template "management-ui.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ template "management-ui.name" . }}
release: {{ .Release.Name }}
9 changes: 9 additions & 0 deletions deploy/helm/management-ui/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.serviceAccountName }}
annotations:
azure.workload.identity/client-id: {{ .Values.azureWorkloadIdentity.managementUiClientId }}
azure.workload.identity/tenant-id: {{ .Values.azureWorkloadIdentity.tenantId }}
labels:
azure.workload.identity/use: "true"
37 changes: 37 additions & 0 deletions deploy/helm/management-ui/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Default values for chat-ui.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1
serviceAccountName: chat-ui
image:
repository: ghcr.io/solliancenet/foundationallm/management-ui
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: latest

service:
type: ClusterIP
port: 80

resources: {}

nodeSelector: {}

tolerations: []

affinity: {}

ingress:
enabled: false

env:
configmap:
- name: AZURE_CLIENT_ID
secret:
- name: NUXT_APP_CONFIG_ENDPOINT
values:
- name: ASPNETCORE_ENVIRONMENT
value: Production


0 comments on commit 9aaf7cd

Please sign in to comment.