Skip to content

Commit f61f5c8

Browse files
authored
feat(karpor): add AI parameters to Karpor's values (#94)
<!-- Thank you for contributing to KusionStack! Note: 1. With pull requests: - Open your pull request against "main" - Your pull request should have no more than two commits, if not you should squash them. - It should pass all tests in the available continuous integration systems such as GitHub Actions. - You should add/modify tests to cover your proposed code changes. - If your pull request contains a new feature, please document it on the README. 2. Please create an issue first to describe the problem. We recommend that link the issue with the PR in the following question. For more info, check https://kusionstack.io/docs/governance/contribute/ --> #### 1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".): - [ ] N - [ ] Y <!-- You can add issue references here. e.g. fix #123, re #123, fix https://github.com/XXX/issues/44 --> #### 2. What is the scope of this PR (e.g. component or file name): <!-- You can add the scope of this change here. e.g. /src/server/core.rs, kusionstack/KCLVM/kclvm-parser --> #### 3. Provide a description of the PR(e.g. more details, effects, motivations or doc link): <!-- You can choose a brief description here --> - [ ] Affects user behaviors - [ ] Contains syntax changes - [ ] Contains variable changes - [ ] Contains experimental features - [ ] Performance regression: Consumes more CPU - [ ] Performance regression: Consumes more Memory - [ ] Other <!-- You can add more details here. e.g. Call method "XXXX" to ..... in order to ...., More details: https://XXXX.com/doc...... --> #### 4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link): - [ ] N - [ ] Y <!-- You can add more details here. e.g. Calling method "XXXX" will cause the "XXXX", "XXXX" modules to be affected. More details: https://XXXX.com/doc...... --> #### 5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links: <!-- You can choose a brief description here --> - [ ] Unit test - [ ] Integration test - [ ] Benchmark (add benchmark stats below) - [ ] Manual test (add detailed scripts or steps below) - [ ] Other <!-- You can add more details here. e.g. The test case in XXXX is used to ..... test cases in /src/tests/XXXXX test cases https://github.com/XXX/pull/44 benchmark stats: time XXX ms --> #### 6. Release note <!-- compatibility change, improvement, bugfix, and new feature need a release note --> Please refer to [Release Notes Language Style Guide](https://kusionstack.io/docs/governance/release-policy/) to write a quality release note. ```release-note None ```
1 parent 49ff52c commit f61f5c8

File tree

4 files changed

+70
-2
lines changed

4 files changed

+70
-2
lines changed

charts/karpor/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: karpor
3-
version: 0.6.20
3+
version: 0.6.21
44
type: application
55
appVersion: 0.5.9
66
description: A modern kubernetes visualization tool (Karpor).

charts/karpor/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,21 @@ The Karpor Server Component is main backend server. It itself is an `apiserver`,
7070

7171
| Key | Type | Default | Description |
7272
|-----|------|---------|-------------|
73+
| 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. |
74+
| server.ai.authToken | string | `""` | Authentication token for accessing the AI service. |
75+
| 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. |
76+
| server.ai.baseUrl | string | `""` | Base URL of the AI service. e.g., "https://api.openai.com/v1". |
77+
| server.ai.model | string | `"gpt-3.5-turbo"` | Name or identifier of the AI model to be used. e.g., "gpt-3.5-turbo". |
78+
| 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. |
79+
| 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) |
80+
| server.enableRbac | bool | `false` | Enable RBAC authorization if set to true. |
7381
| server.image.repo | string | `"kusionstack/karpor"` | Repository for Karpor server image. |
7482
| server.image.tag | string | `""` | Tag for Karpor server image. Defaults to the chart's appVersion if not specified. |
7583
| server.name | string | `"karpor-server"` | Component name for karpor server. |
7684
| server.port | int | `7443` | Port for karpor server. |
7785
| server.replicas | int | `1` | The number of karpor server pods to run. |
7886
| 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. |
7987
| server.serviceType | string | `"ClusterIP"` | Service type for the karpor server. The available type values list as ["ClusterIP"、"NodePort"、"LoadBalancer"]. |
80-
| server.enableRbac | bool | `false` | Enable RBAC authorization if set to true. |
8188

8289
### Karpor Syncer
8390

charts/karpor/templates/karpor-server.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ spec:
1010
{{- include "karpor.selectorLabels" (dict "context" . "component" .Values.server.name) | nindent 4 }}
1111
type: {{ .Values.server.serviceType }}
1212
---
13+
{{- if .Values.server.ai.authToken }}
14+
apiVersion: v1
15+
kind: Secret
16+
metadata:
17+
name: karpor-auth
18+
namespace: {{ .Values.namespace }}
19+
labesl: {{- include "karpor.labels" (dict "context" . "component" .Values.server.name) | nindent 4 }}
20+
type: Opaque
21+
data:
22+
aiAuthToken: {{ .Values.server.ai.authToken | b64enc | quote }}
23+
{{- end }}
24+
---
1325
apiVersion: apps/v1
1426
kind: Deployment
1527
metadata:
@@ -38,6 +50,22 @@ spec:
3850
{{- if .Values.server.enableRbac }}
3951
- --enable-rbac=true
4052
{{- end }}
53+
{{- if and .Values.server.ai.authToken .Values.server.ai.baseUrl }}
54+
- --ai-auth-token=$(aiAuthToken)
55+
- --ai-base-url={{ .Values.server.ai.baseUrl }}
56+
{{- if .Values.server.ai.backend }}
57+
- --ai-backend={{ .Values.server.ai.backend }}
58+
{{- end }}
59+
{{- if .Values.server.ai.model }}
60+
- --ai-model={{ .Values.server.ai.model }}
61+
{{- end }}
62+
{{- if .Values.server.ai.temperature }}
63+
- --ai-temperature={{ .Values.server.ai.temperature }}
64+
{{- end }}
65+
{{- if .Values.server.ai.topP }}
66+
- --ai-top-p={{ .Values.server.ai.topP }}
67+
{{- end }}
68+
{{- end }}
4169
command:
4270
- /karpor
4371
image: {{ include "karpor.realImage" (dict "context" . "repo" .Values.server.image.repo "tag" .Values.server.image.tag "needV" (not (hasPrefix "v" .Values.server.image.tag))) }}
@@ -48,10 +76,25 @@ spec:
4876
volumeMounts:
4977
- mountPath: /etc/karpor/
5078
name: karpor-secret
79+
{{- if .Values.server.ai.authToken }}
80+
- mountPath: /etc/auth/
81+
name: karpor-auth
82+
{{- end }}
5183
resources:
5284
{{- toYaml .Values.server.resources | nindent 12 }}
85+
{{- if .Values.server.ai.authToken }}
86+
envFrom:
87+
- secretRef:
88+
name: karpor-auth
89+
{{- end }}
5390
volumes:
5491
- name: karpor-secret
5592
secret:
5693
defaultMode: 420
5794
secretName: karpor-secret
95+
{{- if .Values.server.ai.authToken }}
96+
- name: karpor-auth
97+
secret:
98+
defaultMode: 420
99+
secretName: karpor-auth
100+
{{- end }}

charts/karpor/values.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,27 @@ server:
3838
cpu: 500m
3939
memory: 1Gi
4040
ephemeral-storage: 10Gi
41+
# -- Enable RBAC authorization if set to true.
4142
enableRbac: false
4243
# -- Service type for the karpor server. The available type values list as ["ClusterIP"、"NodePort"、"LoadBalancer"].
4344
serviceType: ClusterIP
45+
# -- AI configuration section. The AI analysis feature requires that [authToken, baseUrl] be assigned values.
46+
ai:
47+
# -- Authentication token for accessing the AI service.
48+
authToken: ""
49+
# -- Base URL of the AI service. e.g., "https://api.openai.com/v1".
50+
baseUrl: ""
51+
# -- Backend service or platform that the AI model is hosted on. e.g., "openai". If the backend you are using
52+
# is compatible with OpenAI, then there is no need to make any changes here.
53+
backend: "openai"
54+
# -- Name or identifier of the AI model to be used. e.g., "gpt-3.5-turbo".
55+
model: "gpt-3.5-turbo"
56+
# -- Temperature parameter for the AI model. This controls the randomness of the output, where a higher
57+
# value (e.g., 1.0) makes the output more random, and a lower value (e.g., 0.0) makes it more deterministic.
58+
temperature: 1.0
59+
# -- Top-p (nucleus sampling) parameter for the AI model. This controls Controls the probability mass to consider for
60+
# sampling, where a higher value leads to greater diversity in the generated content (typically ranging from 0 to 1)
61+
topP: 1.0
4462

4563
# Configuration for Karpor syncer
4664
syncer:

0 commit comments

Comments
 (0)