Skip to content

Commit

Permalink
Merge pull request kubeagi#788 from bjwswang/agent-portal
Browse files Browse the repository at this point in the history
feat: deploy agent-portal in chart arcadia
  • Loading branch information
bjwswang authored Mar 4, 2024
2 parents ca933d5 + 9b6e56a commit fc5e329
Show file tree
Hide file tree
Showing 9 changed files with 223 additions and 72 deletions.
2 changes: 1 addition & 1 deletion deploy/charts/arcadia/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: arcadia
description: A Helm chart(Also a KubeBB Component) for KubeAGI Arcadia
type: application
version: 0.3.2
version: 0.3.3
appVersion: "0.2.0"

keywords:
Expand Down
17 changes: 14 additions & 3 deletions deploy/charts/arcadia/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,30 @@ graphql and bff server
| `oidc.issuerURL` | URL of issuer portal | `https://portal.<replaced-ingress-nginx-ip>.nip.io/oidc` |
| `oidc.masterURL` | URL of master | `https://k8s.<replaced-ingress-nginx-ip>.nip.io` |

### portal
### opsconsole

portal for arcadia web console
portal for arcadia operation console

| Parameter | Description | Default |
| --------------- | --------------------------------- | ------------------------------------------- |
| `enabled` | enable arcadia web portal console | `true` |
| `kubebbEnabled` | enable kubebb platform | `true` |
| `image` | image of web console pod | `kubeagi/ops-console:latest` |
| `port` | port of web console | `80` |
| `ingress.path` | ingress path of portal | `kubeagi-portal-public` |
| `ingress.host` | host of ingress path | `portal.<replaced-ingress-nginx-ip>.nip.io` |

### agentportal

portal for arcadia gpt service

| Parameter | Description | Default |
| --------------- | --------------------------------- | ------------------------------------------- |
| `enabled` | enable arcadia agent portal | `true` |
| `kubebbEnabled` | enable kubebb platform | `true` |
| `image` | image of web console pod | `kubeagi/agent-portal:latest` |
| `ingress.path` | ingress path of portal | `` |
| `ingress.host` | host of ingress path | `gpts.<replaced-ingress-nginx-ip>.nip.io` |

### fastchat

fastchat is used as LLM serve platform for arcadia
Expand Down
126 changes: 126 additions & 0 deletions deploy/charts/arcadia/templates/agent-portal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{{- if .Values.agentportal.enabled }}
apiVersion: v1
data:
.env.production: |
# oidc server client id && secret
CLIENT_ID={{ .Values.apiserver.oidc.clientID }}
CLIENT_SECRET={{ .Values.apiserver.oidc.clientSecret }}
# oidc server url, e.g. https://kubeagi.com/oidc
OIDC_SERVER_URL={{ .Values.apiserver.oidc.issuerURL }}
# bff-server origin, for SSR
BFF_SERVER_ORIGIN=http://localhost:3000
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-agentportal
namespace: {{ .Release.Namespace }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: {{ .Release.Name }}-agentportal
name: {{ .Release.Name }}-agentportal
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ .Release.Name }}-agentportal
template:
metadata:
labels:
app: {{ .Release.Name }}-agentportal
spec:
containers:
- image: {{ .Values.agentportal.image }}
imagePullPolicy: IfNotPresent
name: agentportal
env:
- name: NODE_TLS_REJECT_UNAUTHORIZED
value: '0'
ports:
- containerPort: 80
protocol: TCP
resources:
limits:
cpu: "5"
memory: 1280Mi
requests:
cpu: 50m
memory: 512Mi
volumeMounts:
- mountPath: /etc/localtime
name: time-localtime
readOnly: true
- mountPath: /usr/src/app/.env.production
name: agentportal-config-volume
subPath: .env.production
restartPolicy: Always
volumes:
- hostPath:
path: /etc/localtime
type: ""
name: time-localtime
- configMap:
name: {{ .Release.Name }}-agentportal
name: agentportal-config-volume
---
apiVersion: v1
kind: Service
metadata:
labels:
app: {{ .Release.Name }}-agentportal
name: {{ .Release.Name }}-agentportal
namespace: {{ .Release.Namespace }}
spec:
internalTrafficPolicy: Cluster
ports:
- name: http
port: 3000
protocol: TCP
targetPort: 3000
selector:
app: {{ .Release.Name }}-agentportal
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
description: {{ .Release.Name }}-agentportal-ingress
displayName: {{ .Release.Name }}-agentportal-ingress
httpSend: /
ingress-lb: portal-ingress
kubernetes.io/ingress.class: portal-ingress
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_cache static-cache;
proxy_cache_valid 404 10m;
proxy_cache_use_stale error timeout updating http_404 http_500 http_502 http_503 http_504;
proxy_cache_bypass $http_x_purge;
add_header X-Cache-Status $upstream_cache_status; # check X-Cache-Status to see if it's HIT
nginx.ingress.kubernetes.io/enable-access-log: "false"
nginx.ingress.kubernetes.io/enable-rewrite-log: "false"
nginx.ingress.kubernetes.io/load-balance: round_robin
nginx.ingress.kubernetes.io/proxy-body-size: 102400m
nginx.ingress.kubernetes.io/proxy-buffering: "on"
nginx.ingress.kubernetes.io/proxy-connect-timeout: "60"
nginx.ingress.kubernetes.io/server-alias: ""
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/upstream-vhost: $host
labels:
ingress-lb: portal-ingress
name: {{ .Release.Name }}-agentportal-ingress
namespace: {{ .Release.Namespace }}
spec:
rules:
- host: {{ .Values.agentportal.ingress.host }}
http:
paths:
- backend:
service:
name: {{ .Release.Name }}-agentportal
port:
number: 3000
path: "/{{ .Values.opsconsole.ingress.path }}"
pathType: ImplementationSpecific
{{- end }}
9 changes: 0 additions & 9 deletions deploy/charts/arcadia/templates/kubebb-portal.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
{{- if and (.Values.portal.enabled) (.Values.portal.kubebbEnabled) }}
{{- if and (.Values.opsconsole.enabled) (.Values.opsconsole.kubebbEnabled) }}
apiVersion: core.kubebb.k8s.com.cn/v1alpha1
kind: Portal
metadata:
name: kubeagi-portal
spec:
entry: /kubeagi-portal-public/index.html
path: /kubeagi-portal

---
apiVersion: core.kubebb.k8s.com.cn/v1alpha1
kind: Menu
metadata:
creationTimestamp: null
labels:
portal: kubeagi-portal
name: yunti-kubeagi-portal-model-app
Expand Down Expand Up @@ -319,5 +327,4 @@ spec:
textEn: LLMOps
status: {}

---
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,49 @@
{{- if .Values.portal.enabled }}
{{- if .Values.opsconsole.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-portal
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ .Release.Name }}-portal
template:
metadata:
labels:
app: {{ .Release.Name }}-portal
spec:
containers:
- image: {{ .Values.opsconsole.image }}
imagePullPolicy: IfNotPresent
name: kubeagi-portal
ports:
- containerPort: 80
protocol: TCP
resources:
limits:
cpu: "1"
memory: 1024Mi
requests:
cpu: 100m
memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-portal
namespace: {{ .Release.Namespace }}
spec:
type: ClusterIP
selector:
app: {{ .Release.Name }}-portal
ports:
- name: api
port: 80
protocol: TCP
targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
Expand Down Expand Up @@ -27,14 +72,15 @@ metadata:
nginx.ingress.kubernetes.io/upstream-vhost: $host
spec:
rules:
- host: {{ .Values.portal.ingress.host }}
- host: {{ .Values.opsconsole.ingress.host }}
http:
paths:
- pathType: ImplementationSpecific
path: "/{{ .Values.portal.ingress.path }}"
path: "/{{ .Values.opsconsole.ingress.path }}"
backend:
service:
name: {{ .Release.Name }}-portal
port:
number: {{ .Values.portal.port }}
number: 80
{{- end }}

46 changes: 0 additions & 46 deletions deploy/charts/arcadia/templates/portal.yaml

This file was deleted.

14 changes: 11 additions & 3 deletions deploy/charts/arcadia/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,23 @@ apiserver:
issuerURL: https://portal.<replaced-ingress-nginx-ip>.nip.io/oidc
masterURL: https://k8s.<replaced-ingress-nginx-ip>.nip.io

# @section portal for arcadia web console
portal:
# @section portal for arcadia operation console
opsconsole:
enabled: true
kubebbEnabled: true
image: kubeagi/ops-console:latest
port: 80
ingress:
path: kubeagi-portal-public
host: portal.<replaced-ingress-nginx-ip>.nip.io

# @section portal for arcadia GPT store
agentportal:
enabled: true
kubebbEnabled: true
image: kubeagi/agent-portal:latest
ingress:
path: ""
host: gpts.<replaced-ingress-nginx-ip>.nip.io

# @section fastchat is used as fastchat configurations for arcadia
fastchat:
Expand Down
14 changes: 11 additions & 3 deletions tests/deploy-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,24 @@ apiserver:
clientSecret: 61324af0-1234-4f61-b110-ef57013267d6
masterURL: https://k8s.test.nip.io

# @section portal for arcadia web console
portal:
# @section portal for arcadia operation console
opsconsole:
enabled: true
kubebbEnabled: false
image: kubeagi/ops-console:latest
port: 80
ingress:
path: kubeagi-portal-public
host: portal.test.nip.io

# @section portal for arcadia gpts
agentportal:
enabled: true
kubebbEnabled: false
image: kubeagi/agent-portal:latest
ingress:
path: ""
host: gpts.test.nip.io

# @section fastchat is used as fastchat configurations for arcadia
fastchat:
image:
Expand Down

0 comments on commit fc5e329

Please sign in to comment.