ai-bot impl
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: ai-git-bot
|
||||
description: AI-Git-Bot (https://github.com/tmseidel/ai-git-bot) - AI code review and coding agent for Gitea, with a bundled PostgreSQL
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.27.0"
|
||||
@@ -0,0 +1,33 @@
|
||||
{{- define "ai-git-bot.fullname" -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "ai-git-bot.labels" -}}
|
||||
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version }}
|
||||
app.kubernetes.io/version: {{ .Values.image.tag | quote }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "ai-git-bot.selectorLabels" -}}
|
||||
app.kubernetes.io/name: ai-git-bot
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "ai-git-bot.postgresql.fullname" -}}
|
||||
{{- printf "%s-postgresql" (include "ai-git-bot.fullname" .) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "ai-git-bot.postgresql.selectorLabels" -}}
|
||||
app.kubernetes.io/name: postgresql
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "ai-git-bot.publicUrl" -}}
|
||||
{{- if .Values.publicUrl -}}
|
||||
{{- .Values.publicUrl -}}
|
||||
{{- else if .Values.ingress.host -}}
|
||||
{{- printf "https://%s" .Values.ingress.host -}}
|
||||
{{- else -}}
|
||||
http://localhost:8080
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,124 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "ai-git-bot.fullname" . }}
|
||||
labels:
|
||||
{{- include "ai-git-bot.labels" . | nindent 4 }}
|
||||
{{- include "ai-git-bot.selectorLabels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
# Recreate: agent sessions run in-process and Flyway migrations must not race
|
||||
# between an old and a new pod.
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "ai-git-bot.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "ai-git-bot.selectorLabels" . | nindent 8 }}
|
||||
{{- if .Values.prometheus.enabled }}
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "8080"
|
||||
prometheus.io/path: /actuator/prometheus
|
||||
{{- end }}
|
||||
spec:
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
initContainers:
|
||||
- name: wait-for-postgresql
|
||||
image: {{ .Values.postgresql.image }}
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- until pg_isready -h {{ include "ai-git-bot.postgresql.fullname" . }} -p 5432; do echo waiting for postgresql; sleep 2; done
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 10 }}
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 16Mi
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 64Mi
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: ai-git-bot
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 10 }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ .Values.existingSecret }}
|
||||
env:
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
value: docker
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
- name: DATABASE_URL
|
||||
value: jdbc:postgresql://{{ include "ai-git-bot.postgresql.fullname" . }}:5432/{{ .Values.postgresql.database }}
|
||||
{{- end }}
|
||||
- name: APP_PUBLIC_URL
|
||||
value: {{ include "ai-git-bot.publicUrl" . | quote }}
|
||||
- name: PROMETHEUS_ENABLED
|
||||
value: {{ .Values.prometheus.enabled | quote }}
|
||||
- name: GITEABOT_SECURITY_LOGIN_METHOD
|
||||
value: {{ .Values.loginMethod | quote }}
|
||||
{{- if eq .Values.loginMethod "oauth" }}
|
||||
- name: GITEABOT_SECURITY_OAUTH_ISSUER_URI
|
||||
value: {{ .Values.oauth.issuerUri | quote }}
|
||||
- name: GITEABOT_SECURITY_OAUTH_SCOPE
|
||||
value: {{ .Values.oauth.scope | quote }}
|
||||
- name: GITEABOT_SECURITY_OAUTH_USER_NAME_ATTRIBUTE
|
||||
value: {{ .Values.oauth.userNameAttribute | quote }}
|
||||
{{- end }}
|
||||
{{- range $name, $value := .Values.env }}
|
||||
- name: {{ $name }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
periodSeconds: 10
|
||||
failureThreshold: 30
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 10 }}
|
||||
volumeMounts:
|
||||
- name: tmp
|
||||
mountPath: /tmp
|
||||
volumes:
|
||||
- name: tmp
|
||||
emptyDir:
|
||||
sizeLimit: {{ .Values.tmpVolume.sizeLimit }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,33 @@
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- if not .Values.ingress.host }}
|
||||
{{- fail "ingress.host is required when ingress.enabled is true" }}
|
||||
{{- end }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "ai-git-bot.fullname" . }}
|
||||
labels:
|
||||
{{- include "ai-git-bot.labels" . | nindent 4 }}
|
||||
{{- include "ai-git-bot.selectorLabels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
rules:
|
||||
- host: {{ .Values.ingress.host }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "ai-git-bot.fullname" . }}
|
||||
port:
|
||||
name: http
|
||||
tls:
|
||||
- secretName: {{ .Values.ingress.tlsSecretName }}
|
||||
hosts:
|
||||
- {{ .Values.ingress.host }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,98 @@
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "ai-git-bot.postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "ai-git-bot.labels" . | nindent 4 }}
|
||||
{{- include "ai-git-bot.postgresql.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: database
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: tcp-postgresql
|
||||
port: 5432
|
||||
targetPort: tcp-postgresql
|
||||
selector:
|
||||
{{- include "ai-git-bot.postgresql.selectorLabels" . | nindent 4 }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "ai-git-bot.postgresql.fullname" . }}
|
||||
labels:
|
||||
{{- include "ai-git-bot.labels" . | nindent 4 }}
|
||||
{{- include "ai-git-bot.postgresql.selectorLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: database
|
||||
spec:
|
||||
serviceName: {{ include "ai-git-bot.postgresql.fullname" . }}
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "ai-git-bot.postgresql.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "ai-git-bot.postgresql.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: database
|
||||
spec:
|
||||
containers:
|
||||
- name: postgresql
|
||||
image: {{ .Values.postgresql.image }}
|
||||
# NOTE: no securityContext. The official postgres image's entrypoint must
|
||||
# start as root to chown a fresh data dir, then drops to the postgres user
|
||||
# (uid 70 in alpine). Same pattern as forte-drop/vaultwarden postgresql.
|
||||
ports:
|
||||
- name: tcp-postgresql
|
||||
containerPort: 5432
|
||||
env:
|
||||
- name: POSTGRES_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.existingSecret }}
|
||||
key: DATABASE_USERNAME
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.existingSecret }}
|
||||
key: DATABASE_PASSWORD
|
||||
- name: POSTGRES_DB
|
||||
value: {{ .Values.postgresql.database }}
|
||||
- name: PGDATA
|
||||
value: /var/lib/postgresql/data/pgdata
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/postgresql/data
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB"
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB"
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
resources:
|
||||
{{- toYaml .Values.postgresql.resources | nindent 10 }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
annotations:
|
||||
argocd.argoproj.io/sync-options: Prune=false,Delete=false
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
{{- with .Values.postgresql.storage.storageClassName }}
|
||||
storageClassName: {{ . }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.postgresql.storage.size }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "ai-git-bot.fullname" . }}
|
||||
labels:
|
||||
{{- include "ai-git-bot.labels" . | nindent 4 }}
|
||||
{{- include "ai-git-bot.selectorLabels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
selector:
|
||||
{{- include "ai-git-bot.selectorLabels" . | nindent 4 }}
|
||||
@@ -0,0 +1,90 @@
|
||||
# Default values for ai-git-bot.
|
||||
# Everything except the database connection and encryption key (AI providers, Git
|
||||
# integrations, bots, prompts) is configured in the web UI and stored in PostgreSQL.
|
||||
|
||||
image:
|
||||
repository: tmseidel/ai-git-bot
|
||||
tag: "1.27.0"
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
# Existing Secret with the app credentials. Every key is exposed to the app as an
|
||||
# env var (envFrom). Required keys: DATABASE_USERNAME, DATABASE_PASSWORD,
|
||||
# APP_ENCRYPTION_KEY. Optional: GITEABOT_SECURITY_OAUTH_CLIENT_ID,
|
||||
# GITEABOT_SECURITY_OAUTH_CLIENT_SECRET (when loginMethod is "oauth").
|
||||
existingSecret: ai-git-bot-secrets
|
||||
|
||||
# Public base URL of the bot (APP_PUBLIC_URL). Defaults to https://<ingress.host>.
|
||||
publicUrl: ""
|
||||
|
||||
# Web UI login: "native" (DB-backed login form) or "oauth" (OIDC).
|
||||
loginMethod: native
|
||||
oauth:
|
||||
issuerUri: ""
|
||||
scope: "openid,profile"
|
||||
userNameAttribute: preferred_username
|
||||
|
||||
prometheus:
|
||||
enabled: false
|
||||
|
||||
# Additional plain env vars (see doc/DEPLOYMENT.md upstream for the full list).
|
||||
env: {}
|
||||
|
||||
replicaCount: 1
|
||||
|
||||
resources:
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 1Gi
|
||||
limits:
|
||||
cpu: "2"
|
||||
memory: 3Gi
|
||||
|
||||
# Agent workspaces (repo clones, builds, test runs) are created under /tmp.
|
||||
tmpVolume:
|
||||
sizeLimit: 10Gi
|
||||
|
||||
podSecurityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
fsGroup: 1000
|
||||
runAsNonRoot: true
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
className: traefik
|
||||
host: ""
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||
tlsSecretName: ai-git-bot-tls
|
||||
|
||||
postgresql:
|
||||
# Set to false and provide DATABASE_URL (via env or the secret) to use an external database.
|
||||
enabled: true
|
||||
image: postgres:17-alpine
|
||||
database: giteabot
|
||||
storage:
|
||||
size: 5Gi
|
||||
storageClassName: ""
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
|
||||
nodeSelector: {}
|
||||
tolerations: []
|
||||
affinity: {}
|
||||
Reference in New Issue
Block a user