From 89021844048edc16d670b516cefcc885f3c326f1 Mon Sep 17 00:00:00 2001 From: Andrew Rothstein Date: Tue, 5 Nov 2024 02:18:28 +0000 Subject: [PATCH 1/4] first swing. broken. --- kubernetes/helm-charts/bricksllm/.gitignore | 1 + kubernetes/helm-charts/bricksllm/.helmignore | 23 ++++ kubernetes/helm-charts/bricksllm/Chart.lock | 9 ++ kubernetes/helm-charts/bricksllm/Chart.yaml | 21 ++++ .../helm-charts/bricksllm/templates/NOTES.txt | 0 .../bricksllm/templates/_helpers.tpl | 62 ++++++++++ .../bricksllm/templates/deployment.yaml | 77 ++++++++++++ .../helm-charts/bricksllm/templates/hpa.yaml | 32 +++++ .../bricksllm/templates/ingress.yaml | 43 +++++++ .../bricksllm/templates/service.yaml | 21 ++++ .../bricksllm/templates/serviceaccount.yaml | 13 ++ .../templates/tests/test-connection.yaml | 19 +++ kubernetes/helm-charts/bricksllm/values.yaml | 116 ++++++++++++++++++ 13 files changed, 437 insertions(+) create mode 100644 kubernetes/helm-charts/bricksllm/.gitignore create mode 100644 kubernetes/helm-charts/bricksllm/.helmignore create mode 100644 kubernetes/helm-charts/bricksllm/Chart.lock create mode 100644 kubernetes/helm-charts/bricksllm/Chart.yaml create mode 100644 kubernetes/helm-charts/bricksllm/templates/NOTES.txt create mode 100644 kubernetes/helm-charts/bricksllm/templates/_helpers.tpl create mode 100644 kubernetes/helm-charts/bricksllm/templates/deployment.yaml create mode 100644 kubernetes/helm-charts/bricksllm/templates/hpa.yaml create mode 100644 kubernetes/helm-charts/bricksllm/templates/ingress.yaml create mode 100644 kubernetes/helm-charts/bricksllm/templates/service.yaml create mode 100644 kubernetes/helm-charts/bricksllm/templates/serviceaccount.yaml create mode 100644 kubernetes/helm-charts/bricksllm/templates/tests/test-connection.yaml create mode 100644 kubernetes/helm-charts/bricksllm/values.yaml diff --git a/kubernetes/helm-charts/bricksllm/.gitignore b/kubernetes/helm-charts/bricksllm/.gitignore new file mode 100644 index 0000000..948259a --- /dev/null +++ b/kubernetes/helm-charts/bricksllm/.gitignore @@ -0,0 +1 @@ +charts/*.tgz diff --git a/kubernetes/helm-charts/bricksllm/.helmignore b/kubernetes/helm-charts/bricksllm/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/kubernetes/helm-charts/bricksllm/.helmignore @@ -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/ diff --git a/kubernetes/helm-charts/bricksllm/Chart.lock b/kubernetes/helm-charts/bricksllm/Chart.lock new file mode 100644 index 0000000..322694a --- /dev/null +++ b/kubernetes/helm-charts/bricksllm/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: redis + repository: oci://registry-1.docker.io/bitnamicharts + version: 20.2.1 +- name: postgresql + repository: oci://registry-1.docker.io/bitnamicharts + version: 16.1.1 +digest: sha256:d380aeee84575489c7b48727ff37b9e47747e8c7e855655fc815455243421660 +generated: "2024-11-04T22:16:50.627919824Z" diff --git a/kubernetes/helm-charts/bricksllm/Chart.yaml b/kubernetes/helm-charts/bricksllm/Chart.yaml new file mode 100644 index 0000000..7b918a3 --- /dev/null +++ b/kubernetes/helm-charts/bricksllm/Chart.yaml @@ -0,0 +1,21 @@ +--- +apiVersion: v2 +name: bricksllm +description: A Helm chart for deploying BricksLLM and its dependencies + +type: application + +version: 0.1.0 + +# bricksllm version +appVersion: "1.37.0" + +dependencies: + - condition: redis.enabled + name: redis + repository: oci://registry-1.docker.io/bitnamicharts + version: ~20 + - conditions: postgresql.enabled + name: postgresql + repository: oci://registry-1.docker.io/bitnamicharts + version: ~16 diff --git a/kubernetes/helm-charts/bricksllm/templates/NOTES.txt b/kubernetes/helm-charts/bricksllm/templates/NOTES.txt new file mode 100644 index 0000000..e69de29 diff --git a/kubernetes/helm-charts/bricksllm/templates/_helpers.tpl b/kubernetes/helm-charts/bricksllm/templates/_helpers.tpl new file mode 100644 index 0000000..7a986ec --- /dev/null +++ b/kubernetes/helm-charts/bricksllm/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "bricksllm.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 "bricksllm.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 "bricksllm.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "bricksllm.labels" -}} +helm.sh/chart: {{ include "bricksllm.chart" . }} +{{ include "bricksllm.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "bricksllm.selectorLabels" -}} +app.kubernetes.io/name: {{ include "bricksllm.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "bricksllm.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "bricksllm.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/kubernetes/helm-charts/bricksllm/templates/deployment.yaml b/kubernetes/helm-charts/bricksllm/templates/deployment.yaml new file mode 100644 index 0000000..4c2f7c6 --- /dev/null +++ b/kubernetes/helm-charts/bricksllm/templates/deployment.yaml @@ -0,0 +1,77 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "bricksllm.fullname" . }} + labels: + {{- include "bricksllm.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "bricksllm.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "bricksllm.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "bricksllm.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: control + containerPort: {{ .Values.services.control.port }} + protocol: TCP + - name: data + containerPort: {{ .Values.services.data.port }} + protocol: TCP + {{- with .Values.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.readinesProbe }} + readinessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/kubernetes/helm-charts/bricksllm/templates/hpa.yaml b/kubernetes/helm-charts/bricksllm/templates/hpa.yaml new file mode 100644 index 0000000..bd8bff1 --- /dev/null +++ b/kubernetes/helm-charts/bricksllm/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "bricksllm.fullname" . }} + labels: + {{- include "bricksllm.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "bricksllm.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/kubernetes/helm-charts/bricksllm/templates/ingress.yaml b/kubernetes/helm-charts/bricksllm/templates/ingress.yaml new file mode 100644 index 0000000..672c0e3 --- /dev/null +++ b/kubernetes/helm-charts/bricksllm/templates/ingress.yaml @@ -0,0 +1,43 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "bricksllm.fullname" . }} + labels: + {{- include "bricksllm.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- with .Values.ingress.className }} + ingressClassName: {{ . }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- with .pathType }} + pathType: {{ . }} + {{- end }} + backend: + service: + name: {{ include "bricksllm.fullname" $ }} + port: + number: {{ $.Values.service.port }} + {{- end }} + {{- end }} +{{- end }} diff --git a/kubernetes/helm-charts/bricksllm/templates/service.yaml b/kubernetes/helm-charts/bricksllm/templates/service.yaml new file mode 100644 index 0000000..94606e3 --- /dev/null +++ b/kubernetes/helm-charts/bricksllm/templates/service.yaml @@ -0,0 +1,21 @@ +{{- $fullName := include "bricksllm.fullname" . }} +{{- $labels := include "bricksllm.labels" . }} +{{- $selectorLabels := include "bricksllm.selectorLabels" . }} +{{- range $name, $v := .Values.services -}} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ $fullName }}-{{ $name }} + labels: + {{- $labels | nindent 4 }} +spec: + type: {{ $v.type }} + ports: + - port: {{ $v.port }} + targetPort: http + protocol: TCP + name: {{ $name | quote }} + selector: + {{- $selectorLabels | nindent 4 }} +{{- end }} diff --git a/kubernetes/helm-charts/bricksllm/templates/serviceaccount.yaml b/kubernetes/helm-charts/bricksllm/templates/serviceaccount.yaml new file mode 100644 index 0000000..453e1e0 --- /dev/null +++ b/kubernetes/helm-charts/bricksllm/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "bricksllm.serviceAccountName" . }} + labels: + {{- include "bricksllm.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/kubernetes/helm-charts/bricksllm/templates/tests/test-connection.yaml b/kubernetes/helm-charts/bricksllm/templates/tests/test-connection.yaml new file mode 100644 index 0000000..ab6f4e2 --- /dev/null +++ b/kubernetes/helm-charts/bricksllm/templates/tests/test-connection.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "bricksllm.fullname" . }}-test-connection" + labels: + {{- include "bricksllm.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "bricksllm.fullname" . }}-control:{{ .Values.services.control.port }}'] + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "bricksllm.fullname" . }}-data:{{ .Values.services.data.port }}'] + restartPolicy: Never diff --git a/kubernetes/helm-charts/bricksllm/values.yaml b/kubernetes/helm-charts/bricksllm/values.yaml new file mode 100644 index 0000000..a4a8289 --- /dev/null +++ b/kubernetes/helm-charts/bricksllm/values.yaml @@ -0,0 +1,116 @@ +--- +# replica count for the bricksllm Deployment +replicaCount: 1 + +# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/ +image: + repository: luyuanxin1995/bricksllm + # This sets the pull policy for images. + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +# for private registries hosting the imagery +imagePullSecrets: [] + +# This is to override the chart name. +nameOverride: "" +fullnameOverride: "" + +# establish a dedicated service account +serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +# additional pod annotations +podAnnotations: {} + +# additional pod labels +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +services: + control: + type: ClusterIP + port: 8001 + data: + type: ClusterIP + port: 8002 + +# Configuring Ingress +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +#resources: +# limits: +# cpu: 100m +# memory: 128Mi +# requests: +# cpu: 100m +# memory: 128Mi + +#livenessProbe: +# httpGet: +# path: / +# port: http + +#readinessProbe: +# httpGet: +# path: / +# port: http + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes for the Deployments +#volumes: +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts for the deployments +#volumeMounts: +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} From ae55b11097aed9a9d81d7c31a348643e99f6813e Mon Sep 17 00:00:00 2001 From: Andrew Rothstein Date: Wed, 6 Nov 2024 03:15:39 +0000 Subject: [PATCH 2/4] gussy up the services with named ports and named ingresses --- kubernetes/helm-charts/Taskfile.yml | 12 ++++ .../bricksllm/templates/deployment.yaml | 30 ++++++-- .../bricksllm/templates/ingress.yaml | 29 +++++--- .../templates/tests/test-connection.yaml | 16 +++-- kubernetes/helm-charts/bricksllm/values.yaml | 72 ++++++++++++------- 5 files changed, 109 insertions(+), 50 deletions(-) create mode 100644 kubernetes/helm-charts/Taskfile.yml diff --git a/kubernetes/helm-charts/Taskfile.yml b/kubernetes/helm-charts/Taskfile.yml new file mode 100644 index 0000000..d50108a --- /dev/null +++ b/kubernetes/helm-charts/Taskfile.yml @@ -0,0 +1,12 @@ +--- +version: '3' +tasks: + default: + cmds: + - | + helm upgrade \ + --create-namespace \ + -n bricksllm \ + --install \ + bricksllm \ + ./bricksllm diff --git a/kubernetes/helm-charts/bricksllm/templates/deployment.yaml b/kubernetes/helm-charts/bricksllm/templates/deployment.yaml index 4c2f7c6..8a97665 100644 --- a/kubernetes/helm-charts/bricksllm/templates/deployment.yaml +++ b/kubernetes/helm-charts/bricksllm/templates/deployment.yaml @@ -1,7 +1,9 @@ +{{ $fullname := include "bricksllm.fullname" . -}} +--- apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "bricksllm.fullname" . }} + name: {{ $fullname }} labels: {{- include "bricksllm.labels" . | nindent 4 }} spec: @@ -35,14 +37,30 @@ spec: securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + env: + - name: POSTGRESQL_HOSTS + value: '{{ $fullname }}-postgresql' + - name: POSTGRESQL_USERNAME + value: postgres + - name: POSTGRESQL_PASSWORD + valueFrom: + secretKeyRef: + name: '{{ $fullname }}-postgresql' + key: postgres-password + - name: REDIS_HOSTS + value: '{{ $fullname }}-redis-master' + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: '{{ $fullname }}-redis' + key: redis-password imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - - name: control - containerPort: {{ .Values.services.control.port }} - protocol: TCP - - name: data - containerPort: {{ .Values.services.data.port }} + {{- range $name, $v := .Values.services }} + - name: {{ $name }} + containerPort: {{ $v.port }} protocol: TCP + {{- end }} {{- with .Values.livenessProbe }} livenessProbe: {{- toYaml . | nindent 12 }} diff --git a/kubernetes/helm-charts/bricksllm/templates/ingress.yaml b/kubernetes/helm-charts/bricksllm/templates/ingress.yaml index 672c0e3..c3039f7 100644 --- a/kubernetes/helm-charts/bricksllm/templates/ingress.yaml +++ b/kubernetes/helm-charts/bricksllm/templates/ingress.yaml @@ -1,30 +1,36 @@ -{{- if .Values.ingress.enabled -}} +{{- $fullname := include "bricksllm.fullname" . }} +{{- $labels := include "bricksllm.labels" . }} +{{- range $name, $v := .Values.ingresses }} +{{- if $v.enabled }} +--- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: {{ include "bricksllm.fullname" . }} + name: {{ $fullname }}-{{ $name }} labels: - {{- include "bricksllm.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} + {{- $labels | nindent 4 }} + {{- with $v.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: - {{- with .Values.ingress.className }} + {{- with $v.className }} ingressClassName: {{ . }} {{- end }} - {{- if .Values.ingress.tls }} + {{- if $v.tls }} tls: - {{- range .Values.ingress.tls }} + {{- range $v.tls }} - hosts: {{- range .hosts }} - {{ . | quote }} {{- end }} - secretName: {{ .secretName }} + {{- with .secretName }} + secretName: {{ . }} + {{- end }} {{- end }} {{- end }} rules: - {{- range .Values.ingress.hosts }} + {{- range $v.hosts }} - host: {{ .host | quote }} http: paths: @@ -35,9 +41,10 @@ spec: {{- end }} backend: service: - name: {{ include "bricksllm.fullname" $ }} + name: {{ $fullname }}-{{ $name }} port: - number: {{ $.Values.service.port }} + number: {{ get (get $.Values.services $name) "port" }} {{- end }} {{- end }} {{- end }} +{{- end }} diff --git a/kubernetes/helm-charts/bricksllm/templates/tests/test-connection.yaml b/kubernetes/helm-charts/bricksllm/templates/tests/test-connection.yaml index ab6f4e2..db01831 100644 --- a/kubernetes/helm-charts/bricksllm/templates/tests/test-connection.yaml +++ b/kubernetes/helm-charts/bricksllm/templates/tests/test-connection.yaml @@ -1,19 +1,21 @@ +{{ $fullname := include "bricksllm.fullname" . -}} +--- apiVersion: v1 kind: Pod metadata: - name: "{{ include "bricksllm.fullname" . }}-test-connection" + name: "{{ $fullname }}-test-connection" labels: {{- include "bricksllm.labels" . | nindent 4 }} annotations: "helm.sh/hook": test spec: containers: +{{- range $name, $v := .Values.services }} - name: wget image: busybox - command: ['wget'] - args: ['{{ include "bricksllm.fullname" . }}-control:{{ .Values.services.control.port }}'] - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "bricksllm.fullname" . }}-data:{{ .Values.services.data.port }}'] + command: + - wget + args: + - '{{ $fullname }}-{{ $name }}:{{ $v.port }}' +{{- end }} restartPolicy: Never diff --git a/kubernetes/helm-charts/bricksllm/values.yaml b/kubernetes/helm-charts/bricksllm/values.yaml index a4a8289..c080514 100644 --- a/kubernetes/helm-charts/bricksllm/values.yaml +++ b/kubernetes/helm-charts/bricksllm/values.yaml @@ -47,29 +47,49 @@ securityContext: {} # runAsUser: 1000 services: - control: + admin: type: ClusterIP port: 8001 - data: + proxy: type: ClusterIP port: 8002 -# Configuring Ingress -ingress: - enabled: false - className: "" - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: - - path: / - pathType: ImplementationSpecific - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local +# Configuring Ingresses +ingresses: + admin: + enabled: true + className: tailscale + #annotations: + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: bricksllm-admin.elephant-frog.ts.net + paths: + - path: / + pathType: ImplementationSpecific + tls: + - hosts: + - bricksllm-admin.elephant-frog.ts.net + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + proxy: + enabled: true + className: tailscale + #annotations: + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: bricksllm-proxy.elephant-frog.ts.net + paths: + - path: / + pathType: ImplementationSpecific + tls: + - hosts: + - bricksllm-proxy.elephant-frog.ts.net + # - secretName: chart-example-tls + # hosts: + # - chart-example.local #resources: # limits: @@ -79,15 +99,15 @@ ingress: # cpu: 100m # memory: 128Mi -#livenessProbe: -# httpGet: -# path: / -# port: http +livenessProbe: + httpGet: + path: /api/health + port: proxy -#readinessProbe: -# httpGet: -# path: / -# port: http +readinessProbe: + httpGet: + path: /api/health + port: proxy autoscaling: enabled: false From 6807c1bdddb3c0ec4c264c54965781bb0a12796c Mon Sep 17 00:00:00 2001 From: Andrew Rothstein Date: Wed, 6 Nov 2024 03:51:01 +0000 Subject: [PATCH 3/4] thats one service with multiple ports tho multiple ingresses --- kubernetes/helm-charts/Taskfile.yml | 4 ++++ .../bricksllm/templates/deployment.yaml | 6 +++--- .../helm-charts/bricksllm/templates/ingress.yaml | 4 ++-- .../helm-charts/bricksllm/templates/service.yaml | 16 ++++++++-------- .../templates/tests/test-connection.yaml | 4 ++-- kubernetes/helm-charts/bricksllm/values.yaml | 10 ++++------ 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/kubernetes/helm-charts/Taskfile.yml b/kubernetes/helm-charts/Taskfile.yml index d50108a..33821a8 100644 --- a/kubernetes/helm-charts/Taskfile.yml +++ b/kubernetes/helm-charts/Taskfile.yml @@ -10,3 +10,7 @@ tasks: --install \ bricksllm \ ./bricksllm + delete: + cmds: + - helm delete -n bricksllm bricksllm + diff --git a/kubernetes/helm-charts/bricksllm/templates/deployment.yaml b/kubernetes/helm-charts/bricksllm/templates/deployment.yaml index 8a97665..f015f69 100644 --- a/kubernetes/helm-charts/bricksllm/templates/deployment.yaml +++ b/kubernetes/helm-charts/bricksllm/templates/deployment.yaml @@ -56,9 +56,9 @@ spec: key: redis-password imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - {{- range $name, $v := .Values.services }} - - name: {{ $name }} - containerPort: {{ $v.port }} + {{- range $n, $p := .Values.services.ports }} + - name: {{ $n }} + containerPort: {{ $p }} protocol: TCP {{- end }} {{- with .Values.livenessProbe }} diff --git a/kubernetes/helm-charts/bricksllm/templates/ingress.yaml b/kubernetes/helm-charts/bricksllm/templates/ingress.yaml index c3039f7..fcbb9dc 100644 --- a/kubernetes/helm-charts/bricksllm/templates/ingress.yaml +++ b/kubernetes/helm-charts/bricksllm/templates/ingress.yaml @@ -41,9 +41,9 @@ spec: {{- end }} backend: service: - name: {{ $fullname }}-{{ $name }} + name: {{ $fullname }} port: - number: {{ get (get $.Values.services $name) "port" }} + name: {{ $name | quote }} {{- end }} {{- end }} {{- end }} diff --git a/kubernetes/helm-charts/bricksllm/templates/service.yaml b/kubernetes/helm-charts/bricksllm/templates/service.yaml index 94606e3..f8441d1 100644 --- a/kubernetes/helm-charts/bricksllm/templates/service.yaml +++ b/kubernetes/helm-charts/bricksllm/templates/service.yaml @@ -1,21 +1,21 @@ -{{- $fullName := include "bricksllm.fullname" . }} +{{- $fullname := include "bricksllm.fullname" . }} {{- $labels := include "bricksllm.labels" . }} {{- $selectorLabels := include "bricksllm.selectorLabels" . }} -{{- range $name, $v := .Values.services -}} --- apiVersion: v1 kind: Service metadata: - name: {{ $fullName }}-{{ $name }} + name: {{ $fullname }} labels: {{- $labels | nindent 4 }} spec: - type: {{ $v.type }} + type: {{ .Values.services.type }} ports: - - port: {{ $v.port }} - targetPort: http +{{- range $n, $p := .Values.services.ports }} + - port: {{ $p }} + targetPort: {{ $p }} protocol: TCP - name: {{ $name | quote }} + name: {{ $n | quote }} +{{- end }} selector: {{- $selectorLabels | nindent 4 }} -{{- end }} diff --git a/kubernetes/helm-charts/bricksllm/templates/tests/test-connection.yaml b/kubernetes/helm-charts/bricksllm/templates/tests/test-connection.yaml index db01831..32b4f42 100644 --- a/kubernetes/helm-charts/bricksllm/templates/tests/test-connection.yaml +++ b/kubernetes/helm-charts/bricksllm/templates/tests/test-connection.yaml @@ -10,12 +10,12 @@ metadata: "helm.sh/hook": test spec: containers: -{{- range $name, $v := .Values.services }} +{{- range $n, $p := .Values.services.ports }} - name: wget image: busybox command: - wget args: - - '{{ $fullname }}-{{ $name }}:{{ $v.port }}' + - '{{ $fullname }}:{{ $p }}' {{- end }} restartPolicy: Never diff --git a/kubernetes/helm-charts/bricksllm/values.yaml b/kubernetes/helm-charts/bricksllm/values.yaml index c080514..eca72c4 100644 --- a/kubernetes/helm-charts/bricksllm/values.yaml +++ b/kubernetes/helm-charts/bricksllm/values.yaml @@ -47,12 +47,10 @@ securityContext: {} # runAsUser: 1000 services: - admin: - type: ClusterIP - port: 8001 - proxy: - type: ClusterIP - port: 8002 + type: ClusterIP + ports: + admin: 8001 + proxy: 8002 # Configuring Ingresses ingresses: From 0bbcd747603f46862bf18e82a2818aa61b1331eb Mon Sep 17 00:00:00 2001 From: Andrew Rothstein Date: Wed, 27 Nov 2024 14:45:17 +0000 Subject: [PATCH 4/4] default values --- kubernetes/helm-charts/bricksllm/values.yaml | 46 +++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/kubernetes/helm-charts/bricksllm/values.yaml b/kubernetes/helm-charts/bricksllm/values.yaml index eca72c4..72bc6ea 100644 --- a/kubernetes/helm-charts/bricksllm/values.yaml +++ b/kubernetes/helm-charts/bricksllm/values.yaml @@ -55,39 +55,33 @@ services: # Configuring Ingresses ingresses: admin: - enabled: true - className: tailscale + enabled: false + #className: "tailscale" #annotations: # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" - hosts: - - host: bricksllm-admin.elephant-frog.ts.net - paths: - - path: / - pathType: ImplementationSpecific - tls: - - hosts: - - bricksllm-admin.elephant-frog.ts.net - # - secretName: chart-example-tls - # hosts: - # - chart-example.local + #hosts: + # - host: bricksllm-admin.elephant-frog.ts.net + # paths: + # - path: / + # pathType: ImplementationSpecific + #tls: + # - hosts: + # - bricksllm-admin.elephant-frog.ts.net proxy: - enabled: true - className: tailscale + enabled: false + #className: tailscale #annotations: # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" - hosts: - - host: bricksllm-proxy.elephant-frog.ts.net - paths: - - path: / - pathType: ImplementationSpecific - tls: - - hosts: - - bricksllm-proxy.elephant-frog.ts.net - # - secretName: chart-example-tls - # hosts: - # - chart-example.local + #hosts: + # - host: bricksllm-proxy.elephant-frog.ts.net + # paths: + # - path: / + # pathType: ImplementationSpecific + #tls: + # - hosts: + # - bricksllm-proxy.elephant-frog.ts.net #resources: # limits: