Skip to content

Commit 6fb6146

Browse files
authored
Merge branch 'dev' into main
2 parents bedebe6 + 67c11e4 commit 6fb6146

6 files changed

Lines changed: 133 additions & 9 deletions

File tree

charts/intel/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ The following table lists configurable parameters of the CodeTogether Intel char
5353
| `java.customCacerts.enabled` | Enables mounting a custom Java trust store (cacerts) | `false` |
5454
| `java.customCacerts.cacertsSecretName` | Name of the Kubernetes secret containing the `cacerts` file | `custom-java-cacerts` |
5555
| `java.customCacerts.trustStorePasswordKey` | (Optional) Key inside the Kubernetes secret containing the trust store password | `trustStorePassword` |
56+
| `ai.mode` | AI integration mode: `bundled` (deploy AI container) or `external` (use external AI service) | `"bundled"` |
57+
| `ai.provider` | AI provider (`openai` or custom) | `"openai"` |
58+
| `ai.model` | AI model to use (`gpt-4-turbo`, `gpt-3.5-turbo`, etc.) | `"gpt-4-turbo"` |
59+
| `ai.resources.cpu` | CPU allocation for AI container | `"2"` |
60+
| `ai.resources.memory` | Memory allocation for AI container | `"4Gi"` |
61+
| `ai.resources.gpu` | GPU support (future feature) | `false` |
62+
| `ai.external.url` | URL for external AI service (if `mode: external`) | `""` |
63+
| `ai.external.apiKeySecret.name` | Name of the Kubernetes secret containing the external AI API key | `"ai-secrets"` |
64+
| `ai.external.apiKeySecret.key` | Key name in the Kubernetes secret containing the API key | `"external-ai-key"` |
5665
| `ingress.enabled` | Enables ingress controller resource | `true` |
5766
| `ingress.annotations` | Annotations for ingress | `{}` |
5867
| `ingress.tls.secretName` | TLS secret name for ingress | `codetogether-intel-tls` |
@@ -107,6 +116,38 @@ If you prefer not to store the Cassandra password in values.yaml, you can store
107116
kubectl create secret generic cassandra-password-secret --from-literal=cassandraPassword='your-secure-cassandra-password' --namespace=codetogether-intel
108117
```
109118

119+
## AI Integration and API Key Security
120+
121+
This chart supports an AI container for generating summaries. Users can choose between deploying an AI model inside the cluster (`bundled` mode) or connecting to an external AI service (`external` mode).
122+
123+
### **Configuring AI Integration**
124+
Modify the `values.yaml` file to set AI mode, provider, and resources:
125+
126+
```bash
127+
ai:
128+
mode: "bundled" # Options: bundled | external
129+
provider: "openai" # Can be "openai" or a custom provider
130+
model: "gpt-4-turbo"
131+
resources:
132+
cpu: "2"
133+
memory: "4Gi"
134+
gpu: false
135+
external:
136+
url: "" # External AI service URL
137+
apiKeySecret:
138+
name: "ai-secrets"
139+
key: "external-ai-key"
140+
```
141+
142+
## AI Secrets
143+
144+
To securely store API keys for AI integration, you can create a `secret` that contains the necessary authentication credentials:
145+
146+
```bash
147+
kubectl create secret generic ai-external-secret \
148+
--from-literal=api-key='your-external-ai-key' \
149+
--namespace=<your-namespace>
150+
```
110151

111152
## Installing the Chart
112153

charts/intel/ollama/Dockerfile.ai

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Use Ollama as the base image
2+
FROM ollama/ollama
3+
4+
# Define the models to be included
5+
#ARG MODELS="qwen2.5-coder:3b"
6+
ARG MODELS
7+
8+
ENV OLLAMA_KEEP_ALIVE=24h
9+
10+
# Pre-load the models at build time **directly in /root/.ollama**
11+
RUN mkdir -p /root/.ollama && \
12+
ollama serve & server=$! ; \
13+
sleep 5 ; \
14+
for m in $MODELS ; do ollama pull $m ; done ; \
15+
kill $server
16+
17+
CMD [ "serve" ]
18+
19+

charts/intel/templates/deployment.yaml

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,57 @@ spec:
2828
{{- end }}
2929
serviceAccountName: {{ include "codetogether.serviceAccountName" . }}
3030
containers:
31+
{{- if eq .Values.ai.mode "bundled" }}
32+
- name: codetogether-llm
33+
image: "{{ .Values.ai.image.repository }}:{{ .Values.ai.image.tag }}"
34+
imagePullPolicy: Always
35+
ports:
36+
- name: ai
37+
containerPort: 8000
38+
protocol: TCP
39+
resources:
40+
requests:
41+
cpu: {{ .Values.ai.resources.requests.cpu | quote }}
42+
memory: {{ .Values.ai.resources.requests.memory | quote }}
43+
limits:
44+
cpu: {{ .Values.ai.resources.limits.cpu | quote }}
45+
memory: {{ .Values.ai.resources.limits.memory | quote }}
46+
{{- end }}
3147
- name: {{ .Chart.Name }}
3248
securityContext:
3349
{{- toYaml .Values.securityContext | nindent 12 }}
34-
image: >-
35-
{{ .Values.image.repository }}
36-
{{- if .Values.image.digest }}@{{ .Values.image.digest }}
37-
{{- else }}:{{ .Values.image.tag | default .Chart.AppVersion }}{{- end }}
50+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
3851
imagePullPolicy: {{ .Values.image.pullPolicy }}
3952
env:
53+
- name: AI_MODE
54+
value: {{ .Values.ai.mode | quote }}
55+
{{- if eq .Values.ai.mode "bundled" }}
56+
- name: AI_BUNDLED_URL
57+
value: "http://codetogether-llm:8000"
58+
{{- end }}
59+
{{- if eq .Values.ai.mode "external" }}
60+
- name: AI_PROVIDER
61+
valueFrom:
62+
configMapKeyRef:
63+
name: ai-config
64+
key: ai_provider
65+
- name: AI_EXTERNAL_URL
66+
valueFrom:
67+
configMapKeyRef:
68+
name: ai-config
69+
key: ai_url
70+
- name: AI_EXTERNAL_API_KEY
71+
valueFrom:
72+
secretKeyRef:
73+
name: ai-external-secret
74+
key: api-key
75+
{{- end }}
4076
#
4177
# Set CodeTogether runtime configuration
4278
#
4379
- name: CT_HQ_BASE_URL
4480
value: {{ .Values.codetogether.url | quote }}
45-
46-
{{- if .Values.java.customCacerts.enabled }}
81+
{{- if .Values.java.customCacerts.enabled }}
4782
- name: CT_TRUST_STORE
4883
value: -Djavax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts
4984
{{- end }}
@@ -61,7 +96,7 @@ spec:
6196
secretKeyRef:
6297
name: {{ .Values.java.customCacerts.cacertsSecretName }}
6398
key: {{ .Values.java.customCacerts.trustStorePasswordKey }}
64-
optional: true # Ensures the key is optional
99+
optional: true
65100
{{- end }}
66101

67102
volumeMounts:
@@ -83,11 +118,15 @@ spec:
83118
protocol: TCP
84119

85120
livenessProbe:
121+
httpGet:
122+
path: /
123+
port: http
86124
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
87125
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
88126
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
89127
successThreshold: {{ .Values.livenessProbe.successThreshold }}
90128
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
129+
readinessProbe:
91130
httpGet:
92131
path: /
93132
port: http
@@ -124,4 +163,4 @@ spec:
124163
{{- with .Values.tolerations }}
125164
tolerations:
126165
{{- toYaml . | nindent 8 }}
127-
{{- end }}
166+
{{- end }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: ai-secrets
5+
type: Opaque
6+
data:
7+
openai-api-key: {{ .Values.ai.openai.api_key | b64enc }}
8+
external-ai-key: {{ .Values.ai.external.api_key | b64enc }}

charts/intel/values.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,23 @@ securityContext: {}
138138
# runAsNonRoot: true
139139
# runAsUser: 1000
140140

141+
ai:
142+
mode: "bundled" # Options: bundled | external
143+
provider: "ollama" # No OpenAI dependency
144+
resources:
145+
requests:
146+
cpu: "2"
147+
memory: "4Gi"
148+
gpu: false
149+
limits:
150+
cpu: "4"
151+
memory: "8Gi"
152+
gpu: false
153+
image:
154+
repository: registry.digitalocean.com/codetogether-registry/ai-summarization
155+
tag: latest
156+
157+
141158
readinessProbe:
142159
initialDelaySeconds: 60
143160
periodSeconds: 60

compose/compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ services:
6363
- ./cassandra-init.cql:/scripts/init.sql
6464
- ./cassandra-startup.sh:/scripts/startup.sh
6565
- ./data:/var/lib/cassandra
66-
entrypoint: /scripts/startup.sh
66+
entrypoint: ["/bin/sh", "-c", "chmod +x /scripts/startup.sh && /scripts/startup.sh"]
6767
healthcheck:
6868
test: ["CMD", "test", "-f", "/tmp/cassandra-ready"]
6969
start_period: 30s

0 commit comments

Comments
 (0)