Skip to content

Commit

Permalink
chore: add AI parameters to Karpor's values
Browse files Browse the repository at this point in the history
  • Loading branch information
ruquanzhao committed Jan 14, 2025
1 parent 49ff52c commit a5acfeb
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/karpor/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: karpor
version: 0.6.20
version: 0.6.21
type: application
appVersion: 0.5.9
description: A modern kubernetes visualization tool (Karpor).
Expand Down
11 changes: 9 additions & 2 deletions charts/karpor/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Karpor Chart

![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/karpor)](https://artifacthub.io/packages/helm/kusionstack/karpor)
![Version: 0.6.21](https://img.shields.io/badge/Version-0.6.21-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.5.9](https://img.shields.io/badge/AppVersion-0.5.9-informational?style=flat-square) [![Artifact HUB](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/karpor)](https://artifacthub.io/packages/helm/kusionstack/karpor)

A modern kubernetes visualization tool (Karpor).

Expand Down Expand Up @@ -70,14 +70,21 @@ The Karpor Server Component is main backend server. It itself is an `apiserver`,

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| server.ai | object | `{"authToken":"","backend":"openai","baseUrl":"","model":"gpt-3.5-turbo","temperature":1,"topP":1}` | AI configuration section. The AI analysis feature requires that [authToken, baseUrl] be assigned values. |
| server.ai.authToken | string | `""` | Authentication token for accessing the AI service. |
| server.ai.backend | string | `"openai"` | Backend service or platform that the AI model is hosted on. e.g., "openai". If the backend you are using is compatible with OpenAI, then there is no need to make any changes here. |
| server.ai.baseUrl | string | `""` | Base URL of the AI service. e.g., "https://api.openai.com/v1". |
| server.ai.model | string | `"gpt-3.5-turbo"` | Name or identifier of the AI model to be used. e.g., "gpt-3.5-turbo". |
| server.ai.temperature | float | `1` | Temperature parameter for the AI model. This controls the randomness of the output, where a higher value (e.g., 1.0) makes the output more random, and a lower value (e.g., 0.0) makes it more deterministic. |
| server.ai.topP | float | `1` | Top-p (nucleus sampling) parameter for the AI model. This controls Controls the probability mass to consider for sampling, where a higher value leads to greater diversity in the generated content (typically ranging from 0 to 1) |
| server.enableRbac | bool | `false` | Enable RBAC authorization if set to true. |
| server.image.repo | string | `"kusionstack/karpor"` | Repository for Karpor server image. |
| server.image.tag | string | `""` | Tag for Karpor server image. Defaults to the chart's appVersion if not specified. |
| server.name | string | `"karpor-server"` | Component name for karpor server. |
| server.port | int | `7443` | Port for karpor server. |
| server.replicas | int | `1` | The number of karpor server pods to run. |
| server.resources | object | `{"limits":{"cpu":"500m","ephemeral-storage":"10Gi","memory":"1Gi"},"requests":{"cpu":"250m","ephemeral-storage":"2Gi","memory":"256Mi"}}` | Resource limits and requests for the karpor server pods. |
| server.serviceType | string | `"ClusterIP"` | Service type for the karpor server. The available type values list as ["ClusterIP"、"NodePort"、"LoadBalancer"]. |
| server.enableRbac | bool | `false` | Enable RBAC authorization if set to true. |

### Karpor Syncer

Expand Down
43 changes: 43 additions & 0 deletions charts/karpor/templates/karpor-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ spec:
{{- include "karpor.selectorLabels" (dict "context" . "component" .Values.server.name) | nindent 4 }}
type: {{ .Values.server.serviceType }}
---
{{- if .Values.server.ai.authToken }}
apiVersion: v1
kind: Secret
metadata:
name: karpor-auth
namespace: {{ .Values.namespace }}
labesl: {{- include "karpor.labels" (dict "context" . "component" .Values.server.name) | nindent 4 }}
type: Opaque
data:
aiAuthToken: {{ .Values.server.ai.authToken | b64enc | quote }}
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -38,6 +50,22 @@ spec:
{{- if .Values.server.enableRbac }}
- --enable-rbac=true
{{- end }}
{{- if and .Values.server.ai.authToken .Values.server.ai.baseUrl }}
- --ai-auth-token=$(aiAuthToken)
- --ai-base-url={{ .Values.server.ai.baseUrl }}
{{- if .Values.server.ai.backend }}
- --ai-backend={{ .Values.server.ai.backend }}
{{- end }}
{{- if .Values.server.ai.model }}
- --ai-model={{ .Values.server.ai.model }}
{{- end }}
{{- if .Values.server.ai.temperature }}
- --ai-temperature={{ .Values.server.ai.temperature }}
{{- end }}
{{- if .Values.server.ai.topP }}
- --ai-top-p={{ .Values.server.ai.topP }}
{{- end }}
{{- end }}
command:
- /karpor
image: {{ include "karpor.realImage" (dict "context" . "repo" .Values.server.image.repo "tag" .Values.server.image.tag "needV" (not (hasPrefix "v" .Values.server.image.tag))) }}
Expand All @@ -48,10 +76,25 @@ spec:
volumeMounts:
- mountPath: /etc/karpor/
name: karpor-secret
{{- if .Values.server.ai.authToken }}
- mountPath: /etc/auth/
name: karpor-auth
{{- end }}
resources:
{{- toYaml .Values.server.resources | nindent 12 }}
{{- if .Values.server.ai.authToken }}
envFrom:
- secretRef:
name: karpor-auth
{{- end }}
volumes:
- name: karpor-secret
secret:
defaultMode: 420
secretName: karpor-secret
{{- if .Values.server.ai.authToken }}
- name: karpor-auth
secret:
defaultMode: 420
secretName: karpor-auth
{{- end }}
18 changes: 18 additions & 0 deletions charts/karpor/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,27 @@ server:
cpu: 500m
memory: 1Gi
ephemeral-storage: 10Gi
# -- Enable RBAC authorization if set to true.
enableRbac: false
# -- Service type for the karpor server. The available type values list as ["ClusterIP"、"NodePort"、"LoadBalancer"].
serviceType: ClusterIP
# -- AI configuration section. The AI analysis feature requires that [authToken, baseUrl] be assigned values.
ai:
# -- Authentication token for accessing the AI service.

Check failure on line 47 in charts/karpor/values.yaml

View workflow job for this annotation

GitHub Actions / chart-test

47:60 [trailing-spaces] trailing spaces
authToken: ""
# -- Base URL of the AI service. e.g., "https://api.openai.com/v1".
baseUrl: ""
# -- Backend service or platform that the AI model is hosted on. e.g., "openai". If the backend you are using
# is compatible with OpenAI, then there is no need to make any changes here.
backend: "openai"
# -- Name or identifier of the AI model to be used. e.g., "gpt-3.5-turbo".
model: "gpt-3.5-turbo"
# -- Temperature parameter for the AI model. This controls the randomness of the output, where a higher
# value (e.g., 1.0) makes the output more random, and a lower value (e.g., 0.0) makes it more deterministic.
temperature: 1.0
# -- Top-p (nucleus sampling) parameter for the AI model. This controls Controls the probability mass to consider for
# sampling, where a higher value leads to greater diversity in the generated content (typically ranging from 0 to 1)
topP: 1.0

# Configuration for Karpor syncer
syncer:
Expand Down

0 comments on commit a5acfeb

Please sign in to comment.