Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Commit

Permalink
Merge pull request #405 from openchatai/feat/helm
Browse files Browse the repository at this point in the history
Feat/helm
  • Loading branch information
codebanesr authored Dec 16, 2023
2 parents 51c0579 + 47ddc8b commit 77c1596
Show file tree
Hide file tree
Showing 54 changed files with 601 additions and 940 deletions.
36 changes: 0 additions & 36 deletions k8s/adminer-deployment.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions k8s/adminer-service.yaml

This file was deleted.

68 changes: 0 additions & 68 deletions k8s/backend-deployment.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions k8s/backend-service.yaml

This file was deleted.

30 changes: 0 additions & 30 deletions k8s/configmap.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions k8s/dashboard-service.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions k8s/database-persistentvolumeclaim.yaml

This file was deleted.

23 changes: 23 additions & 0 deletions k8s/helm/opencopilot/.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/
24 changes: 24 additions & 0 deletions k8s/helm/opencopilot/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: opencopilot
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
Empty file.
62 changes: 62 additions & 0 deletions k8s/helm/opencopilot/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "opencopilot.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 "opencopilot.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 "opencopilot.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "opencopilot.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "opencopilot.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions k8s/helm/opencopilot/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-llm-server-configmap
data:
{{ .Files.Get "files/.env" | indent 4 }}
7 changes: 7 additions & 0 deletions k8s/helm/opencopilot/templates/dashboard/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-dashboard-configmap
data:
.env.dashboard: |
{{ .Files.Get "files/.env.dashboard" | indent 4 }}
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert --out=k8s
kompose.version: 1.31.2 (HEAD)
creationTimestamp: null
name: {{ .Release.Name }}-dashboard
labels:
io.kompose.service: dashboard
name: dashboard
app: {{ .Release.Name }}-dashboard
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: dashboard
app: {{ .Release.Name }}-dashboard
strategy:
type: Recreate
template:
metadata:
annotations:
kompose.cmd: kompose convert --out=k8s
kompose.version: 1.31.2 (HEAD)
linkerd.io/inject: enabled
creationTimestamp: null
labels:
io.kompose.network/opencopilot-opencopilot-network: "true"
io.kompose.service: dashboard
app: {{ .Release.Name }}-dashboard
spec:
containers:
- image: codebanesr/dashboard:latest
- image: {{ .Values.dashboard.image.repository }}:{{ .Values.dashboard.image.tag }}
name: dashboard
ports:
- containerPort: 8000
hostPort: 8000
protocol: TCP
envFrom:
- configMapRef:
name: {{ .Release.Name }}-dashboard-configmap
resources: {}
volumeMounts:
- mountPath: /app/shared_data
Expand All @@ -42,4 +35,3 @@ spec:
- name: shared-data
persistentVolumeClaim:
claimName: shared-data
status: {}
Loading

0 comments on commit 77c1596

Please sign in to comment.