Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/helm-chart-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ jobs:
- name: add helm repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add seaweedfs https://seaweedfs.github.io/seaweedfs/helm
helm repo add minio https://charts.min.io
helm repo update
helm dep up

- name: Run chart-releaser
run: |
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/helm-lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ permissions:
contents: read

jobs:
lint-test:
lint-serverside-dryrun:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -38,17 +38,14 @@ jobs:

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1

- name: Run chart-testing (lint)
run: |
ct lint --chart-dirs . --charts . --validate-maintainers=false

- name: Create kind cluster
uses: helm/kind-action@v1.10.0

- name: Run chart-testing (install)
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add seaweedfs https://seaweedfs.github.io/seaweedfs/helm
helm repo add minio https://charts.min.io
helm repo update
helm dep up
helm template ctfd . -f values.yaml | kubectl create --dry-run=server -f -
12 changes: 7 additions & 5 deletions Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ icon: https://ctfd.io/static/img/ctfd.svg

type: application

version: 0.2.0
# Dev note: trigger a helm chart release by bumping the version
version: 0.3.0

# Redis, MySQL/MariaDB and Seaweedfs
dependencies:
Expand All @@ -17,7 +18,8 @@ dependencies:
version: 14.0.12
repository: https://charts.bitnami.com/bitnami
condition: mariadb-galera.enabled
- name: seaweedfs
version: 4.0.0
repository: https://seaweedfs.github.io/seaweedfs/helm
condition: seaweedfs.enabled
- name: minio
alias: minio
version: 5.4.0
repository: https://charts.min.io/
condition: minio.enabled
82 changes: 37 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ helm install ctfd ctfd/ctfd -f values.yaml

## Install from source

Build helm dependencies (MariaDB/Redis/SeaweedFS) before installing the chart.
Build helm dependencies (MariaDB/Redis/Minio) before installing the chart.

```bash
helm dependency update
Expand All @@ -38,12 +38,12 @@ helm uninstall release-name --namespace ctfd

- CTFd `SECRET_KEY` is automatically generated during installation/upgrade. You can find it in the secret `release-name-ctfd-secret-key`. This secret is injected as environment variable in all CTFd pods.
- Redis in this chart uses single master with multiple workers.
- This chart deploys SeaweedFS S3 as an uploadprovider. You can use AWS S3 or any other external S3 compatible storage as an upload provider. Just set `seaweedfs.enabled` to `false` and configure the external S3 provider in `ctfd.uploadprovider.s3`.
- This chart deploys Minio S3 bucket as an uploadprovider. You can use AWS S3 or any other external S3 compatible storage as an upload provider. Just set `minio.enabled` to `false` and configure the external S3 provider in `ctfd.uploadprovider.s3`.
- This chart intentionally refrains from supporting `filesystem` uploadprovider. This needs `ReadWriteMany` PVCs which are expensive in cloud providers and not recommended for production use. S3 is fast and cheap.

## Values examples

### Deploy Bitnami MariaDB/Redis and SeaweedFS S3
### Deploy Bitnami MariaDB/Redis and Minio
```yaml
ctfd:
image:
Expand All @@ -52,17 +52,17 @@ ctfd:
enabled: true
minReplicas: 2
maxReplicas: 10
mariadb:
mariadb-galera:
enabled: true
architecture: standalone
primary:
persistence:
enabled: true
size: 2Gi
redis:
enabled: true
seaweedfs:
minio:
enabled: true
s3:
enabled: true
persistence:
size: 10Gi
```

### Configure your own external DB/Redis/S3
Expand All @@ -80,7 +80,7 @@ ctfd:
endpoint_url: ""
secret_access_key: ""
access_key_id: ""
mariadb:
mariadb-galera:
enabled: false
external:
port: 3306
Expand All @@ -95,7 +95,7 @@ redis:
host: ""
username: ""
password: ""
seaweedfs:
minio:
enabled: false
```

Expand All @@ -107,32 +107,25 @@ ctfd:
replicas: 2
autoscaling:
enabled: false
resources:
limits:
cpu: "2"
memory: 2Gi
requests:
cpu: "1"
memory: 1Gi
```

## Features

- [x] HA and horizontal autoscaling with CPU and memory metrics
- [x] Configurable CPU/memory requests and limits
- [x] Deploys bitnami Redis, bitnami MariaDB and SeaweedFS S3 as Helm dependencies
- [x] Deploys bitnami Redis, bitnami MariaDB-Galera and ~~SeaweedFS S3~~ (REPLACED WITH MINIO) as Helm dependencies
- [X] Option to use AWS S3 or any other external S3 compatible storage as an upload provider
- [x] Option to use external Redis and MariaDB (e.g., AWS RDS, ElastiCache)
- [x] Customizable CTFd configuration
- [x] Adjustable configurations for Redis and MariaDB
- [x] Integration with external storage as upload provider (AWS S3 or SeaweedFS or any S3 compatible storage)
- [x] Adjustable configurations for Redis and MariaDB-Galera
- [x] Integration with external storage as upload provider (AWS S3 or Minio or any S3 compatible storage)
- [x] Liveness and Readiness checks
- [x] Affinity/Toleration/nodeSelector rules
- [x] Automatically rolls out config updates to CTFd pods (Using checksum annotation)
- [ ] Deploys self-hosted mail server for CTFd email notifications as a helm dependency
- [ ] Automated backups (CTFd export. This could be done with batch/v1 CronJob)
- [ ] Deploys postgres db as a helm dependency (ctfd.io doesn't actively support it so this is a low priority)
- [ ] Support for custom CTFd themes/plugin (using initContainers?)
- [ ] Support for custom CTFd themes/plugin (using initContainers? this is WIP)

## To Do

Expand All @@ -155,7 +148,7 @@ ctfd:
|------------|------|---------|
| https://charts.bitnami.com/bitnami | mariadb-galera | 14.0.12 |
| https://charts.bitnami.com/bitnami | redis | 20.0.5 |
| https://seaweedfs.github.io/seaweedfs/helm | seaweedfs | 4.0.0 |
| https://charts.min.io/ | minio(minio) | 5.4.0 |

## Values

Expand All @@ -172,7 +165,8 @@ ctfd:
| ctfd.image.repository | string | `"ghcr.io/ctfd/ctfd"` | repository link to the CTFd docker image |
| ctfd.image.tag | string | `latest` | CTFd image tag (check https://github.com/CTFd/CTFd/pkgs/container/ctfd) |
| ctfd.imagePullSecrets | list | `[]` | Image pull secrets (use this for private repos) |
| ctfd.ingress.annotations | object | `{}` | Ingress annotations |
| ctfd.ingress.annotations | object | `{"nginx.ingress.kubernetes.io/proxy-body-size":"2G"}` | Ingress annotations |
| ctfd.ingress.annotations."nginx.ingress.kubernetes.io/proxy-body-size" | string | `"2G"` | Max body size for uploads (Check CTFd github repository's nginx configurations) |
| ctfd.ingress.className | string | `""` | Ingress class |
| ctfd.ingress.enabled | bool | `true` | Enables ingress |
| ctfd.initContainers | list | `[]` | |
Expand Down Expand Up @@ -206,18 +200,29 @@ ctfd:
| ctfd.uploadprovider.s3.secret_access_key | string | `""` | AWS S3 bucket access key |
| ctfd.volumeMounts | list | `[]` | CTFd volumeMounts |
| ctfd.volumes | list | `[]` | CTFd volumes |
| mariadb-galera.db.name | string | `"ctfd"` | |
| mariadb-galera.db.password | string | `"ctfd"` | |
| mariadb-galera.db.user | string | `"ctfd"` | |
| extraObjects | list | `[]` | Made for deploying custom manifests with this helm chart |
| mariadb-galera.db.name | string | `"ctfd"` | ctfd database name |
| mariadb-galera.db.password | string | `"ctfd"` | ctfd database password |
| mariadb-galera.db.user | string | `"ctfd"` | ctfd database user |
| mariadb-galera.enabled | bool | `true` | Deploys bitnami's mariadb-galera (set to false if you want to use an external database) |
| mariadb-galera.external | object | ignored | External database connection details. Takes effect if `mariadb.enabled` is set to false |
| mariadb-galera.extraFlags | string | Check `values.yaml`. Used by official CTFd `docker-compose.yml` | MariaDB primary entrypoint extra flags |
| mariadb-galera.galera.mariabackup.password | string | `"ctfd"` | |
| mariadb-galera.metrics.enabled | bool | `true` | |
| mariadb-galera.galera | object | `{"mariabackup":{"password":"ctfd"}}` | backup user (This is required by the subchart to do helm upgrades) |
| mariadb-galera.galera.mariabackup.password | string | `"ctfd"` | backup user (This is required by the subchart to do helm upgrades) |
| mariadb-galera.metrics.enabled | bool | `false` | |
| mariadb-galera.persistence.enabled | bool | `true` | |
| mariadb-galera.persistence.size | string | `"2Gi"` | |
| mariadb-galera.resourcesPreset | string | `"large"` | |
| mariadb-galera.rootUser.password | string | `"ctfd"` | |
| mariadb-galera.persistence.size | string | `"2Gi"` | PVC size |
| mariadb-galera.replicaCount | int | `3` | Number of primary nodes replicas |
| mariadb-galera.resourcesPreset | string | `"large"` | request and limits preset (check bitnami's mariadb-galera chart for details) |
| mariadb-galera.rootUser.password | string | `"ctfd"` | root user |
| minio.buckets[0] | object | `{"name":"ctfd-bucket","policy":"download","purge":false}` | Default bucket to be used by CTFd `download` policy means this bucket is readonly for anonymous access (competitors) |
| minio.drivesPerNode | int | `1` | Minio number of drives per replica/node |
| minio.enabled | bool | `true` | Deploys Minio (set to false if you want to use an external S3 bucket) |
| minio.ingress | object | `{"annotations":{"nginx.ingress.kubernetes.io/proxy-body-size":"0"},"enabled":true,"hosts":["minio.example.com"]}` | Ingress configurations of minio (Used by both CTFd and competitiors) |
| minio.ingress.annotations."nginx.ingress.kubernetes.io/proxy-body-size" | string | `"0"` | Max Body size `0 -> unlimited` (if you are using another ingress controller then look for the equivalent annotation) |
| minio.persistence | object | `{"size":"10Gi"}` | Minio PVC size (change according to your needs) |
| minio.replicas | int | `3` | Minio number of replicas |
| minio.resources.requests.memory | string | `"2Gi"` | |
| redis.auth.enabled | bool | `false` | |
| redis.enabled | bool | `true` | Deploys bitnami's redis (set to false if you want to use an external cache) |
| redis.external | object | ignored | External redis cache connection details. Takes effect if `redis.enabled` is set to false |
Expand All @@ -231,18 +236,5 @@ ctfd:
| redis.replica.resourcesPreset | string | `"micro"` | Check Bintami's documentation |
| redis.sysctl.enabled | bool | `true` | |
| redis.volumePermissions.enabled | bool | `true` | |
| seaweedfs.enabled | bool | `true` | Deploys seaweedfs (set to false if you want to use an bucket) |
| seaweedfs.filer.data.size | string | `"5Gi"` | seaweedfs-filer storage size |
| seaweedfs.filer.data.type | string | `"persistentVolumeClaim"` | seaweedfs-filer data storage type |
| seaweedfs.filer.enablePVC | bool | `true` | seaweedfs-filer enable PVC for data persistence |
| seaweedfs.filer.replicas | int | `1` | seaweedfs-filer replicas |
| seaweedfs.filer.s3.createBuckets | list | `[{"name":"ctfd-bucket"}]` | seaweedfs-s3 create bucket upon deploying |
| seaweedfs.filer.s3.enableAuth | bool | `false` | seaweedfs-s3 enable authentication (no need since seaweed is private to the cluster) |
| seaweedfs.filer.s3.enabled | bool | `true` | seaweedfs-s3 enable. This enables S3 API (Should be left to `true`) |
| seaweedfs.filer.storage | string | `"5Gi"` | seaweedfs-filer PVC storage size |
| seaweedfs.master.data.size | string | `"5Gi"` | seaweedfs storage size |
| seaweedfs.master.data.type | string | `"persistentVolumeClaim"` | seaweedfs data storage type |
| seaweedfs.master.replicas | int | `1` | seaweedfs-master replicas |
| seaweedfs.volume.replicas | int | `1` | seaweedfs-volume replicas |

Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs)
37 changes: 15 additions & 22 deletions README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ helm install ctfd ctfd/ctfd -f values.yaml

## Install from source

Build helm dependencies (MariaDB/Redis/SeaweedFS) before installing the chart.
Build helm dependencies (MariaDB/Redis/Minio) before installing the chart.

```bash
helm dependency update
Expand All @@ -38,12 +38,12 @@ helm uninstall release-name --namespace ctfd

- CTFd `SECRET_KEY` is automatically generated during installation/upgrade. You can find it in the secret `release-name-ctfd-secret-key`. This secret is injected as environment variable in all CTFd pods.
- Redis in this chart uses single master with multiple workers.
- This chart deploys SeaweedFS S3 as an uploadprovider. You can use AWS S3 or any other external S3 compatible storage as an upload provider. Just set `seaweedfs.enabled` to `false` and configure the external S3 provider in `ctfd.uploadprovider.s3`.
- This chart deploys Minio S3 bucket as an uploadprovider. You can use AWS S3 or any other external S3 compatible storage as an upload provider. Just set `minio.enabled` to `false` and configure the external S3 provider in `ctfd.uploadprovider.s3`.
- This chart intentionally refrains from supporting `filesystem` uploadprovider. This needs `ReadWriteMany` PVCs which are expensive in cloud providers and not recommended for production use. S3 is fast and cheap.

## Values examples

### Deploy Bitnami MariaDB/Redis and SeaweedFS S3
### Deploy Bitnami MariaDB/Redis and Minio
```yaml
ctfd:
image:
Expand All @@ -52,17 +52,17 @@ ctfd:
enabled: true
minReplicas: 2
maxReplicas: 10
mariadb:
mariadb-galera:
enabled: true
architecture: standalone
primary:
persistence:
enabled: true
size: 2Gi
redis:
enabled: true
seaweedfs:
minio:
enabled: true
s3:
enabled: true
persistence:
size: 10Gi
```

### Configure your own external DB/Redis/S3
Expand All @@ -80,7 +80,7 @@ ctfd:
endpoint_url: ""
secret_access_key: ""
access_key_id: ""
mariadb:
mariadb-galera:
enabled: false
external:
port: 3306
Expand All @@ -95,7 +95,7 @@ redis:
host: ""
username: ""
password: ""
seaweedfs:
minio:
enabled: false
```

Expand All @@ -107,32 +107,25 @@ ctfd:
replicas: 2
autoscaling:
enabled: false
resources:
limits:
cpu: "2"
memory: 2Gi
requests:
cpu: "1"
memory: 1Gi
```

## Features

- [x] HA and horizontal autoscaling with CPU and memory metrics
- [x] Configurable CPU/memory requests and limits
- [x] Deploys bitnami Redis, bitnami MariaDB and SeaweedFS S3 as Helm dependencies
- [x] Deploys bitnami Redis, bitnami MariaDB-Galera and ~~SeaweedFS S3~~ (REPLACED WITH MINIO) as Helm dependencies
- [X] Option to use AWS S3 or any other external S3 compatible storage as an upload provider
- [x] Option to use external Redis and MariaDB (e.g., AWS RDS, ElastiCache)
- [x] Customizable CTFd configuration
- [x] Adjustable configurations for Redis and MariaDB
- [x] Integration with external storage as upload provider (AWS S3 or SeaweedFS or any S3 compatible storage)
- [x] Adjustable configurations for Redis and MariaDB-Galera
- [x] Integration with external storage as upload provider (AWS S3 or Minio or any S3 compatible storage)
- [x] Liveness and Readiness checks
- [x] Affinity/Toleration/nodeSelector rules
- [x] Automatically rolls out config updates to CTFd pods (Using checksum annotation)
- [ ] Deploys self-hosted mail server for CTFd email notifications as a helm dependency
- [ ] Automated backups (CTFd export. This could be done with batch/v1 CronJob)
- [ ] Deploys postgres db as a helm dependency (ctfd.io doesn't actively support it so this is a low priority)
- [ ] Support for custom CTFd themes/plugin (using initContainers?)
- [ ] Support for custom CTFd themes/plugin (using initContainers? this is WIP)

## To Do

Expand Down
2 changes: 1 addition & 1 deletion templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


{{ if or (index .Values "mariadb-galera" "enabled") (.Values.redis.enabled) -}}
** Please be patient while MariaDB or Redis are being deployed **
** Please be patient while MariaDB and/or Redis are being deployed **
{{ end }}

Get the list of pods by executing:
Expand Down
10 changes: 10 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,14 @@ redis://{{ .Release.Name }}-redis-master:6379
{{- else -}}
redis://{{ .Values.redis.external.username }}:{{ .Values.redis.external.password }}@{{ .Values.redis.external.host }}:{{ .Values.redis.external.port }}
{{- end -}}
{{- end -}}

{{/*
Generate CTFd MINIO_URL
*/}}
{{- define "ctfd.MINIO_URL" -}}
{{- if .Values.minio.enabled -}}
http://{{ (index .Values.minio.ingress.hosts 0) }}
{{- else -}}
{{- end -}}
{{- end -}}
Loading