add blocknote micro service to kube

This commit is contained in:
lebaudantoine
2024-10-20 23:49:25 +02:00
parent 993394d91f
commit 89a44e4979
6 changed files with 272 additions and 1 deletions
+8
View File
@@ -10,6 +10,14 @@ app.get("/", (req: Request, res: Response) => {
res.send("Express + TypeScript Server");
});
app.get("/__heartbeat__", (req: Request, res: Response) => {
res.status(200).send({ status: "OK" });
});
app.get("/__lbheartbeat__", (req: Request, res: Response) => {
res.status(200).send({ status: "OK" });
});
app.listen(port, () => {
console.log(`[server]: Server is running at http://localhost:${port}`);
});
@@ -93,6 +93,14 @@ yProvider:
pullPolicy: Always
tag: "latest"
blocknote:
replicas: 1
image:
repository: localhost:5001/impress-blocknote
pullPolicy: Always
tag: "latest"
ingress:
enabled: true
host: impress.127.0.0.1.nip.io
+9
View File
@@ -157,6 +157,15 @@ Requires top level scope
{{ include "impress.fullname" . }}-y-provider
{{- end }}
{{/*
Full name for the blocknote
Requires top level scope
*/}}
{{- define "impress.blocknote.fullname" -}}
{{ include "impress.fullname" . }}-blocknote
{{- end }}
{{/*
Usage : {{ include "impress.secret.dockerconfigjson.name" (dict "fullname" (include "impress.fullname" .) "imageCredentials" .Values.path.to.the.image1) }}
*/}}
@@ -0,0 +1,136 @@
{{- $envVars := include "impress.common.env" (list . .Values.blocknote) -}}
{{- $fullName := include "impress.blocknote.fullname" . -}}
{{- $component := "blocknote" -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $fullName }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "impress.common.labels" (list . $component) | nindent 4 }}
spec:
replicas: {{ .Values.blocknote.replicas }}
selector:
matchLabels:
{{- include "impress.common.selectorLabels" (list . $component) | nindent 6 }}
template:
metadata:
annotations:
{{- with .Values.blocknote.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "impress.common.selectorLabels" (list . $component) | nindent 8 }}
spec:
{{- if $.Values.image.credentials }}
imagePullSecrets:
- name: {{ include "impress.secret.dockerconfigjson.name" (dict "fullname" (include "impress.fullname" .) "imageCredentials" $.Values.image.credentials) }}
{{- end}}
shareProcessNamespace: {{ .Values.blocknote.shareProcessNamespace }}
containers:
{{- with .Values.blocknote.sidecars }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: {{ .Chart.Name }}
image: "{{ (.Values.blocknote.image | default dict).repository | default .Values.image.repository }}:{{ (.Values.blocknote.image | default dict).tag | default .Values.image.tag }}"
imagePullPolicy: {{ (.Values.blocknote.image | default dict).pullPolicy | default .Values.image.pullPolicy }}
{{- with .Values.blocknote.command }}
command:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.blocknote.args }}
args:
{{- toYaml . | nindent 12 }}
{{- end }}
env:
{{- if $envVars}}
{{- $envVars | indent 12 }}
{{- end }}
{{- with .Values.blocknote.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.blocknote.service.targetPort }}
protocol: TCP
{{- if .Values.blocknote.probes.liveness }}
livenessProbe:
{{- include "impress.probes.abstract" (merge .Values.blocknote.probes.liveness (dict "targetPort" .Values.blocknote.service.targetPort )) | nindent 12 }}
{{- end }}
{{- if .Values.blocknote.probes.readiness }}
readinessProbe:
{{- include "impress.probes.abstract" (merge .Values.blocknote.probes.readiness (dict "targetPort" .Values.blocknote.service.targetPort )) | nindent 12 }}
{{- end }}
{{- if .Values.blocknote.probes.startup }}
startupProbe:
{{- include "impress.probes.abstract" (merge .Values.blocknote.probes.startup (dict "targetPort" .Values.blocknote.service.targetPort )) | nindent 12 }}
{{- end }}
{{- with .Values.blocknote.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- range $index, $value := .Values.mountFiles }}
- name: "files-{{ $index }}"
mountPath: {{ $value.path }}
subPath: content
{{- end }}
{{- range $name, $volume := .Values.blocknote.persistence }}
- name: "{{ $name }}"
mountPath: "{{ $volume.mountPath }}"
{{- end }}
{{- range .Values.blocknote.extraVolumeMounts }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
subPath: {{ .subPath | default "" }}
readOnly: {{ .readOnly }}
{{- end }}
{{- with .Values.blocknote.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.blocknote.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.blocknote.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- range $index, $value := .Values.mountFiles }}
- name: "files-{{ $index }}"
configMap:
name: "{{ include "impress.fullname" $ }}-files-{{ $index }}"
{{- end }}
{{- range $name, $volume := .Values.blocknote.persistence }}
- name: "{{ $name }}"
{{- if eq $volume.type "emptyDir" }}
emptyDir: {}
{{- else }}
persistentVolumeClaim:
claimName: "{{ $fullName }}-{{ $name }}"
{{- end }}
{{- end }}
{{- range .Values.blocknote.extraVolumes }}
- name: {{ .name }}
{{- if .existingClaim }}
persistentVolumeClaim:
claimName: {{ .existingClaim }}
{{- else if .hostPath }}
hostPath:
{{ toYaml .hostPath | nindent 12 }}
{{- else if .csi }}
csi:
{{- toYaml .csi | nindent 12 }}
{{- else if .configMap }}
configMap:
{{- toYaml .configMap | nindent 12 }}
{{- else if .emptyDir }}
emptyDir:
{{- toYaml .emptyDir | nindent 12 }}
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}
@@ -0,0 +1,21 @@
{{- $envVars := include "impress.common.env" (list . .Values.blocknote) -}}
{{- $fullName := include "impress.blocknote.fullname" . -}}
{{- $component := "blocknote" -}}
apiVersion: v1
kind: Service
metadata:
name: {{ $fullName }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "impress.common.labels" (list . $component) | nindent 4 }}
annotations:
{{- toYaml $.Values.blocknote.service.annotations | nindent 4 }}
spec:
type: {{ .Values.blocknote.service.type }}
ports:
- port: {{ .Values.blocknote.service.port }}
targetPort: {{ .Values.blocknote.service.targetPort }}
protocol: TCP
name: http
selector:
{{- include "impress.common.selectorLabels" (list . $component) | nindent 4 }}
+90 -1
View File
@@ -412,4 +412,93 @@ yProvider:
extraVolumeMounts: []
## @param yProvider.extraVolumes Additional volumes to mount on the yProvider.
extraVolumes: []
extraVolumes: []
## @section blocknote
blocknote:
## @param blocknote.command Override the blocknote container command
command: []
## @param blocknote.args Override the blocknote container args
args: []
## @param blocknote.replicas Amount of blocknote replicas
replicas: 3
## @param blocknote.shareProcessNamespace Enable share process namespace between containers
shareProcessNamespace: false
## @param blocknote.sidecars Add sidecars containers to blocknote deployment
sidecars: []
## @param blocknote.securityContext Configure blocknote Pod security context
securityContext: null
## @param blocknote.envVars Configure blocknote container environment variables
## @extra blocknote.envVars.BY_VALUE Example environment variable by setting value directly
## @extra blocknote.envVars.FROM_CONFIGMAP.configMapKeyRef.name Name of a ConfigMap when configuring env vars from a ConfigMap
## @extra blocknote.envVars.FROM_CONFIGMAP.configMapKeyRef.key Key within a ConfigMap when configuring env vars from a ConfigMap
## @extra blocknote.envVars.FROM_SECRET.secretKeyRef.name Name of a Secret when configuring env vars from a Secret
## @extra blocknote.envVars.FROM_SECRET.secretKeyRef.key Key within a Secret when configuring env vars from a Secret
## @skip blocknote.envVars
envVars:
<<: *commonEnvVars
## @param blocknote.podAnnotations Annotations to add to the blocknote Pod
podAnnotations: {}
## @param blocknote.service.type blocknote Service type
## @param blocknote.service.port blocknote Service listening port
## @param blocknote.service.targetPort blocknote container listening port
## @param blocknote.service.annotations Annotations to add to the blocknote Service
service:
type: ClusterIP
port: 80
targetPort: 8081
annotations: {}
## @param blocknote.probes.liveness.path [nullable] Configure path for blocknote HTTP liveness probe
## @param blocknote.probes.liveness.targetPort [nullable] Configure port for blocknote HTTP liveness probe
## @param blocknote.probes.liveness.initialDelaySeconds [nullable] Configure initial delay for blocknote liveness probe
## @param blocknote.probes.liveness.initialDelaySeconds [nullable] Configure timeout for blocknote liveness probe
## @param blocknote.probes.startup.path [nullable] Configure path for blocknote HTTP startup probe
## @param blocknote.probes.startup.targetPort [nullable] Configure port for blocknote HTTP startup probe
## @param blocknote.probes.startup.initialDelaySeconds [nullable] Configure initial delay for blocknote startup probe
## @param blocknote.probes.startup.initialDelaySeconds [nullable] Configure timeout for blocknote startup probe
## @param blocknote.probes.readiness.path [nullable] Configure path for blocknote HTTP readiness probe
## @param blocknote.probes.readiness.targetPort [nullable] Configure port for blocknote HTTP readiness probe
## @param blocknote.probes.readiness.initialDelaySeconds [nullable] Configure initial delay for blocknote readiness probe
## @param blocknote.probes.readiness.initialDelaySeconds [nullable] Configure timeout for blocknote readiness probe
probes:
liveness:
path: /__heartbeat__
initialDelaySeconds: 10
readiness:
path: /__lbheartbeat__
initialDelaySeconds: 10
## @param blocknote.resources Resource requirements for the blocknote container
resources: {}
## @param blocknote.nodeSelector Node selector for the blocknote Pod
nodeSelector: {}
## @param blocknote.tolerations Tolerations for the blocknote Pod
tolerations: []
## @param blocknote.affinity Affinity for the blocknote Pod
affinity: {}
## @param blocknote.persistence Additional volumes to create and mount on the blocknote. Used for debugging purposes
## @extra blocknote.persistence.volume-name.size Size of the additional volume
## @extra blocknote.persistence.volume-name.type Type of the additional volume, persistentVolumeClaim or emptyDir
## @extra blocknote.persistence.volume-name.mountPath Path where the volume should be mounted to
persistence: {}
## @param blocknote.extraVolumeMounts Additional volumes to mount on the blocknote.
extraVolumeMounts: []
## @param blocknote.extraVolumes Additional volumes to mount on the blocknote.
extraVolumes: []