Skip to content

Commit

Permalink
feat: update ai-server chart to support running multiple instances on…
Browse files Browse the repository at this point in the history
… the same cluster under different namespaces.
  • Loading branch information
lots0logs committed Sep 12, 2023
1 parent fc7bfe7 commit 2e29283
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion charts/ai-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ maintainers:
- email: dustin@elegantthemes.com
name: Elegant Themes
name: ai-server
version: 1.1.0
version: 1.2.0
25 changes: 13 additions & 12 deletions charts/ai-server/templates/ai-server.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Cloud Server Service
apiVersion: v1
kind: Service
metadata:
name: ai-server
namespace: dai-app
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
spec:
selector:
app: ai-server
app: {{ .Release.Name }}
ports:
- port: 9999
targetPort: 9999
Expand All @@ -16,10 +15,10 @@ spec:
apiVersion: apps/v1
kind: Deployment
metadata:
name: ai-server
namespace: dai-app
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
app: ai-server
app: {{ .Release.Name }}
spec:
replicas: {{ .Values.REPLICAS }}
strategy:
Expand All @@ -28,11 +27,11 @@ spec:
maxUnavailable: 1
selector:
matchLabels:
app: ai-server
app: {{ .Release.Name }}
template:
metadata:
labels:
app: ai-server
app: {{ .Release.Name }}
redis-client: 'true'
spec:
affinity:
Expand All @@ -54,9 +53,9 @@ spec:
- key: app
operator: In
values:
- ai-server
- {{ .Release.Name }}
namespaces:
- dai-app
- {{ .Release.Namespace }}
topologyKey: kubernetes.io/hostname
- labelSelector:
matchExpressions:
Expand All @@ -68,7 +67,7 @@ spec:
- dc-screenshot
topologyKey: kubernetes.io/hostname
containers:
- name: ai-server
- name: {{ .Release.Name }}
env:
- name: NODE_NAME
valueFrom:
Expand All @@ -82,6 +81,8 @@ spec:
value: {{ .Values.AI_SERVER_REPO_URL | squote }}
- name: IMAGE_VERSION
value: {{ .Values.AI_SERVER_VERSION | squote }}
- name: GIT_REF
value: {{ .Values.GIT_REF | squote }}

image: {{ .Values.AI_SERVER_IMAGE | squote }}
livenessProbe:
Expand Down
8 changes: 4 additions & 4 deletions charts/ai-server/templates/ingress.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ai-server
namespace: dai-app
name: {{ .Release.Name }}
namespace: {{ .Release.Name }}
annotations:
cert-manager.io/cluster-issuer: letsencrypt
kubernetes.io/ingress.class: nginx
Expand All @@ -20,7 +20,7 @@ spec:
tls:
- hosts:
- {{ .Values.VIRTUAL_HOST }}
secretName: ai-server-tls
secretName: {{ .Release.Name }}-tls
rules:
- host: {{ .Values.VIRTUAL_HOST }}
http:
Expand All @@ -29,6 +29,6 @@ spec:
pathType: Prefix
backend:
service:
name: ai-server
name: {{ .Release.Name }}
port:
number: 9999
5 changes: 2 additions & 3 deletions charts/ai-server/templates/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ apiVersion: v1
kind: Secret
metadata:
name: secrets
namespace: dai-app
namespace: {{ .Release.Namespace }}
stringData:
GITHUB_TOKEN: {{ .Values.GITHUB_TOKEN }}
GITHUB_TOKEN: {{ .Values.GITHUB_TOKEN | squote }}
.env: |
AI_SERVER_ENV={{ .Values.AI_SERVER_ENV | squote }}
AI_SERVER_PATH={{ .Values.INSTALL_PATH | squote }}
AI_SERVER_REPO_URL={{ .Values.AI_SERVER_REPO_URL | squote }}
AWS_ACCESS_KEY_ID={{ .Values.AWS_ACCESS_KEY_ID | squote }}
AWS_SECRET_ACCESS_KEY={{ .Values.AWS_SECRET_ACCESS_KEY | squote }}
AWS_REGION={{ .Values.AWS_REGION | squote }}
COOKIE_SALT={{ .Values.COOKIE_SALT | squote }}
IMAGE_VERSION={{ .Values.AI_SERVER_VERSION | squote }}
INTERNAL_TOKEN={{ .Values.INTERNAL_TOKEN | squote }}
JWT_ACCESS_TOKEN_EXPIRES_IN={{ .Values.JWT_ACCESS_TOKEN_EXPIRES_IN | squote }}
Expand Down
1 change: 1 addition & 0 deletions charts/ai-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ AWS_SECRET_ACCESS_KEY:
AWS_REGION:

GITHUB_TOKEN:
GIT_REF:
INSTALL_PATH:
INTERNAL_TOKEN:

Expand Down

0 comments on commit 2e29283

Please sign in to comment.