Skip to content

Commit

Permalink
[CI] Update truefoundry to version 0.3.204-rc.20
Browse files Browse the repository at this point in the history
  • Loading branch information
geekygulshan committed May 22, 2024
1 parent 3193555 commit d9764f4
Show file tree
Hide file tree
Showing 69 changed files with 3,931 additions and 0 deletions.
6 changes: 6 additions & 0 deletions charts/llm-gateway/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: nats
repository: https://nats-io.github.io/k8s/helm/charts/
version: 1.1.6
digest: sha256:d7139a23518bd17a525ab93874436431746026fdbcf299b89bfd0a19baea41ab
generated: "2024-03-18T17:01:49.011124+05:30"
11 changes: 11 additions & 0 deletions charts/llm-gateway/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
name: llm-gateway
version: 0.2.3-rc.1
description: "LLM Gateway deployment chart"
maintainers:
- name: truefoundry
dependencies:
- name: nats
repository: https://nats-io.github.io/k8s/helm/charts/
version: 1.1.6
condition: nats.enabled
100 changes: 100 additions & 0 deletions charts/llm-gateway/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "app.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 "app.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 "app.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "app.labels" -}}
helm.sh/chart: {{ include "app.chart" . }}
{{- range $name, $value := .Values.commonLabels }}
{{ $name }}: {{ tpl $value $ | quote }}
{{- end }}
{{ include "app.selectorLabels" . }}
{{- if .Values.imageTag }}
app.kubernetes.io/version: {{ .Values.imageTag | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

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

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

{{/*
Parse env from template
*/}}
{{- define "app.parseEnv" -}}
{{ tpl (.Values.env | toYaml) . }}
{{- end }}

{{/*
Create the env file
*/}}
{{- define "app.env" }}
{{- range $key, $val := (include "app.parseEnv" .) | fromYaml }}
{{- if and $val (contains "${k8s-secret" ($val | toString)) }}
{{- if eq (regexSplit "/" $val -1 | len) 2 }}
- name: {{ $key }}
valueFrom:
secretKeyRef:
name: {{ $.Values.envSecretName }}
key: {{ index (regexSplit "/" $val -1) 1 | trimSuffix "}" }}
{{- else if eq (regexSplit "/" $val -1 | len) 3 }}
- name: {{ $key }}
valueFrom:
secretKeyRef:
name: {{ index (regexSplit "/" $val -1) 1 }}
key: {{ index (regexSplit "/" $val -1) 2 | trimSuffix "}" }}
{{- else }}
{{- fail "Invalid secret supplied" }}
{{- end }}
{{- else }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
{{- end }}
{{- end }}
111 changes: 111 additions & 0 deletions charts/llm-gateway/templates/clickhouse-installation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{{- if .Values.clickhouse.enabled -}}
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: {{ .Release.Name }}
annotations:
argocd.argoproj.io/sync-options: Prune=false,Delete=false
spec:
defaults:
templates:
serviceTemplate: svc-template
configuration:
clusters:
- name: {{ .Release.Name }}
layout:
shardsCount: {{ .Values.clickhouse.shardsCount }}
replicasCount: {{ .Values.clickhouse.replicasCount }}
templates:
podTemplate: clickhouse-stable
dataVolumeClaimTemplate: clickhouse-data-volume
serviceTemplate: svc-template
zookeeper:
nodes:
- host: {{ tpl .Values.clickhouse.zookeeperHost . }}
port: {{ tpl .Values.clickhouse.zookeeperPort . }}
{{- if .Values.clickhouse.user }}
users:
{{ .Values.clickhouse.user }}/password: {{ required ".Values.clickhouse.password is required" .Values.clickhouse.password }}
{{ .Values.clickhouse.user }}/profile: default
{{ .Values.clickhouse.user }}/quota: default
{{ .Values.clickhouse.user }}/networks/ip:
- 0.0.0.0/0
- ::/0
{{- end }}
files:
config.d/named-collections.xml: |
<clickhouse>
<named_collections>
<nats_config>
{{- $natsURL := (tpl .Values.clickhouse.nats.url .) }}
{{- $natsSubjects := .Values.clickhouse.nats.subjects }}
{{- $natsUsername := .Values.clickhouse.nats.username }}
{{- $natsPassword := .Values.clickhouse.nats.password }}
<nats_url overridable="true">{{ $natsURL }}</nats_url>
<nats_subjects overridable="true">{{ $natsSubjects }}</nats_subjects>
<nats_username overridable="true">{{ $natsUsername }}</nats_username>
<nats_password overridable="true">{{ $natsPassword }}</nats_password>
<nats_format overridable="true">JSONEachRow</nats_format>
<date_time_input_format overridable="true">best_effort</date_time_input_format>
</nats_config>
</named_collections>
</clickhouse>
config.d/log_rotation.xml: |-
<clickhouse>
<logger>
<level>information</level>
<log>/var/log/clickhouse-server/clickhouse-server.log</log>
<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>
<size>100M</size>
<count>5</count>
<console>1</console>
</logger>
</clickhouse>
templates:
serviceTemplates:
- name: svc-template
generateName: clickhouse-{chi}
spec:
ports:
- name: http
port: 8123
- name: tcp
port: 9000
type: ClusterIP
podTemplates:
- name: clickhouse-stable
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: clickhouse.altinity.com/cluster
operator: In
values:
- {{ .Release.Name }}
topologyKey: "kubernetes.io/hostname"
containers:
- name: clickhouse
image: {{ .Values.clickhouse.image }}
resources:
requests:
memory: {{ .Values.clickhouse.resources.requests.memory }}
cpu: {{ .Values.clickhouse.resources.requests.cpu }}
ephemeral-storage: {{ .Values.clickhouse.resources.requests.ephemeralStorage }}
limits:
memory: {{ .Values.clickhouse.resources.limits.memory }}
cpu: {{ .Values.clickhouse.resources.limits.cpu }}
ephemeral-storage: {{ .Values.clickhouse.resources.limits.ephemeralStorage }}
volumeClaimTemplates:
- name: clickhouse-data-volume
spec:
storageClassName: {{ .Values.clickhouse.storage.storageClassName }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.clickhouse.storage.size }}
{{- end }}
69 changes: 69 additions & 0 deletions charts/llm-gateway/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{{- if .Values.llmGatewayEnabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "app.fullname" . }}
labels:
{{- include "app.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "app.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "app.labels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "app.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
env:
{{- include "app.env" . | trim | nindent 12 }}
image: "{{ .Values.imageRepository }}:{{ .Values.imageTag }}"
imagePullPolicy: {{ .Values.imagePullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.healthcheck.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.healthcheck.liveness.path }}
port: {{ .Values.healthcheck.liveness.port }}
readinessProbe:
httpGet:
path: {{ .Values.healthcheck.readiness.path }}
port: {{ .Values.healthcheck.liveness.port }}
{{- end }}
volumeMounts:
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
volumes:
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
39 changes: 39 additions & 0 deletions charts/llm-gateway/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{- if and .Values.llmGatewayEnabled .Values.ingress.enabled -}}
{{- $serviceName := include "app.fullname" . -}}
{{- $servicePort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
{{- if .Values.ingress.annotations }}
annotations:
{{- range $key, $value := .Values.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
name: {{ include "app.fullname" . }}
labels:
{{- include "app.labels" . | nindent 4 }}
{{- if .Values.ingress.labels }}
{{- toYaml .Values.ingress.labels | nindent 4 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.ingressClassName }}
rules:
{{- range $host := .Values.ingress.hosts }}
- host: {{ $host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ $serviceName }}
port:
number: {{ $servicePort }}

{{- end -}}
{{- if .Values.ingress.tls }}
tls:
{{- toYaml .Values.ingress.tls | nindent 4 }}
{{- end -}}
{{- end -}}
17 changes: 17 additions & 0 deletions charts/llm-gateway/templates/nats-metrics-virtualservice.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.nats.natsMetricsServerHost }}
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: "{{ .Release.Name }}-nats-metrics"
spec:
hosts:
- {{ .Values.nats.natsMetricsServerHost | quote }}
gateways:
- {{ tpl .Values.nats.gatewayName . }}
http:
- route:
- destination:
host: {{ .Release.Name }}-nats
port:
number: 8222
{{- end }}
17 changes: 17 additions & 0 deletions charts/llm-gateway/templates/nats-virtualservice.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.nats.natsServerHost }}
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: "{{ .Release.Name }}-nats"
spec:
hosts:
- {{ .Values.nats.natsServerHost | quote }}
gateways:
- {{ tpl .Values.nats.gatewayName . }}
http:
- route:
- destination:
host: {{ .Release.Name }}-nats
port:
number: 8080
{{- end }}
Loading

0 comments on commit d9764f4

Please sign in to comment.