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

Anvil update #474

Closed
wants to merge 64 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
4e27f15
Changes for not mounting entire NFS to each job
almahmoud Aug 13, 2021
bb53d37
Separate data and working dir pvcs
almahmoud Aug 30, 2021
380430d
Removed unnecessary mounts and made inputs read only
nuwang Dec 20, 2021
4138130
Remove spaces that makes helm lint unhappy
ksuderman Feb 9, 2024
e0b960d
First pass at defining cron jobs in the values.yaml file.
ksuderman Feb 9, 2024
9c84d17
Fix command formatting and quoting
ksuderman Feb 13, 2024
d2941d7
Remove nodeSelector
ksuderman Feb 13, 2024
95474e2
Tmp cleanup and maintenance scripts are treated as special cases.
ksuderman Feb 16, 2024
93930d7
Update the name of the container used to run the maintenance script.
ksuderman Feb 16, 2024
287cf13
Define all cron jobs in the values.yaml file again, but allows time d…
ksuderman Feb 19, 2024
8225be5
Use walltime limit for cleanup and other minor tweaks
nuwang Feb 20, 2024
8cc5d94
Change find units from seconds to days
nuwang Feb 20, 2024
64320c8
Parameterize the nodeSelector
ksuderman Feb 21, 2024
2bbaa3a
Remove the chown cron job
ksuderman Feb 21, 2024
df1fb39
Reverting my revert
ksuderman Feb 21, 2024
247cbf5
Add extraFileMappings for cron jobs
ksuderman Feb 28, 2024
cf77963
Start documenting cron jobs
ksuderman Feb 28, 2024
13e4f0b
Make the galaxy.yml file available in a configmap for the maintenance…
ksuderman Mar 8, 2024
27fd304
Update galaxy/values.yaml
ksuderman Mar 8, 2024
42488ff
Add helper to calculate the postgres connection string
ksuderman Mar 10, 2024
0fafea8
Add cron job documentation and remove Galaxy versions section
ksuderman Mar 10, 2024
497b572
Add env definitions
ksuderman Mar 12, 2024
da6a97a
Maintenace job should include default env vars
ksuderman Mar 12, 2024
cdc2a98
Update galaxy/values.yaml
ksuderman Mar 12, 2024
63bc997
Update galaxy/values.yaml
ksuderman Mar 12, 2024
d96979a
Parameterize Docker image for cron jobs
ksuderman Mar 12, 2024
3af24cd
Allow mode (permissions) to be defined on extraFileMappings
ksuderman Mar 13, 2024
b058b5e
Add YAML document separators (triple dashes) to the start of yaml tem…
ksuderman Mar 13, 2024
3fe5723
Add example cron job
ksuderman Mar 13, 2024
07fdbd4
Additional documentation for cron jobs
ksuderman Mar 13, 2024
b4cbdf6
Comment out the example cron job. Examples should not add arbitrary c…
ksuderman Mar 14, 2024
db82ef0
Run extraEnv values through the template engine
ksuderman Mar 17, 2024
859c6b7
Run tests with 1.28, and add missing tool versions to sanitize allowlist
afgane Mar 21, 2024
cb7e7d3
Merge branch 'master' into data_pvc
nuwang Apr 16, 2024
456fc6d
Merge pull request #314 from galaxyproject/data_pvc
afgane Apr 16, 2024
c36336d
Automatic Version Bumping from 5.9.0 to 5.10.0
actions-user Apr 16, 2024
e81042c
Add plotly tools to allow list
afgane Apr 16, 2024
dfceb29
Add checkout set to the tag-and-release step.
ksuderman Apr 17, 2024
7236270
Update .github/workflows/packaging.yml
ksuderman Apr 17, 2024
576807e
Update all checkout actions to v4
ksuderman Apr 17, 2024
8b4631d
Merge pull request #463 from ksuderman/482-release-notes
nuwang Apr 17, 2024
9f45b8c
Merge pull request #458 from ksuderman/document-separators
nuwang Apr 17, 2024
60a4ecc
Automatic Version Bumping from 5.10.0 to 5.10.1
actions-user Apr 17, 2024
050af87
Merge pull request #460 from galaxyproject/encouraging-scallop
nuwang Apr 17, 2024
ba6afdd
Automatic Version Bumping from 5.10.1 to 5.11.0
actions-user Apr 17, 2024
9df267e
Set user.name and user.email for the GitHub bot
ksuderman Apr 17, 2024
a7c1aed
Merge branch 'master' into 408-maintenance
ksuderman Apr 18, 2024
14f190d
Add newline to the end of the file.
ksuderman Apr 18, 2024
87cfd68
Merge pull request #466 from ksuderman/465-bot-email
nuwang Apr 18, 2024
72f95ad
Merge pull request #448 from ksuderman/408-maintenance
nuwang Apr 18, 2024
2e32eac
Automatic Version Bumping from 5.11.0 to 5.12.0
actions-user Apr 18, 2024
7e61ac1
Add enabled flag to the actions
ksuderman Apr 18, 2024
bbdbdb9
Update galaxy/templates/cronjob-maintenance.yaml
ksuderman Apr 19, 2024
eedf472
Merge pull request #468 from ksuderman/408-maintenance-enable
nuwang Apr 20, 2024
68be5df
Update README.md
nuwang Apr 17, 2024
17e8292
Document enabled flag for cron jobs
ksuderman Apr 23, 2024
7fe918b
Persist credentials and set GH_TOKEN for the GitHub command line tool
ksuderman Apr 23, 2024
38f62a8
Merge pull request #470 from ksuderman/462-release-notes
nuwang Apr 24, 2024
c16ea12
Automatic Version Bumping from 5.12.0 to 5.12.1
actions-user Apr 24, 2024
2c3aeaf
Merge pull request #469 from ksuderman/408-readme
nuwang Apr 24, 2024
d918841
Automatic Version Bumping from 5.12.1 to 5.13.0
actions-user Apr 24, 2024
431c683
Ensure tag-and-release checks out the latest commits make by the helm…
ksuderman Apr 26, 2024
fdc086f
Merge pull request #473 from ksuderman/472-checkout-latest
nuwang Apr 26, 2024
4f7ef31
Updating AnVIL branch to latest Galaxy Helm
ksuderman May 7, 2024
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
11 changes: 9 additions & 2 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: Package and push from PR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: cloudve/helm-ci@master
Expand All @@ -36,7 +36,7 @@ jobs:
name: Package and push manual invocation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: cloudve/helm-ci@master
Expand All @@ -51,13 +51,20 @@ jobs:
needs: [ package-from-pr, package-from-manual ]
name: Create a tag and GitHub release for this version.
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
if: |
always()
&& contains(needs.*.result, 'success')
&& !contains(needs.*.result, 'failure')
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Tag and release
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
version=v$(cat galaxy/Chart.yaml | grep ^version: | awk '{print $2}')
git tag -a $version -m "Automatic release of $version"
git push origin $version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Start k8s locally
uses: jupyterhub/action-k3s-helm@v3
with:
k3s-version: v1.25.15+k3s2 # releases: https://github.com/k3s-io/k3s/tags
k3s-version: v1.28.7+k3s1 # releases: https://github.com/k3s-io/k3s/tags
metrics-enabled: false
traefik-enabled: false
- name: Verify function of k8s, kubectl, and helm
Expand Down
90 changes: 70 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Galaxy Helm Chart (v4)
# Galaxy Helm Chart (v5)

[Galaxy](https://galaxyproject.org/) is a data analysis platform focusing on
accessibility, reproducibility, and transparency of primarily bioinformatics
Expand All @@ -8,7 +8,7 @@ updates, upgrades, and rollbacks.

## Supported software versions

- Kubernetes 1.22+
- Kubernetes 1.27+
- Helm 3.5+

## Kubernetes cluster
Expand Down Expand Up @@ -272,6 +272,8 @@ jobHandlers:
failureThreshhold: 3
```

# Additional Configurations

## Extra File Mappings

The `extraFileMappings` field can be used to inject files to arbitrary paths in the `nginx` deployment, as well as any of the `job`, `web`, or `workflow` handlers, and the `init` jobs.
Expand Down Expand Up @@ -420,28 +422,76 @@ The Galaxy application can be horizontally scaled for the web, job, or workflow
by setting the desired values of the `webHandlers.replicaCount`,
`jobHandlers.replicaCount`, and `workflowHandlers.replicaCount` configuration options.

## Galaxy versions
## Cron jobs

Two Cron jobs are defined by default. One to clean up Galaxy's database and one to clean up the `tmp` directory. By default, these
jobs run at 02:05 (the database maintenance script) and 02:15 (`tmp` directyory cleanup). Users can
change the times the cron jobs are run by changing the `schedule` field in the `values.yaml` file:

```yaml
cronJobs:
maintenance:
schedule: "30 6 * * *" # Execute the cron job at 6:30 UTC
```
or by specifying the `schedule` on the command line when instaling Galaxy:
```bash
# Schedule the maintenance job to run at 06:30 on the first day of each month
helm install galaxy -n galaxy galaxy/galaxy --set cronJobs.maintenance.schedule="30 6 1 * *"
```
To disable a cron job after Galaxy has been deployed simply set the enabled flag for that job to false:


```bash
helm upgrade galaxy -n galaxy galaxy/galaxy --reuse-values --set cronJobs.maintenance.enabled=false
```

### Run a CronJob manually

Cron jobs can be invoked manually with tools such as [OpenLens](https://github.com/MuhammedKalkan/OpenLens)
or from the command line with `kubectl`
```bash
kubectl create job --namespace <namespace> <job name> --from cronjob/galaxy-cron-maintenance
```
This will run the cron job regardless of the `schedule` that has been set.

**Note:** the name of the cron job will be `{{ .Release.Name }}-cron-<job name>` where the `<job name>`
is the name (key) used in the `values.yaml` file.

### CronJob configuration

Some changes introduced in the chart sometimes rely on changes in the Galaxy
container image, especially in relation to the Kubernetes runner. This table
keeps track of recommended Chart versions for particular Galaxy versions as
breaking changes are introduced. Otherwise, the Galaxy image and chart should be
independently upgrade-able. In other words, upgrading the Galaxy image from
`21.05` to `21.09` should be a matter of `helm upgrade my-galaxy cloudve/galaxy
--reuse-values --set image.tag=21.09`.
The following fields can be specified when defining cron jobs.

| Name | Definition | Required |
|---|-------------------------------------------------------------------------------------------------------------------------------------------|----------|
| enabled | `true` or `false`. If `false` the cron job will not be run. Default is `true` | **Yes** |
| schedule | When the job will be run. Use tools such as [crontab.guru](https://crontab.guru) for assistance determining the proper schedule string | **Yes** |
| defaultEnv | `true` or `false`. See the `galaxy.podEnvVars` macro in `_helpers.tpl` for the list of variables that will be defined. Default is `false` | No |
| extraEnv | Define extra environment variables that will be available to the job | No |
| securityContext | Specifies a `securityContext` for the job. Typically used to set `runAsUser` | No |
| image | Specify the Docker container used to run the job | No |
| command | The command to run | **Yes** |
| args | Any command line arguments that should be passed to the `command` | No |
| extraFileMappings | Allow arbitrary files to be mounted from config maps | No |

### Notes

If specifying the Docker `image` both the `resposity` and `tag` MUST be specified.
```yaml
image:
repository: quay.io/my-organization/my-image
tag: "1.0"
```

The `extraFileMappings` block is similar to the global `extraFileMappings` except the file will only be mounted for that cron job.
The following fields can be specified for each file.

| Chart version | Galaxy version | Description |
| :------------------ | :--------------- | :-------------- |
| `5.0` | `22.05` | Needs at least container image 22.05 as Galaxy switched from uwsgi to gunicorn |
| `4.0` | `21.05` | Needs [Galaxy PR#11899](https://github.com/galaxyproject/galaxy/pull/11899) for eliminating the CVMFS. If running chart 4.0+ with Galaxy image `21.01` or below, use the CVMFS instead with `--set setupJob.downloadToolConfs.enabled=false --set cvmfs.repositories.cvmfs-gxy-cloud=cloud.galaxyproject.org --set cvmfs.galaxyPersistentVolumeClaims.cloud.storage=1Gi --set cvmfs.galaxyPersistentVolumeClaims.cloud.storageClassName=cvmfs-gxy-cloud --set cvmfs.galaxyPersistentVolumeClaims.cloud.mountPath=/cvmfs/cloud.galaxyproject.org` |
| Name | Definition | Required |
|---|---|----------|
| mode | The file mode (permissions) assigned to the file | No |
| tpl | If set to `true` the file contents will be run through Helm's templating engine. Defaults to `false` | No |
| content | The contents of the file | **Yes** |

## Funding

- _Version 3+_: Galaxy Project, Genomics Virtual Laboratory (GVL)
See the `example` cron job included in the `values.yaml` file for a full example.

- _Version 2_: Genomics Virtual Laboratory (GVL), Galaxy Project, and European
Commission (EC) H2020 Project PhenoMeNal, grant agreement number 654241.

- _Version 1_: European Commission (EC) H2020 Project PhenoMeNal, grant
agreement number 654241.
9 changes: 9 additions & 0 deletions galaxy/disabled/configmap-galaxy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
metadata:
name: {{ .Release.Name }}-galaxy-config
labels:
{{- include "galaxy.labels" $ | nindent 4 }}
kind: ConfigMap
data:
galaxy.yml: |
{{- .Values.galaxy | toYaml | nindent 4 }}
7 changes: 7 additions & 0 deletions galaxy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ postgresql.fullname string and then prepend the release name to form the service
{{- end -}}
{{- end -}}

{{/*
Generate the connection string needed to connect to a Postres database
*/}}
{{- define "galaxy-postgresql.connection-string" -}}
{{- printf "postgresql://%s:%s@%s/galaxy%s" .Values.postgresql.galaxyDatabaseUser (include "galaxy.galaxyDbPassword" .) (include "galaxy-postgresql.fullname" .) .Values.postgresql.galaxyConnectionParams -}}
{{- end -}}

{{/*
Return the rabbitmq cluster to use
*/}}
Expand Down
1 change: 1 addition & 0 deletions galaxy/templates/configmap-cvmfs-fix.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
5 changes: 2 additions & 3 deletions galaxy/templates/configmap-extra-files.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- range $key, $entry := .Values.extraFileMappings -}}
{{- if $entry }}
---
apiVersion: v1
metadata:
# Extract the filename portion only
Expand All @@ -20,9 +21,9 @@ data:
{{- else }}
{{- $entry.content | nindent 4 }}
{{- end }}
---
{{- end }}
{{- end }}
---
apiVersion: v1
metadata:
name: {{ include "galaxy.fullname" $ }}-probedb-py
Expand All @@ -32,5 +33,3 @@ kind: ConfigMap
data:
probedb.py: |
{{- (.Files.Get "scripts/probedb.py") | nindent 4 }}

---
1 change: 1 addition & 0 deletions galaxy/templates/configmap-galaxy-rules.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
1 change: 1 addition & 0 deletions galaxy/templates/configmap-grafana-dashboard.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.influxdb.enabled }}
---
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
1 change: 1 addition & 0 deletions galaxy/templates/configmap-nginx.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down
1 change: 1 addition & 0 deletions galaxy/templates/configs-galaxy.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: v1
metadata:
name: {{ include "galaxy.fullname" . }}-configs
Expand Down
119 changes: 95 additions & 24 deletions galaxy/templates/cronjob-maintenance.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,118 @@
{{ range $key, $cronjob := .Values.cronJobs }}
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "galaxy.fullname" . }}-maintenance
name: {{ include "galaxy.fullname" $ }}-cron-{{ $key }}
labels:
{{- include "galaxy.labels" . | nindent 4 }}
{{- include "galaxy.labels" $ | nindent 4 }}
spec:
schedule: "0 2 * * *"
{{- if $cronjob.enabled }}
schedule: {{ $cronjob.schedule | quote }}
{{- else }}
# Set an impossible date so that the cronjob is still defined, but effectively disabled.
# This will allow the cronjob to be run manually if needed.
schedule: "0 0 30 2 *"
{{- end }}
jobTemplate:
spec:
template:
spec:
{{- if $cronjob.securityContext }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- with .Values.nodeSelector }}
{{- toYaml $cronjob.securityContext | nindent 12 }}
{{- end}}
{{- if $cronjob.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 16 }}
{{- toYaml $cronjob.nodeSelector | nindent 12 }}
{{- else if $.Values.nodeSelector }}
nodeSelector:
{{- toYaml $.Values.nodeSelector | nindent 12 }}
{{- end }}
containers:
- name: galaxy-maintenance
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
# delete all tmp files older than walltime limit
- name: galaxy-cron-{{ $key }}
{{- if $cronjob.image }}
image: {{ $cronjob.image.repository }}:{{ $cronjob.image.tag }}
{{- else }}
image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}"
{{- end }}
imagePullPolicy: {{ $.Values.image.pullPolicy }}
{{- if or $cronjob.defaultEnv $cronjob.extraEnv }}
env:
{{- if $cronjob.defaultEnv }}
{{- include "galaxy.podEnvVars" $}}
{{- end }}
{{- if $cronjob.extraEnv }}
{{- range $env := $cronjob.extraEnv }}
- name: {{ $env.name }}
value: {{ tpl $env.value $ | quote }}
{{- end }}
{{- end }}
{{- end }}
command:
- find
- {{ .Values.persistence.mountPath }}/tmp
- '!'
- -newermt
- -{{ (index .Values "configs" "job_conf.yml" "runners" "k8s" "k8s_walltime_limit" | default 604800) }} seconds
- -type
- f
- -exec
- rm
- '{}'
- ;
{{- range $cmd := $cronjob.command }}
- {{ tpl $cmd $ | quote }}
{{- end}}
{{- if $cronjob.args }}
args:
{{- range $arg := $cronjob.args }}
- {{ tpl $arg $ | quote }}
{{- end }}
{{- end }}
volumeMounts:
- name: galaxy-data
mountPath: {{ .Values.persistence.mountPath }}
mountPath: {{ $.Values.persistence.mountPath }}
{{- range $key, $entry := $cronjob.extraFileMappings }}
- name: {{ include "galaxy.getExtraFilesUniqueName" $key }}
mountPath: {{ $key }}
subPath: {{ include "galaxy.getFilenameFromPath" $key }}
{{- end }}
volumes:
- name: galaxy-data
{{- if .Values.persistence.enabled }}
{{- if $.Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "galaxy.pvcname" . }}
claimName: {{ template "galaxy.pvcname" $ }}
{{- else }}
emptyDir: {}
{{- end }}
{{- range $key, $entry := $cronjob.extraFileMappings }}
- name: {{ include "galaxy.getExtraFilesUniqueName" $key }}
{{- if $entry.useSecret }}
secret:
secretName: {{ printf "%s-%s" (include "galaxy.fullname" $) (include "galaxy.getExtraFilesUniqueName" $key) }}
{{- else }}
configMap:
name: {{ printf "%s-%s" (include "galaxy.fullname" $) (include "galaxy.getExtraFilesUniqueName" $key) }}
{{- end }}
{{- if $entry.mode }}
defaultMode: {{ $entry.mode }}
{{- end }}
{{- end }}
restartPolicy: OnFailure
{{- if $cronjob.extraFileMappings }}
{{- range $name, $entry := $cronjob.extraFileMappings }}
---
apiVersion: v1
metadata:
# Extract the filename portion only
name: {{ printf "%s-%s" (include "galaxy.fullname" $) (include "galaxy.getExtraFilesUniqueName" $name) }}
labels:
{{- include "galaxy.labels" $ | nindent 4 }}
{{- if $entry.useSecret }}
kind: Secret
type: Opaque
stringData:
{{- else }}
kind: ConfigMap
data:
{{- end }}
{{- include "galaxy.getFilenameFromPath" $name | nindent 2 }}: |
{{- if $entry.tpl }}
{{- tpl (tpl $entry.content $) $ | nindent 4 }}
{{- else }}
{{- $entry.content | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}

{{- end }}
1 change: 1 addition & 0 deletions galaxy/templates/deployment-celery-beat.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
1 change: 1 addition & 0 deletions galaxy/templates/deployment-celery.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
Loading
Loading