Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conda-store helm chart #1032

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1cbcff7
Setup helm chart
soapy1 Oct 16, 2024
24ef3ea
Add an example using the helm chart
soapy1 Oct 16, 2024
cce74ab
Add ui deployment
soapy1 Oct 17, 2024
209d6ee
Fix worker file permissions
soapy1 Oct 17, 2024
3f77625
Support multiple workers
soapy1 Nov 12, 2024
0b5fc8e
Add more instructions for how to setup the helm install
soapy1 Nov 12, 2024
cdcf1a3
Seperate config per service
soapy1 Nov 12, 2024
5a9995e
Add some notes on running the service
soapy1 Nov 13, 2024
de98df2
Use local build of conda-store-server for testing
soapy1 Nov 13, 2024
1723436
The ui pod needs the api service enabled within it in order to work
soapy1 Nov 13, 2024
ce3abb5
Get viewing artifacts to work
soapy1 Nov 13, 2024
8752659
Use individal secrets for all required config secrets
soapy1 Nov 14, 2024
9dec1e2
Use gomplate to generate values file
soapy1 Nov 14, 2024
4229421
Trim server deployments
soapy1 Nov 15, 2024
e71d15c
Setup PVC to bind to user provided environments volume
soapy1 Nov 15, 2024
1b37a0b
Setup local volume
soapy1 Nov 18, 2024
0424407
Add notes for values.yaml
soapy1 Dec 3, 2024
f8cda65
Get liveness/readiness for api and ui deployments
soapy1 Dec 4, 2024
9df09ce
Add suggested conda store config for each deployment
soapy1 Dec 4, 2024
d82d724
Don't include values file by default
soapy1 Dec 27, 2024
dd3b521
Clean up unused config
soapy1 Dec 27, 2024
76efce7
Clean up end of file new lines
soapy1 Dec 27, 2024
0327e28
helm lint
soapy1 Dec 27, 2024
2f0ca5c
Use shared labels
soapy1 Dec 27, 2024
b9f2161
Respect resource limits
soapy1 Dec 27, 2024
4b7e05e
Use conda-store ui docker image
soapy1 Jan 1, 2025
688556b
[pre-commit.ci] Apply automatic pre-commit fixes
pre-commit-ci[bot] Jan 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ yarn-error.log*
conda-store.sqlite

*.lockb
*.local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ async def http_exception_handler(request, exc):
return JSONResponse(
{
"status": "error",
"message": exc.detail,
"message": exc,
},
status_code=exc.status_code,
)
Expand Down
23 changes: 23 additions & 0 deletions conda-store-server/install/conda-store/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
7 changes: 7 additions & 0 deletions conda-store-server/install/conda-store/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
name: conda-store
description: A Helm chart for deploying conda-store to kubernetes
type: application
version: 0.1.0
icon: https://raw.githubusercontent.com/conda-incubator/conda-store/refs/heads/main/docusaurus-docs/community/images/logos/conda-store-logo-vertical-lockup.svg
home: https://github.com/conda-incubator/conda-store
78 changes: 78 additions & 0 deletions conda-store-server/install/conda-store/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Conda Store Helm Chart

In order to install conda store with helm, you must
have the following things set up:

## Services
* S3/minio
* DB (eg. Postgres, MySql, etc)
* Redis

## Secrets
* following secrets:
* conda-store-postgres-secret
* conda-store-minio-secret
* conda-store-redis-secret

For example
```
---
apiVersion: v1
data:
username: YWRtaW4=
pasword: cGFzc3dvcmQ=
kind: Secret
metadata:
name: conda-store-postgres-secret
type: Opaque

---
apiVersion: v1
data:
username: YWRtaW4=
pasword: cGFzc3dvcmQ=
kind: Secret
metadata:
name: conda-store-minio-secret
type: Opaque

---
apiVersion: v1
data:
pasword: cGFzc3dvcmQ=
kind: Secret
metadata:
name: conda-store-redis-secret
type: Opaque
```

## Volumes

Conda store requires a persistent volume for installing conda environments into. Users should provide a PersistentVolume that binds to the conda-store-worker PVC. For example:

```
apiVersion: v1
kind: PersistentVolume
metadata:
name: conda-store-environments
spec:
capacity:
storage: 2Gi
accessModes:
- ReadWriteMany
volumeMode: Filesystem
storageClassName: local-storage
local: # required for local-storage
path: /tmp/mnt-vol-kub
claimRef:
namespace: conda-store
name: conda-store-worker-claim
nodeAffinity: # required for local-storage
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- mynode
```
78 changes: 78 additions & 0 deletions conda-store-server/install/conda-store/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "condaStore.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "condaStore.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "condaStore.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "condaStore.labels" -}}
helm.sh/chart: {{ include "condaStore.chart" . }}
{{ include "condaStore.selectorLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "condaStore.selectorLabels" -}}
app.kubernetes.io/name: {{ include "condaStore.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Set's the worker resources if the user has set any.
*/}}
{{- define "worker.resources" -}}
{{- if .Values.worker.resources -}}
resources:
{{ toYaml .Values.worker.resources | indent 12}}
{{ end }}
{{- end -}}

{{/*
Set's the uiServer resources if the user has set any.
*/}}
{{- define "uiServer.resources" -}}
{{- if .Values.uiServer.resources -}}
resources:
{{ toYaml .Values.uiServer.resources | indent 12}}
{{ end }}
{{- end -}}

{{/*
Set's the apiServer resources if the user has set any.
*/}}
{{- define "apiServer.resources" -}}
{{- if .Values.apiServer.resources -}}
resources:
{{ toYaml .Values.apiServer.resources | indent 12}}
{{ end }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
data:
conda_store_config.py: |
{{ .Values.apiServer.condaStoreConfig | nindent 4 }}
kind: ConfigMap
metadata:
name: "{{ template "condaStore.fullname" . }}-api-server"
namespace: {{ .Values.global.namespace }}
labels:
{{- include "condaStore.labels" . | nindent 8 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ template "condaStore.fullname" . }}-api-server"
namespace: {{ .Values.global.namespace }}
labels:
app: "{{ template "condaStore.fullname" . }}-api-server"
{{ include "condaStore.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.apiServer.replicas }}
selector:
matchLabels:
app: "{{ template "condaStore.fullname" . }}-api-server"
template:
metadata:
labels:
app: "{{ template "condaStore.fullname" . }}-api-server"
{{ include "condaStore.labels" . | nindent 8 }}
spec:
containers:
- name: "{{ template "condaStore.fullname" . }}-api-server"
image: "{{ .Values.apiServer.image.repository }}:{{ .Values.apiServer.image.tag }}"
imagePullPolicy: {{ .Values.apiServer.image.pullPolicy }}
args:
- "conda-store-server"
- "--config"
- "/etc/conda-store/conda_store_config.py"
ports:
- containerPort: {{ .Values.apiServer.port }}
livenessProbe:
httpGet:
path: /api/v1/
port: 8080
initialDelaySeconds: {{ .Values.apiServer.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.apiServer.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.apiServer.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.apiServer.livenessProbe.failureThreshold }}
readinessProbe:
httpGet:
path: /api/v1/
port: 8080
initialDelaySeconds: {{ .Values.apiServer.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.apiServer.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.apiServer.readinessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.apiServer.readinessProbe.failureThreshold }}
{{ template "apiServer.resources" . }}
env:
- name: POSTGRES_USERNAME
valueFrom:
secretKeyRef:
name: conda-store-postgres-secret
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: conda-store-postgres-secret
key: password
- name: MINIO_USERNAME
valueFrom:
secretKeyRef:
name: conda-store-minio-secret
key: username
- name: MINIO_PASSWORD
valueFrom:
secretKeyRef:
name: conda-store-minio-secret
key: password
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: conda-store-redis-secret
key: password
volumeMounts:
- name: config
mountPath: "/etc/conda-store/"
readOnly: true
restartPolicy: Always
volumes:
- name: config
configMap:
name: "{{ template "condaStore.fullname" . }}-api-server"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: "{{ template "condaStore.fullname" . }}-api-server"
namespace: {{ .Values.global.namespace }}
labels:
{{ include "condaStore.labels" . | nindent 4 }}
spec:
type: NodePort
ports:
- port: 8080
nodePort: {{ .Values.apiServer.nodePort }}
targetPort: {{ .Values.apiServer.port }}
protocol: TCP
name: http
selector:
app: "{{ template "condaStore.fullname" . }}-api-server"
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ template "condaStore.fullname" . }}-ui-server"
namespace: {{ .Values.global.namespace }}
labels:
{{ include "condaStore.labels" . | nindent 4 }}
app: "{{ template "condaStore.fullname" . }}-ui-server"
spec:
replicas: {{ .Values.uiServer.replicas }}
selector:
matchLabels:
app: "{{ template "condaStore.fullname" . }}-ui-server"
template:
metadata:
labels:
{{ include "condaStore.labels" . | nindent 8 }}
app: "{{ template "condaStore.fullname" . }}-ui-server"
spec:
containers:
- name: "{{ template "condaStore.fullname" . }}-ui-server"
image: "{{ .Values.uiServer.image.repository }}:{{ .Values.uiServer.image.tag }}"
imagePullPolicy: {{ .Values.uiServer.image.pullPolicy }}
env:
- name: REACT_APP_STYLE_TYPE
value: green-accent
- name: REACT_APP_API_URL
value: {{ .Values.uiServer.appEnv.apiUrl }}
- name: REACT_APP_LOGIN_PAGE_URL
value: {{ .Values.uiServer.appEnv.loginPageUrl }}
- name: REACT_APP_LOGOUT_PAGE_URL
value: {{ .Values.uiServer.appEnv.logoutPageUrl }}
- name: REACT_APP_URL_BASENAME
value: {{ .Values.uiServer.appEnv.urlBasename }}
- name: DEBUG
value: express:*
- name: PORT
value: "8080"
ports:
- containerPort: {{ .Values.uiServer.port }}
livenessProbe:
httpGet:
# TODO: it would be nice to have a "ok" endpoint on the ui
path: /status
port: 8080
initialDelaySeconds: {{ .Values.uiServer.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.uiServer.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.uiServer.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.uiServer.livenessProbe.failureThreshold }}
readinessProbe:
httpGet:
path: /status
port: 8080
initialDelaySeconds: {{ .Values.uiServer.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.uiServer.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.uiServer.readinessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.uiServer.readinessProbe.failureThreshold }}
{{ template "uiServer.resources" . }}
restartPolicy: Always
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: "{{ template "condaStore.fullname" . }}-ui-server"
namespace: {{ .Values.global.namespace }}
labels:
{{ include "condaStore.labels" . | nindent 4 }}
spec:
type: NodePort
ports:
- port: 8080
nodePort: {{ .Values.uiServer.nodePort }}
targetPort: {{ .Values.uiServer.port }}
protocol: TCP
name: http
selector:
app: "{{ template "condaStore.fullname" . }}-ui-server"
Loading
Loading