Skip to content

Commit

Permalink
Merge branch 'main' into deployment-strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
0x2b3bfa0 authored Sep 13, 2023
2 parents 4cba03d + dc56bf6 commit a324d47
Show file tree
Hide file tree
Showing 30 changed files with 854 additions and 172 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

## Installation

## Pre-installation steps


### Create namespace

We'll install Studio and related components in a dedicated `studio` namespace.
Expand Down Expand Up @@ -131,6 +128,19 @@ global:
-----END RSA PRIVATE KEY-----
```
## Upgrading to 0.60.x and above
Version 0.60.0 fixes an issue with Ingress objects not getting cleaned up.
To upgrade to 0.60.0 and above, you need to manually delete the existing Ingress object before upgrading:
```bash
kubectl delete ingress -l app.kubernetes.io/managed-by=Helm --namespace studio
kubectl delete ingress blobvault --namespace studio
```

The rest of the upgrade process is the same as described below.

## Update Studio Version

Studio's `studio-values.yaml` file points to the `latest` image tag, instructing Helm to always pull
Expand Down Expand Up @@ -168,3 +178,4 @@ $ helm uninstall studio --namespace studio
### Available Configuration

See [values file](charts/studio/values.yaml) with all available configuration flags.

7 changes: 2 additions & 5 deletions charts/studio/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
dependencies:
- name: nginx
repository: https://charts.bitnami.com/bitnami
version: 13.2.30
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 17.14.3
Expand All @@ -11,5 +8,5 @@ dependencies:
- name: kuberay-operator
repository: https://ray-project.github.io/kuberay-helm
version: 0.6.0
digest: sha256:3b2dc8c1ca3e1841605034aca0e0dd7119c1fbcf17eecc47c997bf4510bce4cf
generated: "2023-08-16T00:49:28.269211675Z"
digest: sha256:11e47f1d691977c00cf3dd4454365b63ebdb81db484e837a1f720616a50fec63
generated: "2023-08-18T21:39:06.308367+02:00"
7 changes: 2 additions & 5 deletions charts/studio/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ apiVersion: v2
name: studio
description: A Helm chart for Kubernetes
type: application
version: 0.4.3
appVersion: "v2.27.0"
version: 0.6.1
appVersion: "v2.29.0"
maintainers:
- name: iterative
email: [email protected]
icon: "https://static.iterative.ai/logo/studio.svg"
dependencies:
- name: nginx
version: "13.2.30"
repository: "https://charts.bitnami.com/bitnami"
- name: redis
condition: redis.enabled
version: "17.14.3"
Expand Down
70 changes: 54 additions & 16 deletions charts/studio/README.md

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions charts/studio/nginx/backend-sidecar.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
server {
listen 80;
access_log /dev/stdout;
error_log /dev/stdout debug;

{{- if and .Values.global.basePath (not (eq .Values.global.basePath "/")) }}
rewrite /{{ include "studio.basePath" . }}/(.*) /$1 break;
{{- end }}

location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://backend;
}
}

upstream backend {
server 127.0.0.1:8000;
}

# Health check endpoint
server {
access_log /dev/null main;
error_log /dev/null info;

listen 8080;
location / {
return 200 'OK';
}
}
57 changes: 57 additions & 0 deletions charts/studio/nginx/blobvault.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
server {
listen 80;
server_name _;
access_log /dev/stdout;
error_log /dev/stdout debug;

root /blobvault;

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Studio-Trace-Id';

{{- if and .Values.global.basePath (not (eq .Values.global.basePath "/")) }}
rewrite /{{ include "studio.basePath" . }}/blobvault/(.*) /$1 break;
{{- else }}
rewrite /blobvault/(.*) /$1 break;
{{- end }}

location ~ \.gz$ {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'GET') {
add_header Content-Encoding gzip;
}
gzip off;
types { } default_type "application/json";
}

location /blobvault {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}

gzip on;

try_files $uri $uri/ =404;
}
}

# Health check endpoint
server {
access_log /dev/null main;
error_log /dev/null info;

listen 8080;
location / {
return 200 'OK';
}
}
33 changes: 33 additions & 0 deletions charts/studio/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
user nginx;
worker_processes auto;

error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /dev/stdout main;
error_log /dev/stdout info;

sendfile on;
tcp_nopush on;

server_tokens off;

keepalive_timeout 65;

gzip on;


include /etc/nginx/conf.d/*.conf;
}
47 changes: 45 additions & 2 deletions charts/studio/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "studio-leo.labels" -}}
helm.sh/chart: {{ include "studio.chart" . }}
{{ include "studio-backend.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "studio-ui.labels" -}}
helm.sh/chart: {{ include "studio.chart" . }}
{{ include "studio-ui.selectorLabels" . }}
Expand All @@ -88,6 +97,24 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "studio-blobvault.labels" -}}
helm.sh/chart: {{ include "studio.chart" . }}
{{ include "studio-blobvault.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "pgbouncer.labels" -}}
helm.sh/chart: {{ include "studio.chart" . }}
{{ include "pgbouncer.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
Expand All @@ -97,8 +124,8 @@ app.kubernetes.io/name: {{ include "studio.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "studio-ui.selectorLabels" -}}
app.kubernetes.io/name: studio-ui
{{- define "studio-blobvault.selectorLabels" -}}
app.kubernetes.io/name: studio-blobvault
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

Expand All @@ -117,11 +144,27 @@ app.kubernetes.io/name: studio-dvcx-worker
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "studio-leo.selectorLabels" -}}
app.kubernetes.io/name: studio-leo
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "studio-ui.selectorLabels" -}}
app.kubernetes.io/name: studio-ui
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "studio-worker.selectorLabels" -}}
app.kubernetes.io/name: studio-worker
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "pgbouncer.selectorLabels" -}}
app.kubernetes.io/name: pgbouncer
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}


{{/*
Create the name of the service account to use
*/}}
Expand Down
5 changes: 5 additions & 0 deletions charts/studio/templates/configmap-studio-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ data:
{{- with .Values.studioBackend.envVars}}
{{- toYaml . | nindent 2 }}
{{- end }}

LEO_SERVICE_HOST: "{{ .Release.Name }}-leo"
LEO_SERVICE_PORT: "{{ .Values.studioLeo.service.port }}"
LEO_ENCODING: "utf-8"

8 changes: 8 additions & 0 deletions charts/studio/templates/configmap-studio-leo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{.Release.Name}}-leo
data:
{{- with .Values.studioLeo.envVars}}
{{- toYaml . | nindent 2 }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/studio/templates/configmap-studio-nginx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-nginx
data:
{{ ( tpl (.Files.Glob "nginx/*").AsConfig . ) | indent 2 }}
69 changes: 69 additions & 0 deletions charts/studio/templates/deployment-pgbouncer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{{- if ((.Values.pgBouncer).enabled) -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{.Release.Name}}-pgbouncer
labels:
{{- include "pgbouncer.labels" . | nindent 4 }}
spec:
{{- if not .Values.pgBouncer.autoscaling.enabled }}
replicas: {{ .Values.pgBouncer.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "pgbouncer.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/secret-pgbouncer: {{ include (print $.Template.BasePath "/secret-pgbouncer.yaml") . | sha256sum }}
{{- include "studio.checksum" . | indent 8 }}
{{- with .Values.pgBouncer.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "pgbouncer.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ .Values.pgBouncer.serviceAccountName }}
securityContext:
{{- with .Values.pgBouncer.podSecurityContext }}
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: pgbouncer
securityContext:
{{- toYaml .Values.pgBouncer.securityContext | nindent 12 }}
image: "{{ .Values.pgBouncer.image.repository }}:{{ .Values.pgBouncer.image.tag }}"
imagePullPolicy: {{ .Values.pgBouncer.image.pullPolicy }}
resources:
{{- toYaml .Values.pgBouncer.resources | nindent 12 }}
env:
- name: PGBOUNCER_PORT
value: "6432"
envFrom:
- secretRef:
name: pgbouncer
{{- if .Values.pgBouncer.envFromSecret }}
- secretRef:
name: {{ .Values.pgBouncer.envFromSecret }}
{{- end }}
ports:
- name: pgbouncer
containerPort: 6432
protocol: TCP
{{- with .Values.pgBouncer.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.pgBouncer.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.pgBouncer.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
Loading

0 comments on commit a324d47

Please sign in to comment.