From 2e292832fea07d536bae205b37598b5291a0426e Mon Sep 17 00:00:00 2001 From: Dustin Falgout Date: Tue, 12 Sep 2023 16:24:57 -0500 Subject: [PATCH] feat: update ai-server chart to support running multiple instances on the same cluster under different namespaces. --- charts/ai-server/Chart.yaml | 2 +- charts/ai-server/templates/ai-server.yml | 25 ++++++++++++------------ charts/ai-server/templates/ingress.yml | 8 ++++---- charts/ai-server/templates/secrets.yml | 5 ++--- charts/ai-server/values.yaml | 1 + 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/charts/ai-server/Chart.yaml b/charts/ai-server/Chart.yaml index f9279d7..4d6058f 100644 --- a/charts/ai-server/Chart.yaml +++ b/charts/ai-server/Chart.yaml @@ -5,4 +5,4 @@ maintainers: - email: dustin@elegantthemes.com name: Elegant Themes name: ai-server -version: 1.1.0 +version: 1.2.0 diff --git a/charts/ai-server/templates/ai-server.yml b/charts/ai-server/templates/ai-server.yml index 8f6e4a8..5e023cf 100644 --- a/charts/ai-server/templates/ai-server.yml +++ b/charts/ai-server/templates/ai-server.yml @@ -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 @@ -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: @@ -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: @@ -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: @@ -68,7 +67,7 @@ spec: - dc-screenshot topologyKey: kubernetes.io/hostname containers: - - name: ai-server + - name: {{ .Release.Name }} env: - name: NODE_NAME valueFrom: @@ -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: diff --git a/charts/ai-server/templates/ingress.yml b/charts/ai-server/templates/ingress.yml index 263ed64..aec7853 100644 --- a/charts/ai-server/templates/ingress.yml +++ b/charts/ai-server/templates/ingress.yml @@ -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 @@ -20,7 +20,7 @@ spec: tls: - hosts: - {{ .Values.VIRTUAL_HOST }} - secretName: ai-server-tls + secretName: {{ .Release.Name }}-tls rules: - host: {{ .Values.VIRTUAL_HOST }} http: @@ -29,6 +29,6 @@ spec: pathType: Prefix backend: service: - name: ai-server + name: {{ .Release.Name }} port: number: 9999 diff --git a/charts/ai-server/templates/secrets.yml b/charts/ai-server/templates/secrets.yml index 0dda509..911838a 100644 --- a/charts/ai-server/templates/secrets.yml +++ b/charts/ai-server/templates/secrets.yml @@ -2,9 +2,9 @@ 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 }} @@ -12,7 +12,6 @@ stringData: 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 }} diff --git a/charts/ai-server/values.yaml b/charts/ai-server/values.yaml index bc5ea16..df622d7 100644 --- a/charts/ai-server/values.yaml +++ b/charts/ai-server/values.yaml @@ -9,6 +9,7 @@ AWS_SECRET_ACCESS_KEY: AWS_REGION: GITHUB_TOKEN: +GIT_REF: INSTALL_PATH: INTERNAL_TOKEN: