Skip to content

Commit

Permalink
feat: aiproxy deploy db (#5240)
Browse files Browse the repository at this point in the history
* feat: aiproxy deploy database

* feat: aiproxy deploy auto set sealos jwt key

* chore: db replicas

* docs: add readme.md

* fix: donot enable xtrace

* fix: readme
  • Loading branch information
zijiren233 authored Nov 27, 2024
1 parent aa3eff0 commit d4fe959
Show file tree
Hide file tree
Showing 6 changed files with 395 additions and 6 deletions.
7 changes: 7 additions & 0 deletions service/aiproxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Use Sealos to Deploy

```bash
sealos run ghcr.io/labring/sealos-cloud-aiproxy-service:latest \
-e ADMIN_KEY=<admin-key> \
-e cloudDomain=<cloud-domain>
```
8 changes: 4 additions & 4 deletions service/aiproxy/deploy/Kubefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ ENV cloudPort=""
ENV certSecretName="wildcard-cert"

ENV ADMIN_KEY=""
ENV SEALOS_JWT_KEY=""
ENV SQL_DSN=""
ENV LOG_SQL_DSN=""
ENV REDIS_CONN_STRING=""
ENV SEALOS_JWT_KEY="<sealos-jwt-key-placeholder>"
ENV SQL_DSN="<sql-placeholder>"
ENV LOG_SQL_DSN="<sql-log-placeholder>"
ENV REDIS_CONN_STRING="<redis-placeholder>"

CMD ["bash scripts/init.sh"]
94 changes: 94 additions & 0 deletions service/aiproxy/deploy/manifests/pgsql-log.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
finalizers:
- cluster.kubeblocks.io/finalizer
labels:
clusterdefinition.kubeblocks.io/name: postgresql
clusterversion.kubeblocks.io/name: postgresql-14.8.0
sealos-db-provider-cr: aiproxy-log
annotations: {}
name: aiproxy-log
namespace: aiproxy-system
spec:
affinity:
nodeLabels: {}
podAntiAffinity: Preferred
tenancy: SharedNode
topologyKeys:
- kubernetes.io/hostname
clusterDefinitionRef: postgresql
clusterVersionRef: postgresql-14.8.0
componentSpecs:
- componentDefRef: postgresql
monitor: true
name: postgresql
replicas: 2
resources:
limits:
cpu: 1000m
memory: 1024Mi
requests:
cpu: 100m
memory: 102Mi
serviceAccountName: aiproxy-log
switchPolicy:
type: Noop
volumeClaimTemplates:
- name: data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
terminationPolicy: Delete
tolerations: []

---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
sealos-db-provider-cr: aiproxy-log
app.kubernetes.io/instance: aiproxy-log
app.kubernetes.io/managed-by: kbcli
name: aiproxy-log
namespace: aiproxy-system

---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
sealos-db-provider-cr: aiproxy-log
app.kubernetes.io/instance: aiproxy-log
app.kubernetes.io/managed-by: kbcli
name: aiproxy-log
namespace: aiproxy-system
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'

---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
sealos-db-provider-cr: aiproxy-log
app.kubernetes.io/instance: aiproxy-log
app.kubernetes.io/managed-by: kbcli
name: aiproxy-log
namespace: aiproxy-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: aiproxy-log
subjects:
- kind: ServiceAccount
name: aiproxy-log
namespace: aiproxy-system
94 changes: 94 additions & 0 deletions service/aiproxy/deploy/manifests/pgsql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
finalizers:
- cluster.kubeblocks.io/finalizer
labels:
clusterdefinition.kubeblocks.io/name: postgresql
clusterversion.kubeblocks.io/name: postgresql-14.8.0
sealos-db-provider-cr: aiproxy
annotations: {}
name: aiproxy
namespace: aiproxy-system
spec:
affinity:
nodeLabels: {}
podAntiAffinity: Preferred
tenancy: SharedNode
topologyKeys:
- kubernetes.io/hostname
clusterDefinitionRef: postgresql
clusterVersionRef: postgresql-14.8.0
componentSpecs:
- componentDefRef: postgresql
monitor: true
name: postgresql
replicas: 2
resources:
limits:
cpu: 1000m
memory: 1024Mi
requests:
cpu: 100m
memory: 102Mi
serviceAccountName: aiproxy
switchPolicy:
type: Noop
volumeClaimTemplates:
- name: data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
terminationPolicy: Delete
tolerations: []

---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
sealos-db-provider-cr: aiproxy
app.kubernetes.io/instance: aiproxy
app.kubernetes.io/managed-by: kbcli
name: aiproxy
namespace: aiproxy-system

---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
sealos-db-provider-cr: aiproxy
app.kubernetes.io/instance: aiproxy
app.kubernetes.io/managed-by: kbcli
name: aiproxy
namespace: aiproxy-system
rules:
- apiGroups:
- "*"
resources:
- "*"
verbs:
- "*"

---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
sealos-db-provider-cr: aiproxy
app.kubernetes.io/instance: aiproxy
app.kubernetes.io/managed-by: kbcli
name: aiproxy
namespace: aiproxy-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: aiproxy
subjects:
- kind: ServiceAccount
name: aiproxy
namespace: aiproxy-system
107 changes: 107 additions & 0 deletions service/aiproxy/deploy/manifests/redis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
finalizers:
- cluster.kubeblocks.io/finalizer
labels:
clusterdefinition.kubeblocks.io/name: redis
clusterversion.kubeblocks.io/name: redis-7.0.6
sealos-db-provider-cr: aiproxy-redis
annotations: {}
name: aiproxy-redis
namespace: aiproxy-system
spec:
affinity:
nodeLabels: {}
podAntiAffinity: Preferred
tenancy: SharedNode
topologyKeys:
- kubernetes.io/hostname
clusterDefinitionRef: redis
clusterVersionRef: redis-7.0.6
componentSpecs:
- componentDefRef: redis
monitor: true
name: redis
replicas: 3
resources:
limits:
cpu: 1000m
memory: 1024Mi
requests:
cpu: 100m
memory: 102Mi
serviceAccountName: aiproxy-redis
switchPolicy:
type: Noop
volumeClaimTemplates:
- name: data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
storageClassName: openebs-backup
- componentDefRef: redis-sentinel
monitor: true
name: redis-sentinel
replicas: 3
resources:
limits:
cpu: 100m
memory: 100Mi
requests:
cpu: 100m
memory: 100Mi
serviceAccountName: aiproxy-redis
terminationPolicy: Delete
tolerations: []

---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
sealos-db-provider-cr: aiproxy-redis
app.kubernetes.io/instance: aiproxy-redis
app.kubernetes.io/managed-by: kbcli
name: aiproxy-redis
namespace: aiproxy-system

---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
sealos-db-provider-cr: aiproxy-redis
app.kubernetes.io/instance: aiproxy-redis
app.kubernetes.io/managed-by: kbcli
name: aiproxy-redis
namespace: aiproxy-system
rules:
- apiGroups:
- '*'
resources:
- '*'
verbs:
- '*'

---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
sealos-db-provider-cr: aiproxy-redis
app.kubernetes.io/instance: aiproxy-redis
app.kubernetes.io/managed-by: kbcli
name: aiproxy-redis
namespace: aiproxy-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: aiproxy-redis
subjects:
- kind: ServiceAccount
name: aiproxy-redis
namespace: aiproxy-system
Loading

0 comments on commit d4fe959

Please sign in to comment.