-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'yGuy/master' into release
Support Helm chart
- Loading branch information
Showing
8 changed files
with
248 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v2 | ||
name: chatgpt-mattermost-bot | ||
description: A ChatGPT-powered Chatbot for Mattermost | ||
type: application | ||
version: 2.1.2 | ||
appVersion: v2.1.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "chatgpt-mattermost-bot.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 "chatgpt-mattermost-bot.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 "chatgpt-mattermost-bot.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "chatgpt-mattermost-bot.labels" -}} | ||
helm.sh/chart: {{ include "chatgpt-mattermost-bot.chart" . }} | ||
{{ include "chatgpt-mattermost-bot.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "chatgpt-mattermost-bot.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "chatgpt-mattermost-bot.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "chatgpt-mattermost-bot.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "chatgpt-mattermost-bot.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "chatgpt-mattermost-bot.fullname" . }}-config | ||
labels: | ||
app: chatgpt-mattermost-bot | ||
{{- include "chatgpt-mattermost-bot.labels" . | nindent 4 }} | ||
data: | ||
MATTERMOST_URL: "{{ required "MATTERMOST_URL is required" .Values.config.MATTERMOST_URL }}" | ||
OPENAI_MODEL_NAME: "{{ .Values.config.OPENAI_MODEL_NAME | default "gpt-3.5-turbo" }}" | ||
OPENAI_MAX_TOKENS: "{{ .Values.config.OPENAI_MAX_TOKENS | default "2000" }}" | ||
OPENAI_TEMPERATURE: "{{ .Values.config.OPENAI_TEMPERATURE | default "1" }}" | ||
YFILES_SERVER_URL: "{{ .Values.config.YFILES_SERVER_URL | default "" }}" | ||
NODE_EXTRA_CA_CERTS: "{{ .Values.config.NODE_EXTRA_CA_CERTS | default "" }}" | ||
MATTERMOST_BOTNAME: "{{ .Values.config.MATTERMOST_BOTNAME | default "@chatgpt" }}" | ||
PLUGINS: "{{ .Values.config.PLUGINS | default "graph-plugin, image-plugin" }}" | ||
DEBUG_LEVEL: "{{ .Values.config.DEBUG_LEVEL | default "INFO" }}" | ||
BOT_CONTEXT_MSG: "{{ .Values.config.BOT_CONTEXT_MSG | default "100" }}" | ||
NODE_ENV: "{{ .Values.config.NODE_ENV | default "production" }}" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ include "chatgpt-mattermost-bot.fullname" . }}-secret | ||
labels: | ||
app: chatgpt-mattermost-bot | ||
{{- include "chatgpt-mattermost-bot.labels" . | nindent 4 }} | ||
stringData: | ||
MATTERMOST_TOKEN: "{{ required "MATTERMOST_TOKEN is required" .Values.config.MATTERMOST_TOKEN }}" | ||
OPENAI_API_KEY: "{{ required "OPENAI_API_KEY is required" .Values.config.OPENAI_API_KEY }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "chatgpt-mattermost-bot.fullname" . }} | ||
labels: | ||
{{- include "chatgpt-mattermost-bot.labels" . | nindent 4 }} | ||
spec: | ||
{{- if not .Values.autoscaling.enabled }} | ||
replicas: {{ .Values.replicaCount }} | ||
{{- end }} | ||
selector: | ||
matchLabels: | ||
{{- include "chatgpt-mattermost-bot.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "chatgpt-mattermost-bot.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "chatgpt-mattermost-bot.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 12 }} | ||
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
envFrom: | ||
- configMapRef: | ||
name: {{ include "chatgpt-mattermost-bot.fullname" . }}-config | ||
- secretRef: | ||
name: {{ include "chatgpt-mattermost-bot.fullname" . }}-secret | ||
livenessProbe: | ||
exec: | ||
command: | ||
- pidof | ||
- node | ||
initialDelaySeconds: 5 | ||
periodSeconds: 15 | ||
failureThreshold: 4 | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{- if .Values.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "chatgpt-mattermost-bot.serviceAccountName" . }} | ||
labels: | ||
{{- include "chatgpt-mattermost-bot.labels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
image: | ||
registry: ghcr.io/yguy | ||
repository: chatgpt-mattermost-bot | ||
pullPolicy: IfNotPresent | ||
# Overrides the image tag whose default is the chart appVersion. | ||
tag: "v2.1.2" | ||
|
||
imagePullSecrets: [] | ||
|
||
replicaCount: 1 | ||
|
||
nameOverride: "" | ||
fullnameOverride: "chatgpt-mattermost-bot" | ||
|
||
config: # required: example: description: | ||
MATTERMOST_URL: "" # yes https://mattermost.server The URL to the server. This is used for connecting the bot to the Mattermost API | ||
MATTERMOST_TOKEN: "" # yes abababacdcdcd The authentication token from the logged in mattermost bot | ||
OPENAI_API_KEY: "" # yes sk-234234234234234234 The OpenAI API key to authenticate with OpenAI | ||
OPENAI_MODEL_NAME: "" # no gpt-3.5-turbo The OpenAI language model to use, defaults to gpt-3.5-turbo | ||
OPENAI_MAX_TOKENS: "" # no 2000 The maximum number of tokens to pass to the OpenAI API, defaults to 2000 | ||
OPENAI_TEMPERATURE: "" # no 0.2 The sampling temperature to use, between 0 and 2, defaults to 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. | ||
YFILES_SERVER_URL: "" # no http://localhost:3835 The URL to the yFiles graph service for embedding auto-generated diagrams. | ||
NODE_EXTRA_CA_CERTS: "" # no /file/to/cert.crt a link to a certificate file to pass to node.js for authenticating self-signed certificates | ||
MATTERMOST_BOTNAME: "" # no "@chatgpt" the name of the bot user in Mattermost, defaults to '@chatgpt' | ||
PLUGINS: "" # no graph-plugin, image-plugin The enabled plugins of the bot. By default, all plugins (grpah-plugin and image-plugin) are enabled. | ||
DEBUG_LEVEL: "" # no TRACE a debug level used for logging activity, defaults to INFO | ||
BOT_CONTEXT_MSG: "" # no 15 The number of previous messages which are appended to the conversation with ChatGPT, defaults to 100 | ||
NODE_ENV: "" # no development The mode NodeJS runs in. Defaults to production | ||
|
||
|
||
serviceAccount: | ||
create: true | ||
annotations: {} | ||
name: "" | ||
|
||
podAnnotations: {} | ||
|
||
podSecurityContext: | ||
runAsNonRoot: true | ||
runAsUser: 10001 | ||
runAsGroup: 10002 | ||
|
||
securityContext: | ||
runAsNonRoot: true | ||
runAsUser: 10001 | ||
runAsGroup: 10002 | ||
readOnlyRootFilesystem: true | ||
allowPrivilegeEscalation: false | ||
|
||
resources: {} | ||
|
||
autoscaling: | ||
enabled: false | ||
minReplicas: 1 | ||
maxReplicas: 100 | ||
targetCPUUtilizationPercentage: 80 | ||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] | ||
|
||
affinity: {} |